/* Jallarhorn public site — dark theme matches jallarhorn-control SPA.
   Design tokens driven by docs/design/tokens.json ("Argus Oversight"). */

:root {
  --bg:            #121414;   /* surface */
  --surface:       #1e2020;   /* surface-container */
  --surface-2:     #282a2b;   /* surface-high */
  --surface-hover: #333535;   /* surface-highest */
  --border:        #3e4850;   /* outline-variant */
  --border-strong: #87929b;   /* outline */
  --primary:       #00AEEF;   /* electric cyan */
  --primary-hover: #0a98d1;
  --primary-glow:  rgba(0, 174, 239, 0.25);
  --primary-dim:   rgba(0, 174, 239, 0.12);
  --amber:         #FF9900;   /* tertiary */
  --emerald:       #10b981;   /* success / healthy pill — outside Stitch primary palette but needed for status semantics */
  --red:           #ef4444;
  --text:          #e2e2e2;   /* on-surface */
  --text-muted:    #bdc8d1;   /* on-surface-variant */
  --text-dim:      #87929b;   /* outline */
  --shadow-lg:     0 20px 40px rgba(0, 0, 0, 0.5);
  --radius:        4px;        /* ROUND_FOUR */
  --radius-sm:     4px;
  --radius-xs:     2px;
  --content-max:   1200px;
  --content-narrow: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.6em;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1rem; }
