/* ============================================================
    EBD RACING — Main Stylesheet
    Engineered By Design · Gareth Knopp · 2026 29/03/26
    Updated 03/04/2026
    Updated 05/04/2026 (added styles for 986 electrical faults documentation page) 
      - needs review of all pages independantly and cleanup consolodation
   ============================================================ */

/* ── VARIABLES ── */
:root {
    --bg:       #0d0d0d;
    --surface:  #1a1a1a;
    --surface2: #222;
    --accent:   #e8512a;
    --accent2:  #ff6b3d;
    --text:     #f0f0f0;
    --muted:    #888;
    --border:   #2a2a2a;
    --font:     'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── RESET ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── BASE ── */
body {
    background:  var(--bg);
    color:       var(--text);
    font-family: var(--font);
    line-height: 1.6;
    font-size:   16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--border); }
img { max-width: 100%; height: auto; }

/* ── CSS LOGO (fallback) ── */
.ebd-logo { display: flex; flex-direction: column; text-decoration: none; }
.ebd-logo .l1 { line-height: 1; letter-spacing: 0.02em; color: var(--text); }
.ebd-logo .l1 strong { font-weight: 900; }
.ebd-logo .l1 span   { font-weight: 300; }
.ebd-logo .l2 { font-weight: 400; letter-spacing: 0.38em; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.logo-nav    .l1 { font-size: 1.05rem; }
.logo-nav    .l2 { font-size: 0.48rem; }
.logo-hero   .l1 { font-size: 2.4rem; }
.logo-hero   .l2 { font-size: 0.75rem; margin-top: 4px; }
.logo-footer .l1 { font-size: 0.85rem; }
.logo-footer .l2 { font-size: 0.40rem; }

/* ── IMAGE LOGO ── */
img.logo-nav    { height: 36px; width: auto; filter: invert(1); }
img.logo-hero   { max-width: 480px; width: 100%; filter: invert(1); margin-bottom: 1.5rem; }
img.logo-footer { height: 28px; width: auto; filter: invert(1); }

/* ── NAV ── */
nav {
    position:        fixed;
    top: 0; left: 0; right: 0;
    z-index:         100;
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         0.85rem 2.5rem;
    background:      rgba(13,13,13,0.94);
    backdrop-filter: blur(12px);
    border-bottom:   1px solid var(--border);
}
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
    color:           var(--muted);
    text-decoration: none;
    font-size:       0.78rem;
    letter-spacing:  0.08em;
    text-transform:  uppercase;
    transition:      color 0.2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--accent); text-decoration: none; }

