/* ============================================================
   Cuck Code — site styles.
   References ONLY the design tokens in css/tokens.css.
   ============================================================ */

/* ---------- reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg-0);
  min-height: 100vh;
  transition: background-color var(--speed) var(--ease), color var(--speed) var(--ease);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 700;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.container {
  width: min(var(--max-width), 100% - var(--space-6) * 2);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -48px;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transition: top var(--speed) var(--ease);
}

.skip-link:focus {
  top: var(--space-3);
  color: var(--on-accent);
}

/* ---------- top navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-0);
  transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.nav-inner {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 800; /* wordmark weight (heavy, as in the app) */
  font-size: var(--text-lg);
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--text-1);
}

/* the eye: corners are the code tags < >, the iris is the red thread */
.brand-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-mark .eye {
  stroke: var(--text-1);
}

.brand-mark .iris {
  fill: var(--thread);
}

/* the wordmark: "Cuck" in ink, "CODE" in the thread.
   a tight line-height of its own: on narrow portrait phones "Cuck"
   and "CODE" wrap onto two rows, and the inherited body line-height
   (1.6) left a dead gap between them and a block taller than the nav
   bar. 1.15 keeps the rows close and the lockup inside the bar. */
.brand-word {
  line-height: 1.15;
}

.brand-word .code {
  color: var(--thread);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-4);
  list-style: none;
}

.nav-links a {
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color var(--speed) var(--ease), background-color var(--speed) var(--ease);
}

.nav-links a:hover {
  color: var(--text-1);
  background: var(--bg-3);
}

.nav-links a.active {
  color: var(--thread);
  background: var(--bg-3);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* language switcher */
.lang-switch {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-full);
  padding: 3px;
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color var(--speed) var(--ease), background-color var(--speed) var(--ease);
}

.lang-switch button:hover {
  color: var(--text-1);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* theme toggle */
.theme-toggle {
  appearance: none;
  border: 1px solid var(--border-0);
  background: var(--bg-2);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--speed) var(--ease), border-color var(--speed) var(--ease),
    background-color var(--speed) var(--ease);
}

.theme-toggle:hover {
  color: var(--text-1);
  border-color: var(--border-1);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

/* mobile menu button */
.nav-burger {
  appearance: none;
  display: none;
  border: 1px solid var(--border-0);
  background: var(--bg-2);
  color: var(--text-1);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  place-items: center;
}

.nav-burger svg {
  width: 18px;
  height: 18px;
}

/* dim backdrop behind the open mobile menu (shown in the phone breakpoint) */
.nav-backdrop {
  display: none;
}

/* language switcher that lives inside the dropdown panel (phones only) */
.lang-panel {
  display: none;
  margin-top: var(--space-3);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-9) 0 var(--space-8);
  background: var(--bg-0);
}

/* subtle red glow, top center */
.hero::before {
  content: "";
  position: absolute;
  top: -35%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 620px;
  background: radial-gradient(closest-side, var(--glow-accent), transparent 72%);
  pointer-events: none;
}

/* faint grid lines */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border-0) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-0) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.22;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 25%, transparent 75%);
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-8);
  align-items: center;
}

/* min-width:0 keeps a nowrap headline from widening its grid track
   (1fr tracks have an implicit min-width:auto, which would push the
   terminal column narrower). */
.hero .container > * {
  min-width: 0;
}

/* the copy column is a size container: 1cqw = 1% of its own width,
   so the headline sizes itself against the column, not the viewport. */
.hero-copy {
  container-type: inline-size;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-5);
}

.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--thread);
}

.hero h1 {
  /* the question never wraps and never crosses the center line: its size
     is a fraction of its own column width (1cqw = 1% of .hero-copy), so
     the rendered line always fits inside the left half of the hero.
     Weights: question medium, accent bold. */
  font-size: clamp(1.05rem, 4.3cqw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.hero h1 .accent {
  display: block;
  /* the punchline: ~1.8x the question, always within 1.5–2x, hard-capped
     so it can't get ridiculous in edge cases */
  font-size: clamp(1.7rem, 7.8cqw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--thread);
}

/* "AI can." is always on its own line under the question, whatever the
   viewport width: the first span becomes a block (and never wraps), so
   the accent span drops to a second row instead of flowing inline. */
.hero h1 > span:first-child {
  display: block;
  white-space: nowrap;
}

.hero .lede {
  font-size: var(--text-lg);
  color: var(--text-2);
  max-width: 34ch;
  margin-bottom: var(--space-6);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--speed) var(--ease), color var(--speed) var(--ease),
    border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: var(--on-accent);
}

.btn-ghost {
  background: var(--bg-2);
  border-color: var(--border-1);
  color: var(--text-1);
}

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

/* ---------- hero terminal card ---------- */
/* The terminal always renders on its own dark background (the CLI reads
   the terminal's background, not the app's theme). Colours from
   brand/brand.config.ts › terminal.dark. */
.terminal {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--term-bar);
  border-bottom: 1px solid var(--term-border);
}