p  { margin: 0 0 1em; }
code, pre, kbd, samp, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-variant-numeric: tabular-nums; }
code { background: var(--surface-2); padding: 0.12em 0.35em; border-radius: var(--radius-xs); font-size: 0.9em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.2rem; overflow-x: auto; font-size: 0.88rem; line-height: 1.5; white-space: pre; max-width: 100%; }
pre code { white-space: inherit; }
.docs-content pre { word-break: normal; overflow-wrap: normal; }
pre code { background: transparent; padding: 0; }
a { color: var(--primary); text-decoration: none; transition: color 150ms ease; }
a:hover { color: #5ec8f3; text-decoration: underline; }
img, svg { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
blockquote { border-left: 3px solid var(--primary); padding: 0.5rem 1.2rem; margin: 1.5rem 0; color: var(--text-muted); background: var(--surface); border-radius: var(--radius-sm); }

/* Layout */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.container-narrow { max-width: var(--content-narrow); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.small { font-size: 0.88rem; }
.lede  { font-size: 1.15rem; color: var(--text-muted); max-width: 640px; }
.eyebrow { text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.14em; font-weight: 600; color: var(--primary); margin-bottom: 0.8rem; display: inline-block; }
.mt-1 { margin-top: 0.5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }  .mt-4 { margin-top: 2.5rem; }  .mt-5 { margin-top: 4rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2.5rem; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(18, 20, 20, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { color: var(--primary); }
.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; transition: color 150ms ease; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: 0.5rem; border-radius: var(--radius-xs); }
.mobile-nav { display: none; background: var(--surface); border-top: 1px solid var(--border); padding: 0.5rem 1rem 1rem; flex-direction: column; gap: 0.6rem; }
.mobile-nav a { color: var(--text); padding: 0.7rem 0.5rem; border-radius: var(--radius-xs); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; border-radius: var(--radius-sm); padding: 0.7rem 1.2rem; font-weight: 600; font-size: 0.95rem; border: 1px solid transparent; cursor: pointer; transition: background 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #00344b; box-shadow: 0 0 0 1px rgba(0, 174, 239, 0.4), 0 8px 20px var(--primary-glow); font-weight: 700; }
.btn-primary:hover { background: var(--primary-hover); color: #00344b; box-shadow: 0 0 0 1px rgba(0, 174, 239, 0.6), 0 10px 24px var(--primary-glow); }
.topbar .btn-primary { background: var(--primary); color: #00344b !important; }
.topbar .nav a.btn-primary:hover { color: #00344b !important; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-dim); color: var(--primary); }
.btn-lg { padding: 0.9rem 1.6rem; font-size: 1rem; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 9vw, 6rem) 0 clamp(3rem, 6vw, 5rem); border-bottom: 1px solid var(--border); }
.hero::before { content: ''; position: absolute; inset: -50% -20% auto -20%; height: 120%; background: radial-gradient(ellipse at 50% 0%, rgba(0, 174, 239, 0.18), transparent 60%), radial-gradient(ellipse at 20% 30%, rgba(0, 174, 239, 0.06), transparent 50%); pointer-events: none; }
.hero > .container { position: relative; z-index: 1; }
.hero h1 { margin-bottom: 0.8rem; }
.hero .lede { font-size: clamp(1.05rem, 2.2vw, 1.25rem); max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 1.5rem 2rem; margin-top: 2.5rem; color: var(--text-muted); font-size: 0.88rem; }
.hero-proof strong { color: var(--text); font-weight: 600; }

/* Section */
section { padding: clamp(2.5rem, 5vw, 4.5rem) 0; }
section + section { border-top: 1px solid var(--border); }
.page-head { padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(2rem, 3vw, 2.5rem); border-bottom: 1px solid var(--border); text-align: left; }
.page-head .container-narrow,
.page-head .container { text-align: left; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 1.75rem; transition: border-color 150ms ease, background 150ms ease; }
.card:hover { border-color: var(--border-strong); }
.card h3 { margin-bottom: 0.5rem; }
.card .icon { color: var(--primary); margin-bottom: 0.9rem; display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; background: var(--primary-dim); border-radius: var(--radius-sm); }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Tables — wrap in .table-wrap for horizontal scroll on narrow viewports */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); margin: 1.25rem 0; }
.table-wrap .table { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 0.95rem; }
.table thead { background: var(--surface-2); }
.table th, .table td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-weight: 600; color: var(--text); font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface); }
.table-compact th, .table-compact td { padding: 0.55rem 0.75rem; font-size: 0.88rem; }
.table td .chk, .table td .xmk, .table td .partial { font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chk { color: var(--emerald); } .xmk { color: var(--red); } .partial { color: var(--amber); }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2rem; }
@media (max-width: 960px) { .pricing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem 1.5rem; display: flex; flex-direction: column; }
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-glow), 0 20px 40px rgba(0, 174, 239, 0.12); position: relative; }
.pricing-card.featured::before { content: 'Most popular'; position: absolute; top: -0.8rem; left: 50%; transform: translateX(-50%); background: var(--primary); color: #00344b; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; padding: 0.3rem 0.8rem; border-radius: 100px; }
.pricing-card h3 { font-size: 1.1rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.pricing-price { font-size: 2.5rem; font-weight: 700; margin: 0.3rem 0 0.2rem; letter-spacing: -0.02em; font-family: 'Space Grotesk', 'Inter', sans-serif; font-variant-numeric: tabular-nums; }
.pricing-price span { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.pricing-card .pricing-ceiling { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.2rem; }
.pricing-card ul { list-style: none; padding: 0; margin: 0 0 1.5rem; font-size: 0.92rem; }
.pricing-card ul li { position: relative; padding-left: 1.5rem; margin-bottom: 0.5rem; color: var(--text); }
.pricing-card ul li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 10px; height: 5px; border-left: 2px solid var(--emerald); border-bottom: 2px solid var(--emerald); transform: rotate(-45deg); }
.pricing-card .btn { margin-top: auto; }

/* Docs */
.docs-layout { display: grid; grid-template-columns: 240px 1fr; gap: 3rem; padding: 2.5rem 0 4rem; max-width: var(--content-max); margin: 0 auto; align-items: start; }
.docs-nav { position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 0.5rem; }
.docs-nav h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin: 1.4rem 0 0.5rem; font-weight: 700; }
.docs-nav h4:first-child { margin-top: 0; }
.docs-nav a { display: block; padding: 0.35rem 0; color: var(--text-muted); font-size: 0.93rem; border-left: 2px solid transparent; padding-left: 0.75rem; margin-left: -0.75rem; }
.docs-nav a:hover { color: var(--text); text-decoration: none; }
.docs-nav a.active { color: var(--primary); border-left-color: var(--primary); }
.docs-content { min-width: 0; }
.docs-content h1 { font-size: 2.2rem; margin-bottom: 1rem; }
.docs-content h2 { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 2rem; }
.docs-content h3 { margin-top: 1.8rem; }
.docs-content ul, .docs-content ol { padding-left: 1.5rem; }
.docs-content li { margin: 0.35rem 0; }
.docs-content pre { margin: 1.2rem 0; }
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; gap: 1.5rem; padding-left: clamp(1rem, 4vw, 2rem); padding-right: clamp(1rem, 4vw, 2rem); }
  .docs-nav { position: static; max-height: none; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; padding-right: 0; margin-left: 0; }
}
/* Default docs-layout gutter on desktop too — was 0 because max-width container inside docs-layout */
.docs-layout { padding-left: clamp(1rem, 4vw, 2rem); padding-right: clamp(1rem, 4vw, 2rem); }
/* Any .table at mobile/tablet should scroll — tables without a wrap still behave */
@media (max-width: 760px) {
  .table, .docs-content .table, section .table { display: block; overflow-x: auto; white-space: nowrap; }
  .table thead, .table tbody, .table tr { white-space: normal; }
  .table tr { display: table-row; }
  .table tbody td, .table thead th { white-space: normal; }
}

