/* P0420 Camry Field Manual — workshop-manual dark theme */
:root {
  --bg: #16181B;
  --panel: #22262B;
  --panel-2: #1C1F23;
  --line: #3A3F46;
  --text: #E8E6E1;
  --muted: #B4B7BB;
  --orange: #F28C28;
  --orange-ink: #16181B;
  --green: #4CAF7A;
  --readout: #0F1113;
  --radius: 4px;
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --font-body: "Barlow", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --hazard: repeating-linear-gradient(-45deg, var(--orange) 0 9px, var(--bg) 9px 18px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }

a { color: var(--orange); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--orange); color: var(--orange-ink); padding: var(--s2) var(--s4); font-weight: 600; z-index: 100; }
.skip:focus { left: var(--s4); top: var(--s2); }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 16px; }

h1, h2, h3, .footer-h, .toc-h { font-family: var(--font-head); line-height: 1.15; letter-spacing: .01em; color: var(--text); }
h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 700; margin: 0 0 var(--s3); text-transform: none; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; margin: var(--s7) 0 var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
h3 { font-size: 1.3rem; font-weight: 600; margin: var(--s5) 0 var(--s2); }
p, ul, ol { margin: 0 0 var(--s4); }
strong { font-weight: 600; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--readout); border: 1px solid var(--line); border-radius: 3px; padding: .05em .35em; color: var(--text); white-space: nowrap; }
.small { font-size: .9rem; color: var(--muted); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header::after { content: ""; display: block; height: 4px; background: var(--hazard); opacity: .9; }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; position: relative; gap: var(--s4); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--text); }
.brand-mark { flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-code { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: var(--orange); letter-spacing: .06em; }
.brand-sub { font-family: var(--font-head); font-size: .95rem; text-transform: uppercase; letter-spacing: .14em; color: var(--text); }

.nav-toggle { display: inline-flex; align-items: center; gap: var(--s2); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .75rem; font: 600 .95rem var(--font-head); text-transform: uppercase; letter-spacing: .1em; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 18px; height: 2px; background: var(--orange); position: relative; content: ""; }
.nav-toggle-bars::before { position: absolute; top: -6px; }
.nav-toggle-bars::after { position: absolute; top: 6px; }
.site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-top: 0; padding: var(--s2) 16px var(--s4); }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: .65rem 0; color: var(--text); text-decoration: none; font-family: var(--font-head); font-size: 1.1rem; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
.site-nav li:last-child a { border-bottom: 0; }
.site-nav a:hover { color: var(--orange); }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; position: static; background: none; border: 0; padding: 0; }
  .site-nav ul { display: flex; gap: var(--s5); }
  .site-nav a { border: 0; padding: .25rem 0; font-size: 1rem; }
  .site-nav a[aria-current="page"] { color: var(--orange); }
}

/* Breadcrumbs */
.crumbs { margin: var(--s5) 0 0; font-size: .9rem; color: var(--muted); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.crumbs li + li::before { content: "/"; margin: 0 .4rem 0 .15rem; color: var(--line); }
.crumbs a { color: var(--muted); }

/* Article */
.doc { max-width: 46rem; margin: 0 auto; padding: var(--s6) 0 var(--s7); }
.doc p, .doc li { max-width: 72ch; }
.doc-head { margin-bottom: var(--s5); }
.meta { font-size: .9rem; color: var(--muted); margin-bottom: var(--s4); font-family: var(--font-head); letter-spacing: .06em; text-transform: uppercase; }
.lede { font-size: 1.15rem; color: var(--text); }

/* Quick answer */
.quick { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--orange); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.quick-label, .callout-label, .toc-h { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); margin: 0 0 var(--s2); font-weight: 700; }
.quick p:last-child { margin-bottom: 0; }

/* Callouts with hazard edge */
.callout { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5) var(--s4) calc(var(--s5) + 10px); margin: var(--s5) 0; }
.callout::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; background: var(--hazard); border-radius: var(--radius) 0 0 var(--radius); }
.callout p:last-child { margin-bottom: 0; }

/* TOC */
.toc { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.toc ol { margin: 0; padding-left: 1.4rem; columns: 1; }
.toc li { margin: .15rem 0; }
@media (min-width: 640px) { .toc ol { columns: 2; column-gap: var(--s6); } }

/* Tables: spec sheet */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--s4) 0 var(--s5); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.spec { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 34rem; }
table.spec caption { text-align: left; padding: var(--s3) var(--s4); font-family: var(--font-head); font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); border-bottom: 1px solid var(--line); }
table.spec th { text-align: left; background: var(--panel-2); font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; color: var(--orange); padding: .6rem .8rem; border-bottom: 2px solid var(--orange); vertical-align: bottom; }
table.spec td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
table.spec tbody tr:nth-child(even) td { background: rgba(255,255,255,.025); }
table.spec tbody tr:last-child td { border-bottom: 0; }
table.spec td.mono { white-space: nowrap; }