/* ── HAMBURGER BUTTON ── */
.nav-toggle {
    display:        none;
    flex-direction: column;
    justify-content: center;
    gap:            5px;
    background:     none;
    border:         none;
    cursor:         pointer;
    padding:        4px;
    z-index:        200;
}
.nav-toggle span {
    display:          block;
    width:            24px;
    height:           2px;
    background:       var(--text);
    border-radius:    2px;
    transition:       transform 0.25s, opacity 0.25s;
}
/* Animate to X when open */
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
    .nav-toggle { display: flex; }

    .nav-links {
        display:        none;
        position:       fixed;
        top:            57px; /* height of nav bar */
        left: 0; right: 0;
        background:     rgba(13,13,13,0.97);
        backdrop-filter: blur(12px);
        flex-direction: column;
        gap:            0;
        border-bottom:  1px solid var(--border);
        z-index:        99;
    }
    .nav-links.open { display: flex; }
    .nav-links li { border-bottom: 1px solid var(--border); }
    .nav-links a {
        display:  block;
        padding:  1rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* ── PAGE WRAPPER ── */
.page-wrap { padding-top: 3.5rem; }

/* ── HERO ── */
.hero {
    min-height:  70vh;
    display:     flex;
    align-items: center;
    padding:     3rem 2.5rem 2rem;
    position:    relative;
    overflow:    hidden;
}
.hero::before {
    content:  '';
    position: absolute;
    inset:    0;
    background:
        radial-gradient(ellipse at 65% 45%, rgba(232,81,42,0.12) 0%, transparent 58%),
        repeating-linear-gradient(0deg,  transparent, transparent 70px, rgba(255,255,255,0.013) 70px, rgba(255,255,255,0.013) 71px),
        repeating-linear-gradient(90deg, transparent, transparent 70px, rgba(255,255,255,0.013) 70px, rgba(255,255,255,0.013) 71px);
}
.hero-inner { position: relative; max-width: 800px; }

/* ── HERO TAGLINE ── */
.hero-tagline {
    font-size:      clamp(2.2rem, 4.5vw, 3.6rem);
    font-weight:    900;
    line-height:    1.05;
    letter-spacing: -2px;
    margin:         1.5rem 0 2rem;
}
.hero-tagline em { font-style: normal; color: var(--accent); }

/* ── HERO TAG (small subtitle) ── */
.hero-tag {
    color:         var(--muted);
    font-size:     1rem;
    line-height:   1.75;
    margin-bottom: 2rem;
    max-width:     520px;
}

/* ── HERO STATS ── */
.hero-stats {
    display:       inline-flex;
    border:        1px solid var(--border);
    border-radius: 2px;
    overflow:      hidden;
    margin-bottom: 2rem;
}
.hstat {
    padding:      0.85rem 1.4rem;
    border-right: 1px solid var(--border);
}
.hstat:last-child { border-right: none; }
.hstat span {
    font-size:      1.4rem;
    font-weight:    900;
    letter-spacing: -1px;
    line-height:    1;
    display:        block;
    color:          var(--text);
}
.hstat small {
    font-size:      0.6rem;
    color:          var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top:     0.2rem;
    display:        block;
}

/* ── HERO CTAS ── */
.hero-ctas { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }

/* ── BUTTONS ── */
.btn {
    padding:         0.7rem 1.6rem;
    border-radius:   2px;
    font-size:       0.78rem;
    font-weight:     700;
    letter-spacing:  0.08em;
    text-transform:  uppercase;
    text-decoration: none;
    cursor:          pointer;
    border:          none;
    display:         inline-block;
    font-family:     var(--font);
    transition:      all 0.2s;
}
.btn-p       { background: var(--accent); color: #fff; }
.btn-p:hover { background: var(--accent2); transform: translateY(-1px); text-decoration: none; color: #fff; }
.btn-s       { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-s:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-g       { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-g:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── SECTIONS ── */
section { padding: 3.5rem 2.5rem; max-width: 1200px; margin: 0 auto; }
.sec-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); max-width: 100%; }
.sec-alt > * { max-width: 1200px; margin-left: auto; margin-right: auto; }
.sec-label { font-size: 0.68rem; color: var(--accent); letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 0.5rem; }
.sec-title { font-size: clamp(1.4rem, 2.5vw, 1.9rem); font-weight: 800; letter-spacing: -0.5px; margin-bottom: 1rem; }
.sec-sub   { color: var(--muted); margin-bottom: 2.25rem; font-size: 0.88rem; max-width: 540px; }

/* ── ABOUT ── */
.about-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.about-text p { color: var(--muted); margin-bottom: 0.9rem; font-size: 0.88rem; line-height: 1.8; }
.about-cards  { display: flex; flex-direction: column; gap: 0.6rem; }

/* ── ACARDS ── */
.acard       { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1rem 1.2rem; display: flex; gap: 1rem; align-items: flex-start; }
.acard-icon  { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.acard h3    { font-size: 0.88rem; margin-bottom: 0.25rem; }
.acard p     { color: var(--muted); font-size: 0.8rem; line-height: 1.6; margin: 0; }
a.acard       { transition: border-color 0.2s; }
a.acard:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }

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

/* ── CAR CARDS ── */
.car-card       { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1.1rem; transition: border-color 0.2s; }
.car-card:hover { border-color: var(--accent); }
.car-label      { font-size: 0.62rem; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.35rem; }
.car-card h3    { font-size: 0.9rem; margin-bottom: 0.3rem; }
.car-card p     { color: var(--muted); font-size: 0.78rem; line-height: 1.6; margin: 0; }

/* ── PROJECT CARDS ── */
.pcard       { background: var(--surface); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; transition: border-color 0.2s, transform 0.2s; }
.pcard:hover { border-color: var(--accent); transform: translateY(-2px); }
.pimg        { height: 110px; background: linear-gradient(135deg, #1c1c1c, #252525); display: flex; align-items: center; justify-content: center; font-size: 2rem; border-bottom: 1px solid var(--border); }
.pbody       { padding: 1rem; }
.pcat        { font-size: 0.62rem; color: var(--accent); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.35rem; }
.pbody h3    { font-size: 0.88rem; margin-bottom: 0.35rem; }
.pbody p     { color: var(--muted); font-size: 0.78rem; line-height: 1.6; margin: 0; }
.plink       { display: inline-block; margin-top: 0.65rem; color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.plink:hover { text-decoration: underline; }
.pcard--soon       { opacity: 0.45; pointer-events: none; cursor: default; }
.pcard--soon:hover { border-color: var(--border); transform: none; }

/* ── DIAGNOSTICS CTA ── */
.sec-inner-cta { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }

/* ── TOOLS GROUPS ── */
.tools-group-label {
    font-size:      0.68rem;
    color:          var(--accent);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom:  0.9rem;
    margin-top:     0.25rem;
    padding-bottom: 0.5rem;
    border-bottom:  1px solid var(--border);
}

/* ── TOOL CARDS ── */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tool-card {
    background:      var(--bg);
    border:          1px solid var(--border);
    border-radius:   3px;
    padding:         1.1rem;
    text-decoration: none;
    color:           var(--text);
    display:         block;
    transition:      border-color 0.2s;
}
.tool-card:hover         { border-color: var(--accent); text-decoration: none; }
.tool-card .tool-cat     { font-size: 0.65rem; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.35rem; }
.tool-card h3            { font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--text); }
.tool-card p             { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin: 0; }
.tool-card--soon         { opacity: 0.45; cursor: default; pointer-events: none; }
.tool-card--soon:hover   { border-color: var(--border); }

/* ── OLD TOOLS GRID (6-col, kept for compatibility) ── */
.tcard       { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1rem; text-decoration: none; color: var(--text); display: block; transition: border-color 0.2s; }
.tcard:hover { border-color: var(--accent); }
.ticon       { font-size: 1.3rem; margin-bottom: 0.4rem; }
.tcard h4    { font-size: 0.82rem; margin-bottom: 0.2rem; }
.tcard p     { color: var(--muted); font-size: 0.72rem; }

/* ── DTC GRID ── */
.dtc-grid       { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.dtc-item       { background: var(--surface); border: 1px solid var(--border); border-radius: 2px; padding: 0.7rem 0.85rem; font-size: 0.78rem; line-height: 1.55; transition: border-color 0.2s; text-decoration: none; color: var(--text); display: block; }
.dtc-item:hover { border-color: var(--accent); }
.dtc-item span  { color: var(--accent); font-weight: 700; font-size: 0.65rem; display: block; margin-bottom: 0.15rem; letter-spacing: 0.1em; }

/* ── INSTAGRAM ── */
.ig-grid     { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.ig-cell     { aspect-ratio: 1; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--muted); overflow: hidden; }
.ig-cell img { width: 100%; height: 100%; object-fit: cover; }
.ig-note     { margin-top: 1rem; text-align: center; color: var(--muted); font-size: 0.82rem; }
.ig-note a   { color: var(--accent); }

/* ── CONTACT ── */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.cinfo p      { color: var(--muted); font-size: 0.88rem; line-height: 1.8; margin-bottom: 1rem; }
.cdet         { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.6rem; color: var(--muted); font-size: 0.85rem; }
.cdet-icon    { color: var(--accent); }

/* ── FORMS ── */
form           { display: flex; flex-direction: column; gap: 0.7rem; }
input, textarea, select {
    background:    var(--surface);
    border:        1px solid var(--border);
    color:         var(--text);
    padding:       0.65rem 0.9rem;
    border-radius: 2px;
    font-family:   var(--font);
    font-size:     0.88rem;
    transition:    border-color 0.2s;
    outline:       none;
    width:         100%;
}
input:focus,
textarea:focus,
select:focus   { border-color: var(--accent); }
textarea       { resize: vertical; min-height: 100px; }
.form-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-field    { display: flex; flex-direction: column; gap: 0.3rem; }
.form-field label { font-size: 0.78rem; color: var(--muted); }
.form-success  { background: rgba(76,175,80,0.1); border: 1px solid #4caf50; border-radius: 3px; padding: 0.7rem 1rem; color: #4caf50; margin-bottom: 1.25rem; font-size: 0.85rem; }
.form-error    { background: rgba(232,81,42,0.1); border: 1px solid var(--accent); border-radius: 3px; padding: 0.7rem 1rem; color: var(--accent); margin-bottom: 1.25rem; font-size: 0.85rem; }
.alert         { padding: 0.75rem 1rem; border-radius: 2px; margin-bottom: 0.9rem; font-size: 0.85rem; }
.alert-success { background: rgba(30,180,100,0.12); border: 1px solid rgba(30,180,100,0.3); color: #4caf82; }
.alert-error   { background: rgba(232,81,42,0.10); border: 1px solid rgba(232,81,42,0.3); color: var(--accent); }

/* ── INNER PAGES ── */
.page-header          { padding: 2rem 2.5rem 1.5rem; border-bottom: 1px solid var(--border); }
.page-header .sec-label { font-size: 0.68rem; color: var(--accent); letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 0.4rem; }
.page-header h1       { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.5px; }
.page-content         { max-width: 1200px; margin: 0 auto; padding: 2rem 2.5rem; overflow-x: hidden; }
.page-content p       { color: var(--muted); font-size: 0.88rem; line-height: 1.8; margin-bottom: 0.9rem; }
.page-content h2      { font-size: 1.1rem; font-weight: 700; margin: 1.75rem 0 0.65rem; }
.page-content h3      { font-size: 0.95rem; font-weight: 700; margin: 1.25rem 0 0.4rem; color: var(--accent); }

/* ── RAL COLOURS ── */
.ral-grid        { display: grid; grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 0.65rem; }
.ral-swatch      { border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.ral-color       { height: 46px; width: 100%; display: block; }
.ral-label       { padding: 0.35rem 0.45rem; background: var(--surface); font-size: 0.7rem; color: var(--muted); text-align: center; line-height: 1.4; }
.ral-label strong { display: block; color: var(--text); font-size: 0.72rem; }
.ral-section     { margin-bottom: 2rem; }
.ral-section h2  { font-size: 0.85rem; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 0.85rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--border); }

/* ── FOOTER ── */
footer       { border-top: 1px solid var(--border); padding: 1.5rem 2.5rem; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.76rem; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
footer a     { color: var(--muted); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {

    .hero                         { padding: 5rem 1.5rem 2.5rem; }
    .about-grid, .contact-grid    { grid-template-columns: 1fr; gap: 1.5rem; }
    .grid-3                       { grid-template-columns: 1fr 1fr; }
    .tools-grid                   { grid-template-columns: repeat(2, 1fr); }
    .dtc-grid                     { grid-template-columns: repeat(2, 1fr); }
    .ig-grid                      { grid-template-columns: repeat(3, 1fr); }
    section                       { padding: 2.5rem 1.5rem; }
    .page-header                  { padding: 1.5rem; }
    .page-content                 { padding: 1.5rem; }
    footer                        { flex-direction: column; text-align: center; }
    .sec-inner-cta                { flex-direction: column; align-items: flex-start; }
    .form-row                     { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .grid-3                       { grid-template-columns: 1fr; }
    .tools-grid                   { grid-template-columns: 1fr; }
    .hero-tagline                 { letter-spacing: -1px; }
    .hero-stats                   { flex-wrap: wrap; }
    .dtc-grid                     { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   COMPONENT LIBRARY — shared across tool and content pages
   Consolidated from page-level inline styles 2026
   ============================================================ */

/* ── CALC CARD ───────────────────────────────────────────────
   Replaces: .rf-card, .bsfc-card, .tb-card, .da-card,
             .chassis-card, .tyre-card, .pt-card, .lube-calc
   Usage: <div class="calc-card"> */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.5rem;
  margin-bottom: 0.75rem;
}
.calc-card h3 {
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ── CALC SECTION ────────────────────────────────────────────
   Replaces: .rf-section, .bsfc-section, .bt-section, .da-section
   Usage: <div class="calc-section"> */
.calc-section        { margin-bottom: 3rem; }
.calc-section-header { margin-bottom: 1.25rem; }

/* ── CALC FIELD ──────────────────────────────────────────────
   Replaces: .rf-field, .bsfc-field, .tb-field, .da-field,
             .chassis-field, .tyre-field, .pt-field, .lube-field
   Usage: <div class="calc-field"> */
.calc-field          { margin-bottom: 0.75rem; }
.calc-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.calc-field input,
.calc-field select   { width: 100%; }
.calc-field .hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-style: italic;
}

/* ── CALC INPUT GRIDS ────────────────────────────────────────
   Replaces: .rf-grid-2/3/4, .bsfc-grid-3/4/5, .tb-grid-2/3/4
   Usage: <div class="calc-grid-2"> etc */
.calc-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.calc-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; align-items: end; }
.calc-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; align-items: end; }
.calc-grid-5 { display: grid; grid-template-columns: repeat(5,1fr); gap: 1rem; align-items: end; }

/* ── STAT RESULT BOX ─────────────────────────────────────────
   Canonical result display box. r-val = big number, r-sub = label.
   Optional modifiers: .r-good (green), .r-warn (amber), .r-bad (red)
   Replaces: .bsfc-result, .tb-result, .rf-result-box, .pt-result,
             .lube-result (all stat-box variants)
   Usage: <div class="stat-box"> */
.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.75rem 1rem;
}
.stat-box .r-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.5px;
  line-height: 1;
}
.stat-box .r-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.stat-box .r-context {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.stat-box.r-good .r-val { color: #4caf50; }
.stat-box.r-warn .r-val { color: #d4a017; }
.stat-box.r-bad  .r-val { color: #e05a2a; }

/* ── STAT RESULTS ROW ────────────────────────────────────────
   Replaces: .bsfc-results-row, .tb-results-row, .rf-results
   Usage: <div class="stat-row stat-row-4"> */
.stat-row   { display: grid; gap: 1rem; margin-top: 1.25rem; }
.stat-row-2 { grid-template-columns: repeat(2,1fr); }
.stat-row-3 { grid-template-columns: repeat(3,1fr); }
.stat-row-4 { grid-template-columns: repeat(4,1fr); }

/* ── SEGMENTED TOGGLE ────────────────────────────────────────
   Replaces: .bt-toggle, .rf-mode-toggle, .tb-toggle
   Usage: <div class="ebd-toggle"> <button class="active">...</button> </div> */
.ebd-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  width: fit-content;
  margin-bottom: 1.5rem;
}
.ebd-toggle button {
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  padding: 0.5rem 1.1rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.ebd-toggle button:last-child { border-right: none; }
.ebd-toggle button.active {
  background: var(--accent);
  color: #fff;
}
.ebd-toggle button:not(.active):hover {
  background: var(--surface);
  color: var(--text);
}

/* ── USE-CASE CHIPS ──────────────────────────────────────────
   Replaces: .bsfc-chips/.bsfc-chip, .bt-chips/.bt-chip,
             .da-chips/.da-chip, .tb-chips/.tb-chip
   Usage: <div class="ebd-chips"> <span class="ebd-chip">...</span> </div> */
.ebd-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2.5rem; }
.ebd-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.ebd-chip::before { content: '→ '; color: var(--accent); }

/* ── CALLOUT / FORMULA BOX ───────────────────────────────────
   Replaces: .bsfc-formula, .chassis-formula, .tb-formula,
             .da-callout, .bt-notice, .tyre-note
   Usage: <div class="ebd-callout"> */
.ebd-callout {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 0.85rem 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 1rem 0;
}
.ebd-callout strong { color: var(--text); font-family: monospace; }
.ebd-callout-label {
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

/* ── REFERENCE TABLE ─────────────────────────────────────────
   Replaces: .bsfc-ref-table, .bt-table, .tb-ref-table,
             .kd-table, .da-table, .combo-table
   Usage: <table class="ref-table"> wrapped in <div class="ref-table-wrap"> */
.ref-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ref-table th {
  background: var(--bg);
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.55rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ref-table td {
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
.ref-table tr:last-child td  { border-bottom: none; }
.ref-table tr:nth-child(even) td { background: var(--bg); }
.ref-table tr:hover td        { background: rgba(232,81,42,0.04); }
.ref-table td.muted  { color: var(--muted); font-size: 0.78rem; }
.ref-table td.mono   { font-family: monospace; font-size: 0.85rem; }
.ref-table td.good   { color: #4caf50; font-weight: 700; font-size: 0.78rem; }
.ref-table td.warn   { color: #d4a017; font-weight: 700; font-size: 0.78rem; }
.ref-table td.bad    { color: #e05a2a; font-weight: 700; font-size: 0.78rem; }
.ref-table td.accent { color: var(--accent); font-weight: 700; font-size: 0.78rem; }

/* ── FAQ ACCORDION ───────────────────────────────────────────
   Used on: ThrottleBody, LapAnalysis, ChannelReference
   and all future pages with Q&A sections
   Usage: <div class="faq-item"> <button class="faq-toggle"> </div> */
.faq-item { margin-bottom: 0.6rem; }
.faq-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-family: var(--font);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.2s;
}
.faq-toggle:hover  { border-color: var(--accent); }
.faq-toggle.open   { border-radius: 3px 3px 0 0; border-color: var(--accent); }
.faq-toggle span {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-left: 1rem;
  flex-shrink: 0;
}
.faq-body {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 3px 3px;
  padding: 1.1rem 1.25rem;
  display: none;
}
.faq-body.open { display: block; }
.faq-body p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
  margin-bottom: 0.65rem;
}
.faq-body p:last-child { margin-bottom: 0; }
.faq-body strong { color: var(--text); }

/* ── SERIES NAVIGATION ───────────────────────────────────────
   Used on multi-page series (Data Analysis etc)
   Usage: <div class="series-nav"> <a class="series-link active"> */
.series-nav  { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2rem; }
.series-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.series-link:hover  { border-color: var(--accent); color: var(--text); text-decoration: none; }
.series-link.active   { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.series-link.disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.series-link.disabled .series-link-label { color: var(--muted); }
.series-link-label  {
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 0.2rem;
}

/* ── ABOUT PAGE STAT BLOCK ───────────────────────────────────
   Moved from about.php inline style */
.about-full-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  align-items: start;
  margin-bottom: 0.5rem;
}
.about-full-text p  { margin-bottom: 0.9rem; }
.about-full-text h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.75rem; }
.about-stat-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 5rem;
}
.astat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.2rem;
}
.astat span {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  display: block;
  color: var(--text);
}
.astat small {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.2rem;
  display: block;
}

/* ── CALLOUT COLOUR MODIFIERS ────────────────────────────────
   Usage: add .warn or .good to any .ebd-callout
   .warn = amber (caution/myth-busting)
   .good = teal (confirmed good values, pass states) */
.ebd-callout.warn { border-left-color: #d4a017; }
.ebd-callout.warn .ebd-callout-label { color: #d4a017; }
.ebd-callout.good { border-left-color: #2dd4bf; }
.ebd-callout.good .ebd-callout-label { color: #2dd4bf; }

/* ── CROSSLINK ───────────────────────────────────────────────
   Inline contextual link to a related page or section.
   Usage: <a class="crosslink" href="...">...</a> */
.crosslink {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.83rem;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.35rem 0.75rem;
  margin: 0.5rem 0 1rem;
  transition: border-color 0.2s;
}
.crosslink:hover { border-color: var(--accent); text-decoration: none; }

/* ── AFFILIATE BOX ───────────────────────────────────────────
   Product recommendation block with icon, description and CTA.
   Usage: <div class="affiliate-box"> */
.affiliate-box {
  background: #131313;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
}
.affiliate-box .ab-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.affiliate-box h4 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.affiliate-box p  { margin: 0 0 0.6rem; font-size: 0.83rem; color: var(--muted); }
.affiliate-box .ab-disclaimer { font-size: 0.72rem; color: #444; margin: 0.4rem 0 0; }
@media (max-width: 560px) { .affiliate-box { flex-direction: column; gap: 0.75rem; } }

/* ── WAVEFORM CHART ──────────────────────────────────────────
   Oscilloscope-style SVG diagram wrapper. Used for O2/MAF
   signal visualisations. Two or three charts sit side by side.
   Usage: <div class="wf-wrap"> <div class="wf-charts"> <div class="wf-chart">...</div> </div> </div> */
.wf-wrap   { margin: 1.2rem 0; }
.wf-label  { font-size: 0.68rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 0.5rem; }
.wf-charts { display: flex; gap: 1rem; }
.wf-chart  { flex: 1 1 0; min-width: 0; }
.wf-chart svg { width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 3px; }
.wf-title  { font-size: 0.72rem; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.35rem; }
.wf-title span { color: #555; text-transform: none; letter-spacing: 0; }
.wf-legend { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.4rem; }
.wf-legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; color: #666; }
.wf-swatch { width: 18px; height: 2px; border-radius: 1px; flex-shrink: 0; }
@media (max-width: 640px) { .wf-charts { flex-direction: column; } }

/* ── RANGE PILLS ─────────────────────────────────────────────
   Standalone status badges for numeric ranges and pass/fail states.
   Distinct from ref-table td.good/warn/bad (text colour only).
   Usage: <span class="range-pill rp-good">Normal</span> */
.range-pill { padding: 0.3rem 0.75rem; border-radius: 2px; font-size: 0.73rem; font-weight: 700; display: inline-block; }
.rp-good { background: rgba(76,175,80,0.12);   color: #4caf50; border: 1px solid rgba(76,175,80,0.25); }
.rp-warn { background: rgba(212,160,23,0.12);  color: #d4a017; border: 1px solid rgba(212,160,23,0.25); }
.rp-bad  { background: rgba(224,90,42,0.12);   color: #e05a2a; border: 1px solid rgba(224,90,42,0.25); }
.rp-info { background: rgba(255,255,255,0.04); color: var(--muted); border: 1px solid var(--border); }

/* ── AFFILIATE CARDS ─────────────────────────────────────────
   Grid of product recommendation cards with Amazon CTA.
   Usage:
     <div class="aff-grid">
       <div class="aff-card">
         <div class="aff-label">Recommended</div>
         <div class="aff-product">Product name</div>
         <div class="aff-desc">Description text.</div>
         <a href="https://amzn..." class="aff-btn">Buy on Amazon</a>
         <!-- or if link not yet generated: -->
         <span class="aff-btn-pending">Affiliate link pending SiteStripe</span>
       </div>
     </div>
   Grid: use .aff-grid for auto-fill columns (min 240px).
   Single card: omit .aff-grid wrapper. */

.aff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}
.aff-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.aff-label {
  font-size: 0.62rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}
.aff-product {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.aff-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
}
.aff-btn {
  display: block;
  background: #ff9900;
  color: #111;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background 0.2s;
}
.aff-btn:hover { background: #e68a00; text-decoration: none; color: #111; }
.aff-btn-pending {
  display: block;
  background: var(--bg);
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 2px;
  font-size: 0.72rem;
  font-style: italic;
}

/* ── RESPONSIVE: component library ──────────────────────────  */
@media (max-width: 900px) {
  .about-full-grid   { grid-template-columns: 1fr; gap: 1.5rem; }
  .about-stat-block  { flex-direction: row; flex-wrap: wrap; position: static; }
  .astat             { flex: 1 1 120px; }
  .stat-row-4        { grid-template-columns: repeat(2,1fr); }
  .stat-row-3        { grid-template-columns: repeat(2,1fr); }
  .calc-grid-5       { grid-template-columns: repeat(2,1fr); }
  .calc-grid-4       { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 560px) {
  .stat-row-4        { grid-template-columns: 1fr; }
  .stat-row-3        { grid-template-columns: 1fr; }
  .stat-row-2        { grid-template-columns: 1fr; }
  .calc-grid-2       { grid-template-columns: 1fr; }
  .calc-grid-3       { grid-template-columns: 1fr; }
  .calc-grid-4       { grid-template-columns: 1fr; }
  .calc-grid-5       { grid-template-columns: 1fr; }
}