.terminal-bar .tdot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--term-dot);
}

.terminal-bar .tdot:first-child {
  background: var(--term-accent);
}

.terminal-bar .ttitle {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--term-faint);
}

.terminal-body {
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.75;
  background: var(--term-bg);
  color: var(--term-ink);
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

/* header: <●> CUCK CODE  0.1 · project … (wraps on narrow screens) */
.terminal-body .tch-header {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 14px 20px 0;
  flex-wrap: wrap;
}

.terminal-body .tch-eye {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-weight: 400;
}

.terminal-body .tch-lt,
.terminal-body .tch-gt {
  color: var(--term-faint);
}

.terminal-body .tch-iris {
  color: var(--term-accent);
  margin: 0 1px;
}

.terminal-body .tch-name {
  font-weight: 700;
  color: var(--term-ink);
  letter-spacing: 0.02em;
}

.terminal-body .tch-facts {
  color: var(--term-muted);
  font-size: 0.92em;
  margin-left: 0.3em;
}

/* hint line (wraps on narrow screens) */
.terminal-body .tch-hint {
  color: var(--term-faint);
  padding: 2px 20px 0;
  font-size: 0.88em;
  overflow-wrap: break-word;
}

/* user message: thread marker + text */
.terminal-body .tch-user {
  display: flex;
  gap: 0.5em;
  padding: 12px 20px 0;
  color: var(--term-ink);
}

.terminal-body .tch-thread {
  color: var(--term-accent);
  flex-shrink: 0;
}

/* reply: default ink */
.terminal-body .tch-reply {
  padding: 6px 20px 0;
  color: var(--term-ink);
}

.terminal-body .tch-reply > div {
  white-space: pre-wrap;
  word-break: break-word;
}

/* prompt bar: filled panel with accent sign */
.terminal-body .tch-promptbar {
  margin: 14px 20px 0;
  background: var(--term-panel);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 0.5em;
  color: var(--term-ink);
}

.terminal-body .tch-prompt-sign {
  color: var(--term-accent);
  font-weight: 700;
}

.terminal-body .tch-prompt-text {
  color: var(--term-faint);
}

/* status bar: darker fill, muted (wraps on narrow screens) */
.terminal-body .tch-statusbar {
  margin: 0 20px 16px;
  background: var(--term-bar);
  border-radius: 4px;
  padding: 6px 12px;
  color: var(--term-faint);
  font-size: 0.82em;
  overflow-wrap: break-word;
}

/* blinking caret (inside the prompt bar) */
.terminal-body .caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  vertical-align: text-bottom;
  background: var(--term-accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- sections ---------- */
.section {
  padding: var(--space-8) 0;
}

.section-tight {
  padding: var(--space-7) 0;
}

.no-pad-top {
  padding-top: 0;
}

.section-alt {
  background: var(--bg-1);
  border-top: 1px solid var(--border-0);
  border-bottom: 1px solid var(--border-0);
  transition: background-color var(--speed) var(--ease);
}

.section-head {
  max-width: 62ch;
  margin-bottom: var(--space-7);
}

.section-head h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.section-head p {
  color: var(--text-2);
  font-size: var(--text-md);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--space-3);
}

/* ---------- feature grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease),
    background-color var(--speed) var(--ease);
}

.card:hover {
  border-color: var(--border-1);
  transform: translateY(-3px);
}

.card .icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
}

.card .icon svg {
  width: 20px;
  height: 20px;
}

.card h3 {
  font-size: var(--text-md);
  margin-bottom: var(--space-2);
}

.card p {
  font-size: var(--text-sm);
  color: var(--text-2);
}

/* visually hidden, still read by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- features bento (features.html) ---------- */
.bento {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  grid-auto-flow: dense;
  gap: var(--space-4);
}

.bento-item {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow: hidden;
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease),
    background-color var(--speed) var(--ease);
}

.bento-item::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-1), transparent);
  opacity: 0;
  transition: opacity var(--speed) var(--ease);
}

.bento-item:hover {
  border-color: var(--border-1);
  transform: translateY(-3px);
}

