:root {
  --ink: #0B0F17;
  --panel: #131A28;
  --blue: #2B9BF4;
  --cyan: #4FD8E8;
  --paper: #F5F7FA;
  --muted: #5B6472;
  --line: #DCE1E8;
  --line-dark: rgba(245,247,250,0.14);
  --muted-on-dark: #AEB6C4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .display {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: inherit; }

img { max-width: 100%; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Header ---------- */
header {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 101;
  background: var(--paper);
}

header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand img {
  height: 46px;
  width: auto;
  display: block;
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

nav {
  display: flex;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  margin-left: 28px;
  transition: color 0.2s ease;
}

nav a:first-child { margin-left: 0; }

nav a:hover, nav a[aria-current="page"] { color: var(--ink); }

.btn-header {
  padding: 10px 20px;
  font-size: 0.9rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.cta-row {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(11,15,23,0.18);
}

.btn-ghost {
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover { border-color: var(--ink); }

.hero .btn-primary,
.page-hero .btn-primary {
  background: var(--paper);
  color: var(--ink);
}

.hero .btn-primary:hover,
.page-hero .btn-primary:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

.hero .btn-ghost,
.page-hero .btn-ghost {
  color: var(--paper);
  border-color: var(--line-dark);
}

.hero .btn-ghost:hover,
.page-hero .btn-ghost:hover { border-color: var(--paper); }

/* ---------- Hero (home) ---------- */
.hero {
  position: relative;
  padding: 88px 0 80px;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
  line-height: 1.12;
  max-width: 15ch;
  letter-spacing: -0.03em;
  color: var(--paper);
}

.hero p.lede {
  margin-top: 24px;
  font-size: 1.15rem;
  color: var(--muted-on-dark);
  max-width: 46ch;
}

.hero-reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: heroIn 0.7s ease forwards;
}

.hero-reveal-2 { animation-delay: 0.15s; }
.hero-reveal-3 { animation-delay: 0.3s; }

@keyframes heroIn {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-reveal { opacity: 1 !important; transform: none !important; animation: none !important; }
}

.statement {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.4;
  max-width: 30ch;
  margin: 0 auto;
  text-align: center;
  color: var(--ink);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.statement.playing { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .statement { opacity: 1 !important; transform: none !important; }
}

/* ---------- Page header (About / Products / Contact) ---------- */
.page-hero {
  padding: 64px 0 56px;
  background: var(--ink);
  color: var(--paper);
}

.page-hero h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  max-width: 20ch;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.page-hero p.lede {
  margin-top: 18px;
  font-size: 1.1rem;
  color: var(--muted-on-dark);
  max-width: 52ch;
}

/* Node graph illustration */
.graph-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  margin: 0 auto;
}

.graph-frame::before {
  content: '';
  position: absolute;
  inset: -25%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(43,155,244,0.38), rgba(79,216,232,0.16) 45%, transparent 72%);
  filter: blur(28px);
  z-index: -1;
  opacity: 0;
  animation: glowFadeIn 0.8s ease forwards 1.3s, glowBreathe 4.5s ease-in-out infinite 1.3s;
  pointer-events: none;
}

.graph-frame svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 5px rgba(79,216,232,0.5)) drop-shadow(0 0 14px rgba(43,155,244,0.3));
}

@keyframes glowFadeIn { to { opacity: 1; } }

@keyframes glowBreathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.pulse-dot { filter: drop-shadow(0 0 3px rgba(79,216,232,0.9)); }

.graph-frame line {
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: draw 1.1s ease forwards;
}

.graph-frame line:nth-child(2) { animation-delay: 0.15s; }
.graph-frame line:nth-child(3) { animation-delay: 0.3s; }
.graph-frame line:nth-child(4) { animation-delay: 0.45s; }

.graph-frame circle {
  opacity: 0;
  animation: pop 0.5s ease forwards;
}

.graph-frame circle:nth-of-type(1) { animation-delay: 0.6s; }
.graph-frame circle:nth-of-type(2) { animation-delay: 0.7s; }
.graph-frame circle:nth-of-type(3) { animation-delay: 0.8s; }
.graph-frame circle:nth-of-type(4) { animation-delay: 0.9s; }
.graph-frame circle:nth-of-type(5) { animation-delay: 1.0s; }

@keyframes draw { to { stroke-dashoffset: 0; } }

@keyframes pop {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .graph-frame line, .graph-frame circle {
    animation: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
  .graph-frame::before { animation: none !important; opacity: 0.7 !important; }
  .pulse-dot { display: none !important; }
}

/* ---------- Sections ---------- */
section { padding: 64px 0; }

.divider { border-top: 1px solid var(--line); }

.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 56px;
}

.kicker {
  color: var(--muted);
  font-size: 0.95rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-top: 10px;
  max-width: 16ch;
}

.about-grid p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 56ch;
}

