@tailwind base;
@tailwind components;
@tailwind utilities;

/* ─── Palette: warm-neutral dark, warmth as accent only ─── */
/* OKLCH is canonical; sRGB hex declared first as fallback for non-OKLCH UAs. */
:root {
  /* Surfaces — soft warm light (light is the default theme; never pure white) */
  --base: #f4f1ea;
  --mantle: #efece4;
  --surface0: #e8e4da;
  --surface1: #ddd8cc;
  --surface2: #cdc7b8;

  /* Text — warm near-black, never pure black */
  --overlay1: #6b675f;
  --subtext0: #57534b;
  --subtext1: #3d3a33;
  --text: #2a2722;

  /* Accents — darkened/desaturated for AA contrast on a light field */
  --mauve: #6f4fa6;
  --lavender: #5d57a0;
  --sky: #3f6275;
  --blue: #2f5fb0;
  --green: #4a7338;
  --yellow: #8a6516;
  --rust: #b3502f;
  --tape: #8a7a55;

  /* Semantic */
  --bg: var(--base);
  --bg-elevated: var(--mantle);
  --border: var(--surface1);
  --border-strong: var(--surface2);
  --fg: var(--text);
  --fg-muted: var(--subtext0);
  --fg-subtle: var(--overlay1);
  --accent: var(--mauve);
  --accent-cool: var(--lavender);
  /* Side B accent: amber pairs split-complementary with mauve (H≈80 vs H≈300, equal chroma).
     Rust is kept as a named tone but no longer the primary warm accent — it competed with mauve
     for attention and sat too close to error red. */
  --accent-warm: var(--yellow);
  --accent-rust: var(--yellow);

  /* Always-light text on accent fills (buttons, skip link) — overridden per theme */
  --btn-on-accent: #f4f1ea;

  /* Theme-dependent surface treatments (light defaults; dark overrides below) */
  --grid-color: rgba(60, 50, 35, 0.05);
  --grid-size: 96px;
  --grain-opacity: 0;
  --grain-blend: multiply;
  --shadow-card: 0 8px 24px -14px rgba(60, 50, 35, 0.22);
  --shadow-terminal: 0 24px 48px -28px rgba(60, 50, 35, 0.28);

  /* Film-grain texture — analog cassette texture cue, ~1.5% opacity */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.96  0 0 0 0 0.89  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  /* ─── Type scale ─── */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-base: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  /* ─── Spacing scale (4px base) ─── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-18: 72px;

  /* ─── Letter-spacing ─── */
  --tracking-tight: 0.02em;
  --tracking-normal: 0.04em;
  --tracking-wide: 0.14em;
  --tracking-wider: 0.22em;
  --tracking-widest: 0.32em;

  /* ─── Radius ─── */
  --radius-sm: 2px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* ─── Font stacks ─── */
  --font-mono: "JetBrains Mono", "Courier New", Courier, monospace;
}

/* ─── Dark theme overrides ─── */
.dark,
[data-theme="dark"] {
  /* Surfaces — warm-neutral dark, never cold slate */
  --base: #0a0908;
  --base: oklch(0.13 0.004 50);
  --mantle: #111110;
  --mantle: oklch(0.16 0.004 50);
  --surface0: #181715;
  --surface0: oklch(0.19 0.005 50);
  --surface1: #232220;
  --surface1: oklch(0.23 0.005 50);
  --surface2: #34322f;
  --surface2: oklch(0.3 0.006 55);

  /* Text — warm cream, not pure white */
  --overlay1: #8e8b86;
  --overlay1: oklch(0.62 0.005 55);
  --subtext0: #a8a5a0;
  --subtext0: oklch(0.71 0.005 55);
  --subtext1: #cfcbc4;
  --subtext1: oklch(0.83 0.008 60);
  --text: #ebe8e2;
  --text: oklch(0.92 0.008 65);

  /* Accents */
  --mauve: #b89cdc;
  --mauve: oklch(0.71 0.1 300);
  --lavender: #a8a3d8;
  --lavender: oklch(0.7 0.07 280);
  --sky: #8aaab8;
  --sky: oklch(0.69 0.04 230);
  --blue: #7aa2e3;
  --blue: oklch(0.7 0.11 255);
  --green: #9ab28a;
  --green: oklch(0.73 0.05 140);
  --yellow: #d4b070;
  --yellow: oklch(0.78 0.1 80);
  --rust: #d97757;
  --rust: oklch(0.66 0.13 38);
  --tape: #c4ad88;
  --tape: oklch(0.74 0.05 75);

  --btn-on-accent: #0a0908;
  --grid-color: rgba(255, 245, 230, 0.035);
  --grain-opacity: 0.025;
  --grain-blend: overlay;
  --shadow-card: 0 1px 0 rgba(255, 220, 170, 0.02) inset, 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-terminal: 0 24px 48px -24px rgba(0, 0, 0, 0.7);
}

