/* ==========================================================================
   Dalaran — design system
   Pure black canvas, neutral grey scale, system sans for prose,
   JetBrains Mono for all UI chrome. Near-square corners. Spectrum accent.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */

:root {
  /* Neutral scale */
  --bg:        #000000;
  --panel:     #171717;
  --panel-2:   #0a0a0a;
  --elev:      #1c1c1c;
  --border:    #262626;
  --border-2:  #333333;
  --text:      #fafafa;
  --muted:     #a1a1a1;
  --muted-2:   #737373;

  /* Spectrum — the signature graphic */
  --spec: linear-gradient(90deg,
    #ff3b30 0%, #ff9500 16%, #ffd60a 32%,
    #34c759 50%, #32d0e0 66%, #3b82f6 83%, #a855f7 100%);
  --spec-soft: linear-gradient(90deg,
    rgba(255,59,48,.55), rgba(255,149,0,.55), rgba(255,214,10,.55),
    rgba(52,199,89,.55), rgba(50,208,224,.55), rgba(59,130,246,.55), rgba(168,85,247,.55));

  /* Type */
  --sans: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
          Consolas, "Liberation Mono", monospace;

  /* Shape */
  --r:      2px;
  --r-md:   3px;
  --r-pill: 999px;

  --gutter: clamp(20px, 4vw, 40px);
  --maxw:   1320px;
  --nav-h:  56px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Light theme — inverted neutral scale, same structure. */
[data-theme="light"] {
  --bg:        #ffffff;
  --panel:     #f5f5f5;
  --panel-2:   #fafafa;
  --elev:      #ededed;
  --border:    #e5e5e5;
  --border-2:  #d4d4d4;
  --text:      #0a0a0a;
  --muted:     #525252;
  --muted-2:   #737373;
}

/* ---------- 2. Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.nav-open { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }

::selection { background: var(--text); color: var(--bg); }

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- 3. Typography ---------- */

h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--text); font-weight: 450; }

/* Display — system sans, tight, near-normal weight. */
.display {
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 1.0;
  letter-spacing: -0.01em;
  font-weight: 450;
  text-wrap: balance;
}
.h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-weight: 450;
  text-wrap: balance;
}
.h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-weight: 450;
  text-wrap: balance;
}
.h3 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.005em; }

/* Mono headline — the signature card/section title. */
.h-mono {
  font-family: var(--mono);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.33;
  letter-spacing: 0.0125em;
  text-transform: uppercase;
  color: var(--text);
}
.h-mono-sm { font-size: 0.95rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: 1.1875rem;
  line-height: 1.5;
  color: var(--text);
  max-width: 630px;
  text-wrap: pretty;
}
.lede-muted { color: var(--muted); }

.muted { color: var(--muted); }
.bright { color: var(--text); }

.mono { font-family: var(--mono); font-size: 0.9em; }

