/* LetMeSplain site — "a field manual read by lamplight."
   Identity tokens are from the committed brief (splain/docs/website-brief.md §3):
   warm near-black ground, paper-white ink, ONE amber torch accent, bookish serif
   display over quiet system sans. Green is reserved for validator-pass semantics
   only. Motion budget: the dot's breathing glow + the spotlight transition. */

:root {
    --ground: #1b191e;
    --panel: #242229;
    --line: #37343d;
    --ink: #ece7dd;
    --muted: #9a938b;
    --torch: #f0a441;
    --torch-deep: #c77f1f;
    --check: #56b795;

    --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Charter, Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

    /* The ENGINE's absorption vars (Filament-style RGB triplets). Defaults = the
       site's own identity, so the site tour's popover wears the field manual;
       the hero's theme buttons overwrite these live — same mechanism a Filament
       host uses, which is the whole point of the demo. */
    --gray-100: 236, 231, 221;
    --gray-300: 154, 147, 139;
    --gray-400: 154, 147, 139;
    --gray-900: 36, 34, 41;
    --gray-950: 27, 25, 30;
    --primary-400: 244, 183, 100;
    --primary-500: 240, 164, 65;
    --primary-600: 199, 127, 31;
    --font-family: var(--sans);

    /* The mock admin's own tokens default to the field manual — it stays undressed
       (and readable) until a theme button dresses it as a host. */
    --demo-bg: 27, 25, 30;
    --demo-panel: 36, 34, 41;
    --demo-ink: 236, 231, 221;
    --demo-accent-ink: 244, 183, 100; /* accent AS TEXT: light shade on dark panels, dark on light */
    --demo-btn-ink: 36, 34, 41; /* ink ON the accent button: dark on amber; themes set white */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font: 400 16.5px/1.65 var(--sans);
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(240, 164, 65, 0.28); }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.005em; text-wrap: balance; }

a { color: var(--torch); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Links inside running text must be distinguishable without color (WCAG 1.4.1) —
   chrome links (nav, buttons, sidebar, wordmark) carry their own affordances. */
p a, li a, figcaption a, .docs-body a:not(h2 a):not(h3 a) {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(240, 164, 65, 0.55);
}
a:focus-visible, button:focus-visible { outline: 2px solid var(--torch); outline-offset: 2px; border-radius: 2px; }

code, pre, .eyebrow { font-family: var(--mono); }

/* ── Shared page furniture ─────────────────────────────────────────────── */

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.5rem; }

.site-head {
    border-bottom: 1px solid var(--line);
    background: rgba(27, 25, 30, 0.92);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 30;
}

.site-head .wrap { display: flex; align-items: baseline; gap: 2rem; padding-top: 0.95rem; padding-bottom: 0.95rem; }

.wordmark { font-family: var(--serif); font-size: 1.25rem; color: var(--ink); }
.wordmark b { color: var(--torch); font-weight: 500; }
.wordmark:hover { text-decoration: none; }

.site-nav { display: flex; gap: 1.4rem; margin-left: auto; font-size: 0.92rem; }
.site-nav a { color: var(--muted); }
.site-nav a[aria-current='page'], .site-nav a:hover { color: var(--ink); text-decoration: none; }

.eyebrow {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--torch);
    margin-bottom: 0.9rem;
}
.eyebrow::before { content: 'data-splain="'; color: var(--muted); }
.eyebrow::after { content: '"'; color: var(--muted); }

section { padding: 4.5rem 0; border-bottom: 1px solid var(--line); }

/* ── Honest-scope box: honesty as a first-class component ──────────────── */

.honest {
    border: 1px solid rgba(240, 164, 65, 0.45);
    border-left-width: 3px;
    border-radius: 0.4rem;
    background: rgba(240, 164, 65, 0.06);
    padding: 0.9rem 1.1rem;
    font-size: 0.92rem;
    color: var(--ink);
    max-width: 46rem;
}
.honest b { color: var(--torch); font-weight: 600; }

/* ── Hero ──────────────────────────────────────────────────────────────── */

/* Longhand on purpose: shorthand would clobber .wrap's horizontal padding. */
.hero { padding-top: 5.5rem; padding-bottom: 4.5rem; border-bottom: 1px solid var(--line); }

.hero h1 {
    font-size: clamp(2.3rem, 5.4vw, 3.6rem);
    line-height: 1.12;
    margin: 0 0 1.1rem;
    max-width: 15em;
}
.hero h1 em { font-style: italic; color: var(--torch); }

.hero .support { color: var(--muted); max-width: 38em; font-size: 1.08rem; margin: 0 0 2rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }

.btn {
    display: inline-block;
    font: 600 0.95rem/1 var(--sans);
    padding: 0.8rem 1.25rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn-torch { background: var(--torch); color: #241a08; }
.btn-torch:hover { background: #f4b764; text-decoration: none; }
.btn-quiet { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-quiet:hover { border-color: var(--muted); text-decoration: none; }

/* ── The "wears your clothes" demo ─────────────────────────────────────── */

.demo-shell { margin-top: 3.2rem; }

.theme-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.theme-row .label { font-size: 0.85rem; color: var(--muted); margin-right: 0.4rem; }

.theme-btn {
    font: 500 0.85rem/1 var(--sans);
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 2rem;
    padding: 0.5rem 0.95rem 0.5rem 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.theme-btn .swatch { width: 0.85rem; height: 0.85rem; border-radius: 50%; display: inline-block; }
.theme-btn[aria-pressed='true'] { border-color: var(--torch); color: var(--ink); }

/* The mock admin reads the SAME absorption vars the engine does. */
.mock-admin {
    --m-bg: rgb(var(--demo-bg));
    --m-panel: rgb(var(--demo-panel));
    --m-line: rgba(var(--demo-ink), 0.12);
    --m-ink: rgb(var(--demo-ink));
    --m-muted: rgba(var(--demo-ink), 0.66);
    --m-accent: rgb(var(--primary-600));

    background: var(--m-bg);
    color: var(--m-ink);
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    overflow: hidden;
    font-family: var(--sans);
    font-size: 0.88rem;
    box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.55);
}

.mock-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--m-line);
    background: var(--m-panel);
}
.mock-brand { font-weight: 700; }
.mock-brand .dot-i { color: var(--m-accent); }
.mock-search {
    margin-left: auto;
    background: var(--m-bg);
    border: 1px solid var(--m-line);
    color: var(--m-muted);
    border-radius: 0.4rem;
    padding: 0.4rem 0.7rem;
    min-width: 10rem;
    font-size: 0.82rem;
}

.mock-body { display: grid; grid-template-columns: 11rem 1fr; min-height: 17rem; }

.mock-side { border-right: 1px solid var(--m-line); padding: 0.9rem 0; background: var(--m-panel); }
.mock-side a { display: block; color: var(--m-muted); padding: 0.45rem 1rem; font-size: 0.84rem; }
.mock-side a.on { color: rgb(var(--demo-accent-ink)); background: rgba(var(--primary-600), 0.09); border-right: 2px solid var(--m-accent); }
.mock-side a:hover { text-decoration: none; }

.mock-main { padding: 1rem 1.2rem 1.4rem; }
.mock-main h3 { font-family: var(--sans); font-size: 1.02rem; margin: 0.2rem 0 0.9rem; font-weight: 650; }

.mock-toolbar { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.mock-new {
    margin-left: auto;
    background: var(--m-accent);
    color: rgb(var(--demo-btn-ink));
    border: 0;
    border-radius: 0.45rem;
    font: 600 0.84rem/1 var(--sans);
    padding: 0.55rem 0.9rem;
    cursor: pointer;
}

.mock-table { width: 100%; border-collapse: collapse; background: var(--m-panel); border: 1px solid var(--m-line); border-radius: 0.5rem; overflow: hidden; }
.mock-table th, .mock-table td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--m-line); }
.mock-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--m-muted); }
.mock-table tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 1rem; font-size: 0.72rem; font-weight: 600; background: rgba(var(--primary-600), 0.14); color: rgb(var(--demo-accent-ink)); }

.demo-note { margin-top: 0.9rem; font-size: 0.88rem; color: var(--muted); max-width: 44em; }

/* ── Feature beats ─────────────────────────────────────────────────────── */

.beats { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.1rem; margin-top: 2.2rem; }

.beat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    padding: 1.3rem 1.4rem;
}
.beat h3 { font-size: 1.12rem; margin: 0 0 0.5rem; }
.beat p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.beat code { font-size: 0.85em; color: var(--ink); background: rgba(0, 0, 0, 0.28); border-radius: 4px; padding: 0.08em 0.35em; }

/* ── Code / quickstart ─────────────────────────────────────────────────── */

pre {
    background: #141317;
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    padding: 1.1rem 1.3rem;
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.6;
}
pre code { background: none; padding: 0; }
.code-caption { font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }

/* ── Pricing posture ───────────────────────────────────────────────────── */