/* Tags */
.tag { display: inline-block; font-family: var(--font-mono); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 3px; border: 1px solid currentColor; line-height: 1.5; margin-right: .35rem; white-space: nowrap; }
.tag.ok { color: var(--green); }
.tag.warn { color: var(--orange); }

/* Diagnostic flow */
.flow { list-style: none; padding: 0; margin: var(--s5) 0; counter-reset: none; }
.flow .step { position: relative; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: 0 0 2.75rem; max-width: none; }
.flow .step:not(:last-child)::after { content: ""; position: absolute; left: 2rem; bottom: calc(-2.75rem - 1px); height: 2.75rem; border-left: 2px dashed var(--orange); }
.flow .step:not(:last-child)::before { content: ""; position: absolute; left: calc(2rem - 6px); bottom: -2.75rem; border: 7px solid transparent; border-top-color: var(--orange); border-bottom: 0; transform: translateY(100%) translateY(-7px); }
.flow .step:last-child { border-left-color: var(--green); }
.step-num { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); margin: 0; font-weight: 700; }
.flow .step:last-child .step-num { color: var(--green); }
.flow h3 { margin-top: .2rem; }
.outcomes { margin: var(--s3) 0 0; padding-top: var(--s3); border-top: 1px dashed var(--line); font-size: .95rem; color: var(--muted); line-height: 2; }
.outcomes .tag { margin-left: 0; }
.outcomes .tag + .tag, .outcomes .tag.warn { margin-left: .5rem; }
.result-line { font-size: .95rem; color: var(--muted); }

/* Lists */
ul.check { list-style: none; padding-left: 0; }
ul.check li { position: relative; padding-left: 1.6rem; margin-bottom: var(--s2); }
ul.check li::before { content: ""; position: absolute; left: .2rem; top: .6em; width: .6rem; height: .6rem; border: 2px solid var(--orange); transform: rotate(45deg); }
ol.numbered { padding-left: 1.5rem; }
ol.numbered li { margin-bottom: var(--s2); padding-left: .25rem; }
ol.numbered li::marker { font-family: var(--font-mono); color: var(--orange); font-weight: 700; }

/* FAQ */
.faq-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s3); }
.faq-item summary { cursor: pointer; padding: var(--s3) var(--s4); font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; list-style: none; position: relative; padding-right: 2.5rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: var(--s4); top: 50%; transform: translateY(-50%); font-family: var(--font-mono); color: var(--orange); font-size: 1.3rem; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { padding: 0 var(--s4) var(--s4); margin: 0; }

/* Related */
.rel-list { list-style: none; padding: 0; display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .rel-list { grid-template-columns: 1fr 1fr; } }
.rel-list a { display: block; height: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); text-decoration: none; color: var(--text); }
.rel-list a:hover { border-color: var(--orange); }
.rel-t { display: block; font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; color: var(--orange); margin-bottom: .25rem; }
.rel-d { display: block; font-size: .95rem; color: var(--muted); line-height: 1.5; }
.backlink { margin-top: var(--s6); padding: var(--s4); background: var(--panel-2); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Sources */
.sources ol { padding-left: 1.4rem; font-size: .95rem; }
.sources li { margin-bottom: var(--s2); }

.email-line { font-family: var(--font-mono); font-size: 1.05rem; word-break: break-all; }
.independence a, .sources a { word-break: break-word; }
.code-big { font-size: clamp(2.5rem, 12vw, 4.5rem); color: var(--orange); margin: 0; letter-spacing: .08em; }

/* Footer */
.site-footer { position: relative; background: var(--panel-2); padding: calc(var(--s6) + 4px) 0 var(--s5); margin-top: var(--s6); }
.site-footer::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--hazard); }
.footer-grid { display: grid; gap: var(--s5); grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand { display: flex; align-items: center; gap: var(--s2); font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.footer-mark { width: 32px; height: 32px; }
.independence { font-size: .95rem; }
.footer-h { font-size: 1rem; text-transform: uppercase; letter-spacing: .14em; color: var(--orange); margin: 0 0 var(--s2); border: 0; padding: 0; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .35rem; }
.footer-links a { color: var(--text); }
.footer-links a:hover { color: var(--orange); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .nav-toggle, .related { display: none; }
  body { background: #fff; color: #000; }
}

/* long domains in emails and URLs must wrap on phones */
a[href^="mailto:"], a[href^="http"] { overflow-wrap: anywhere; } /* long domains */