/* Small grey sans label that sits above a heading. */
.eyebrow {
  display: block;
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Mono uppercase section label. */
.label {
  display: block;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.spec-text {
  background: var(--spec);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Two-tone heading: grey lead-in, white payload. */
.two-tone { color: var(--muted-2); }
.two-tone b { color: var(--text); font-weight: inherit; }

/* ---------- 4. Layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { max-width: 820px; }
.wrap-mid { max-width: 1040px; }

.section { padding-block: clamp(64px, 8vw, 120px); }
.section-tight { padding-block: clamp(40px, 5vw, 72px); }

/* Alternating panel — the only background shift on the site. */
.panel { background: var(--panel); }

.section-head { max-width: 720px; margin-bottom: clamp(36px, 4vw, 56px); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head .lede { margin-top: 16px; }
.section-head.center .lede { margin-inline: auto; }

.grid { display: grid; gap: 28px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-center { justify-content: center; }
.stack-sm > * + * { margin-top: 8px; }

@media (max-width: 1000px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .split.reverse > *:first-child { order: 2; }
}
@media (max-width: 640px) {
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
}

/* ---------- 5. Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: var(--text);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-weight: 450;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s, opacity 0.16s;
}
.btn:hover { opacity: 0.85; }
.btn svg { width: 15px; height: 15px; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-2);
}
.btn-outline:hover { opacity: 1; background: var(--elev); border-color: var(--muted-2); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { opacity: 1; background: var(--elev); }

/* Spectrum-filled CTA. */
.btn-spec {
  position: relative;
  background: var(--spec);
  color: #000;
  font-weight: 500;
  border: 0;
}
.btn-spec:hover { opacity: 1; filter: brightness(1.12); }

.btn-lg { height: 44px; padding: 0 20px; font-size: 1rem; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 0.8125rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.875rem;
  text-transform: uppercase;
}
.link-arrow::after { content: "→"; transition: transform 0.2s var(--ease); }
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- 6. Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #34c759;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag-accent { color: var(--text); border-color: var(--muted-2); }

/* ---------- 7. Feature columns ---------- */

/* Borderless text column — the primary feature pattern. */
.feat .eyebrow { margin-bottom: 8px; }
.feat h3 { margin-bottom: 12px; }
.feat p { color: var(--muted); }

/* Spectrum thumbnail that heads a feature. */
.feat-thumb {
  aspect-ratio: 16 / 10;
  margin-bottom: 18px;
  border-radius: var(--r-md);
  background: var(--spec);
  position: relative;
  overflow: hidden;
}
.feat-thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.feat-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.feat-row .feat-thumb { aspect-ratio: 1; margin-bottom: 0; }
@media (max-width: 640px) { .feat-row { grid-template-columns: 1fr; } }

/* Bordered card, used sparingly. */
.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  transition: border-color 0.2s, background 0.2s;
}
.card:hover { border-color: var(--border-2); }
.card p { color: var(--muted); }
.card h3 { margin-bottom: 10px; }

.card-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  margin-bottom: 16px;
}
.card-icon svg { width: 17px; height: 17px; }

.ticks { list-style: none; margin: 0; padding: 0; }
.ticks li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 9px;
  color: var(--muted);
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.5em;
  width: 10px; height: 6px;
  border-left: 1.5px solid var(--text);
  border-bottom: 1.5px solid var(--text);
  transform: rotate(-45deg);
}

/* ---------- 8. Header ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.header.scrolled { border-bottom-color: var(--border); }
.header .wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 1600px;
}

/* Wordmark — lowercase, tight, heavy. */
.logo {
  display: inline-flex;
  align-items: baseline;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--text);
  margin-right: 22px;
}

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 0.9375rem;
  color: var(--muted);
  transition: color 0.15s;
}
.nav a:hover, .nav a.active { color: var(--text); }
.nav .caret { width: 10px; height: 10px; opacity: 0.7; }

/* Dropdown */
.nav-item { position: relative; }
.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-trigger:hover, .nav-trigger.active { color: var(--text); }
.nav-trigger .caret { width: 11px; height: 11px; opacity: 0.65; transition: transform 0.2s var(--ease); }
.nav-item.open .nav-trigger { color: var(--text); }
.nav-item.open .nav-trigger .caret { transform: rotate(180deg); }

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 292px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.16s, transform 0.16s var(--ease), visibility 0.16s;
  z-index: 90;
}
.nav-item.open .nav-menu { opacity: 1; visibility: visible; transform: none; }
.nav-menu a {
  display: block;
  padding: 9px 11px;
  border-radius: var(--r);
  color: var(--muted);
}
.nav-menu a:hover { background: var(--elev); }
.nav-menu a b {
  display: block;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 2px;
}
.nav-menu a span { font-size: 0.82rem; color: var(--muted-2); }

.nav-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* Search field in the nav. */
.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin-left: 10px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--muted-2);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.nav-search:hover { border-color: var(--border-2); }
.nav-search svg { width: 14px; height: 14px; }
.nav-search kbd {
  margin-left: 10px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.6875rem;
}

.nav-toggle { display: none; }

@media (max-width: 1120px) {
  .nav, .nav-search { display: none; }
  .nav-toggle { display: grid; }
}

.drawer {
  position: fixed;
  inset: var(--nav-h) 0 0;
  z-index: 79;
  background: var(--bg);
  padding: 16px var(--gutter) 40px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.drawer.open { opacity: 1; visibility: visible; }
.drawer a {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
  color: var(--text);
}
.drawer .btn { width: 100%; margin-top: 20px; }

/* ---------- 9. Hero ---------- */

.hero {
  position: relative;
  padding-top: clamp(56px, 8vw, 110px);
  padding-bottom: clamp(48px, 6vw, 90px);
  overflow: hidden;
}
.hero-inner { position: relative; text-align: center; z-index: 2; }
.hero .lede { margin: 22px auto 0; }
.hero .row { margin-top: 30px; }

/* Spectrum ribbon sweeping in from the right. */
/* Full-bleed stage: ribbons converge on the device and run off the right edge. */
.hero-stage {
  position: relative;
  width: 100%;
  height: clamp(300px, 40vw, 540px);
  margin-top: clamp(18px, 3vw, 44px);
}
.hero-stage > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.hero-device {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  height: 82%;
  width: auto;
  z-index: 2;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.9));
}
@media (max-width: 760px) {
  .hero-stage { height: clamp(260px, 62vw, 340px); }
  .hero-device { height: 74%; }
}

