/* Check Engine Chat — The Tuner.
   Design system: factory service manual (cream paper, ink, hairline rules)
   with dark backlit instrument panels inset like photo plates.
   One accent: check engine amber. No gradients, no glass, no blobs. */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --paper: #f5f0e4;
    --paper-deep: #ece5d2;
    --paper-edge: #e0d6bd;
    --ink: #1c1812;
    --ink-soft: #55503f;
    --ink-faint: #8a8268;
    --rule: #c8bd9e;
    --rule-soft: #dcd3b8;
    --amber: #ffb000;
    --amber-deep: #ff8c00;
    --amber-ink: #a35b00;
    --panel: #14110b;
    --panel-raised: #1d1910;
    --panel-line: #33291a;
    --good: #2e6e3a;
    --font-head: 'Archivo', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
    --maxw: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-head);
    background: var(--paper);
    color: var(--ink);
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ── Type ───────────────────────────────────────────────── */

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p  { color: var(--ink-soft); max-width: 62ch; }
a  { color: var(--amber-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); }

/* Section numbering, manual style */
.sec-head {
    display: flex; align-items: baseline; gap: 14px;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 10px; margin-bottom: 26px;
}
.sec-head .num {
    font-family: var(--font-mono); font-weight: 600;
    color: var(--amber-ink); font-size: 0.95rem; white-space: nowrap;
}
.sec-head h2 { text-transform: uppercase; letter-spacing: 0.02em; }

/* Stamped labels */
.stamp {
    display: inline-block; font-family: var(--font-mono); font-size: 0.72rem;
    font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
    border: 1.5px solid var(--ink); padding: 3px 10px; color: var(--ink);
    transform: rotate(-0.5deg); background: transparent;
}
.stamp.amber { border-color: var(--amber-ink); color: var(--amber-ink); }
.stamp.caution { border-color: #8a2f14; color: #8a2f14; }

/* Figure captions */
.fig-cap {
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint);
    margin-top: 10px; letter-spacing: 0.02em;
}

/* ── Nav: table of contents ─────────────────────────────── */

