/* magpie feature tour: editorial layout over the app's Midnight Frost palette */

/* Self-hosted so the page renders on networks that can't reach Google's CDN.
   swap = text paints in the fallback immediately, then upgrades. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/Inter-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/Inter-500-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/Inter-600-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/Inter-700-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/JetBrainsMono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/JetBrainsMono-500-latin.woff2") format("woff2");
}

:root {
  --bg: #0a0c12;
  --bg-lift: #0f121b;
  --panel: #12161f;
  --line: #1e2331;
  --line-soft: #171b26;
  --text: #edeff4;
  --dim: #9aa2b5;
  --faint: #666e83;
  --accent: #f0a832;
  --accent-soft: rgba(240, 168, 50, 0.12);
  --r: 16px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* a whisper of texture so the flat dark doesn't read as cheap */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: inherit;
}

kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-lift);
  color: var(--dim);
}

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.top.scrolled {
  border-bottom-color: var(--line);
}
.brand {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.brand .dot {
  color: var(--accent);
}
.top nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  padding: 6px 12px;
  font-size: 14px;
  color: var(--dim);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover {
  color: var(--text);
  background: var(--line-soft);
}
.star-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.star-btn:hover {
  color: var(--text);
  border-color: var(--faint);
}
.star-btn svg {
  color: var(--accent);
}
#star-count {
  font-family: var(--mono);
  font-size: 12.5px;
}

.lang-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 12px;
  margin-left: 4px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.lang-btn:hover {
  color: var(--text);
  border-color: var(--faint);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 24px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-lift);
  font-size: 15px;
  font-weight: 550;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--faint);
}
.btn.small {
  padding: 7px 16px;
  font-size: 13.5px;
  border-radius: 8px;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1204;
  font-weight: 600;
  box-shadow: 0 8px 30px -10px rgba(240, 168, 50, 0.55);
}
.btn.primary:hover {
  filter: brightness(1.07);
  border-color: var(--accent);
}
.btn.ghost {
  background: transparent;
}

/* ---------- layout ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px 100px;
}

/* the sticky header would otherwise sit on top of whatever you jumped to */
.chapter,
.row {
  scroll-margin-top: 92px;
}

/* ---------- chapter rail ---------- */
.rail {
  position: fixed;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  width: 178px;
  max-height: 78vh;
  overflow-y: auto;
  scrollbar-width: none;
  transition: opacity 0.3s ease;
}
.rail::-webkit-scrollbar {
  display: none;
}
.rail.dim {
  opacity: 0.42;
}
.rail-chapter {
  border-left: 2px solid var(--line);
  padding: 3px 0 3px 14px;
  transition: border-color 0.25s ease;
}
.rail-chapter.active {
  border-left-color: var(--accent);
}
.rail-link {
  display: block;
  padding: 5px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--faint);
  text-decoration: none;
  transition: color 0.2s ease;
}
.rail-link:hover {
  color: var(--text);
}
.rail-chapter.active .rail-link {
  color: var(--text);
  font-weight: 550;
}
.rail-num {
  display: inline-block;
  min-width: 22px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}
.rail-chapter.active .rail-num {
  color: var(--accent);
}
/* Only the chapter you're in unfolds; 23 links at once would out-weigh the
   page. max-height rather than the 0fr→1fr grid trick: min-height:0 on the
   child (which the trick needs to collapse) also zeroes the track's auto
   minimum, so 1fr resolves to 0 in a container with no definite height.
   The cap only has to clear the longest chapter (6 links). */
.rail-subs {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.32s ease, opacity 0.25s ease;
}
.rail-chapter.active .rail-subs {
  max-height: 320px;
  opacity: 1;
}
.rail-sub {
  display: block;
  padding: 3px 0 3px 22px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--faint);
  text-decoration: none;
  transition: color 0.15s ease;
}
.rail-sub:hover {
  color: var(--text);
}

/* The rail is fixed to the left edge, so it needs the content column out of
   its way rather than a viewport wide enough to ignore it. Three tiers:
   wide enough to keep the column centred, narrow enough that the column
   has to shift right, and too narrow for both. */
