/* PhonixAI — main stylesheet
   Dark, high-contrast "lattice" theme. All motion is disabled under
   prefers-reduced-motion (see bottom of file). */

:root {
  --bg: #05070f;
  --bg-2: #0a0f1f;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(148, 163, 255, 0.14);
  --border-strong: rgba(148, 163, 255, 0.3);
  --text: #e8ecff;
  --text-2: #a5adcf;
  --text-3: #6f7799;
  --cyan: #5ef2ff;
  --violet: #8b7bff;
  --pink: #ff8bd1;
  --amber: #ffc56b;
  --grad: linear-gradient(100deg, var(--cyan) 0%, var(--violet) 55%, var(--pink) 100%);
  --radius: 18px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* faint global noise + vignette for depth */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: -1;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 123, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(94, 242, 255, 0.07), transparent 60%),
    var(--bg);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h2 { font-size: clamp(2rem, 4.2vw, 3.2rem); font-weight: 600; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; color: var(--text-2); }
strong { color: var(--text); font-weight: 600; }
em { color: var(--text); font-style: normal; border-bottom: 1px dashed var(--border-strong); }
code { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--cyan); color: #000; padding: 10px 14px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.grad-text {
  background: var(--grad);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: grad-shift 8s ease-in-out infinite alternate;
}
@keyframes grad-shift { to { background-position: 100% 0; } }

/* ───────────── Buttons ───────────── */
.btn {
  --pad: 14px 22px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; gap: 10px;
  padding: var(--pad);
  border-radius: 999px;
  font: 600 0.98rem/1 var(--font-body);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.35s, border-color 0.35s;
  white-space: nowrap;
}
.btn span { transition: transform 0.35s var(--ease); }
.btn:hover span { transform: translateX(4px); }
.btn--primary {
  color: #04060d;
  background: var(--grad); background-size: 200% 100%;
  box-shadow: 0 8px 30px -8px rgba(94, 242, 255, 0.55), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn--primary:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 14px 40px -10px rgba(139, 123, 255, 0.7); }
.btn--ghost { color: var(--text); border: 1px solid var(--border-strong); background: rgba(255,255,255,0.02); backdrop-filter: blur(8px); }
.btn--ghost:hover { border-color: var(--cyan); background: rgba(94, 242, 255, 0.06); transform: translateY(-2px); }
.btn--sm { --pad: 10px 18px; font-size: 0.9rem; }
.btn--lg { --pad: 18px 30px; font-size: 1.1rem; }

/* ───────────── Nav ───────────── */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled { background: rgba(5, 7, 15, 0.72); backdrop-filter: blur(14px) saturate(140%); border-color: var(--border); }
.nav__inner { max-width: var(--maxw); margin: 0 auto; padding: 16px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark { width: 30px; height: 30px; transition: transform 0.8s var(--ease); }
.brand:hover .brand__mark { transform: rotate(90deg); }
.brand__word { font: 700 1.3rem/1 var(--font-display); letter-spacing: -0.02em; }
.brand__word span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav__links { display: flex; align-items: center; gap: 28px; font-size: 0.93rem; }
.nav__links a:not(.btn) { color: var(--text-2); position: relative; transition: color 0.3s; }
.nav__links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
  background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease);
}
.nav__links a:not(.btn):hover { color: var(--text); }
.nav__links a:not(.btn):hover::after, .nav__links a.is-active::after { transform: scaleX(1); }
.nav__links a.is-active { color: var(--text); }
.nav__toggle { display: none; }

@media (max-width: 860px) {
  .nav__toggle {
    display: grid; place-content: center; gap: 6px;
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  }
  .nav__toggle span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.35s var(--ease); }
  .nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .nav__links {
    position: fixed; inset: 76px 16px auto 16px;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 14px; border-radius: var(--radius);
    background: rgba(10, 15, 31, 0.96); border: 1px solid var(--border); backdrop-filter: blur(16px);
    opacity: 0; transform: translateY(-10px) scale(0.98); pointer-events: none;
    /* visibility keeps closed links out of the tab order / a11y tree; its
       delay lets the fade-out finish before they disappear. */
    visibility: hidden;
    transition: opacity 0.3s, transform 0.35s var(--ease), visibility 0s linear 0.35s;
  }
  .nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
  .nav__links a:not(.btn) { padding: 12px 10px; font-size: 1.05rem; }
  .nav__links a:not(.btn)::after { display: none; }
  .nav__links .btn { justify-content: center; margin-top: 8px; }
}

/* ───────────── Hero ───────────── */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: 120px 0 90px; overflow: hidden;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 25% 50%, rgba(5,7,15,0.85) 0%, rgba(5,7,15,0.35) 60%, transparent 100%),
    linear-gradient(to bottom, transparent 70%, var(--bg) 100%);
}
.hero__content { position: relative; z-index: 2; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: rgba(10, 15, 31, 0.6); backdrop-filter: blur(8px);
  font: 500 0.82rem/1 var(--font-mono); color: var(--text-2); letter-spacing: 0.02em;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 rgba(94,242,255,0.7); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(94,242,255,0); } 100% { box-shadow: 0 0 0 0 rgba(94,242,255,0); } }