/* ─── P3 wide-gamut enrichment (accents only; surfaces stay sRGB) ─── */
@supports (color: color(display-p3 1 1 1)) {
  .dark,
  [data-theme="dark"] {
    --mauve: color(display-p3 0.74 0.62 0.88);
    --lavender: color(display-p3 0.68 0.65 0.86);
    --rust: color(display-p3 0.84 0.48 0.36);
    --yellow: color(display-p3 0.83 0.7 0.46);
    --sky: color(display-p3 0.56 0.67 0.73);
    --blue: color(display-p3 0.5 0.64 0.89);
    --green: color(display-p3 0.62 0.7 0.56);
    --tape: color(display-p3 0.76 0.68 0.55);
  }
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: -1px -1px;
  background-attachment: fixed;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
}

/* ─── Layout ─── */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ─── Logo banner ─── */
.logo-wrap {
  margin-top: var(--space-10);
  margin-bottom: var(--space-6);
  display: flex;
  justify-content: center;
}

.logo-img {
  width: 100%;
  max-width: 820px;
  display: block;
}

/* ─── Sections ─── */
.section {
  padding: 0 0 56px;
}

.section-label {
  font-size: var(--fs-base);
  font-weight: 800;
  letter-spacing: var(--tracking-wider);
  color: var(--mauve);
  margin-bottom: 14px;
}

/* ─── Grid box — bordered container ─── */
.grid-box {
  position: relative;
  border: 1px solid var(--border);
  width: 100%;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card);
}

/* Film-grain overlay — analog cassette texture cue */
.grid-box::after,
.hero-terminal::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 240px 240px;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  z-index: 0;
}
.grid-box > *,
.hero-terminal > * {
  position: relative;
  z-index: 1;
}

/* ─── Hero ─── */
.hero-row {
  padding: 72px 32px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-tagline {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  color: var(--fg);
  line-height: 1.4;
}

.hero-etymology {
  margin-top: 6px;
  font-size: var(--fs-sm);
  color: var(--fg-subtle);
  letter-spacing: var(--tracking-tight);
}

.hero-etymology-jp {
  color: var(--fg);
}

.hero-sub {
  font-size: var(--fs-base);
  letter-spacing: var(--tracking-wider);
  color: var(--fg-subtle);
  margin-top: 14px;
}

/* ─── Action rows ─── */
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
}

.action-label {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  color: var(--fg-subtle);
  flex-shrink: 0;
  white-space: nowrap;
}

.accent-warm {
  color: var(--accent-warm);
}

.version-badge {
  margin-left: 10px;
}

.star-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
}

.action-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-cmd {
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--fg);
  letter-spacing: var(--tracking-tight);
}

/* Install pill — terminal-style command box */
.install-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--mantle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  font-family: inherit;
  font-size: var(--fs-md);
  max-width: 100%;
  overflow: hidden;
}

.install-pill-prompt {
  color: var(--mauve);
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
}