.bento-item:hover::after {
  opacity: 1;
}

.bento-item--wide {
  grid-column: 1;
}

.bento-item--narrow {
  grid-column: 2;
}

.bento-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.bento-num {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.bento-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  display: grid;
  place-items: center;
}

.bento-icon svg {
  width: 22px;
  height: 22px;
}

.bento-item h3 {
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.bento-item p {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-2);
}

/* ---------- how it works (steps) ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  counter-reset: step;
}

.step {
  position: relative;
  padding: var(--space-5);
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-lg);
}

.step::before {
  counter-increment: step;
  content: "0" counter(step);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-1);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  display: inline-block;
  margin-bottom: var(--space-4);
}

.step h3 {
  font-size: var(--text-md);
  margin-bottom: var(--space-2);
}

.step p {
  font-size: var(--text-sm);
  color: var(--text-2);
}

/* ---------- big CTA band ---------- */
.cta-band {
  position: relative;
  overflow: hidden;
  text-align: center;
  background: var(--bg-2);
  border-top: 1px solid var(--border-0);
  border-bottom: 1px solid var(--border-0);
  padding: var(--space-8) 0;
}

.cta-band::before {
  content: "";
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 480px;
  background: radial-gradient(closest-side, var(--glow-accent), transparent 72%);
  pointer-events: none;
}

.cta-band .container {
  position: relative;
  z-index: 1;
}

.cta-band h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.cta-band p {
  color: var(--text-2);
  max-width: 52ch;
  margin: 0 auto var(--space-6);
}

.cta-band .hero-cta {
  justify-content: center;
}

/* ---------- downloads ---------- */
.latest {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-7);
  box-shadow: var(--shadow-1);
}

.latest::before {
  content: "";
  position: absolute;
  top: -70%;
  right: -12%;
  width: 480px;
  height: 420px;
  background: radial-gradient(closest-side, var(--glow-accent), transparent 72%);
  pointer-events: none;
}

.latest-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.latest-head h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
}

.latest-head .release-date {
  margin-left: 0;
}

.latest p.latest-note {
  position: relative;
  z-index: 1;
  color: var(--text-2);
  max-width: 64ch;
  margin-bottom: var(--space-5);
}

.dl-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--space-3);
}

.dl-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg-1);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
}

.dl-row:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.dl-row .dl-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.dl-row .dl-icon svg {
  width: 18px;
  height: 18px;
}

.dl-row .dl-meta {
  min-width: 0;
}

.dl-row .dl-platform {
  font-weight: 600;
  font-size: var(--text-sm);
}

.dl-row .dl-file {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-row .btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
}

/* ---------- downloads: source card ---------- */
.dl-source {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  transition: border-color var(--speed) var(--ease);
}
.dl-source:hover {
  border-color: var(--accent-border);
}
.dl-source .src-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-1);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dl-source .src-icon svg {
  width: 20px;
  height: 20px;
}
.dl-source .src-meta {
  min-width: 0;
  flex: 1;
}
.dl-source .src-title {
  font-weight: 700;
  font-size: var(--text-md);
  margin-bottom: 2px;
}
.dl-source .src-desc {
  font-size: var(--text-xs);
  color: var(--text-3);
  line-height: 1.4;
}
.dl-source .src-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  transition: background var(--speed) var(--ease);
}
.dl-source .src-link:hover {
  background: var(--bg-3);
}
.dl-source .src-link svg {
  width: 16px;
  height: 16px;
}

/* ---------- downloads: platform cards grid ---------- */
.dl-platforms {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.dl-platform-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.dl-platform-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.dl-platform-card .card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-1);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
  flex-shrink: 0;
}
.dl-platform-card .card-icon svg {
  width: 28px;
  height: 28px;
}

.dl-platform-card .card-name {
  font-weight: 700;
  font-size: var(--text-md);
  margin-bottom: var(--space-2);
}

.dl-platform-card .card-arch {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  margin-bottom: var(--space-3);
}

.dl-platform-card .card-file {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--bg-3);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  flex: 1;
}

.dl-platform-card .card-meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.dl-platform-card .card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dl-platform-card .card-meta svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

.dl-platform-card .card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
  flex-shrink: 0;
}
/* primary button variant — red for the first (recommended) card */
.dl-platform-card .card-btn.primary {
  background: var(--accent);
  color: var(--text-1);
  border: 1px solid var(--accent);
}
.dl-platform-card .card-btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, white);
}
/* secondary — outline for the other two */
.dl-platform-card .card-btn.secondary {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-1);
}
.dl-platform-card .card-btn.secondary:hover {
  background: var(--bg-3);
  border-color: var(--accent-border);
}
.dl-platform-card .card-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- downloads: badges row ---------- */
.dl-badges {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.dl-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-3);
  background: var(--bg-3);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
}
.dl-badge svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.dl-badge.accent {
  color: var(--accent);
  border-color: var(--accent-border);
}

