/* ═══════════════════════════════════════════════════════════
   Tracker Brochure Site — Shared Styles
   Orange glassmorphism theme with dot-grid background
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

:root {
  /* Light-only design — opt out of browser auto-dark-mode (Chrome's
     "auto dark mode for web contents", Safari's color-scheme heuristics,
     extensions like Dark Reader honor this hint). The creamsicle palette
     is calibrated for a light surface; force-darkening produces dark-on-
     dark heading text. */
  color-scheme: light;

  /* Orange palette */
  --orange-50:  #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-300: #fdba74;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --orange-800: #9a3412;
  --orange-900: #7c2d12;

  /* Neutrals */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Semantic — Creamsicle: warm cream base, orange accents */
  --bg-deep:     #fef7f0;
  --bg-surface:  rgba(255, 247, 237, 0.8);
  --bg-card:     rgba(255, 255, 255, 0.6);
  --bg-card-hover: rgba(255, 255, 255, 0.75);
  --bg-code:     rgba(67, 20, 7, 0.92);
  --text-primary:   #1c1917;
  --text-secondary: #57534e;
  --text-muted:     #a8a29e;
  --border-subtle:  rgba(234, 88, 12, 0.18);
  --border-glow:    rgba(249, 115, 22, 0.35);
  --glow-orange:    rgba(249, 115, 22, 0.06);

  /* Layout */
  --max-width: 1200px;
  --nav-height: 64px;

  /* Blur */
  --blur-heavy: blur(24px) saturate(1.4);
  --blur-medium: blur(16px) saturate(1.2);
  --blur-light: blur(8px);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Dot Grid Background ───────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle, rgba(234, 88, 12, 0.08) 1px, transparent 1px),
    radial-gradient(circle, rgba(249, 115, 22, 0.04) 1px, transparent 1px);
  background-size: 32px 32px, 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* Warm gradient overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(251, 146, 60, 0.1), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(249, 115, 22, 0.07), transparent);
  pointer-events: none;
}

/* ─── Navigation ────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(255, 247, 237, 0.85);
  backdrop-filter: var(--blur-heavy);
  -webkit-backdrop-filter: var(--blur-heavy);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Brand: logo + wordmark + a small, muted "by 2389.ai" tag that never wraps or
   competes with the wordmark (the old big orange lockup wrapped to two lines). */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.nav-brand .logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-700));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand-by {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding-left: 0.55rem;
  border-left: 1px solid var(--border-subtle);
}

/* Hamburger toggle — hidden on desktop, revealed when the links collapse. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--glow-orange); border-color: var(--orange-400); }
.nav-toggle:focus-visible { outline: 2px solid var(--orange-600); outline-offset: 2px; }
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--orange-700);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.5rem 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-links a:hover {
  color: var(--orange-700);
  background: var(--glow-orange);
}

.nav-links a.active {
  color: var(--orange-600);
  background: var(--glow-orange);
  font-weight: 600;
}

.nav-ext { font-size: 0.72em; opacity: 0.55; }

/* Collapse to a hamburger drawer before the 10 links can overflow — even wide
   desktops couldn't fit them all in a row. */
@media (max-width: 1100px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    padding: 0.6rem 1rem 1.1rem;
    background: rgba(255, 247, 237, 0.98);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

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

  .nav-links a {
    padding: 0.8rem 0.9rem;
    font-size: 0.95rem;
    border-radius: 10px;
  }

  /* Morph the hamburger into an X while open. */
  .nav.open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .nav.open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

@media (max-width: 420px) {
  .brand-by { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle-bar,
  .nav-links { transition: none; }
}

/* ─── Main Layout ───────────────────────────────────────── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 2rem) 1.5rem 4rem;
}

/* ─── Glass Card ────────────────────────────────────────── */
.glass {
  background: var(--bg-card);
  backdrop-filter: var(--blur-heavy);
  -webkit-backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2.5rem;
  /* Bigger gap between top-level sections so the page breathes
     and individual cards stop competing for attention. */
  margin-bottom: 2.75rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 40px -10px rgba(249, 115, 22, 0.1);
}

.glass-sm {
  /* Nested glass tiles: lighter weight than the parent so the
     page doesn't read as glass-on-glass-on-glass. */
  padding: 1.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(234, 88, 12, 0.12);
}

.glass-flush {
  padding: 0;
  overflow: hidden;
}

/* ─── Hero ──────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 2rem 4rem;
  margin-bottom: 3rem;
}

.hero h1 {
  /* Scaled down from 4.5rem max — the longer "won't surprise you on the
     bill" headline reads as a sentence, not a slogan; smaller cap keeps
     it from dominating the viewport and lets the bullets breathe. */
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 880px;
  margin: 0 auto 1.25rem;
  /* Bright fallback if -webkit-background-clip:text fails (extensions,
     reader mode, force-dark). Without this it inherits the dark
     --orange-900 from the heading rule and reads as dark-on-dark. */
  color: var(--orange-600);
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600), var(--orange-700));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 2.5rem;
  font-weight: 400;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-meta {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  line-height: 1.7;
}