.hero__title { font-size: clamp(2.5rem, 6.4vw, 5rem); font-weight: 700; letter-spacing: -0.035em; margin: 26px 0 24px; max-width: 17ch; }
@media (max-width: 600px) { .eyebrow__more { display: none; } }
.hero__lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 40rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 34px 0 56px; }
.hero__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; max-width: 720px; margin: 0; border-top: 1px solid var(--border); }
.hero__stats div { padding: 18px 20px 0 0; }
.hero__stats div + div { padding-left: 20px; border-left: 1px solid var(--border); }
.hero__stats dt { font: 600 1.5rem/1.1 var(--font-display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__stats dd { margin: 6px 0 0; font-size: 0.86rem; color: var(--text-3); }
@media (max-width: 600px) {
  .hero__stats { grid-template-columns: 1fr; }
  .hero__stats div, .hero__stats div + div { padding: 14px 0; border-left: 0; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: 14px; }
  .hero__stats dd { margin: 0; }
}
.hero__scroll {
  position: absolute; left: 50%; bottom: 28px; z-index: 2; translate: -50% 0;
  width: 26px; height: 42px; border: 1.5px solid var(--border-strong); border-radius: 14px;
}
.hero__scroll span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--cyan); animation: scroll-hint 2s var(--ease) infinite; }
@keyframes scroll-hint { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ───────────── Sections ───────────── */
.section { position: relative; padding: clamp(80px, 12vw, 150px) 0; }
.section--alt { background: linear-gradient(180deg, transparent, rgba(139,123,255,0.04) 20%, rgba(94,242,255,0.03) 80%, transparent); }
.section__head { max-width: 760px; margin-bottom: 56px; }
.section__lede { font-size: 1.15rem; }
.kicker { font: 500 0.82rem/1 var(--font-mono); color: var(--cyan); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 18px; }

.split { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(40px, 6vw, 90px); align-items: center; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ── The name ── */
.equation { list-style: none; padding: 18px 20px; margin: 26px 0 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.equation code { color: var(--cyan); font-size: 1rem; }
.equation li.muted { margin-top: 6px; font-size: 0.85rem; color: var(--text-3); }
.split__viz {
  margin: 0; position: relative; padding: 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(139,123,255,0.07), rgba(94,242,255,0.03)), var(--bg-2);
  box-shadow: 0 30px 80px -40px rgba(94,242,255,0.35);
}
#dispersion { width: 100%; height: auto; overflow: visible; }
#dispersion .axis { stroke: var(--text-3); stroke-width: 1; }
#dispersion .axis--dim { stroke-dasharray: 3 5; opacity: 0.6; }
#dispersion .axis-label { fill: var(--text-3); font: 12px var(--font-mono); }
#dispersion .disp-grid line { stroke: rgba(148,163,255,0.07); }
#dispersion .branch { fill: none; stroke-width: 3; stroke-linecap: round; }
#dispersion .probe { fill: #fff; filter: drop-shadow(0 0 6px var(--cyan)); }
#dispersion .branch-label { font: 12px var(--font-mono); }
#dispersion .branch-label--a { fill: var(--cyan); }
#dispersion .branch-label--o { fill: var(--pink); }
.chain { position: relative; height: 34px; margin-top: 14px; }
.chain i {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--cyan) 45%, var(--violet));
  box-shadow: 0 0 12px rgba(94,242,255,0.6);
  animation: atom 2.4s ease-in-out infinite;
}
.chain::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
@keyframes atom { 0%, 100% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 960px) { .cards { grid-template-columns: 1fr; } }
.card {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg;
  position: relative; overflow: hidden; isolation: isolate;
  padding: 34px 30px 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.5s var(--ease), border-color 0.4s, background 0.4s;
  will-change: transform;
}
.card::before { /* animated gradient border */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; z-index: -1;
  background: conic-gradient(from var(--angle, 0deg), transparent 0 60%, var(--cyan), var(--violet), transparent 85%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.5s;
  animation: spin-border 4s linear infinite;
}
@property --angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spin-border { to { --angle: 360deg; } }
.card:hover { border-color: transparent; background: var(--surface-2); }
.card:hover::before { opacity: 1; }
.card__glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(380px circle at var(--mx) var(--my), rgba(94,242,255,0.14), transparent 45%);
}
.card:hover .card__glow { opacity: 1; }
.card__icon {
  width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 26px;
  border-radius: 14px; background: linear-gradient(135deg, rgba(94,242,255,0.16), rgba(139,123,255,0.16));
  border: 1px solid var(--border-strong);
}
.card__icon svg { width: 30px; height: 30px; fill: none; stroke: var(--cyan); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.card__icon svg rect { fill: var(--violet); stroke: none; }
.card h3 { font-size: 1.55rem; }
.tags { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font: 500 0.78rem/1 var(--font-mono); color: var(--text-2); padding: 7px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); }