/* Footer */
.site-footer { background: #0c0f0f; border-top: 1px solid var(--border); padding: 3.5rem 0 2rem; margin-top: 4rem; font-size: 0.9rem; color: var(--text-muted); }
.footer-grid { display: grid; grid-template-columns: 2.2fr repeat(4, 1fr); gap: 2rem; }
.footer-brand .brand { font-size: 1.15rem; margin-bottom: 0.8rem; }
.footer-tagline { color: var(--text-muted); max-width: 300px; font-size: 0.88rem; }
.site-footer h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text); margin-bottom: 0.9rem; font-weight: 700; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 0.24rem 0; }
.site-footer ul a { color: var(--text-muted); font-size: 0.88rem; }
.site-footer ul a:hover { color: var(--text); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 1.25rem; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; }
.footer-legal { margin: 0 0 0.3rem; font-size: 0.82rem; color: var(--text-dim); }
.footer-legal + .footer-legal { color: var(--text-dim); }
.footer-built { margin: 0; font-size: 0.82rem; color: var(--text-dim); }
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-brand { grid-column: span 2; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { grid-column: span 1; }
}

/* Status dot */
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); margin-right: 0.5rem; vertical-align: middle; }
.status-dot.ok { background: var(--emerald); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.2); }
.status-dot.down { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

/* Mobile topbar collapse */
@media (max-width: 760px) {
  .nav { display: none; }
  .nav-toggle { display: block; }
}
.mobile-nav:not([hidden]) { display: flex; }

/* Accessibility */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-xs); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Utility: section intros */
.section-intro { text-align: center; max-width: 720px; margin: 0 auto 2.5rem; }
.section-intro h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); }

/* Code blocks with filename label */
.codefile { position: relative; margin: 1.2rem 0; }
.codefile .codefile-name { background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 0.4rem 0.9rem; font-size: 0.78rem; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.codefile pre { margin: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* 404 */
.error-page { text-align: center; padding: 6rem 1rem; }
.error-page h1 { font-size: clamp(3rem, 10vw, 6rem); margin-bottom: 1rem; color: var(--primary); }
.error-page p { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 2rem; }

/* Comparison (vs/X) */
.compare-hero { padding: 3rem 0 2rem; border-bottom: 1px solid var(--border); }
.compare-hero .source-note { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.compare-hero .source-note strong { color: var(--text); }
.compare-verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 2rem 0; }
@media (max-width: 760px) { .compare-verdict { grid-template-columns: 1fr; } }
.verdict-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; }
.verdict-card.jallarhorn { border-color: var(--primary); }
.verdict-card h3 { margin-top: 0; font-size: 1.1rem; }
.verdict-card ul { list-style: none; padding: 0; margin: 1rem 0 0; }
.verdict-card li { padding: 0.3rem 0 0.3rem 1.4rem; position: relative; font-size: 0.93rem; }
.verdict-card li::before { content: '→'; position: absolute; left: 0; color: var(--text-muted); }
.verdict-card.jallarhorn li::before { color: var(--primary); }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 100px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.badge-new { background: var(--primary-dim); color: var(--primary); }
.badge-soon { background: rgba(255, 153, 0, 0.15); color: var(--amber); }
.badge-planned { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