.install-pill-cmd {
  font-family: inherit;
  color: var(--fg);
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.install-pill .copy-btn {
  border: none;
  padding: 2px 4px;
  margin-left: 4px;
}

.action-link {
  font-size: var(--fs-base);
  color: var(--accent);
  letter-spacing: var(--tracking-normal);
  transition: color 0.12s;
}

.action-link:hover {
  color: var(--fg);
}

.arrow {
  color: var(--fg-subtle);
}

/* ─── Copy button ─── */
.copy-btn {
  font-size: var(--fs-md);
  font-family: inherit;
  letter-spacing: 0.08em;
  color: var(--fg-subtle);
  border: 1px solid var(--border);
  padding: 3px 8px;
  transition:
    color 0.12s,
    border-color 0.12s;
  flex-shrink: 0;
}

.copy-btn:hover {
  color: var(--fg);
  border-color: var(--fg-subtle);
}
.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

/* ─── Agents ─── */
.agents-header {
  padding: 14px 24px;
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--fg-subtle);
  border-bottom: 1px solid var(--border);
}

.agents-cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.agent-cell {
  padding: 18px 24px;
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  text-align: center;
  transition:
    color 0.12s,
    background 0.12s;
}

.agent-cell:nth-child(4n + 1) {
  border-left: none;
}
.agent-cell:hover {
  color: var(--fg);
  background: var(--surface0);
}

.show-more-row {
  width: 100%;
  padding: 16px 24px;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--fg-subtle);
  border-top: 1px solid var(--border);
  text-align: center;
  transition:
    color 0.12s,
    background 0.12s;
}

.show-more-row:hover {
  color: var(--fg);
  background: var(--surface0);
}

/* ─── Features grid ─── */
.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.feat-cell {
  padding: 28px 24px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.feat-cell:nth-child(-n + 3) {
  border-top: none;
}
.feat-cell:nth-child(3n + 1) {
  border-left: none;
}

.feat-cell-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 10px;
}

.feat-cell-desc {
  font-size: var(--fs-md);
  color: var(--fg-muted);
  line-height: 1.7;
  letter-spacing: var(--tracking-tight);
}

.feat-code-block {
  border: 1px solid var(--border);
  overflow-x: auto;
  background: var(--bg);
}

.feat-code-header {
  padding: 9px 16px;
  font-size: var(--fs-base);
  letter-spacing: 0.16em;
  color: var(--fg-subtle);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.feat-code-body {
  padding: 18px 20px;
  font-size: var(--fs-base);
  line-height: 1.9;
  letter-spacing: var(--tracking-tight);
  background: var(--bg);
  white-space: pre;
}

/* Syntax lines */
.sy-line {
  display: flex;
  gap: 20px;
}

.sy-ln {
  color: var(--fg-subtle);
  user-select: none;
  text-align: right;
  min-width: 2ch;
  flex-shrink: 0;
  opacity: 0.4;
}

.sy-line-content {
  flex: 1;
}

/* Syntax */
.sy-key {
  color: var(--lavender);
}
.sy-str {
  color: var(--sky);
}
.sy-url {
  color: var(--blue);
}
.sy-cmt {
  color: var(--fg-subtle);
}
.sy-dash {
  color: var(--fg-subtle);
}
.sy-punct {
  color: var(--fg-muted);
}

/* ─── Install ─── */
.install-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
}

.install-row:first-child {
  border-top: none;
}

.install-label {
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--fg-subtle);
  flex-shrink: 0;
  min-width: 210px;
}