/* ---------- 10. Viewer frame ---------- */

.viewer {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  overflow: hidden;
}
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.viewer-dots { display: flex; gap: 6px; }
.viewer-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-2); }
.viewer-title { font-family: var(--mono); font-size: 0.72rem; color: var(--muted-2); }
.viewer-chips { margin-left: auto; display: flex; gap: 5px; }
.viewer-chips span {
  font-family: var(--mono);
  font-size: 0.64rem;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted-2);
}
.viewer-body {
  display: grid;
  grid-template-columns: 168px 1fr 184px;
  min-height: 380px;
}
.viewer-pane {
  padding: 12px;
  font-family: var(--mono);
  font-size: 0.69rem;
  color: var(--muted-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.viewer-pane:last-child { border-right: 0; border-left: 1px solid var(--border); }
.viewer-pane h5 {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { padding: 3px 5px; border-radius: 2px; white-space: nowrap; }
.tree li:hover { background: var(--elev); color: var(--muted); }
.tree li.on { color: var(--text); background: var(--elev); }
.tree .in-1 { padding-left: 16px; }
.tree .in-2 { padding-left: 30px; }

.viewer-canvas { position: relative; background: #000; min-height: 380px; }
.viewer-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewer-hud {
  position: absolute;
  left: 12px; bottom: 10px;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted-2);
  display: flex;
  gap: 13px;
}
.viewer-hud b { color: var(--text); font-weight: 450; }

.meter { margin-bottom: 12px; }
.meter-label { display: flex; justify-content: space-between; margin-bottom: 4px; color: var(--muted); }
.meter-track { height: 3px; border-radius: 2px; background: var(--elev); overflow: hidden; }
.meter-fill { height: 100%; background: var(--spec); background-size: 300% 100%; transition: width 0.4s var(--ease); }

.timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted-2);
}
.timeline-track {
  position: relative;
  flex: 1;
  height: 20px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--border) 0 1px, transparent 1px 24px);
  overflow: hidden;
}
.timeline-fill { position: absolute; inset: 0 auto 0 0; background: var(--elev); }
.timeline-head { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); }

@media (max-width: 900px) {
  .viewer-body { grid-template-columns: 1fr; min-height: 300px; }
  .viewer-pane { display: none; }
  .viewer-canvas { min-height: 300px; }
}

/* ---------- 11. Marquee ---------- */

.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; width: max-content; gap: 54px; animation: slide 46s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--muted-2);
  white-space: nowrap;
  transition: color 0.2s;
}
.marquee-track span:hover { color: var(--text); }
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- 12. Code ---------- */

