/* ============================================================
   TELOS — the meaning of life, computed
   Drenched cobalt · acid-lime signal · computational deadpan
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg, canvas { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; padding: 0; }

/* ---------- Tokens ---------- */
:root {
  /* surfaces — drenched cobalt, the brand IS the colour */
  --bg:        oklch(0.190 0.062 256);
  --bg-deep:   oklch(0.128 0.050 258);
  --surface:   oklch(0.250 0.066 256);
  --surface-2: oklch(0.300 0.060 255);

  /* ink */
  --ink:   oklch(0.972 0.012 250);
  --muted: oklch(0.745 0.032 252);
  --faint: oklch(0.620 0.030 254);

  /* brand */
  --primary:    oklch(0.640 0.150 252);
  --primary-lo: oklch(0.480 0.130 253);
  --accent:     oklch(0.885 0.185 124);   /* acid lime — the signal / the answer */
  --accent-dim: oklch(0.780 0.150 124);
  --accent-ink: oklch(0.190 0.060 140);   /* dark text on lime fills */

  /* lines & glows */
  --line:      oklch(1 0 0 / 0.12);
  --line-soft: oklch(1 0 0 / 0.07);
  --glow-accent: oklch(0.885 0.185 124 / 0.55);
  --glow-primary: oklch(0.640 0.150 252 / 0.45);

  /* type */
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body:    "Archivo", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* fluid scale (1.28 ratio) */
  --step--1: clamp(0.80rem, 0.77rem + 0.15vw, 0.88rem);
  --step-0:  clamp(1.00rem, 0.95rem + 0.25vw, 1.15rem);
  --step-1:  clamp(1.28rem, 1.18rem + 0.5vw, 1.6rem);
  --step-2:  clamp(1.6rem, 1.4rem + 1vw, 2.4rem);
  --step-3:  clamp(2.1rem, 1.7rem + 2vw, 3.6rem);
  --step-4:  clamp(2.8rem, 2rem + 4vw, 5.5rem);

  /* spacing rhythm */
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --section-y: clamp(5rem, 12vh, 11rem);
  --maxw: 1240px;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 14px;
  --radius-sm: 9px;

  /* z-scale (semantic) */
  --z-bg: 0;
  --z-base: 1;
  --z-sticky: 50;
  --z-nav: 100;
  --z-skip: 200;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
.mono { font-family: var(--mono); font-feature-settings: "ss01", "cv01"; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 0.6rem; left: 0.6rem; z-index: var(--z-skip);
  background: var(--accent); color: var(--accent-ink);
  padding: 0.5rem 0.9rem; border-radius: var(--radius-sm);
  font-family: var(--mono); font-weight: 700; font-size: var(--step--1);
  transform: translateY(-160%); transition: transform 0.2s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Reveal scaffolding (hide only before paint, fail-safe in JS) ---------- */
html.reveal-armed [data-reveal] { opacity: 0; transform: translateY(28px); will-change: opacity, transform; }

/* ---------- Buttons ---------- */
.btn {
  --bg-btn: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: var(--mono); font-weight: 700; font-size: var(--step--1);
  letter-spacing: 0.01em; line-height: 1;
  padding: 0.85em 1.4em; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; position: relative; isolation: isolate;
  transition: transform 0.25s var(--ease-out), background-color 0.25s var(--ease-out),
              box-shadow 0.25s var(--ease-out), color 0.25s var(--ease-out);
}
.btn--lg { padding: 1.05em 1.7em; font-size: var(--step-0); }
.btn--accent {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 0 var(--glow-accent);
}
.btn--accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px -12px var(--glow-accent);
  background: oklch(0.92 0.19 124);
}
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

/* ---------- Engine canvas ---------- */
#engine {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: var(--z-bg); pointer-events: none;
  opacity: 0; transition: opacity 1.2s ease;
}
#engine.ready { opacity: 1; }
.engine-veil {
  position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none;
  background:
    /* darken the left column so hero text stays legible over the field */
    linear-gradient(to right, var(--bg) 0%, var(--bg) 30%, oklch(0.190 0.062 256 / 0.62) 50%, transparent 74%),
    /* let the field dissolve into the page at the fold */
    linear-gradient(to bottom, transparent 64%, var(--bg) 100%);
}
/* WebGL-less fallback: a quiet field so the hero never sits on flat colour */
.engine-veil::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(38% 48% at 22% 26%, var(--glow-primary), transparent 60%),
    radial-gradient(40% 50% at 76% 34%, oklch(0.885 0.185 124 / 0.12), transparent 62%);
  opacity: 0.55;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: 1.5rem;
  padding: clamp(0.85rem, 2vw, 1.3rem) var(--gutter);
  transition: background-color 0.35s ease, border-color 0.35s ease, backdrop-filter 0.35s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: oklch(0.150 0.052 258 / 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line-soft);
}
.nav__brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; font-size: var(--step-1); }
.nav__mark {
  width: 0.85em; height: 0.85em; border-radius: 3px; transform: rotate(45deg);
  background: var(--accent); box-shadow: 0 0 18px -2px var(--glow-accent);
}
.nav__links { display: flex; gap: clamp(1rem, 2.5vw, 2.2rem); margin-left: auto; font-family: var(--mono); font-size: var(--step--1); }
.nav__links a { color: var(--muted); position: relative; padding: 0.2em 0; transition: color 0.2s ease; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--accent); transition: width 0.3s var(--ease-out);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { width: 100%; }
.nav__cta { margin-left: 0; }