.install-right {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.install-cmd {
  font-family: inherit;
  font-size: var(--fs-md);
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: var(--tracking-tight);
}

/* ─── Footer ─── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 40px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  background: var(--bg);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: var(--fs-md);
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
}

.footer-logo {
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
}
.footer-sep {
  opacity: 0.3;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-link {
  font-size: var(--fs-md);
  letter-spacing: var(--tracking-wide);
  color: var(--fg-subtle);
  transition: color 0.12s;
}

.footer-link:hover {
  color: var(--fg);
}

.footer-icon {
  font-size: var(--fs-lg);
  color: var(--fg-subtle);
  transition: color 0.12s;
  display: flex;
  align-items: center;
}

.footer-icon:hover {
  color: var(--fg);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .page-wrap {
    padding: 0 20px;
  }

  .action-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .agents-cells {
    grid-template-columns: repeat(2, 1fr);
  }
  .agent-cell:nth-child(4n + 1) {
    border-left: 1px solid var(--border);
  }
  .agent-cell:nth-child(2n + 1) {
    border-left: none;
  }

  .feat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .feat-cell:nth-child(-n + 3) {
    border-top: 1px solid var(--border);
  }
  .feat-cell:nth-child(-n + 2) {
    border-top: none;
  }
  .feat-cell:nth-child(3n + 1) {
    border-left: 1px solid var(--border);
  }
  .feat-cell:nth-child(2n + 1) {
    border-left: none;
  }

  .install-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .install-label {
    min-width: unset;
  }
  .install-cmd {
    white-space: normal;
    word-break: break-all;
  }

  .footer {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  .footer-left {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero-row {
    padding: 48px 20px;
  }
  .hero-tagline {
    font-size: var(--fs-base);
  }
  .agents-cells {
    grid-template-columns: 1fr 1fr;
  }
  .feat-grid {
    grid-template-columns: 1fr;
  }
  .feat-cell {
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
  }
  .feat-cell:first-child {
    border-top: none !important;
  }
}

/* ─── Fumadocs theme bridge (HSL components) ─── */
:root {
  --fd-background: 48 23% 94%; /* #f4f1ea */
  --fd-foreground: 40 9% 15%; /* #2a2722 */
  --fd-card: 45 22% 92%; /* #efece4 */
  --fd-card-foreground: 40 9% 15%;
  --fd-popover: 45 22% 92%;
  --fd-popover-foreground: 40 9% 15%;
  --fd-primary: 265 36% 48%; /* mauve #6f4fa6 */
  --fd-primary-foreground: 48 23% 94%;
  --fd-secondary: 44 19% 89%;
  --fd-secondary-foreground: 40 9% 15%;
  --fd-muted: 44 19% 91%;
  --fd-muted-foreground: 40 6% 35%;
  --fd-accent: 36 72% 31%; /* amber #8a6516 */
  --fd-accent-foreground: 48 23% 94%;
  --fd-border: 45 17% 83%; /* #ddd8cc */
  --fd-ring: 265 36% 48%;
}

html.dark,
html[data-theme="dark"] {
  --fd-background: 30 9% 4%; /* #0a0908 */
  --fd-foreground: 38 21% 90%; /* #ebe8e2 */
  --fd-card: 30 5% 7%; /* #111110 */
  --fd-card-foreground: 38 21% 90%;
  --fd-popover: 30 5% 7%;
  --fd-popover-foreground: 38 21% 90%;
  --fd-primary: 270 39% 74%; /* mauve #b89cdc */
  --fd-primary-foreground: 30 9% 4%;
  --fd-secondary: 30 6% 11%;
  --fd-secondary-foreground: 38 21% 90%;
  --fd-muted: 30 6% 9%;
  --fd-muted-foreground: 30 7% 64%;
  --fd-accent: 36 53% 64%; /* amber #d4b070 */
  --fd-accent-foreground: 30 9% 4%;
  --fd-border: 30 6% 13%;
  --fd-ring: 270 39% 74%;
}

/* ─── Top nav (shared across landing + docs) ─── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.top-nav-inner {
  width: 100%;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
@media (max-width: 640px) {
  .top-nav-inner {
    padding: 12px 20px;
  }
}

.top-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: var(--fs-sm);
  color: var(--fg);
  transition: color 0.12s;
}

.top-nav-brand:hover {
  color: var(--accent);
}

.top-nav-logo-img {
  height: 20px;
  width: auto;
  display: block;
}

.top-nav-name {
  font-family: inherit;
}

.top-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 22px;
}

.top-nav-link {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--fg-muted);
  transition: color 0.12s;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  line-height: 22px;
}

.top-nav-link:hover {
  color: var(--fg);
}

.top-nav-icon {
  font-size: 22px;
}
.top-nav-icon svg {
  display: block;
}

.top-nav-repo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: var(--tracking-tight);
  transition: color 0.12s;
  line-height: 22px;
}
.top-nav-repo:hover {
  color: var(--fg);
}
.top-nav-repo-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.top-nav-repo-name {
  font-family: var(--font-mono);
  text-transform: lowercase;
}
.top-nav-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-warm);
  font-weight: 700;
}
@media (max-width: 640px) {
  .top-nav-repo-name {
    display: none;
  }
}

.top-nav-arrow {
  display: inline-block;
  font-size: 0.85em;
  color: var(--fg-subtle);
  transition:
    transform 0.18s ease,
    color 0.12s;
}
.top-nav-link:hover .top-nav-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ─── Cassette label (under logo) ─── */
.cassette-label {
  text-align: center;
  padding: 0 0 var(--space-16);
}
.hero-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  color: var(--accent-warm);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
}
.hero-headline {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.15;
  color: var(--fg);
  max-width: 720px;
  margin: 0 auto;
}
.hero-accent {
  color: var(--accent-rust);
}
.cassette-label .hero-etymology {
  margin-top: var(--space-4);
  font-size: var(--fs-md);
  color: var(--fg-subtle);
}