/* ---------- downloads: coming soon ---------- */
.coming-soon {
  min-height: calc(100vh - 220px);
  display: grid;
  place-items: center;
  padding: var(--space-9) 0;
}

.coming-soon-inner {
  text-align: center;
  max-width: 34rem;
  margin: 0 auto;
}

.cs-icon {
  width: 72px;
  height: 72px;
  color: var(--text-3);
  margin: 0 auto var(--space-5);
  display: block;
}

.cs-date {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin: var(--space-2) 0 var(--space-4);
}

.cs-body {
  color: var(--text-3);
  font-size: var(--text-sm);
  line-height: 1.7;
  max-width: 30rem;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .coming-soon {
    min-height: calc(100vh - 260px);
    padding: var(--space-6) 0;
  }

  .cs-icon {
    width: 56px;
    height: 56px;
  }
}

/* versions table */
.sub-head {
  font-size: var(--text-xl);
  margin-top: var(--space-7);
  margin-bottom: var(--space-5);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-0);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
}

table.versions {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 640px;
}

table.versions th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-1);
  white-space: nowrap;
}

table.versions td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-0);
  color: var(--text-2);
  vertical-align: middle;
}

table.versions tr:last-child td {
  border-bottom: 0;
}

table.versions tr:hover td {
  background: var(--bg-3);
}

table.versions .v {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
}

table.versions .d {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  white-space: nowrap;
}

table.versions a.dl-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* placeholder notice */
.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-2);
}

.notice svg {
  width: 18px;
  height: 18px;
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 2px;
}

.notice strong {
  color: var(--text-1);
}