/* ── Modes ── */
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
@media (max-width: 960px) { .modes { grid-template-columns: 1fr; } }
.mode {
  position: relative; padding: 36px 30px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-2);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.mode:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -30px rgba(139,123,255,0.5); }
.mode--featured { background: linear-gradient(170deg, rgba(139,123,255,0.18), rgba(94,242,255,0.06) 60%), var(--bg-2); border-color: var(--border-strong); }
.mode__index {
  display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 22px;
  border-radius: 50%; border: 1px solid var(--border-strong);
  font: 600 1rem/1 var(--font-mono); color: var(--cyan);
}
.checks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 28px; color: var(--text); font-size: 0.95rem; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 0.35em; width: 16px; height: 16px; border-radius: 50%;
  background: var(--grad);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ── Timeline ── */
.timeline {
  --progress: 0;
  position: relative; list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px;
}
.timeline::before, .timeline::after { content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 2px; border-radius: 2px; }
.timeline::before { background: var(--border); }
.timeline::after { background: var(--grad); transform: scaleX(var(--progress)); transform-origin: left; transition: transform 0.2s linear; box-shadow: 0 0 14px rgba(94,242,255,0.5); }
.timeline__step { position: relative; padding-top: 46px; }
.timeline__node {
  position: absolute; top: 0; left: 0; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border-strong); z-index: 1;
  transition: border-color 0.4s, box-shadow 0.4s, background 0.4s;
}
.timeline__step.is-lit .timeline__node { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 0 6px rgba(94,242,255,0.15), 0 0 20px var(--cyan); }
@media (max-width: 860px) {
  .timeline { grid-template-columns: 1fr; gap: 34px; padding-left: 40px; }
  .timeline::before, .timeline::after { left: 8px; right: auto; top: 8px; bottom: 8px; width: 2px; height: auto; }
  .timeline::after { transform: scaleY(var(--progress)); transform-origin: top; }
  .timeline__step { padding-top: 0; }
  .timeline__node { left: -40px; }
}

/* ── Team ── */
.split--team { align-items: start; }
.principles { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.principle {
  display: flex; gap: 20px; padding: 22px 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color 0.4s, transform 0.5s var(--ease), background 0.4s;
}
.principle:hover { border-color: var(--border-strong); transform: translateX(6px); background: var(--surface-2); }
.principle__k { font: 500 0.85rem/1.8 var(--font-mono); color: var(--violet); }
.principle h3 { font-size: 1.1rem; margin-bottom: 4px; }
.principle p { margin: 0; font-size: 0.95rem; }

/* ── Contact ── */
.contact {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(56px, 9vw, 100px) clamp(20px, 5vw, 60px) clamp(130px, 14vw, 170px);
  border-radius: 28px; border: 1px solid var(--border-strong);
  background: radial-gradient(800px 300px at 50% 0%, rgba(139,123,255,0.22), transparent 70%), var(--bg-2);
}
.contact h2 { max-width: 18ch; margin-inline: auto; }
.contact .section__lede { max-width: 36rem; margin: 0 auto 34px; }
.contact__actions { position: relative; z-index: 1; display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.contact__actions .btn { white-space: normal; word-break: break-all; }
.contact__wave { position: absolute; inset: auto 0 0 0; height: 160px; pointer-events: none; opacity: 0.55; }
.contact__wave svg { width: 100%; height: 100%; }
.contact__wave .w { fill: none; stroke-width: 1.5; }
.contact__wave .w1 { stroke: var(--cyan); }
.contact__wave .w2 { stroke: var(--violet); opacity: 0.7; }
.contact__wave .w3 { stroke: var(--pink); opacity: 0.45; }

/* ── Footer ── */
.footer { border-top: 1px solid var(--border); padding: 48px 0 40px; }
.footer__inner { display: grid; grid-template-columns: 1fr auto; gap: 30px 40px; align-items: start; }
.footer__brand p { margin: 8px 0 0; font-size: 0.9rem; color: var(--text-3); }
.footer__legal { display: flex; flex-wrap: wrap; gap: 14px 36px; margin: 0; font-size: 0.88rem; }
.footer__legal dt { font: 500 0.72rem/1 var(--font-mono); color: var(--text-3); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.footer__legal dd { margin: 0; color: var(--text-2); }
.footer__legal dd[data-placeholder] { color: var(--text-3); font-style: italic; }
.footer__copy { grid-column: 1 / -1; margin: 0; font-size: 0.82rem; color: var(--text-3); }
@media (max-width: 700px) { .footer__inner { grid-template-columns: 1fr; } }

/* ───────────── Reveal on scroll ───────────── */
.js .reveal { opacity: 0; transform: translateY(26px); filter: blur(6px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), filter 0.9s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; filter: none; }

/* ───────────── Reduced motion ───────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .js .reveal { opacity: 1; transform: none; filter: none; }
  .card { transform: none !important; }
}