.about-grid p + p { margin-top: 16px; }

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 12px;
}

.value-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.value-card p {
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--ink);
  color: var(--paper);
  border-radius: 20px;
  padding: 48px 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.cta-band h2 { color: var(--paper); max-width: 24ch; }

.cta-band .btn-primary {
  background: var(--paper);
  color: var(--ink);
  flex-shrink: 0;
}

.cta-band .btn-primary:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

/* Synapse panel */
.synapse {
  background: var(--panel);
  color: var(--paper);
  border-radius: 20px;
  padding: 56px;
}

.synapse-grid, .prepla-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.synapse .eyebrow { color: var(--cyan); }
.synapse h2 { color: var(--paper); max-width: none; }
.synapse p { color: #AEB6C4; margin-top: 18px; font-size: 1.05rem; max-width: 46ch; }

.status-line {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: #AEB6C4;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  display: inline-block;
  flex-shrink: 0;
}

.chat-mock {
  background: #0F1420;
  border: 1px solid #232B3D;
  border-radius: 14px;
  padding: 20px;
  font-size: 0.9rem;
}

.bubble {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  max-width: 85%;
  line-height: 1.45;
}

.bubble.user { background: #1E2636; color: #DDE3EC; }

.bubble.ai {
  background: linear-gradient(135deg, #1B3A57, #16303F);
  color: #DCEEF6;
  margin-left: auto;
  border: 1px solid #2A4B63;
}

.bubble .who {
  display: block;
  font-size: 0.72rem;
  color: #7B879B;
  margin-bottom: 4px;
}

.msg { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.msg .bubble { margin-bottom: 0; }
.msg-ai { flex-direction: row; }
.msg-user { flex-direction: row-reverse; }
.msg-user .bubble { margin-left: auto; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-bot { background: #0F1420; border: 1px solid #2A4B63; }
.avatar-bot img { width: 20px; height: 20px; object-fit: contain; }
.avatar-human { background: #1E2636; }
.avatar-human svg { width: 16px; height: 16px; }

.typing-indicator {
  background: #1E2636;
  border-radius: 10px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7B879B;
  animation: bounce 1.1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-mock .msg-user,
.chat-mock .typing-row,
.chat-mock .reveal-row {
  opacity: 0;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typingCycle {
  0% { opacity: 0; transform: translateY(6px); }
  18% { opacity: 1; transform: translateY(0); }
  82% { opacity: 1; }
  100% { opacity: 0; }
}

.chat-mock.playing .msg-user { animation: fadeSlide 0.5s ease forwards; animation-delay: 0.1s; }
.chat-mock.playing .typing-row { animation: typingCycle 1.8s ease forwards; animation-delay: 1.6s; }
.chat-mock.playing .reveal-row { animation: fadeSlide 0.5s ease forwards; animation-delay: 3.5s; }

@media (prefers-reduced-motion: reduce) {
  .chat-mock .msg-user, .chat-mock .reveal-row {
    opacity: 1 !important; transform: none !important; animation: none !important;
  }
  .chat-mock .typing-row { display: none !important; }
  .typing-indicator span { animation: none !important; }
}

/* Prepla panel (light, paired with dark Synapse panel) */
.prepla {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 56px;
}

.prepla .eyebrow { color: var(--blue); }
.prepla .status-line { color: var(--muted); }
.prepla .status-line .dot { background: var(--blue); }

.quiz-mock {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  font-size: 0.92rem;
  overflow: hidden;
}

.quiz-mock .q-label { font-size: 0.72rem; color: var(--muted); margin-bottom: 8px; }
.quiz-mock .q-text { font-weight: 500; margin-bottom: 14px; line-height: 1.5; }

.quiz-mock .option {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  color: var(--muted);
  background: #fff;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.quiz-mock .option.correct { border-color: var(--line); color: var(--muted); background: #fff; }

.quiz-mock.playing .option.correct {
  animation: selectPulse 0.4s ease forwards;
  animation-delay: 3.05s;
}

@keyframes selectPulse {
  0%   { border-color: var(--line); background: #fff; color: var(--muted); }
  100% { border-color: var(--blue); background: rgba(43,155,244,0.07); color: var(--ink); }
}

.quiz-mock .explain {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  line-height: 1.5;
}

.quiz-mock.playing .explain-intro {
  animation: dropReveal 0.55s ease forwards;
  animation-delay: 0.3s;
}

.quiz-mock.playing .explain-followup {
  animation: dropReveal 0.55s ease forwards;
  animation-delay: 3.5s;
}

@keyframes dropReveal {
  0%   { max-height: 0; opacity: 0; margin-top: 0; padding-top: 0; padding-bottom: 0; }
  100% { max-height: 320px; opacity: 1; margin-top: 14px; padding-top: 12px; padding-bottom: 12px; }
}

.quiz-mock .explain .who { display: block; font-size: 0.72rem; color: #9AA4B5; margin-bottom: 4px; }
.quiz-mock .explain .analogy { display: block; font-style: italic; color: #C9D3E0; margin-bottom: 8px; }
.quiz-mock .explain .reason { display: block; }

.quiz-mock .cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  transform: translate(14px, 46px) scale(1);
}

.quiz-mock.playing .cursor { animation: cursorMove 2.2s ease forwards; animation-delay: 1.7s; }

@keyframes cursorMove {
  0%   { opacity: 0; transform: translate(14px, 46px) scale(1); }
  12%  { opacity: 1; transform: translate(14px, 46px) scale(1); }
  55%  { opacity: 1; transform: translate(220px, 355px) scale(1); }
  62%  { opacity: 1; transform: translate(220px, 355px) scale(0.75); }
  70%  { opacity: 1; transform: translate(220px, 355px) scale(1); }
  88%  { opacity: 1; transform: translate(220px, 355px) scale(1); }
  100% { opacity: 0; transform: translate(220px, 152px) scale(1); }
}

@keyframes cursorMoveMobile {
  0%   { opacity: 0; transform: translate(14px, 46px) scale(1); }
  12%  { opacity: 1; transform: translate(14px, 46px) scale(1); }
  55%  { opacity: 1; transform: translate(130px, 420px) scale(1); }
  62%  { opacity: 1; transform: translate(130px, 420px) scale(0.75); }
  70%  { opacity: 1; transform: translate(130px, 420px) scale(1); }
  88%  { opacity: 1; transform: translate(130px, 420px) scale(1); }
  100% { opacity: 0; transform: translate(130px, 420px) scale(1); }
}

@media (max-width: 780px) {
  .quiz-mock.playing .cursor { animation-name: cursorMoveMobile; }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-mock .option.correct {
    border-color: var(--blue) !important;
    color: var(--ink) !important;
    background: rgba(43,155,244,0.07) !important;
    animation: none !important;
  }
  .quiz-mock .explain {
    max-height: none !important;
    opacity: 1 !important;
    margin-top: 14px !important;
    padding: 12px 14px !important;
    animation: none !important;
  }
  .quiz-mock .cursor { display: none !important; }
}

/* ---------- Contact page ---------- */
.contact-card {
  background: var(--panel);
  color: var(--paper);
  border-radius: 20px;
  padding: 64px 56px;
  text-align: center;
}

.contact-card h2 { color: var(--paper); max-width: none; margin: 0 auto; }
.contact-card p { color: #AEB6C4; font-size: 1.1rem; max-width: 46ch; margin: 18px auto 0; }
.contact-card .cta-row { justify-content: center; margin-top: 32px; }

.contact-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-top: 48px;
}

.contact-detail h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.contact-detail p { color: var(--muted); }

/* ---------- Footer ---------- */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--line-dark);
  background: var(--ink);
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

footer .muted { color: var(--muted-on-dark); font-size: 0.9rem; }

body.nav-locked { overflow: hidden; }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,15,23,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  z-index: 90;
  transition: opacity 0.25s ease;
}

.nav-backdrop.open { display: block; opacity: 1; }

.nav-close { display: none; }

@media (max-width: 780px) {
  .header-right { gap: 12px; }

  nav {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    padding: 4px 24px 8px;
    box-shadow: 0 20px 40px rgba(11,15,23,0.22);
    border-radius: 0 0 16px 16px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.32s cubic-bezier(.32,.72,0,1), opacity 0.22s ease;
    z-index: 100;
  }

  nav.open { max-height: 70vh; opacity: 1; overflow-y: auto; }

  nav a {
    margin-left: 0;
    padding: 16px 0;
    width: 100%;
    font-size: 1.05rem;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
  }

  nav a:hover, nav a[aria-current="page"] { color: var(--blue); }

  nav a:last-child { border-bottom: none; }

  .nav-toggle { display: flex; }
  .btn-header { padding: 9px 16px; font-size: 0.85rem; }

  .hero-grid, .about-grid, .synapse-grid, .prepla-grid, .contact-detail-grid { grid-template-columns: 1fr; }
  .value-grid { grid-template-columns: 1fr; gap: 24px; }
  .synapse, .prepla { padding: 36px 24px; }
  .graph-frame { max-width: 280px; margin-top: 24px; }
  .cta-band { padding: 36px 28px; flex-direction: column; align-items: flex-start; text-align: left; }
  .contact-card { padding: 44px 28px; }
}