/* ---------- footer ---------- */
.footer {
  background: var(--bg-1);
  border-top: 1px solid var(--border-0);
  padding: var(--space-7) 0 var(--space-6);
  transition: background-color var(--speed) var(--ease);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer .brand {
  font-size: var(--text-md);
}

.footer-tagline {
  color: var(--text-3);
  font-size: var(--text-xs);
  margin-top: var(--space-2);
  max-width: 46ch;
}

.footer-nav {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.footer-nav a {
  color: var(--text-3);
  font-size: var(--text-sm);
}

.footer-nav a:hover {
  color: var(--text-1);
}

.footer .copyright {
  width: 100%;
  padding-top: var(--space-5);
  margin-top: var(--space-2);
  border-top: 1px solid var(--border-0);
  font-size: var(--text-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ---------- page header (subpages) ---------- */
.page-head {
  padding: var(--space-8) 0 var(--space-6);
}

.page-head h1 {
  font-size: var(--text-3xl);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
}

.page-head p {
  color: var(--text-2);
  max-width: 64ch;
  font-size: var(--text-lg);
}

/* ---------- responsive ---------- */
/* Tablet (≤960px): hero stacks, cards 2-up. The nav keeps its full row. */
@media (max-width: 960px) {
  .hero .container {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }

  .hero {
    padding-top: var(--space-8);
  }

  .hero .lede {
    max-width: none;
  }

  .terminal {
    transform: none;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
}

/* Phone portrait (≤768px): burger nav, one-column grids, tighter spacing,
   de-cluttered top bar. Below 420px: a few extra-small tweaks. */
@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
  }

  .container {
    width: calc(100% - var(--space-5) * 2);
  }

  .section {
    padding: var(--space-7) 0;
  }

  .section-tight {
    padding: var(--space-6) 0;
  }

  .hero {
    padding: var(--space-7) 0 var(--space-7);
  }

  .cta-band {
    padding: var(--space-7) 0;
  }

  .page-head {
    padding: var(--space-6) 0 var(--space-5);
  }

  /* top bar keeps only brand + theme + burger; the language switcher moves
     into the menu, so the bar no longer overflows a 360–390px phone */
  .nav-actions {
    gap: var(--space-2);
  }

  .nav-burger {
    display: grid;
  }

  .nav .lang-switch:not(.lang-panel) {
    display: none;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-0);
    padding: var(--space-3) var(--space-5) var(--space-5);
    margin-left: 0;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--speed) var(--ease), opacity var(--speed) var(--ease),
      visibility 0s linear var(--speed);
    box-shadow: var(--shadow-2);
  }

  .nav-open .nav-links {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }

  .nav-open .nav-backdrop {
    display: block;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    background: var(--bg-0);
    opacity: 0.55;
    cursor: pointer;
  }

  .nav-links a {
    /* block, not inline: in the vertical stack the anchor's vertical
       padding must count toward the <li> height, otherwise each link
       paints a tall highlight box inside a short line slot and the
       boxes overlap the next link. */
    display: block;
    padding: var(--space-3) var(--space-3);
    font-size: var(--text-md);
  }

  .lang-panel {
    display: flex;
    justify-content: flex-start;
  }

  /* grids */
  .grid {
    grid-template-columns: 1fr;
  }

  .bento {
    grid-template-columns: 1fr;
  }

  .bento-item--wide,
  .bento-item--narrow {
    grid-column: auto;
  }

  .steps {
    max-width: 560px;
  }

  /* type (the hero h1 keeps its clamp() sizing: it must fit on one row) */
  .hero .lede {
    font-size: var(--text-md);
  }

  .page-head h1 {
    font-size: var(--text-2xl);
  }

  .page-head p {
    font-size: var(--text-md);
  }

  .section-head {
    max-width: none;
  }

  .section-head h2,
  .cta-band h2 {
    font-size: var(--text-xl);
  }

  /* hero terminal: smaller, not so tall on a narrow viewport */
  .terminal-body {
    font-size: 0.85rem;
    line-height: 1.7;
    min-height: 0;
  }

  .terminal-body .tch-header,
  .terminal-body .tch-hint {
    padding-left: 14px;
    padding-right: 14px;
  }

  .terminal-body .tch-user {
    padding-left: 14px;
    padding-right: 14px;
  }

  .terminal-body .tch-reply {
    padding-left: 14px;
    padding-right: 14px;
  }

  .terminal-body .tch-promptbar,
  .terminal-body .tch-statusbar {
    margin-left: 14px;
    margin-right: 14px;
  }

  /* CTAs: full-width, stacked, easy to tap */
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta .btn {
    justify-content: center;
  }

  /* downloads */
  .latest {
    padding: var(--space-5);
  }

  .dl-row {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .dl-source {
    flex-direction: column;
    text-align: center;
    padding: var(--space-4);
  }

  .dl-source .src-link {
    width: 100%;
    justify-content: center;
  }

  .dl-platforms {
    grid-template-columns: 1fr;
  }

  .dl-badges {
    justify-content: center;
  }

  .release {
    padding: var(--space-5) var(--space-5) var(--space-4);
  }

  .release-date {
    margin-left: 0;
    width: 100%;
  }

  /* footer stacks */
  .footer {
    padding: var(--space-6) 0 var(--space-5);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
  }

  .footer-nav {
    gap: var(--space-5);
    flex-wrap: wrap;
  }

  .footer .copyright {
    width: 100%;
    margin-top: var(--space-3);
    padding-top: var(--space-4);
  }
}

/* extra-small phones */
@media (max-width: 420px) {
  .page-head h1 {
    font-size: 1.9rem;
  }

  .section-head h2,
  .cta-band h2 {
    font-size: 1.4rem;
  }

  .terminal-body {
    font-size: 0.78rem;
  }

  .card,
  .step,
  .release {
    padding: var(--space-4);
  }

  .notice {
    padding: var(--space-3);
  }
}

/* Wide monitors (≥1920px): use the extra space */
@media (min-width: 1920px) {
  :root {
    --max-width: 1440px;
  }

  .terminal-body {
    font-size: 1rem;
  }
}

/* ---------- examples showcase ---------- */
.section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: var(--space-3);
}

.section-lede {
  color: var(--text-2);
  max-width: 62ch;
  margin-bottom: var(--space-7);
}

.ex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.ex-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.ex-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
}

.ex-card-head h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

.ex-card-head p {
  color: var(--text-2);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

.ex-open {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--link);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  padding: 5px var(--space-2);
  transition: color var(--speed) var(--ease),
    border-color var(--speed) var(--ease);
}

.ex-open:hover {
  color: var(--link);
  border-color: var(--focus);
  text-decoration: none;
}

/* a browser-window frame around the live example */
.ex-frame {
  margin: 0 var(--space-4) var(--space-4);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-0);
}

.ex-frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-0);
}

.ex-frame-bar .tdot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-3);
}

.ex-frame-bar .tdot:first-child {
  background: var(--thread);
}

.ex-frame-url {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-frame iframe {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  background: var(--bg-0);
}

@media (max-width: 768px) {
  .ex-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