.code {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 7px;
  border-bottom: 1px solid var(--border);
}
.code-tab {
  padding: 4px 10px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.code-tab:hover { color: var(--muted); }
.code-tab[aria-selected="true"] { color: var(--text); background: var(--elev); }
.code-copy {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: transparent;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.code-copy:hover { color: var(--text); border-color: var(--border-2); }
.code-copy.done { color: #34c759; border-color: #34c759; }

.code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #d4d4d4;
  tab-size: 2;
}
.code pre[hidden] { display: none; }

.tok-kw  { color: #c4a6ff; }
.tok-str { color: #7ee0b8; }
.tok-num { color: #ffd60a; }
.tok-com { color: #6b6b6b; }
.tok-fn  { color: #7cc4ff; }
.tok-dec { color: #ff9ec4; }

.install {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.install .prompt { color: var(--muted-2); }
.install button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r);
  background: var(--elev);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.install button:hover { color: var(--text); background: var(--border); }

/* ---------- 13. Stats ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.stat b {
  display: block;
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  font-weight: 450;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-2);
}
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 14. Steps ---------- */

.steps { counter-reset: s; display: grid; gap: 0; }
.step {
  counter-increment: s;
  position: relative;
  padding: 22px 0 22px 62px;
  border-bottom: 1px solid var(--border);
}
.step:first-child { border-top: 1px solid var(--border); }
.step::before {
  content: counter(s, decimal-leading-zero);
  position: absolute;
  left: 0; top: 22px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted-2);
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--muted); }

/* ---------- 15. Accordion ---------- */

.acc { border-top: 1px solid var(--border); }
.acc-item { border-bottom: 1px solid var(--border); }
.acc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.acc-btn:hover { color: var(--muted); }
.acc-btn i { flex: none; width: 14px; height: 14px; position: relative; }
.acc-btn i::before, .acc-btn i::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s var(--ease);
}
.acc-btn i::after { transform: rotate(90deg); }
.acc-btn[aria-expanded="true"] i::after { transform: rotate(0); }
.acc-panel { overflow: hidden; height: 0; transition: height 0.3s var(--ease); }
.acc-panel > div { padding: 0 0 22px; color: var(--muted); max-width: 74ch; }

/* ---------- 16. Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
td { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
td.check { color: var(--text); }
td.no { color: var(--muted-2); }

/* ---------- 17. Docs ---------- */

.docs {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 196px;
  gap: 44px;
  align-items: start;
  padding-block: 44px 100px;
}
.docs-side {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  max-height: calc(100vh - var(--nav-h) - 40px);
  overflow-y: auto;
  font-size: 0.875rem;
}
.docs-side h5 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 22px 0 8px;
}
.docs-side h5:first-child { margin-top: 0; }
.docs-side a {
  display: block;
  padding: 5px 9px;
  border-radius: var(--r);
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.docs-side a:hover { color: var(--text); background: var(--panel-2); }
.docs-side a.active { color: var(--text); background: var(--elev); }

.docs-main { min-width: 0; }
.docs-main h2 { margin-top: 48px; scroll-margin-top: 90px; }
.docs-main h3 { margin-top: 30px; scroll-margin-top: 90px; }
.docs-main > h2:first-of-type { margin-top: 32px; }
.docs-main p, .docs-main ul { color: var(--muted); }
.docs-main ul { padding-left: 20px; }
.docs-main li { margin-bottom: 6px; }
.docs-main .code { margin: 18px 0; }
.docs-main :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
}

.docs-toc { position: sticky; top: calc(var(--nav-h) + 20px); font-size: 0.82rem; }
.docs-toc h5 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 10px;
}
.docs-toc a { display: block; padding: 4px 0; color: var(--muted-2); }
.docs-toc a:hover, .docs-toc a.active { color: var(--text); }

.callout {
  padding: 15px 17px;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-left: 2px solid var(--text);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--muted);
}
.callout b { color: var(--text); font-weight: 500; }

@media (max-width: 1160px) { .docs { grid-template-columns: 210px minmax(0, 1fr); } .docs-toc { display: none; } }
@media (max-width: 860px) { .docs { grid-template-columns: 1fr; gap: 24px; } .docs-side { position: static; max-height: none; } }

/* ---------- 17b. Video embed ---------- */

/* Crops a strip off the top of an embedded player: the iframe is grown by --crop
   and pulled up by the same amount, so the container still holds a clean 16:9 box
   while the top --crop pixels of the video fall outside it. */
.video-crop {
  --crop: 32px;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #000;
}
.video-crop iframe {
  position: absolute;
  top: calc(var(--crop) * -1);
  left: 0;
  width: 100%;
  height: calc(100% + var(--crop));
  border: 0;
  display: block;
}

/* Vertical (phone-shot) video. Aspect is pinned to the source so nothing letterboxes. */
.video-vert {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 864 / 1908;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #000;
}
.video-vert video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-vert-wrap { display: flex; justify-content: center; }
@media (max-width: 1000px) { .video-vert { max-width: 260px; } }

/* Screenshot with a strip trimmed off the top. Same idea as .video-crop, but for a
   natural-height image: pull it up by --crop and let the container clip it. */
.shot-crop {
  --crop: 64px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #000;
  align-self: start;
}
.shot-crop img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: calc(var(--crop) * -1);
}

/* Vertical clip beside a wide capture. */
.field-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  .field-grid { grid-template-columns: 1fr; justify-items: center; }
}

.example-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---------- 18. Posts ---------- */

.post-card { display: flex; flex-direction: column; height: 100%; }
.post-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  margin-bottom: 16px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--spec);
}
.post-thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.post-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.post-card h3 { margin-bottom: 8px; }
.post-card p { color: var(--muted); flex: 1; }
.post-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted-2);
}
.avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.62rem;
  font-weight: 600;
  color: #000;
  background: var(--spec);
}

