/* ============================================================================
   site.css — the aiTerminal website. Design language = the Midnight theme the
   terminal ships with: #0B0E14 bg, #161A23 surfaces, #0A84FF accent.
   Pure CSS. No frameworks.
   ========================================================================== */

:root {
  --bg: #0B0E14;
  --bg2: #070910;
  --surface: #161A23;
  --hover: #202631;
  --border: #2A303C;
  --fg: #F2F4F8;
  --muted: #8A90A0;
  --accent: #0A84FF;
  --accent2: #369AFF;
  --green: #30D158;
  --warn: #FF9F0A;
  --error: #FF453A;
  --purple: #BF5AF2;
  --teal: #64D2FF;
  --mark-green: #4ADE80;
  --mark-blue: #38BDF8;
  --mono: "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: rgba(10, 132, 255, .35); }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre { font-family: var(--mono); }
img { max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------------- nav ---------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 26px; height: 60px; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--fg); }
.nav-brand:hover { text-decoration: none; }
.nav-brand img { width: 28px; height: 28px; border-radius: 7px; }
.nav-links { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.nav-links a:hover { color: var(--fg); text-decoration: none; }
.nav-links a.active { color: var(--fg); }
.nav-cta {
  background: var(--accent); color: #fff !important; padding: 7px 16px;
  border-radius: 8px; font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(10,132,255,.4); text-decoration: none; }
.nav-gh { display: inline-flex; align-items: center; gap: 6px; }
.nav-gh svg { width: 18px; height: 18px; fill: currentColor; }
.nav-toggle { display: none; background: none; border: none; color: var(--fg); font-size: 22px; cursor: pointer; }

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  padding: 84px 0 60px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: -30% -20% auto;
  height: 120%;
  background:
    radial-gradient(640px 420px at 18% 20%, rgba(10,132,255,.13), transparent 65%),
    radial-gradient(520px 380px at 85% 10%, rgba(74,222,128,.07), transparent 65%);
  pointer-events: none;
}
.hero-inner { position: relative; text-align: center; }
.hero-icon { width: 84px; height: 84px; border-radius: 20px; margin-bottom: 22px;
  box-shadow: 0 18px 50px -12px rgba(56,189,248,.3); }
.hero h1 { font-size: clamp(38px, 6vw, 62px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; }
.hero h1 .grad {
  background: linear-gradient(92deg, var(--mark-green), var(--mark-blue) 55%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub {
  margin: 18px auto 0; max-width: 720px;
  color: var(--muted); font-size: 19px;
}
.hero .sub b { color: var(--fg); font-weight: 600; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; margin: 30px 0 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 11px;
  font-weight: 650; font-size: 15.5px;
  border: 1px solid var(--border);
  color: var(--fg); background: var(--surface);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(10,132,255,.45); }
.btn .os { font-size: 12px; color: var(--muted); font-weight: 500; display: block; line-height: 1; margin-top: 2px; }
.btn.primary .os { color: rgba(255,255,255,.75); }
.btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.btn .soon { font-size: 10px; background: var(--hover); color: var(--muted); border-radius: 5px; padding: 2px 6px; margin-left: 2px; }
.hero-sub-note { color: var(--muted); font-size: 13px; }
.hero-sub-note code { background: var(--surface); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border); }
.hero-term { text-align: left; }

/* ---------------- stat band ---------------- */
.stats { border-block: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 45%, transparent); }
.stats-inner { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 26px 0; }
.stat { text-align: center; }
.stat b { display: block; font-size: 27px; font-weight: 800; color: var(--fg); font-family: var(--mono); }
.stat b .u { color: var(--accent2); }
.stat span { color: var(--muted); font-size: 12.5px; }

/* ---------------- sections ---------------- */
.section { padding: 84px 0 10px; }
.section-head { max-width: 760px; margin-bottom: 34px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
}
.section h2 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 750; letter-spacing: -0.015em; line-height: 1.2; }
.section .lead { color: var(--muted); margin-top: 12px; font-size: 16.5px; }
.section .lead code { color: var(--fg); background: var(--surface); padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border); font-size: .92em; }