.hero-meta strong {
  color: var(--orange-900);
  font-weight: 600;
}

/* ─── Hero eyebrow + bullets (the new lede) ─────────────── */
.hero-eyebrow {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--orange-700);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
}

.hero-bullets {
  list-style: none;
  padding: 0;
  margin: 0 auto 2rem;
  max-width: 720px;
  text-align: left;
  display: grid;
  gap: 0.75rem;
}

.hero-bullets li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.5rem;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.hero-bullets li::before {
  content: "→";
  position: absolute;
  left: 1rem;
  top: 0.85rem;
  color: var(--orange-700);
  font-weight: 700;
}

.hero-bullets strong {
  color: var(--orange-900);
  font-weight: 600;
}

.hero-bullets code {
  font-size: 0.8em;
}

/* ─── <details> "more commands" ─────────────────────────── */
details.more-cmds {
  margin-top: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0;
  background: rgba(254, 215, 170, 0.15);
}

details.more-cmds summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--orange-700);
  user-select: none;
}

details.more-cmds summary::-webkit-details-marker {
  display: none;
}

details.more-cmds summary::before {
  content: "+ ";
  display: inline-block;
  width: 1em;
  font-weight: 700;
  color: var(--orange-700);
  transition: transform 0.15s ease;
}

details.more-cmds[open] summary::before {
  content: "− ";
}

details.more-cmds summary:hover {
  color: var(--orange-600);
}

details.more-cmds summary:focus-visible {
  outline: 2px solid var(--orange-600);
  outline-offset: 2px;
  border-radius: 6px;
}

details.more-cmds pre {
  margin: 0;
  border-radius: 0 0 10px 10px;
  border-top: 1px solid var(--border-subtle);
  border-left: none;
  border-right: none;
  border-bottom: none;
}

/* ─── Outcome cards (replaces 12-grid) ──────────────────── */
.outcome-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.5rem;
}

.outcome-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--orange-900);
  margin: 0;
}

.outcome-card p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.outcome-card .outcome-cli {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.8rem;
  border-top: 1px dashed var(--border-subtle);
}

.outcome-card .outcome-cli code {
  background: transparent;
  padding: 0;
  font-size: 0.95em;
  color: var(--orange-800);
}

/* ─── Release card (hero "what's new") ──────────────────── */
.release-card {
  margin: 2.5rem auto 0;
  padding: 1.25rem 1.5rem;
  background: rgba(249, 115, 22, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: left;
  max-width: 760px;
}

.release-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.release-card-title {
  font-weight: 600;
  color: var(--orange-900);
  font-size: 0.95rem;
}

.release-card-link {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--orange-700);
}