nav {
    border-bottom: 2px solid var(--ink);
    background: var(--paper);
    position: sticky; top: 0; z-index: 50;
}
.nav-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    position: relative;
}
.nav-brand {
    font-family: var(--font-mono); font-weight: 600; font-size: 1rem;
    color: var(--ink); letter-spacing: 0.02em;
}
.nav-brand .dot { color: var(--amber-deep); }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
    font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft);
    padding: 6px 10px; border: 1.5px solid transparent;
}
.nav-links a:hover { text-decoration: none; border-color: var(--rule); }
.nav-links a.active { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.nav-toggle { display: none; background: none; border: 1.5px solid var(--ink); font-size: 1.1rem; padding: 4px 10px; cursor: pointer; color: var(--ink); }

/* ── The dark instrument plate ──────────────────────────── */

.plate {
    background: var(--panel);
    border: 3px solid var(--ink);
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px var(--panel-line), inset 0 6px 24px rgba(0,0,0,0.55);
    padding: 28px;
    color: #d8cdb2;
}
.plate .lcd {
    font-family: var(--font-mono); color: var(--amber);
    text-shadow: 0 0 12px rgba(255,176,0,0.45);
}
.plate .lcd.dim { color: #7a6a3f; text-shadow: none; }

/* Hero dial */
.dial-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dial-band text { fill: #9b8c62; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em; }
.dial-band .tick { stroke: #55491f; stroke-width: 2; }
.dial-band .tick.major { stroke: var(--amber); }
.needle { transform-origin: 260px 240px; transition: transform 0.9s cubic-bezier(0.22, 1.4, 0.36, 1); }
.spectrum { display: flex; gap: 3px; align-items: flex-end; height: 46px; margin-top: 6px; }
.spectrum span {
    width: 6px; background: var(--amber); opacity: 0.85; height: 8%;
    box-shadow: 0 0 8px rgba(255,176,0,0.35); border-radius: 1px;
}

.start-btn {
    font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.12em;
    text-transform: uppercase; font-size: 0.82rem;
    color: var(--panel); background: var(--amber);
    border: 3px solid #3a2c00; border-radius: 999px;
    padding: 18px 22px; cursor: pointer;
    box-shadow: 0 0 0 6px #241d0d, 0 0 26px rgba(255,176,0,0.35);
}
.start-btn:hover { background: #ffc23d; }

/* ── Buttons on paper ───────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600;
    padding: 12px 20px; border: 2px solid var(--ink); color: var(--ink);
    letter-spacing: 0.03em; cursor: pointer; background: transparent;
}
.btn:hover { text-decoration: none; background: var(--paper-deep); }
.btn-fill { background: var(--ink); color: var(--paper); }
.btn-fill:hover { background: #322c20; }

/* ── Spec tables ────────────────────────────────────────── */

table.spec { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.spec th {
    font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em;
    text-transform: uppercase; text-align: left; color: var(--ink-faint);
    border-bottom: 2px solid var(--ink); padding: 8px 10px;
}
table.spec td { border-bottom: 1px solid var(--rule-soft); padding: 10px; vertical-align: top; }
table.spec td.mono, table.spec .val { font-family: var(--font-mono); font-size: 0.88rem; }

/* Dotted leader rows, like a manual index */
.leader { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; }
.leader .dots { flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.leader .val { font-family: var(--font-mono); font-weight: 600; }

/* ── Layout blocks ──────────────────────────────────────── */

section { padding: 56px 0; }
section.tight { padding: 34px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

.hero { padding: 64px 0 48px; border-bottom: 1px solid var(--rule); }
.hero .kicker { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber-ink); margin-bottom: 14px; }
.hero p.lede { font-size: 1.18rem; margin-top: 16px; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* Odometer stats */
.odo-row { display: flex; gap: 40px; flex-wrap: wrap; }
.odo { min-width: 150px; }
.odo .odo-num {
    font-family: var(--font-mono); font-weight: 600; font-size: 2rem;
    background: var(--panel); color: var(--amber); display: inline-block;
    padding: 4px 12px; border-radius: 4px; border: 2px solid var(--ink);
    text-shadow: 0 0 10px rgba(255,176,0,0.4); letter-spacing: 0.06em;
}
.odo .odo-label { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-faint); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.08em; }

/* Gauge cards (sounds page) */
.sound-card { border: 1.5px solid var(--ink); padding: 18px; background: var(--paper); }
.sound-card h3 { font-size: 1rem; }
.sound-card .sys { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.sound-card p { font-size: 0.9rem; margin-top: 8px; }
.sev { display: flex; gap: 3px; margin-top: 10px; }
.sev i { width: 14px; height: 6px; background: var(--rule); }
.sev.s1 i:nth-child(-n+1), .sev.s2 i:nth-child(-n+2), .sev.s3 i:nth-child(-n+3),
.sev.s4 i:nth-child(-n+4), .sev.s5 i:nth-child(-n+5) { background: var(--amber-deep); }
.wave { stroke: var(--amber-ink); stroke-width: 1.6; fill: none; opacity: 0.9; }
.reveal .wave { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.4s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Pricing */
.price-card { border: 2px solid var(--ink); padding: 26px; background: var(--paper); }
.price-card.featured { background: var(--paper-deep); box-shadow: 6px 6px 0 var(--ink); }
.price-amount { font-family: var(--font-mono); font-size: 2.4rem; font-weight: 600; margin: 8px 0 2px; }
.price-period { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint); }
.price-features { list-style: none; margin-top: 18px; }
.price-features li { padding: 8px 0; border-bottom: 1px dotted var(--rule); font-size: 0.95rem; }
.price-features li::before { content: "▸ "; color: var(--amber-ink); font-family: var(--font-mono); }

/* VIN plate footer */
footer { margin-top: 40px; border-top: 2px solid var(--ink); padding: 34px 0 44px; background: var(--paper-deep); }
.vin-plate {
    border: 2px solid var(--ink); border-radius: 6px; background: #ded3b6;
    padding: 18px 20px; font-family: var(--font-mono); font-size: 0.8rem;
    color: var(--ink-soft); display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 24px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.vin-plate b { color: var(--ink); font-weight: 600; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-family: var(--font-mono); font-size: 0.8rem; }

/* CAUTION strip */
.caution-strip {
    border: 2px solid var(--ink);
    background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, var(--panel) 14px 28px);
    height: 10px;
}

/* ── Responsive & motion ────────────────────────────────── */

@media (max-width: 820px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); border-bottom: 2px solid var(--ink); flex-direction: column; padding: 10px 24px 16px; }
    .nav-links.show { display: flex; }
    .nav-toggle { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .needle { transition: none; }
    .reveal .wave { animation: none; stroke-dashoffset: 0; }
}