/* feature = text + replica, alternating */
.feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 44px; align-items: center; padding: 40px 0; }
.feature.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.feature.flip .feature-copy { order: 2; }
.feature.flip .feature-demo { order: 1; }
.feature h3 { font-size: 23px; font-weight: 720; margin-bottom: 10px; letter-spacing: -0.01em; }
.feature h3 .fx { font-family: var(--mono); color: var(--accent2); }
.feature p { color: var(--muted); font-size: 15.5px; }
.feature p code, .feature li code { color: var(--fg); background: var(--surface); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); font-size: .9em; }
.feature ul { margin-top: 12px; color: var(--muted); font-size: 14.5px; list-style: none; }
.feature li { padding: 4px 0 4px 24px; position: relative; }
.feature li::before { content: "❯"; position: absolute; left: 2px; color: var(--accent); font-family: var(--mono); font-size: 12px; top: 7px; }

/* grid cards (plugins, use cases, providers…) */
.cards { display: grid; gap: 14px; margin-top: 26px; }
.cards.c3 { grid-template-columns: repeat(3, 1fr); }
.cards.c4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 18px;
  transition: transform .2s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 14px 34px -14px rgba(0,0,0,.6); }
.card .ic { font-size: 21px; margin-bottom: 8px; display: block; }
.card b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.card b code { font-family: var(--mono); color: var(--accent2); font-size: .95em; }
.card p { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* theme gallery chips */
.theme-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 26px; }
.theme-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; color: var(--muted); cursor: pointer;
  transition: all .2s ease; font-family: var(--mono);
}
.theme-chip:hover { transform: translateY(-2px); color: var(--fg); }
.theme-chip.active { border-color: var(--chip, var(--accent)); color: var(--fg); box-shadow: 0 0 0 1px var(--chip, var(--accent)); }
.theme-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--chip); box-shadow: 0 0 8px color-mix(in srgb, var(--chip) 65%, transparent); }
.theme-chip.light .theme-dot { outline: 1px solid rgba(0,0,0,.2); }

/* keymap keyboard */
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 24px; }
.keyrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 10px; font-size: 13.5px;
}
.keyrow span { color: var(--muted); }
kbd {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  background: var(--hover); border: 1px solid var(--border);
  border-bottom-width: 2px; font-size: 12px; color: var(--fg);
  white-space: nowrap;
}

/* command family strip */
.cmd-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.cmd-pill {
  font-family: var(--mono); font-size: 14px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 999px; color: var(--muted);
  transition: all .2s ease;
}
.cmd-pill b { color: var(--accent2); font-weight: 700; }
.cmd-pill:hover { border-color: var(--accent); color: var(--fg); transform: translateY(-2px); }

/* perf bars */
.perf { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 26px; }
.perf-item { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 18px; }
.perf-item b { font-family: var(--mono); font-size: 22px; color: var(--mark-green); }
.perf-item p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* download section */
.dl { text-align: center; padding: 90px 0; }
.dl .icon { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 18px; }
.dl h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.dl p { color: var(--muted); margin: 12px auto 28px; max-width: 560px; }
.dl-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* footer */
footer { border-top: 1px solid var(--border); margin-top: 70px; padding: 40px 0 60px; color: var(--muted); font-size: 14px; }
.foot { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot .brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 650; }
.foot .brand img { width: 24px; height: 24px; border-radius: 6px; }
.foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--fg); }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero::before, .hero-icon, .hero-term { animation: none; }
}