/* ---------- Shared layout ---------- */
section { position: relative; z-index: var(--z-base); }
.section-kicker {
  color: var(--accent-dim); font-size: var(--step--1); font-weight: 500;
  letter-spacing: 0.04em; margin-bottom: 1.4rem;
}
.h2 {
  font-family: var(--display); font-weight: 700; font-size: var(--step-3);
  line-height: 1.04; letter-spacing: -0.025em; text-wrap: balance; max-width: 18ch;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(7rem, 16vh, 11rem) var(--gutter) clamp(3rem, 8vh, 6rem);
  max-width: var(--maxw); margin-inline: auto;
}
.hero__inner { max-width: 60rem; }
.hero__status {
  display: inline-flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  font-size: var(--step--1); color: var(--muted);
  background: oklch(1 0 0 / 0.04); border: 1px solid var(--line-soft);
  padding: 0.5rem 0.9rem; border-radius: 999px; margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
}
.hero__status-out { color: var(--accent); }
.dot { width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--glow-accent); animation: pulse 2.4s var(--ease-out) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--glow-accent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.hero__title {
  font-family: var(--display); font-weight: 800;
  font-size: var(--step-4); line-height: 0.95; letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero__title .line { display: block; }
.hero__title .line--accent { color: var(--accent); }
.hero__lede {
  margin-top: clamp(1.5rem, 4vh, 2.2rem); max-width: 56ch;
  font-size: var(--step-1); line-height: 1.5; color: var(--muted);
}
.hero__lede + .hero__actions { margin-top: clamp(2rem, 5vh, 2.8rem); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.hero__spec {
  margin-top: clamp(2.5rem, 6vh, 4rem);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
}
.hero__spec > div { background: oklch(0.190 0.062 256 / 0.6); padding: 1.1rem 1.2rem; }
.hero__spec dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.hero__spec dd { font-family: var(--display); font-weight: 700; font-size: var(--step-1); margin-top: 0.3rem; letter-spacing: -0.02em; }

.hero__scroll {
  display: inline-flex; align-items: center; gap: 0.8rem; margin-top: clamp(2.5rem, 7vh, 4.5rem);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
}
.hero__scroll-rail { width: 2px; height: 38px; background: var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.hero__scroll-bead { position: absolute; top: 0; left: 0; width: 100%; height: 40%; background: var(--accent); border-radius: 2px; animation: bead 2.2s var(--ease-out) infinite; }
@keyframes bead { 0% { transform: translateY(-110%); } 60%,100% { transform: translateY(260%); } }

/* ---------- Marquee ---------- */
.marquee {
  border-block: 1px solid var(--line-soft); background: var(--bg-deep);
  overflow: hidden; padding-block: clamp(1rem, 2.5vw, 1.6rem); position: relative; z-index: var(--z-base);
}
.marquee__track {
  display: flex; align-items: center; gap: 2.5rem; width: max-content;
  font-family: var(--display); font-weight: 700; font-size: var(--step-2);
  letter-spacing: -0.02em; color: var(--muted); white-space: nowrap;
  animation: marquee 28s linear infinite;
}
.marquee__sep { color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Problem ---------- */
.problem {
  max-width: var(--maxw); margin-inline: auto; padding: var(--section-y) var(--gutter);
}
.problem__stack { display: flex; flex-direction: column; gap: clamp(1.2rem, 3vh, 2rem); }
.problem__line {
  font-family: var(--display); font-weight: 500; font-size: var(--step-3);
  line-height: 1.08; letter-spacing: -0.025em; color: var(--faint); max-width: 24ch; text-wrap: balance;
}
.problem__line--punch { color: var(--ink); font-weight: 700; }
.strike { text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 3px; color: var(--muted); }
.code-chip {
  font-family: var(--mono); font-size: 0.82em; color: var(--accent-dim);
  background: oklch(1 0 0 / 0.05); border: 1px solid var(--line-soft);
  padding: 0.05em 0.4em; border-radius: 6px; white-space: nowrap;
}
.hl { color: var(--accent); }

/* ---------- Method / pipeline ---------- */
.method { max-width: var(--maxw); margin-inline: auto; padding: var(--section-y) var(--gutter); }
.method__head { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(1rem, 2vw, 1.5rem); counter-reset: stage; }
.stage {
  position: relative; padding: clamp(1.6rem, 3vw, 2.4rem);
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
}
.stage::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0; transition: opacity 0.4s var(--ease-out);
}
.stage:hover { transform: translateY(-5px); border-color: var(--line); }
.stage:hover::before { opacity: 1; }
.stage__no { display: block; font-size: var(--step-2); font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.stage__title { font-family: var(--display); font-weight: 700; font-size: var(--step-2); letter-spacing: -0.02em; margin-bottom: 0.6rem; }
.stage__body { color: var(--muted); font-size: var(--step-0); max-width: 36ch; }

/* ---------- Answer (the payoff) ---------- */
.answer {
  position: relative; text-align: center; padding: clamp(7rem, 18vh, 13rem) var(--gutter);
  background: var(--bg-deep); border-block: 1px solid var(--line-soft); overflow: hidden;
}
.answer::after {
  content: ""; position: absolute; left: 50%; top: 52%; translate: -50% -50%;
  width: min(90vw, 760px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--glow-accent), transparent 62%);
  filter: blur(40px); opacity: 0.5; z-index: 0; pointer-events: none;
}
.answer__inner { position: relative; z-index: 1; max-width: 44rem; margin-inline: auto; }
.answer__kicker { color: var(--accent); justify-content: center; display: block; }
.answer__pre { color: var(--muted); font-size: var(--step-1); }
.answer__value { margin: clamp(0.5rem, 2vh, 1.5rem) 0; line-height: 0.9; }
.answer__num {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(7rem, 34vw, 22rem); letter-spacing: -0.05em;
  color: var(--accent); display: inline-block;
  text-shadow: 0 0 70px var(--glow-accent);
}
.answer__post { font-size: var(--step-1); color: var(--ink); }
.answer__comment { color: var(--faint); }
.answer__foot { margin-top: 1.6rem; color: var(--muted); max-width: 42ch; margin-inline: auto; }

/* ---------- API ---------- */
.api {
  max-width: var(--maxw); margin-inline: auto; padding: var(--section-y) var(--gutter);
  display: grid; grid-template-columns: 1fr; gap: clamp(2.5rem, 5vw, 4rem); align-items: center;
}
@media (min-width: 900px) { .api { grid-template-columns: 0.85fr 1.15fr; } }
.api__lede { color: var(--muted); margin-top: 1.4rem; max-width: 44ch; font-size: var(--step-1); }
.api__list { margin-top: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.api__list li { display: flex; gap: 0.9rem; align-items: baseline; color: var(--muted); }
.api__k { color: var(--accent); font-size: var(--step--1); font-weight: 700; min-width: 8.5rem; }

.code {
  background: var(--bg-deep); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 40px 80px -40px oklch(0 0 0 / 0.7);
}
.code__bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--line-soft); background: oklch(1 0 0 / 0.025); }
.code__dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.code__dot:nth-child(1) { background: oklch(0.7 0.17 25); }
.code__dot:nth-child(2) { background: oklch(0.82 0.15 85); }
.code__dot:nth-child(3) { background: var(--accent-dim); }
.code__name { margin-left: 0.6rem; color: var(--faint); font-size: var(--step--1); }
.code__body { margin: 0; padding: clamp(1.1rem, 2.5vw, 1.8rem); overflow-x: auto; font-size: clamp(0.78rem, 0.7rem + 0.4vw, 0.95rem); line-height: 1.85; color: oklch(0.86 0.02 250); }
.t-key { color: oklch(0.78 0.13 320); }
.t-str { color: var(--accent-dim); }
.t-fn  { color: var(--primary); }
.t-var { color: oklch(0.85 0.10 60); }
.t-cmt { color: var(--faint); font-style: italic; }

/* ---------- Voices ---------- */
.voices { max-width: var(--maxw); margin-inline: auto; padding: var(--section-y) var(--gutter); }
.voices__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: clamp(1rem, 2vw, 1.5rem); margin-top: 2.5rem; }
.voice {
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem;
  padding: clamp(1.6rem, 3vw, 2.2rem); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.voice__quote { font-family: var(--display); font-weight: 500; font-size: var(--step-1); line-height: 1.32; letter-spacing: -0.015em; }
.voice__by { display: flex; flex-direction: column; gap: 0.25rem; }
.voice__by cite { font-style: normal; font-weight: 600; }
.voice__meta { color: var(--accent-dim); font-size: var(--step--1); }

/* ---------- CTA ---------- */
.cta { position: relative; padding: clamp(6rem, 14vh, 11rem) var(--gutter); text-align: center; overflow: hidden; }
.cta::before {
  content: ""; position: absolute; inset: auto 50% 0; translate: 50% 0; width: min(95vw, 1100px); height: 60%;
  background: radial-gradient(ellipse at bottom, var(--glow-primary), transparent 70%); opacity: 0.7; z-index: 0;
}
.cta__inner { position: relative; z-index: 1; max-width: 40rem; margin-inline: auto; }
.cta__title { font-family: var(--display); font-weight: 800; font-size: var(--step-3); line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance; }
.cta__form { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; margin-top: 2.4rem; }
.cta__input {
  flex: 1 1 280px; max-width: 360px; padding: 1.05em 1.3em; font-size: var(--step-0);
  background: oklch(1 0 0 / 0.05); border: 1.5px solid var(--line);
  border-radius: 999px; color: var(--ink); transition: border-color 0.2s ease, background-color 0.2s ease;
}
.cta__input::placeholder { color: var(--faint); }
.cta__input:focus { outline: none; border-color: var(--accent); background: oklch(1 0 0 / 0.08); }
.cta__fine { margin-top: 1.4rem; color: var(--faint); font-size: var(--step--1); }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--line-soft); padding: clamp(3.5rem, 8vh, 6rem) var(--gutter) 2.5rem; max-width: var(--maxw); margin-inline: auto; }
.foot__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.2rem; }
.foot__brand { font-family: var(--display); font-weight: 800; font-size: var(--step-2); letter-spacing: -0.02em; }
.foot__tag { color: var(--faint); font-size: var(--step--1); }
.foot__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 2rem; margin: clamp(2.5rem, 6vh, 4rem) 0; }
.foot__cols h4 { font-family: var(--mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 1rem; font-weight: 500; }
.foot__cols a { display: block; color: var(--muted); padding: 0.35rem 0; transition: color 0.2s ease; }
.foot__cols a:hover { color: var(--accent); }
.foot__fine { color: var(--faint); font-size: var(--step--1); max-width: 70ch; line-height: 1.7; border-top: 1px solid var(--line-soft); padding-top: 2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__cta { margin-left: auto; padding: 0.7em 1.1em; font-size: 0.78rem; }
  .hero__title { letter-spacing: -0.03em; }

  /* the status string is long mono — let it wrap inside a softer-cornered chip */
  .hero__status {
    max-width: 100%; white-space: normal; word-break: break-word;
    border-radius: var(--radius-sm); font-size: 0.72rem;
  }

  /* quiet the field to a backdrop so body copy stays legible across the full width */
  .engine-veil {
    background:
      linear-gradient(to bottom, oklch(0.190 0.062 256 / 0.5), oklch(0.190 0.062 256 / 0.8)),
      linear-gradient(to bottom, transparent 70%, var(--bg) 100%);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.reveal-armed [data-reveal] { opacity: 1; transform: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .marquee__track { animation: none; }
  #engine { display: none; }
}