.release-card-list {
  margin: 0 0 0.85rem;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.release-card-list li {
  margin-bottom: 0.4rem;
}

.release-card-list li:last-child {
  margin-bottom: 0;
}

.release-card-prev {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: white;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
  /* Re-assert white — otherwise the global a:hover color turns the label
     orange-on-orange and unreadable. */
  color: #fff;
  box-shadow: 0 6px 24px rgba(249, 115, 22, 0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(249, 115, 22, 0.08);
  color: var(--orange-800);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.btn-ghost:hover {
  color: var(--orange-900);
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.35);
}

/* ─── Typography ────────────────────────────────────────── */
h1, h2, h3, h5, h6 {
  /* Warm dark — harmonizes with the creamsicle palette.
     8.82:1 on cream, 9.17:1 on .glass — still AAA. */
  color: var(--orange-900);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h4 {
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h2 {
  font-size: 2rem;
  font-weight: 800;
  /* More breathing room under section headings. */
  margin-bottom: 1.25rem;
}

h2 .accent { color: var(--orange-600); }

h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  /* Subsections within a section get a clear top break. */
  margin-top: 1.5rem;
}

h3:first-child { margin-top: 0; }

h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--orange-700);
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

p.lead {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

a {
  color: var(--orange-700);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--orange-600);
}

strong { color: var(--orange-900); font-weight: 600; }

/* ─── Code ──────────────────────────────────────────────── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  /* Softer inline-code chips — dense pages had tons of these and they
     fought the prose for attention. Lower-contrast bg + no border. */
  background: rgba(254, 215, 170, 0.45);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: #7c2d12;
}

pre {
  background: var(--bg-code);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #e7e5e4;
}

pre .comment { color: #a8a29e; }
pre .keyword { color: #fdba74; }
pre .string  { color: #86efac; }
pre .flag    { color: #fb923c; }

/* ─── Auto-highlighter (hl-* classes emitted by highlight.js) ─── */
/* Mapped to tracker's orange/amber/stone palette.
   Goal: auto-highlighted blocks read the same as hand-annotated
   ones (keyword/string/comment/flag) above. */
.hl-kw     { color: #fdba74; }           /* matches .keyword — workflow/agent/edges */
.hl-node   { color: #fcd34d; }           /* amber-300 — node names */
.hl-str    { color: #86efac; }           /* matches .string */
.hl-field  { color: #fdba74; }           /* field keys — orange-300 */
.hl-op     { color: #e7e5e4; }           /* arrows/ops — body text */
.hl-cmt    { color: #a8a29e; font-style: italic; } /* matches .comment */
.hl-bool   { color: #fb923c; }           /* orange-400 */
.hl-num    { color: #fb923c; }           /* orange-400 */
.hl-cond   { color: #fdba74; }           /* when/and/or — orange-300 */
.hl-prompt { color: #86efac; font-weight: 600; } /* $ prompt — green */
.hl-cmd    { color: #fdba74; }           /* command name — orange-300 */
.hl-flag   { color: #fb923c; }           /* matches .flag */
.hl-file   { color: #fcd34d; }           /* file paths — amber-300 */
.hl-pass   { color: #86efac; font-weight: 600; } /* PASS — green */
.hl-warn   { color: #fcd34d; font-weight: 600; } /* warning — amber */
.hl-fail   { color: #fca5a5; font-weight: 600; } /* FAIL — rose-300, muted red */
.hl-dim    { color: #78716c; }           /* stone-500 — help/source lines */
.hl-shcmd  { color: #e7e5e4; }           /* shell command body */
.hl-shvar  { color: #fcd34d; }           /* $VAR / ${var} — amber */
.hl-shkw   { color: #fdba74; }           /* if/then/for — orange-300 */

pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
}

/* ─── Grid Layouts ──────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Cards in a grid take their spacing from the grid gap, not their own margin —
   the base .glass margin-bottom (2.75rem) would otherwise stack on top of the
   gap and open a chasm between stacked cards on mobile. */
.grid-2 > .glass,
.grid-2 > .glass-sm,
.grid-3 > .glass,
.grid-3 > .glass-sm {
  margin-bottom: 0;
}

/* ─── Feature Card ──────────────────────────────────────── */
.feature-card {
  padding: 2rem;
}

.feature-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(234, 88, 12, 0.1));
  border: 1px solid rgba(249, 115, 22, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.feature-card p {
  font-size: 0.925rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ─── Stat Row ──────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.stat {
  text-align: center;
}

.stat .number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--orange-600);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat .label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}

/* ─── Tables ────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--orange-700);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(249, 115, 22, 0.04);
}

tbody td {
  padding: 0.75rem 1.25rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tbody tr:hover td {
  background: rgba(249, 115, 22, 0.03);
}

/* Responsive tables: below the mobile breakpoint, stack each row into a
   labeled card so wide tables are scannable vertically instead of forcing a
   horizontal scroll. The per-cell label comes from `data-label`, which the
   script in baseof.html auto-stamps from each column's <th> — so every table
   (current and future) gets this with no per-cell markup. No JS → the table
   keeps today's horizontal-scroll behavior (progressive enhancement). */
@media (max-width: 768px) {
  .table-wrap { overflow-x: visible; }

  /* Visually hide the header row but keep it in the DOM for the auto-label
     script and for assistive tech. */
  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table-wrap tr {
    display: block;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--bg-card);
    margin-bottom: 0.85rem;
    padding: 0.2rem 0.95rem;
  }

  .table-wrap tbody tr:hover td { background: transparent; }

  .table-wrap td {
    display: block;
    position: relative;
    padding: 0.6rem 0 0.6rem 38%;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    min-height: 1.4rem;
    /* Wrap long, unbreakable tokens (code, tokens, paths, URLs) so they never
       overflow the narrow value column on a phone. */
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .table-wrap td code { overflow-wrap: anywhere; word-break: break-word; }
  .table-wrap tr td:last-child { border-bottom: none; }

  .table-wrap td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 0.6rem;
    width: 34%;
    padding-right: 0.6rem;
    font-weight: 600;
    font-size: 0.7rem;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--orange-700);
    white-space: normal;
  }

  /* A cell with no header label (a table without <thead>) spans full width. */
  .table-wrap td:not([data-label]),
  .table-wrap td[data-label=""] { padding-left: 0; }
  .table-wrap td:not([data-label])::before,
  .table-wrap td[data-label=""]::before { content: none; }
}

/* ─── Diagram / Mermaid ─────────────────────────────────── */
.diagram {
  text-align: center;
  padding: 2rem 1rem;
  margin-bottom: 1.5rem;
}

.diagram .mermaid {
  display: block;
  width: 100%;
  overflow-x: auto;
}

.diagram .mermaid svg {
  max-width: 100%;
  height: auto !important;
  min-height: 500px;
}

/* ─── System layers diagram ────────────────────────────── */
/* Three lines per box, each with a distinct treatment.
   Mermaid renders HTML labels inside <foreignObject>; these classes
   target the spans we emit in architecture.html. */
.layers-key {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.diagram-layers .ly-name {
  font-weight: 700;
  color: var(--orange-900);
}

.diagram-layers .ly-path {
  display: inline-block;
  margin: 0.15em 0;
  padding: 0.05em 0.4em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82em;
  color: var(--orange-800);
  background: rgba(254, 215, 170, 0.45);
  border-radius: 3px;
}

.diagram-layers .ly-desc {
  font-size: 0.86em;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ─── Section Divider ───────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
  margin: 3rem 0;
}

/* ─── In-page Table of Contents ─────────────────────────── */
/* A row of pill links: distinct tap targets, clear affordance, and an active
   state driven by the scrollspy in baseof.html (highlights the section you're
   reading). "On this page" is a quiet label on its own line. */
.page-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem 1.15rem 1.1rem;
  margin: 0 0 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.page-toc strong {
  flex-basis: 100%;
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.page-toc a {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-secondary);
  background: var(--orange-50);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.page-toc a:hover {
  color: var(--orange-700);
  background: #fff;
  border-color: var(--orange-400);
  transform: translateY(-1px);
  text-decoration: none;
}

.page-toc a:focus-visible {
  outline: 2px solid var(--orange-600);
  outline-offset: 2px;
}

/* A workflow-name pill wraps its label in <code>; strip the inline-code chip so
   it reads as clean monospace inside the pill and follows the pill's color
   (including white when active) instead of a box-in-a-box. */
.page-toc a code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.92em;
}

/* The section currently in view — set by the scrollspy. */
.page-toc a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  border-color: var(--orange-600);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

@media (max-width: 768px) {
  /* Larger tap targets on touch screens. */
  .page-toc a { padding: 0.5rem 0.95rem; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .page-toc a { transition: none; }
  .page-toc a:hover { transform: none; }
}

/* Anchored headings should not be hidden by the fixed nav. */
section[id],
h2[id],
h3[id],
h4[id] {
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}

/* ─── Badge ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange-800);
  border: 1px solid rgba(249, 115, 22, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Workflow Card ─────────────────────────────────────── */
.workflow-card {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.workflow-card .wf-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--orange-700);
}

.workflow-card .wf-display {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.workflow-card .wf-goal {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── CLI Command ───────────────────────────────────────── */
.cli-cmd {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.03);
  border: 1px solid rgba(249, 115, 22, 0.08);
  margin-bottom: 0.75rem;
}

.cli-cmd code {
  white-space: nowrap;
  font-size: 0.85rem;
  background: #ffedd5;
  color: #9a3412;
  flex-shrink: 0;
}

.cli-cmd .desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Step List ─────────────────────────────────────────── */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 2rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-600), var(--orange-700));
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps li h4 {
  margin-bottom: 0.3rem;
}

.steps li p {
  font-size: 0.925rem;
}

/* ─── Footer ────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4rem;
}

.footer a {
  color: var(--orange-600);
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  main { padding-left: 1rem; padding-right: 1rem; }
  .glass { padding: 1.5rem; }
  .glass-sm { padding: 1.15rem; }
  .hero { padding: 3rem 1rem 2rem; }
  .hero h1 { font-size: 2.25rem; }

  /* Stack cards in one column with a tight gap — the desktop 1.5rem gap looks
     like a chasm once cards are full-width and stacked. */
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 0.85rem; }

  /* Diagrams: drop the desktop min-height (which letterboxed a scaled-down
     diagram into a tall band of whitespace) and trim padding. */
  .diagram { padding: 1.25rem 0.25rem; }
  .diagram .mermaid svg { min-height: 0; }

  /* Denser code blocks so more of each line is visible before scrolling. */
  pre { padding: 1rem; font-size: 0.78rem; }

  .stat-row { gap: 1.5rem; }
}