/* ---------------- docs layout ---------------- */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; padding: 40px 0 80px; }
.docs-nav { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; font-size: 14px; }
.docs-nav b { display: block; color: var(--fg); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 6px; }
.docs-nav a { display: block; color: var(--muted); padding: 4px 10px; border-left: 2px solid var(--border); border-radius: 0 6px 6px 0; }
.docs-nav a:hover, .docs-nav a.active { color: var(--fg); border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none; }
.docs-main h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.docs-main .lead { color: var(--muted); margin: 10px 0 20px; font-size: 16px; }
.docs-main h2 { font-size: 24px; font-weight: 720; margin: 54px 0 12px; padding-top: 14px; border-top: 1px solid var(--border); letter-spacing: -0.01em; scroll-margin-top: 80px; }
.docs-main h3 { font-size: 17.5px; font-weight: 680; margin: 28px 0 8px; scroll-margin-top: 80px; }
.docs-main p, .docs-main li { color: var(--muted); font-size: 15px; }
.docs-main p b, .docs-main li b { color: var(--fg); }
.docs-main ul, .docs-main ol { padding-left: 22px; margin: 10px 0; }
.docs-main li { margin: 5px 0; }
.docs-main code { color: var(--fg); background: var(--surface); padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border); font-size: .88em; }
.docs-main pre {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; overflow-x: auto; margin: 14px 0; font-size: 13px; line-height: 1.6;
}
.docs-main pre code { background: none; border: none; padding: 0; color: var(--fg); }
.docs-main pre .c { color: var(--muted); }       /* comment */
.docs-main pre .k { color: var(--accent2); }      /* key / flag */
.docs-main pre .s { color: var(--mark-green); }   /* string */
.docs-main pre .p { color: var(--accent); }       /* prompt */
.docs-main table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.docs-main th { text-align: left; color: var(--fg); font-weight: 650; border-bottom: 1px solid var(--border); padding: 8px 10px; }
.docs-main td { border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); padding: 8px 10px; color: var(--muted); vertical-align: top; }
.docs-main td code { white-space: nowrap; }
.docs-main .callout {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 12px; padding: 14px 18px; margin: 16px 0; font-size: 14.5px; color: var(--muted);
}
.docs-main .callout b { color: var(--fg); }

/* use-case cards */
.uc { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-top: 18px; }
.uc h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.uc h3 .em { margin-right: 8px; }
.uc p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.uc pre {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.65; margin: 0;
}
.uc pre .p { color: var(--accent); }
.uc pre .a { color: var(--accent2); }
.uc pre .ab { color: var(--accent); font-weight: 700; }
.uc pre .d { color: var(--muted); }
.uc pre .g { color: var(--mark-green); }
.uc pre .w { color: var(--warn); }
.uc pre .e { color: var(--error); }
.uc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.uc-grid .uc { margin-top: 0; }

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  .feature, .feature.flip { grid-template-columns: 1fr; gap: 22px; }
  .feature.flip .feature-copy { order: 1; }
  .feature.flip .feature-demo { order: 2; }
  .stats-inner { grid-template-columns: repeat(3, 1fr); row-gap: 20px; }
  .cards.c3, .cards.c4 { grid-template-columns: 1fr 1fr; }
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px 10px; }
  .docs-nav b { width: 100%; }
  .uc-grid { grid-template-columns: 1fr; }
  .perf { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 16px 24px; align-items: flex-start; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .cards.c3, .cards.c4 { grid-template-columns: 1fr; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); }
}


/* ============================================================================
   The story layout — one pinned terminal stage, chapters scroll beside it.
   ========================================================================== */

/* asymmetric hero */
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 54px; align-items: center; text-align: left;
}
.hero-grid h1 { font-size: clamp(34px, 4.6vw, 54px); }
.hero-grid .sub { margin: 18px 0 0; font-size: 17.5px; }
.hero-ctas.left { justify-content: flex-start; }
.hero-static { position: relative; }
.hero-static .term { transform: perspective(1400px) rotateY(-4deg) rotateX(1.5deg); }
.hero-static::after {
  content: ""; position: absolute; inset: 12% -6% -8%;
  background: radial-gradient(closest-side, rgba(10,132,255,.14), transparent 72%);
  z-index: -1;
}