.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.1rem; margin-top: 2rem; max-width: 46rem; }
.tier { background: var(--panel); border: 1px solid var(--line); border-radius: 0.6rem; padding: 1.4rem 1.5rem; }
.tier h3 { margin: 0 0 0.2rem; font-size: 1.3rem; }
.tier .who { color: var(--muted); font-size: 0.88rem; margin: 0 0 1rem; }
.tier ul { margin: 0; padding-left: 1.1rem; color: var(--ink); font-size: 0.93rem; }
.tier li { margin: 0.35rem 0; }
.tier li::marker { color: var(--torch); }

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-foot { padding: 2.6rem 0 3.2rem; color: var(--muted); font-size: 0.88rem; }
.site-foot .wink { font-family: var(--serif); font-style: italic; }

/* ── Docs shell ────────────────────────────────────────────────────────── */

/* Longhand on purpose (same trap as .hero): shorthand clobbers .wrap's side padding. */
.docs-grid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; align-items: start; padding-top: 2.6rem; padding-bottom: 4rem; }

.docs-side { position: sticky; top: 4.4rem; font-size: 0.9rem; }
.docs-side .side-title { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.docs-side a { display: block; color: var(--muted); padding: 0.28rem 0; }
.docs-side a[aria-current='page'] { color: var(--torch); }
.docs-side a:hover { color: var(--ink); text-decoration: none; }

.docs-body { max-width: 46rem; }
.docs-body h1 { font-size: 2.1rem; margin-top: 0; }
.docs-body h2 { font-size: 1.45rem; margin-top: 2.4rem; border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; }
.docs-body h3 { font-size: 1.12rem; margin-top: 1.8rem; }
.docs-body h2 a, .docs-body h3 a { color: inherit; }
.docs-body img { max-width: 100%; border: 1px solid var(--line); border-radius: 0.5rem; }
.docs-body table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 0.9rem; }
.docs-body th, .docs-body td { border: 1px solid var(--line); padding: 0.5rem 0.75rem; text-align: left; }
.docs-body th { background: var(--panel); }
.docs-body blockquote { margin: 1.2rem 0; padding: 0.2rem 1.1rem; border-left: 3px solid rgba(240, 164, 65, 0.45); background: rgba(240, 164, 65, 0.05); border-radius: 0 0.4rem 0.4rem 0; }
.docs-body code { background: rgba(0, 0, 0, 0.28); border-radius: 4px; padding: 0.08em 0.35em; font-size: 0.88em; }
.docs-body pre code { background: none; padding: 0; font-size: 1em; }
.docs-body hr { border: 0; border-top: 1px solid var(--line); margin: 2.2rem 0; }

/* highlight.js — tokens tuned to the identity (no external theme). */
.hljs-comment, .hljs-quote { color: #9a9289; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-meta { color: #d9a0e8; }
.hljs-string, .hljs-attr { color: #b5c98e; }
.hljs-number, .hljs-literal { color: #e8b26a; }
.hljs-title, .hljs-name, .hljs-built_in { color: #8fbfdc; }
.hljs-variable, .hljs-template-variable { color: var(--ink); }

/* ── Screenshots strip ─────────────────────────────────────────────────── */

.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.1rem; margin-top: 2rem; }
.shot { margin: 0; }
.shot img { width: 100%; border: 1px solid var(--line); border-radius: 0.55rem; display: block; }
.shot figcaption { font-size: 0.83rem; color: var(--muted); margin-top: 0.5rem; }

/* ── Motion: the entire budget ─────────────────────────────────────────── */

@keyframes dot-breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 164, 65, 0.35); }
    50% { box-shadow: 0 0 0 9px rgba(240, 164, 65, 0); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}

/* ── Small screens ─────────────────────────────────────────────────────── */

@media (max-width: 760px) {
    .mock-body { grid-template-columns: 1fr; }
    .mock-side { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--m-line); padding: 0; }
    .mock-side a.on { border-right: 0; border-bottom: 2px solid var(--m-accent); }
    /* minmax(0,…): a bare 1fr track's min-content floor lets wide code blocks
       push the column past the viewport. */
    .docs-grid { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
    .docs-side { position: static; display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
    .docs-side .side-title { width: 100%; }
    .site-nav { gap: 1rem; }
}

/* ── The dot wears the torch (and, during the demo, the host's accent) ──── */

[data-splain-dot] {
    background: rgb(var(--primary-600)) !important;
    animation: dot-breathe 3.4s ease-in-out infinite;
}

/* Theme flips stay live DURING the walkthrough — the point of the demo. driver.css
   sets pointer-events:none under .driver-active and its overlay covers the page;
   exempt the theme row exactly the way the product's own Studio panel exempts
   itself. (The popover re-skins live because the tokens are CSS variables.) */
body.driver-active .theme-row { position: relative; z-index: 10010; }
body.driver-active .theme-row, body.driver-active .theme-row * { pointer-events: auto; }