/* ─── Hero terminal demo ─── */
.hero-terminal {
  margin: var(--space-10) auto 0;
  width: 100%;
  max-width: 880px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-align: left;
  overflow: hidden;
  box-shadow: var(--shadow-terminal);
}
.hero-terminal-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 60%, var(--bg) 40%);
}
.hero-terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface2);
}
.hero-terminal-title {
  margin-left: var(--space-3);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  letter-spacing: var(--tracking-wide);
}
.hero-terminal-body {
  padding: var(--space-5) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--fg-muted);
}
.t-rows {
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
}
.t-line {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.t-blank {
  grid-column: 1 / -1;
  height: var(--space-3);
}
.t-row {
  display: contents;
}
.t-row > :nth-child(1) {
  padding-left: var(--space-2);
}
.t-row > :nth-child(3) {
  text-align: right;
}
.t-summary-line {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  padding-left: var(--space-2);
  margin-top: var(--space-3);
  border-top: 1px solid var(--surface2);
  padding-top: var(--space-3);
}
.t-prompt {
  color: var(--accent);
  font-weight: 700;
}
.t-ok {
  color: var(--green);
}
.t-dim {
  color: var(--fg-subtle);
}
.t-divider {
  height: 1px;
  background: var(--surface2);
  margin: var(--space-1) 0;
  opacity: 0.6;
}
.t-summary-line {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.t-summary {
  color: var(--fg);
  font-weight: 600;
}
.t-summary-pair {
  display: inline-flex;
  align-items: baseline;
}
.t-fade {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.t-fade[data-shown="true"] {
  opacity: 1;
  transform: translateY(0);
}
.t-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 4px;
  background: var(--fg);
  vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}
.t-spin {
  display: inline-block;
  width: 1ch;
  height: 1em;
  position: relative;
  color: var(--accent-warm);
  vertical-align: -2px;
}
.t-spin::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: t-spin 0.7s linear infinite;
}
@keyframes t-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .t-fade {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .t-cursor,
  .t-spin::before {
    animation: none;
  }
}
@media (max-width: 640px) {
  .hero-terminal-body {
    font-size: var(--fs-xs);
    padding: var(--space-4);
  }
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border: 1px solid transparent;
  transition:
    transform 0.12s ease,
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Hero CTA row ─── */
.hero-cta {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-7);
  flex-wrap: wrap;
}
@media (max-width: 480px) {
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-cta .btn {
    justify-content: center;
  }
}

/* ─── Tape side banner ─── */
.tape-side {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 0 28px;
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: var(--tracking-widest);
}
.tape-side-tag {
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.tape-side[data-side="B"] .tape-side-tag {
  color: var(--accent-warm);
  border-color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 8%, transparent);
}
.tape-side-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  position: relative;
}
.tape-side-line::before,
.tape-side-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transform: translateY(-50%);
}
.tape-side-line::before {
  left: 24%;
}
.tape-side-line::after {
  right: 24%;
}
.tape-side-label {
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
  letter-spacing: 0.28em;
}

