/* ============================================================
   claui.app — landing styles
   Dark, Apple-style. Scroll-scrubbed sections read a per-section
   CSS variable --p (0→1, set by app.js) and express all motion as a
   function of it, so animation tracks the scroll position both ways.
   Without JS (or under prefers-reduced-motion) --p stays at its
   default of 1, so every section renders in its final, static state.
   ============================================================ */

/* ---------- Fonts (self-hosted, copied from the app) ---------- */
@font-face {
  font-family: 'Geist';
  src: url('assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Monaspace Neon';
  src: url('assets/fonts/MonaspaceNeon-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Monaspace Neon';
  src: url('assets/fonts/MonaspaceNeon-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ---------- Tokens (mirror the app's themeStore.ts) ---------- */
:root {
  --bg: #0a0a0a;
  --bg-elev: #0f0f0f;
  --bg-elev2: #151515;
  --fg: #ededed;
  --fg-dim: #888;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #0070f3;
  --accent-fg: #fff;
  --green: #80cbc4;
  --warn: #ffc799;
  --font-ui: 'Geist', -apple-system, 'SF Pro Text', system-ui, sans-serif;
  --font-mono: 'Monaspace Neon', Menlo, monospace;
  --r: 22px; /* continuous-corner radius for the window */
  --maxw: 1120px;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* Ambient top glow */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 100vh;
  background: radial-gradient(120% 80% at 50% -10%, rgba(0, 112, 243, 0.16), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
a { color: inherit; text-decoration: none; }
code, kbd { font-family: var(--font-mono); }
h1, h2 { letter-spacing: -0.03em; line-height: 1.04; margin: 0; }
section { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 999px;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.3s ease;
  box-shadow: 0 8px 30px rgba(0, 112, 243, 0.35);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn-lg { font-size: 18px; padding: 16px 28px; }
.btn-sm { padding: 8px 16px; font-size: 14px; box-shadow: none; }
.ver {
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(18px, 5vw, 48px);
  backdrop-filter: saturate(160%) blur(14px);
  background: rgba(10, 10, 10, 0.55);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.brand img { border-radius: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.gh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-dim);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.gh:hover { color: var(--fg); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.gh-mark { display: block; }
.gh-stars { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ============================================================
   HERO — pinned, scrubbed by --p
   ============================================================ */
[data-scrub] { --p: 1; } /* default for no-JS / reduced-motion */

.hero { height: 200vh; }
.hero-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(60px, 9vh, 116px);
  overflow: hidden;
}
.hero-copy {
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
  /* Visible at the top; rises and fades out as you scroll into the window. */
  transform: translateY(calc(var(--p) * -56px));
  opacity: calc(1 - var(--p) * 1.9);
  will-change: transform, opacity;
}
.hero-title {
  font-size: clamp(64px, 12vw, 132px);
  font-weight: 700;
  background: linear-gradient(180deg, #fff, #b8b8b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-tagline {
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 600;
  margin: 10px 0 0;
}
.hero-sub {
  color: var(--fg-dim);
  font-size: clamp(16px, 2vw, 19px);
  margin: 16px auto 0;
  max-width: 560px;
}
.hero-sub code { color: var(--fg); background: var(--bg-elev2); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.hero-cta { margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-meta { color: var(--fg-dim); font-size: 14px; margin: 0; }

.window-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(900px, 90vw);
  height: min(62vh, 600px);
  /* p=1: centered in the viewport (status bar always in frame).
     p=0: pushed down so only the top of the window peeks above the fold. */
  transform: translate(-50%, calc(-50% + (1 - var(--p)) * 48vh)) scale(calc(0.97 + var(--p) * 0.03));
  will-change: transform;
}
/* Fill the fixed window height: title bar + flexible body + status bar. */
.window-wrap .claui-window { height: 100%; }
.window-wrap .win-body { flex: 1 1 auto; min-height: 0; }
.glow {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 70%;
  height: 60%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(0, 112, 243, 0.45), transparent);
  filter: blur(60px);
  opacity: calc(0.4 + var(--p) * 0.5);
  pointer-events: none;
}

/* ============================================================
   claui WINDOW MOCKUP
   ============================================================ */
.claui-window {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  overflow: hidden;
}
.win-titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.lights { display: inline-flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; background: #3a3a3a; }
.lights i:nth-child(1) { background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.win-title { color: var(--fg-dim); font-size: 13px; }

.win-body { display: grid; grid-template-columns: 1fr 230px; min-height: 340px; }
.terminal { padding: 18px 20px; font-family: var(--font-mono); font-size: 13.5px; }
.term-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.mascot { border-radius: 8px; }
.term-head-meta { display: flex; flex-direction: column; line-height: 1.4; }
.t-strong { font-weight: 700; }
.t-dim { color: var(--fg-dim); }
.t-green { color: var(--green); }
.t-prompt { color: var(--accent); font-weight: 700; }
.t-path { color: #87ceeb; }
.t-key { color: var(--warn); }
.term-feed { display: flex; flex-direction: column; gap: 9px; }
.t-line { margin: 0; }

/* On-load typing reveal (one line at a time). Suppressed under reduced motion. */
.t-line { opacity: 0; transform: translateY(4px); animation: lineIn 0.45s ease forwards; animation-delay: calc(var(--i) * 0.55s + 0.4s); }
@keyframes lineIn { to { opacity: 1; transform: none; } }
.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--fg);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.sidebar { border-left: 1px solid var(--line); background: var(--bg-elev); padding: 14px 0; }
.side-section { padding: 6px 0 14px; }
.side-head {
  display: flex;
  justify-content: space-between;
  padding: 4px 16px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}
.side-add { color: var(--fg-dim); opacity: 0.7; }
.side-row {
  position: relative;
  padding: 7px 16px;
  font-size: 13.5px;
  color: var(--fg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.side-row.is-active, .proj-active { background: rgba(255, 255, 255, 0.06); }
.side-row.is-active::before, .proj-active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.side-session { color: var(--fg-dim); }
.side-meta { font-size: 11px; color: var(--fg-dim); opacity: 0.7; }

.win-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 34px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 12.5px;
  color: var(--fg-dim);
}
.sb-ctx, .sb-right { display: inline-flex; align-items: center; gap: 8px; }
.sb-label { color: var(--fg-dim); }
.sb-bar { width: 90px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.sb-fill { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 999px; }
.sb-chip { display: inline-flex; gap: 5px; }
.sb-cost { color: var(--fg); }
.sb-model { color: var(--fg); background: var(--bg-elev2); padding: 2px 8px; border-radius: 999px; }

/* ============================================================
   BANDS / REVEALS
   ============================================================ */
.band {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(90px, 16vh, 180px) 24px;
  text-align: center;
}
.band-title { font-size: clamp(30px, 5vw, 52px); font-weight: 700; }
.band-title code { font-family: var(--font-mono); color: var(--accent); background: none; }
.band-sub { color: var(--fg-dim); font-size: clamp(17px, 2.2vw, 21px); margin: 22px auto 0; max-width: 640px; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in-view { opacity: 1; transform: none; }

/* ============================================================
   FEATURE STAGES — pinned, scrubbed by --p
   ============================================================ */
.feature { height: 160vh; }
.feature-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(30px, 6vw, 90px);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(24px, 6vw, 64px);
}
.feature:nth-child(even) .feature-stage { direction: rtl; }
.feature:nth-child(even) .feature-stage > * { direction: ltr; }
.kicker {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.feature-copy h2 { font-size: clamp(30px, 4.4vw, 48px); font-weight: 700; }
.feature-copy p { color: var(--fg-dim); font-size: clamp(16px, 2vw, 19px); margin-top: 18px; max-width: 460px; }
kbd {
  background: var(--bg-elev2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  padding: 1px 8px;
  font-size: 0.82em;
  color: var(--fg);
}

/* Each feature shows a real claui window frame, sized to its grid column. */
.frame .claui-window { width: 100%; }
.frame .win-body { min-height: 300px; }
.win-body-full { grid-template-columns: 1fr !important; }

/* per-item local progress: ramps 0→1 as --p passes this item's slot */
.tab, .sess { --lp: clamp(0, calc((var(--p) - var(--i) * 0.16) * 5), 1); }

/* Tabs (title-bar strip) — slide in one by one */
.tabstrip { display: inline-flex; gap: 8px; overflow: hidden; }
.tab {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 6px 13px;
  border-radius: 9px;
  background: var(--bg-elev2);
  color: var(--fg-dim);
  white-space: nowrap;
  opacity: var(--lp);
  transform: translateX(calc((1 - var(--lp)) * -22px));
}
.tab-claude.is-active { color: var(--fg); background: rgba(0, 112, 243, 0.2); }
.tab-shell { color: var(--green); }
/* Hero title-bar tabs are static (the scroll-in reveal is only for the tabs feature). */
.tabstrip-static .tab { opacity: 1; transform: none; }

/* Projects — the active row is highlighted; app.js snaps it cleanly to a
   project as you scroll and swaps the window content to match. Rows get a
   little extra height so the switching reads clearly. */
[data-projects] .side-row { padding: 11px 16px; transition: background 0.25s ease; }

/* Sessions — rows fade and slide in as you scroll */
.sess { opacity: var(--lp); transform: translateX(calc((1 - var(--lp)) * 16px)); }
.badge { color: var(--accent); font-size: 12px; }

/* ============================================================
   CTA + LAUNCH NOTE
   ============================================================ */
.cta {
  text-align: center;
  padding: clamp(110px, 18vh, 200px) 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.cta h2 { font-size: clamp(34px, 6vw, 64px); font-weight: 700; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  padding: 40px clamp(24px, 6vw, 64px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  color: var(--fg-dim);
  font-size: 14px;
}
.footer-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); }
.footer-brand img { border-radius: 5px; }
.footer-links { display: flex; gap: 22px; }
.footer-links a:hover { color: var(--fg); }
.footer-fine { margin: 0 0 0 auto; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .feature { height: auto; }
  .feature-stage {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
    padding-top: 80px;
    padding-bottom: 40px;
    gap: 36px;
  }
  .feature:nth-child(even) .feature-stage { direction: ltr; }
  .win-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .footer-fine { margin: 0; flex-basis: 100%; }
}

/* ============================================================
   REDUCED MOTION — kill all scrubbing & reveals, show final state
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero { height: auto; }
  .hero-stage { position: static; height: auto; padding-bottom: 80px; }
  .feature { height: auto; }
  .feature-stage { position: static; height: auto; }
  .hero-copy { margin-bottom: 32px; }
  .window-wrap { position: static !important; height: auto !important; width: min(1120px, 94vw); margin: 0 auto; }
  .window-wrap .win-body { flex: none; min-height: 420px; }
  .hero-copy, .window-wrap, .glow { transform: none !important; opacity: 1 !important; }
  .t-line, .reveal, .tab, .sess { opacity: 1 !important; transform: none !important; animation: none !important; }
  .caret { animation: none; }
}