.post-featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 4vw, 56px); align-items: center; }
.post-featured .post-thumb { aspect-ratio: 4 / 3; margin-bottom: 0; }
@media (max-width: 900px) { .post-featured { grid-template-columns: 1fr; } }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 30px; }
.filter {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.filter:hover { color: var(--text); border-color: var(--border-2); }
.filter.on { color: var(--bg); background: var(--text); border-color: var(--text); }

/* ---------- 18b. Article ---------- */

.post-wrap { max-width: 720px; margin-inline: auto; }

.post-head { padding-block: clamp(32px, 5vw, 64px) clamp(24px, 3vw, 36px); }
.post-head h1 { margin: 14px 0 0; }
.post-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  font-size: 0.9rem;
  color: var(--muted-2);
}
.post-byline .avatar { width: 26px; height: 26px; font-size: 0.7rem; }
.post-byline b { color: var(--text); font-weight: 450; }

.post-hero {
  position: relative;
  aspect-ratio: 21 / 9;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--spec);
  margin-bottom: clamp(28px, 4vw, 44px);
}
.post-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.post-body { font-size: 1.0625rem; line-height: 1.7; color: var(--muted); }
.post-body > p { margin-bottom: 1.25em; }
.post-body h2 {
  margin: 2em 0 0.6em;
  font-size: 1.5rem;
  line-height: 1.25;
  scroll-margin-top: 90px;
}
.post-body h3 { margin: 1.6em 0 0.5em; font-size: 1.15rem; }
.post-body ul, .post-body ol { padding-left: 22px; margin-bottom: 1.25em; }
.post-body li { margin-bottom: 0.5em; }
.post-body strong, .post-body b { color: var(--text); font-weight: 500; }
.post-body a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.post-body .code { margin: 1.5em 0; }
.post-body :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
}
.post-body blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--border-2);
  color: var(--muted);
}
.post-body hr { margin: 2.2em 0; }

.post-foot-nav {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

/* ---------- 19. Jobs ---------- */

.job {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.2s var(--ease);
}
.job:first-child { border-top: 1px solid var(--border); }
.job:hover { padding-left: 8px; }
.job-title { color: var(--text); font-size: 1.02rem; }
.job-meta { font-size: 0.85rem; color: var(--muted-2); margin-top: 3px; }
.job .link-arrow { margin-left: auto; }
@media (max-width: 640px) { .job { flex-wrap: wrap; } .job .link-arrow { margin-left: 0; } }

/* ---------- 20. Pricing ---------- */

.plan {
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  height: 100%;
}
.plan.featured { border-color: var(--muted-2); }
.plan-price { display: flex; align-items: baseline; gap: 6px; margin: 16px 0 4px; }
.plan-price b { font-size: 2.3rem; font-weight: 450; letter-spacing: -0.02em; color: var(--text); }
.plan-price span { color: var(--muted-2); font-size: 0.88rem; }
.plan .ticks { margin: 20px 0; flex: 1; }
.plan .btn { width: 100%; }

/* ---------- 21. CTA ---------- */

.cta { text-align: center; }
.cta .lede { margin-inline: auto; }

/* Spectrum rule — a thin brand divider. */
.spec-rule { height: 2px; border: 0; background: var(--spec); }

/* ---------- 22. Footer ---------- */

.footer { border-top: 1px solid var(--border); padding-block: 56px 30px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 36px 26px; }
.footer-brand p { color: var(--muted-2); max-width: 30ch; margin-top: 12px; }
.footer h6 {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 9px; }
.footer li a { font-size: 0.9rem; color: var(--muted); transition: color 0.15s; }
.footer li a:hover { color: var(--text); }
.footer-bot {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted-2);
}
.footer-bot .socials { margin-left: auto; display: flex; gap: 4px; }
@media (max-width: 940px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- 23. Forms ---------- */

.field {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
}
.field:focus { outline: none; border-color: var(--muted-2); }
textarea.field { height: auto; padding: 10px 12px; resize: vertical; }

/* ---------- 24. Reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 25. Utilities ---------- */

.center { text-align: center; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 46px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.full { width: 100%; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  top: -60px; left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--r);
  background: var(--text);
  color: var(--bg);
  transition: top 0.2s;
}
.skip:focus { top: 12px; }
