/* Thebes v3 — bright scroll-scrubbed narrative. Self-contained stylesheet
 * for the homepage (apply/spec keep style.css). Warm ivory canvas; type-led
 * beats float over the light-drawn scene; glass only where content needs a
 * floor (terminal section, footer). */

@font-face {
  font-family: 'Inter';
  src: url('./inter-var-latin.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('./jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('./jetbrains-mono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ivory: #faf8f4;
  --ink: #101c27;
  --ink-soft: #44525f;
  --teal: #0e7c7b;
  --teal-bright: #2ee6e2;
  --violet: #7c5cd6;
  --violet-bright: #a78bfa;
  --line: rgba(16, 28, 39, 0.1);
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --shadow: 0 12px 40px rgba(16, 28, 39, 0.1), 0 2px 8px rgba(16, 28, 39, 0.05);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--ivory); color: var(--ink-soft);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--violet); }
code { font-family: var(--mono); font-size: 0.92em; }

/* ─── Scene canvas ─────────────────────────────────────────────── */
#substrate-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; }
.static-hero-bg { display: none; }
.no-webgl #substrate-canvas { display: none; }
.no-webgl .static-hero-bg {
  display: block; position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 60% 45% at 50% 38%, rgba(46, 230, 226, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 62% 60%, rgba(167, 139, 250, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #faf8f4 0%, #f2ede1 100%);
}

/* ─── Nav ──────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px max(28px, env(safe-area-inset-right)) 14px max(28px, env(safe-area-inset-left));
  background: rgba(250, 248, 244, 0.72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: 0.01em; color: var(--ink); }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a { color: var(--ink-soft); font-size: 15px; font-weight: 550; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  color: #fff !important;
  background: linear-gradient(135deg, var(--teal) 0%, var(--violet) 100%);
  padding: 9px 20px; border-radius: 999px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(14, 124, 123, 0.25);
}
@media (max-width: 540px) {
  .nav-links { gap: 16px; }
  .nav-links a:not(.nav-cta):not([aria-label]) { display: none; }
}

/* ─── Beats (fixed overlay, driven by hero3d.js) ───────────────── */
#beats { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.beat {
  position: absolute; inset: 0;
  display: grid; align-items: center;
  padding: 0 clamp(24px, 7vw, 110px);
  visibility: hidden; opacity: 0;
  will-change: opacity, transform;
}
.beat-inner { max-width: 1180px; margin: 0 auto; width: 100%; }
.align-center { text-align: center; }
/* Beat 1: product-hero framing — the machine owns the upper frame,
 * the wordmark sits in the lower third. */
.beat-1 { align-items: end; padding-bottom: 4vh; }
.beat-1 h1 { font-size: clamp(64px, 10.5vw, 138px); }
@media (max-height: 700px) { .beat-1 { padding-bottom: 3vh; } }
.align-left { text-align: left; }
.align-right { text-align: right; }
.align-right .line { margin-left: auto; }
.align-left .line { margin-right: auto; }
.align-center .line { margin-left: auto; margin-right: auto; }

.kicker {
  font-family: var(--mono); font-size: clamp(11px, 1.1vw, 13px);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 18px; font-weight: 600;
  text-shadow: 0 1px 10px rgba(250, 248, 244, 0.9);
}
.beat h1 {
  font-size: clamp(72px, 13vw, 168px); line-height: 0.98;
  letter-spacing: -0.045em; font-weight: 800; color: var(--ink);
}
.beat h1 .dot { color: var(--teal); }
.beat h2 {
  font-size: clamp(40px, 6.2vw, 92px); line-height: 1.02;
  letter-spacing: -0.038em; font-weight: 800; color: var(--ink);
  max-width: 17ch;
}
.align-center h2 { margin-left: auto; margin-right: auto; }
.align-right h2 { margin-left: auto; }
.beat .line {
  margin-top: 26px; font-size: clamp(17px, 1.9vw, 23px); line-height: 1.55;
  color: var(--ink); max-width: 52ch; font-weight: 600;
  /* clean caption panel so the 3D can never bury the body copy: a soft,
   * blurred, semi-opaque ivory backing the dark text always reads on, while a
   * hint of the (blurred) artifact still shows through. */
  display: table; padding: 14px 20px; border-radius: 14px;
  background: rgba(250, 248, 244, 0.70);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(16, 28, 39, 0.07);
  text-shadow: none;
}
.align-right .line { margin-left: auto; }
.align-center .line { margin-left: auto; margin-right: auto; }
/* side-aligned beats: keep the copy in its own third, off the artifact */
.align-left .line, .align-right .line { max-width: 40ch; }
/* Headline knockout: white text + difference blending makes the letters
 * read near-black over the ivory canvas and flip to white exactly where
 * the dark artifact passes behind them. mix-blend-mode only composites
 * within the nearest ISOLATED group — and .beat (will-change + animated
 * opacity) and fixed #beats both isolate — so the blended elements are
 * HOISTED to direct body children (.knock, created in hero3d.js) and the
 * in-flow originals keep layout with visibility:hidden. Mobile, static
 * mode, and no-webgl use plain ink instead (scrim + blend = mud).
 */
.knock {
  position: fixed; top: 0; left: 0; margin: 0; z-index: 9;
  pointer-events: none; color: #fff; mix-blend-mode: difference;
  text-shadow: none; will-change: transform, opacity;
}
.knock .dot { color: #fff; }
.static-mode .beat h1, .static-mode .beat h2,
.no-webgl .beat h1, .no-webgl .beat h2 {
  mix-blend-mode: normal; color: var(--ink); visibility: inherit !important;
}

.scroll-cue {
  margin-top: 36px; display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--ink-soft);
}
.scroll-cue span { display: block; width: 1px; height: 44px; background: linear-gradient(180deg, transparent, var(--teal)); animation: cue 2.2s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: scaleY(0.4); opacity: 0.4; } 50% { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scroll-cue span { animation: none; } }

/* ─── Scroll track (the timeline length) ───────────────────────── */
#track { height: 750vh; position: relative; z-index: 1; }

/* ─── Beat 6 — deploy (in flow) ────────────────────────────────── */
.deploy { position: relative; z-index: 12; padding: 18vh clamp(24px, 7vw, 110px) 14vh; }
.deploy-inner { max-width: 880px; margin: 0 auto; text-align: center; }
.deploy h2 {
  font-size: clamp(40px, 6vw, 84px); letter-spacing: -0.038em; line-height: 1.02;
  font-weight: 800; color: var(--ink); text-shadow: 0 2px 26px rgba(250, 248, 244, 0.85);
}
.deploy .line {
  margin: 22px auto 36px; font-size: clamp(16px, 1.8vw, 21px); line-height: 1.55;
  color: var(--ink-soft); max-width: 54ch;
  text-shadow: 0 1px 14px rgba(250, 248, 244, 0.9);
}
.deploy .line code { color: var(--teal); font-weight: 600; }
/* in-browser deploy how-to: numbered steps */
.deploy .how { margin: 24px 0 0; padding: 0; list-style: none; counter-reset: how; max-width: 62ch; }
.deploy .how li { position: relative; padding-left: 42px; margin-bottom: 15px; font-size: clamp(16px, 1.7vw, 20px); color: var(--ink-soft); line-height: 1.5; counter-increment: how; }
.deploy .how li::before { content: counter(how); position: absolute; left: 0; top: 1px; width: 27px; height: 27px; border-radius: 50%; background: var(--ink); color: var(--ivory); font: 600 13px/27px var(--mono); text-align: center; }
.deploy .how strong { color: var(--ink); }
.deploy .how a, .deploy .line a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.terminal {
  text-align: left; background: #0b0d12; color: #e6e8ee;
  border-radius: 18px; border: 1px solid rgba(16, 28, 39, 0.5);
  padding: 26px 30px; overflow-x: auto;
  box-shadow: 0 24px 70px rgba(16, 28, 39, 0.28), 0 4px 14px rgba(16, 28, 39, 0.12);
}
.terminal code { font-size: 13.5px; line-height: 1.75; white-space: pre; display: block; }
.terminal .prompt, .terminal .ok { color: #34d399; }
.terminal .dim { color: #6b7280; }
.terminal .hi { color: #fbbf24; font-weight: 600; }

.cta-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 40px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 30px; border-radius: 999px; font-size: 16px; font-weight: 650;
  min-height: 48px; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, var(--violet) 100%);
  color: #fff !important; box-shadow: 0 10px 28px rgba(14, 124, 123, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(14, 124, 123, 0.38); }
.btn-secondary {
  background: var(--glass-strong); color: var(--ink) !important;
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn-secondary:hover { border-color: var(--teal); transform: translateY(-2px); }
.deep-link { margin-top: 34px; font-size: 15px; color: var(--ink-soft); }

/* ─── Beat 6 — build (CTA) ─────────────────────────────────────── */
.build { position: relative; z-index: 12; padding: 6vh clamp(24px, 7vw, 110px) 18vh; }
.build-inner { max-width: 880px; margin: 0 auto; text-align: center; }
.build h2 {
  font-size: clamp(44px, 7vw, 96px); letter-spacing: -0.04em; line-height: 1.0;
  font-weight: 800; color: var(--ink); text-shadow: 0 2px 26px rgba(250, 248, 244, 0.85);
}
.build .line {
  margin: 22px auto 8px; font-size: clamp(16px, 1.8vw, 21px); line-height: 1.55;
  color: var(--ink-soft); max-width: 46ch;
  text-shadow: 0 1px 14px rgba(250, 248, 244, 0.9);
}
.edu-callout {
  max-width: 620px; margin: 42px auto 6px; padding: 30px 36px 28px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.edu-callout::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--violet) 100%);
}
.edu-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.24em;
  text-transform: uppercase; font-weight: 600; color: var(--teal);
  margin-bottom: 10px;
}
.edu-amount {
  font-family: var(--mono); font-size: clamp(38px, 5vw, 58px);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.1;
  background: linear-gradient(135deg, var(--teal) 0%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--teal);
}
.edu-body {
  margin-top: 12px; font-size: clamp(16px, 1.7vw, 18.5px); line-height: 1.55;
  font-weight: 500; color: var(--ink-soft);
  max-width: 44ch; margin-left: auto; margin-right: auto;
}
.edu-body strong { color: var(--ink); font-weight: 700; }
.edu-cta { margin-top: 20px; }

.chip {
  display: inline-flex; align-items: center;
  padding: 15px 24px; border-radius: 999px; font-size: 15px; font-weight: 600;
  min-height: 48px; color: var(--ink-soft);
  border: 1px dashed rgba(16, 28, 39, 0.28);
  font-family: var(--mono); letter-spacing: 0.02em;
  cursor: default; user-select: none;
}
.chip-live {
  color: var(--ink); cursor: pointer; user-select: auto;
  border-style: solid; border-color: rgba(16, 28, 39, 0.45);
  text-decoration: none; transition: border-color .15s, transform .15s;
}
.chip-live:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ─── Footer ───────────────────────────────────────────────────── */
.footer {
  position: relative; z-index: 12;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 26px clamp(24px, 7vw, 110px);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.footer .brand { font-size: 16px; }
.footer-note { flex: 1; min-width: 240px; font-size: 13.5px; color: var(--ink-soft); }
.footer-note code { background: rgba(16, 28, 39, 0.06); padding: 2px 6px; border-radius: 4px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 14px; color: var(--ink-soft); }
.footer-links a:hover { color: var(--teal); }

/* ─── Progress rail ────────────────────────────────────────────── */
.rail {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%);
  z-index: 30; display: flex; flex-direction: column; gap: 2px;
}
.rail button {
  width: 44px; height: 30px; background: none; border: none; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.rail button::after {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(16, 28, 39, 0.22); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.rail button:hover::after { background: var(--teal); }
.rail button.on::after {
  background: linear-gradient(135deg, var(--teal-bright), var(--violet-bright));
  height: 22px; border-radius: 99px;
  box-shadow: 0 0 12px rgba(46, 230, 226, 0.55);
}
@media (max-width: 720px) { .rail { right: 6px; } }

/* ─── Static mode (reduced motion / no WebGL) ──────────────────── */
/* Beats become normal stacked sections; the track spacer collapses. */
.static-mode #beats { position: static; pointer-events: auto; }
.static-mode .beat {
  position: static; visibility: visible !important; opacity: 1 !important;
  transform: none !important; min-height: 72vh; padding-top: 14vh;
}
.static-mode #track { display: none; }
.static-mode .rail { display: none; }
.static-mode .scroll-cue { display: none; }

/* ─── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .beat h2 { max-width: 12ch; }
  /* soft ivory scrim behind beat copy — legibility over the machine */
  .beat-inner {
    background: radial-gradient(closest-side, rgba(250, 248, 244, 0.85) 40%, rgba(250, 248, 244, 0) 100%);
    padding: 30px 8px;
  }
  .align-right { text-align: left; }
  .align-right .line, .align-right h2 { margin-left: 0; margin-right: auto; }
  .terminal { padding: 18px 16px; }
  .terminal code { font-size: 11.5px; }
  .deploy { padding-top: 10vh; }
  .edu-callout { padding: 24px 20px 22px; margin-top: 32px; }
}
@media (pointer: coarse) {
  .btn, .nav-cta { min-height: 48px; }
}