/* ─── Track row (left marker + content) ─── */
.track {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 28px;
  padding: 0 0 56px;
}
.track-marker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  position: sticky;
  top: 80px;
  align-self: start;
}
.track-num {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--mauve);
}
.track-bar {
  width: 28px;
  height: 2px;
  background: var(--mauve);
  opacity: 0.6;
}
.track-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--fg-subtle);
  line-height: 1.5;
}
.track-body {
  min-width: 0;
}

@media (max-width: 768px) {
  .track {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-bottom: 40px;
  }
  .track-marker {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    position: static;
  }
  .track-bar {
    width: 18px;
  }
  .track-num {
    font-size: var(--fs-base);
  }
  .cassette-label .hero-tagline {
    font-size: var(--fs-base);
  }
  .tape-side {
    gap: 12px;
    padding: 12px 0 20px;
    font-size: var(--fs-xs);
    letter-spacing: 0.24em;
  }
  .tape-side-label {
    display: none;
  }
}

/* ─── Docs: hide site TopNav on mobile (Fumadocs's mobile subnav owns the sidebar trigger) ─── */
@media (max-width: 767px) {
  body:has(#nd-docs-layout) .top-nav {
    display: none;
  }
}

/* ─── Docs: drop the body grid; keep the flat --bg from html ─── */
body:has(#nd-docs-layout) {
  background-image: none;
}

/* ─── Docs: solid code-block bg over the flat background ─── */
.fd-codeblock {
  background: var(--bg-elevated) !important;
}
.fd-codeblock pre {
  background: transparent;
}

/* ─── kbd: keyboard key chip ─── */
kbd {
  display: inline-block;
  padding: 1px var(--space-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.85em;
  line-height: 1.4;
  white-space: nowrap;
}

/* ─── A11y: skip link + global focus-visible ─── */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--btn-on-accent);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-md);
  text-transform: uppercase;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

#main:focus-visible {
  outline: none;
}

/* ─── Site footer (multi-column) ─── */
.site-footer {
  margin-top: var(--space-16);
  padding: var(--space-14) 32px var(--space-10);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  /* Break out of .page-wrap to span full viewport width like .top-nav */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}
.footer-grid,
.footer-bottom {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 640px) {
  .site-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--space-10);
  align-items: start;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.footer-brand-name {
  font-weight: 800;
  font-size: var(--fs-base);
  letter-spacing: var(--tracking-wider);
  color: var(--fg);
}
.footer-tagline {
  font-size: var(--fs-sm);
  color: var(--fg-subtle);
  line-height: 1.6;
  max-width: 32ch;
}
.footer-social {
  display: flex;
  gap: var(--space-3);
  font-size: var(--fs-lg);
  color: var(--fg-subtle);
}
.footer-social a {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.footer-social a:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.footer-badge {
  display: inline-block;
  margin-top: var(--space-4);
  opacity: 0.85;
  transition: opacity 0.12s;
}
.footer-badge:hover {
  opacity: 1;
}

.footer-col-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  color: var(--accent-warm);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-col a {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  transition: color 0.12s;
}
.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: var(--space-14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    text-align: left;
  }
}

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

.footer-bottom-email {
  color: inherit;
  text-transform: lowercase;
  letter-spacing: var(--tracking-tight);
  transition: color 0.12s;
}
.footer-bottom-email:hover {
  color: var(--accent);
}

/* ─── Scroll cue ─── */
.scroll-cue {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg-subtle);
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 30;
}
.scroll-cue[data-hidden="true"] {
  opacity: 0;
}
.scroll-cue-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}
.scroll-cue-chevron {
  width: 12px;
  height: 12px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  animation: cue-bounce 1.6s ease-in-out infinite;
}
@keyframes cue-bounce {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
    opacity: 0.5;
  }
  50% {
    transform: translateY(6px) rotate(45deg);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue-chevron {
    animation: none;
    opacity: 0.7;
  }
}
@media (max-width: 640px) {
  .scroll-cue {
    display: none;
  }
}

/* ─── Theme toggle (top nav) ─── */
.top-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) 0 var(--space-1) var(--space-4);
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--fg-muted);
  font-size: var(--fs-lg);
  cursor: pointer;
  transition: color 0.15s ease;
}
.top-nav-toggle:hover {
  color: var(--fg);
}
.top-nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