.rail {
  display: none;
}
@media (min-width: 1100px) {
  .rail {
    display: block;
  }
}
/* the left gutter can't hold the rail yet, so the column stops centring */
@media (min-width: 1100px) and (max-width: 1699px) {
  .rail {
    left: 20px;
    width: 156px;
  }
  main {
    margin-left: 196px;
    margin-right: 20px;
  }
  .rail-link {
    font-size: 12.5px;
  }
  .rail-sub {
    font-size: 11.5px;
    padding-left: 18px;
  }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 110px 0 0;
}
.hero::before {
  /* amber aurora behind the headline */
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  width: 900px;
  height: 620px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    rgba(240, 168, 50, 0.13) 0%,
    rgba(240, 168, 50, 0.04) 38%,
    transparent 68%
  );
  pointer-events: none;
  filter: blur(8px);
}
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(240, 168, 50, 0.22);
  border-radius: 100px;
  padding: 5px 14px;
  margin-bottom: 28px;
}
.hero h1 {
  position: relative;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 700;
  margin: 0 0 24px;
  background: linear-gradient(180deg, #ffffff 30%, #b9c0d2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  position: relative;
  max-width: 620px;
  margin: 0 auto 36px;
  color: var(--dim);
  font-size: 18px;
  line-height: 1.6;
}
.cta {
  position: relative;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.meta {
  position: relative;
  margin: 18px 0 0;
  color: var(--faint);
  font-size: 13px;
  font-family: var(--mono);
}

.stage {
  position: relative;
  margin: 64px 0 0;
  padding: 0;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #000;
}
.stage video {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 80px 0 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.stats div {
  background: var(--bg-lift);
  padding: 26px 20px;
  text-align: center;
}
.stats b {
  display: block;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-family: var(--mono);
  color: var(--text);
}
.stats span {
  font-size: 13px;
  color: var(--faint);
}

/* ---------- chapters ---------- */
.chapter {
  margin-top: 140px;
}
.chapter-head {
  max-width: 640px;
  margin-bottom: 56px;
}
.chapter-head .num {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.14em;
  margin-bottom: 14px;
}
.chapter-head h2 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 650;
  margin: 0 0 12px;
}
.chapter-head p {
  margin: 0;
  color: var(--dim);
  font-size: 17px;
}

/* alternating feature rows: text one side, screenshot the other */
.rows {
  display: flex;
  flex-direction: column;
  gap: 96px;
}
.row {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 56px;
  align-items: center;
}
.row:nth-child(even) .row-copy {
  order: 2;
}
.row-copy h3 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 12px;
}
.row-copy p {
  margin: 0;
  color: var(--dim);
  font-size: 16px;
  line-height: 1.65;
}
.row-copy .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}

.shot {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s ease;
}
.shot::after {
  /* soft top highlight, like light falling on glass */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 42%);
  pointer-events: none;
}
.row:hover .shot {
  transform: translateY(-4px);
  border-color: #2a3145;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
}
/* a terminal transcript in the screenshot's slot (site.js visualOf) */
.shot .term {
  margin: 0;
  padding: 26px 28px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--dim);
  white-space: pre-wrap;
  word-break: break-all;
}
.shot .term .p {
  color: var(--accent);
  font-weight: 600;
}
.shot .term .ok {
  color: #7fd9a3;
}

/* scroll-in */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- the rest: compact two-column definition list ---------- */
.rest {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 4px 48px;
  margin: 0;
}
.rest-item {
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
}
.rest dt {
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 5px;
}
.rest dd {
  margin: 0;
  color: var(--dim);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ---------- privacy ---------- */
.privacy .claims {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}
.privacy .claims li {
  position: relative;
  background: linear-gradient(180deg, var(--bg-lift), var(--bg));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px 22px 26px;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.6;
}
.privacy .claims li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
}
.privacy .claims b {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}

/* ---------- closing ---------- */
/* star history */
.starchart {
  margin-top: 130px;
  padding: 26px 28px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}
.sc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.sc-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sc-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.sc-link:hover {
  text-decoration: underline;
}
.sc-plot svg {
  display: block;
  width: 100%;
  height: auto;
}
.sc-axis {
  display: flex;
  justify-content: space-between;
  font: 500 12px var(--mono);
  color: var(--faint);
  margin-top: -4px;
}

.closing {
  position: relative;
  margin-top: 150px;
  padding: 90px 32px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: radial-gradient(
      ellipse at 50% 0%,
      rgba(240, 168, 50, 0.1) 0%,
      transparent 60%
    ),
    var(--bg-lift);
}
.closing h2 {
  font-size: clamp(26px, 3.8vw, 40px);
  letter-spacing: -0.035em;
  font-weight: 650;
  margin: 0 0 30px;
}

footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 30px 32px 44px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 13.5px;
}
footer a {
  color: var(--dim);
  text-decoration: none;
}
footer a:hover {
  color: var(--text);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .row,
  .row:nth-child(even) .row-copy {
    grid-template-columns: 1fr;
    order: unset;
    gap: 24px;
  }
  .rows {
    gap: 64px;
  }
  .chapter {
    margin-top: 96px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  main {
    padding: 0 20px 72px;
  }
  .hero {
    padding-top: 72px;
  }
  .privacy .claims {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .row:hover .shot {
    transform: none;
  }
}