/* chapter-local controls (theme chips, ai pills) */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.mini-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  cursor: pointer; transition: all .2s ease;
}
.mini-chip:hover { color: var(--fg); border-color: color-mix(in srgb, var(--chip, var(--accent)) 60%, var(--border)); }
.mini-chip.active { color: var(--fg); border-color: var(--chip, var(--accent)); box-shadow: 0 0 0 1px var(--chip, var(--accent)); }
.mini-chip .theme-dot { width: 10px; height: 10px; }

/* quiet stats (no counters) */
.quiet-stats { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 26px; font-size: 13.5px; color: var(--muted); }
.quiet-stats b { color: var(--fg); font-family: var(--mono); font-weight: 700; }
.quiet-stats span { white-space: nowrap; }

/* "more features" compact rows */
.more { border-top: 1px solid var(--border); }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 26px; }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-static .term { transform: none; }
  .more-grid { grid-template-columns: 1fr; }
}


/* ============================================================================
   The feature explorer — the navigation IS a command palette, mirroring the
   product ("everything is a terminal command"). Entirely click-driven.
   ========================================================================== */
.explorer { padding: 40px 0 30px; }
.explorer-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  margin-top: 30px;
}

/* the palette — styled after the app's own ⌘P switcher */
.palette {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 22px 60px -28px rgba(0,0,0,.7);
  position: sticky; top: 84px;
}
.palette-search {
  font-family: var(--mono); font-size: 13px;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg);
  user-select: none;
}
.palette-search .p { color: var(--accent); }
.pal-group {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted);
  padding: 12px 16px 4px;
  user-select: none;
}
.pal-row {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 7px 10px; margin: 1px 6px; width: calc(100% - 12px);
  border-radius: 8px;
  font-size: 13px; color: var(--muted);
  transition: background .18s ease, color .18s ease;
}
.pal-row:hover { background: var(--hover); color: var(--fg); }
.pal-row.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--fg);
}
.pal-row .pal-cmd { font-family: var(--mono); font-weight: 700; color: var(--accent2); white-space: nowrap; }
.pal-row.active .pal-cmd { color: var(--accent2); }
.pal-row .pal-desc { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-foot {
  padding: 10px 16px 12px; border-top: 1px solid var(--bg);
  font-size: 11.5px; color: var(--muted); font-family: var(--mono);
  display: flex; justify-content: space-between; align-items: center;
}
#stage-replay {
  background: none; border: 1px solid var(--border); color: var(--muted);
  font: 11.5px var(--mono); padding: 4px 12px; border-radius: 999px; cursor: pointer;
  transition: all .2s ease;
}
#stage-replay:hover { color: var(--fg); border-color: var(--accent); }

/* the stage + its caption */
#stage { position: relative; }
#stage::before {
  content: ""; position: absolute; inset: 10% -6% -8%;
  background: radial-gradient(closest-side, rgba(10,132,255,.10), transparent 74%);
  z-index: 0; pointer-events: none;
}
.stage-term { position: relative; z-index: 1; opacity: 0; }
.stage-term.in { opacity: 1; transition: opacity .4s ease; }
.stage-caption { margin-top: 18px; min-height: 92px; }
.stage-caption h4 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.stage-caption h4 .fx { font-family: var(--mono); color: var(--accent2); }
.stage-caption p { color: var(--muted); font-size: 14px; margin-top: 5px; max-width: 640px; }
.stage-caption p code, .stage-caption p kbd { color: var(--fg); background: var(--surface); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); font-size: .9em; }
.stage-caption .chip-row { margin-top: 12px; }

@media (max-width: 960px) {
  .explorer-grid { grid-template-columns: 1fr; }
  .palette { position: static; }
  .pal-row .pal-desc { white-space: normal; }
}
