/* ==========================================================================
   CV Rite CV Joints & Suspension — shared styles
   Palette and type direction from research/design-language.md
   Two distinct white roles kept separate:
     --on-brand  = text on brand/always-dark bands (fixed white, both themes)
     --surface   = card/panel fill (flips dark in dark mode)
   ========================================================================== */

:root {
  /* ---- Light (default) ---- */
  --ground: #F4F3F0;
  --surface: #FFFFFF;
  --ink: #17191C;
  --muted: #4F575F;
  --brand: #C2410C;        /* fills, rules, large display only */
  --brand-text: #A8360A;   /* orange text under ~20px (light) */
  --steel: #8A939C;
  --on-brand: #FFFFFF;     /* NEVER remapped */
  --accent-on-dark: #FF9A55; /* orange text on always-dark bands; fixed in both themes */
  --band: #1B1E22;         /* always-dark header/footer/hero band */

  --surface-border: #E2E1DC;
  --surface-shadow: 0 1px 3px rgba(23, 25, 28, 0.08), 0 4px 16px rgba(23, 25, 28, 0.06);

  --maxw: 1120px;
  --radius: 10px;
  --gap: clamp(1rem, 2.5vw, 2rem);

  --font-head: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

[data-theme="dark"] {
  --ground: #121416;
  --surface: #2C3137;       /* measured 1.41:1 vs #121416 ground (design-doc #23272C was 1.23:1) */
  --ink: #ECEDEE;
  --muted: #A9B0B7;
  --brand: #C2410C;
  --brand-text: #FF9A55;    /* orange text in dark */
  --steel: #8A939C;
  --on-brand: #FFFFFF;      /* fixed */
  --band: #0C0D0F;

  --surface-border: #343A40;
  --surface-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 18px rgba(0, 0, 0, 0.35);
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.08;
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}
h1 { font-size: clamp(2rem, 5.5vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.4rem); }
p { margin: 0 0 1rem; }
a { color: var(--brand-text); }
a:hover { color: var(--brand); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem;
  background: var(--brand); color: var(--on-brand);
  padding: 0.6rem 1rem; border-radius: var(--radius);
  z-index: 200; transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; color: var(--on-brand); }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  line-height: 1.1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn .icon { width: 1.15em; height: 1.15em; flex: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: #9c340a; color: var(--on-brand); }
.btn-outline {
  background: transparent;
  color: var(--brand-text);
  border-color: var(--brand);
}
.btn-outline:hover { background: var(--brand); color: var(--on-brand); }
.btn-ghost {
  background: rgba(255,255,255,0.1);
  color: var(--on-brand);
  border-color: rgba(255,255,255,0.35);
}
.btn-ghost:hover { background: rgba(255,255,255,0.2); color: var(--on-brand); }

/* ==========================================================================
   Header + nav
   ========================================================================== */
.site-header {
  background: var(--band);
  color: var(--on-brand);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--brand);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
}
.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--on-brand);
  text-decoration: none;
  white-space: nowrap;
  margin-right: auto;
}
.brand-wordmark .cv { color: var(--brand); }
.brand-wordmark .rite { color: var(--on-brand); }
.brand-wordmark .sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.main-nav a:not([class]) {
  color: var(--on-brand);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}
.main-nav a:not([class]):hover { color: var(--brand-text); }
.main-nav a[aria-current="page"] {
  color: var(--brand-text);
  border-bottom-color: var(--brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: transparent;
  color: var(--on-brand);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--brand); }
.theme-toggle .icon { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Hamburger */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  flex: none;
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,0.3);
  background: transparent;
  color: var(--on-brand);
  cursor: pointer;
}
.nav-toggle .icon { width: 22px; height: 22px; }

/* ==========================================================================
   Off-canvas drawer (mobile)
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 150;
}
.mobile-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(84vw, 340px);
  background: var(--band);
  color: var(--on-brand);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 160;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  border-left: 3px solid var(--brand);
}
.mobile-drawer.open { transform: translateX(0); }
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-close {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  background: transparent;
  color: var(--on-brand);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  cursor: pointer;
}
.drawer-close .icon { width: 22px; height: 22px; }

.mobile-drawer nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.mobile-drawer nav a:not([class]) {
  display: block;
  color: var(--on-brand);
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.mobile-drawer nav a[aria-current="page"] { color: var(--brand-text); }

.drawer-cta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.drawer-cta .btn { width: 100%; justify-content: center; }

/* ==========================================================================
   Sections / layout helpers
   ========================================================================== */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-tight { padding-block: clamp(1.75rem, 4vw, 3rem); }
.section-head { max-width: 46rem; margin-bottom: 2rem; }
.eyebrow {
  font-family: var(--font-head);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
  color: var(--brand-text);
  margin: 0 0 0.4rem;
}
.lead { font-size: 1.15rem; color: var(--muted); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  background: var(--band);
  color: var(--on-brand);
  overflow: hidden;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, rgba(27,30,34,0.92) 0%, rgba(27,30,34,0.78) 45%, rgba(27,30,34,0.55) 100%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  padding-block: clamp(3rem, 8vw, 6rem);
  max-width: 44rem;
}
.hero h1 { color: var(--on-brand); }
.hero h1 .accent { color: var(--brand-text); }
.hero p { color: #E6E7E8; font-size: 1.2rem; }
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ==========================================================================
   Cards / grids
   ========================================================================== */
.grid {
  display: grid;
  gap: var(--gap);
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--surface-shadow);
  padding: 1.5rem;
}
.card h3 { color: var(--ink); }

.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  flex: none;
  border-radius: var(--radius);
  background: rgba(194, 65, 12, 0.1);
  margin-bottom: 1rem;
}
.icon-wrap .icon { width: 26px; height: 26px; color: var(--brand); stroke: var(--brand); }

/* Services strip (home) */
.service-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.service-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--surface-shadow);
}
.service-item .icon-wrap { width: 40px; height: 40px; margin-bottom: 0; }
.service-item .icon-wrap .icon { width: 22px; height: 22px; }
.service-item strong { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; }

/* How it works */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 3.5rem; }
.step .step-num {
  position: absolute; left: 0; top: 0;
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--on-brand);
  font-family: var(--font-head); font-weight: 700; font-size: 1.3rem;
  border-radius: 50%;
}

/* ==========================================================================
   Chips / callouts
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(138, 147, 156, 0.18);
  color: var(--muted);
  border: 1px solid var(--surface-border);
}
.chip-confirm {
  background: rgba(194, 65, 12, 0.12);
  color: var(--brand-text);
  border-color: rgba(194, 65, 12, 0.4);
}
/* Chip on always-dark band: readable in BOTH themes */
.on-band .chip,
.chip-on-dark {
  background: rgba(255,255,255,0.12);
  color: #E6E7E8;
  border-color: rgba(255,255,255,0.28);
}
.on-band .chip-confirm,
.chip-confirm.chip-on-dark {
  background: rgba(255, 154, 85, 0.16);
  color: #FF9A55;
  border-color: rgba(255, 154, 85, 0.45);
}

.callout {
  background: var(--surface);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--surface-shadow);
}
.callout p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Symptom list
   ========================================================================== */
.symptom {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--surface-shadow);
  padding: 1.5rem;
}
.symptom h3 { margin-bottom: 0.35rem; }
.symptom .cause {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}
.symptom .cause strong { color: var(--ink); }

/* ==========================================================================
   Map / address band
   ========================================================================== */
.map-band { background: var(--band); color: var(--on-brand); }
.map-band h2 { color: var(--on-brand); }
.map-band .addr { color: #E6E7E8; }
.map-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--gap);
  align-items: stretch;
}
.map-embed {
  border: 0;
  width: 100%;
  min-height: 340px;
  border-radius: var(--radius);
  background: #333;
}
.nap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.nap-list li { display: flex; gap: 0.75rem; align-items: flex-start; }
.nap-list .icon-wrap {
  margin: 0; width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
}
.nap-list .icon-wrap .icon { color: var(--brand-text); stroke: var(--brand-text); }
.nap-list .label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--steel);
}
.nap-list .value { font-size: 1.15rem; font-weight: 600; color: var(--on-brand); }
.nap-list a.value { color: var(--brand-text); text-decoration: none; }
.nap-list a.value:hover { color: #FF9A55; }

/* ==========================================================================
   Forms
   ========================================================================== */
.enquiry-form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 600; font-family: var(--font-head); font-size: 1.05rem; }
.field input, .field select, .field textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 3px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-note { font-size: 0.9rem; color: var(--muted); }

/* ==========================================================================
   CTA band (orange)
   ========================================================================== */
.cta-band {
  background: var(--brand);
  color: var(--on-brand);
}
.cta-band h2 { color: var(--on-brand); }
.cta-band p { color: var(--on-brand); }
.cta-band .btn-ghost { border-color: rgba(255,255,255,0.6); }
.cta-band .btn-light { background: var(--on-brand); color: var(--brand); border-color: var(--on-brand); }
.cta-band .btn-light:hover { background: #FFE8DD; color: var(--brand); }
.cta-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.cta-inner .cta-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--band);
  color: #C9CDD1;
  padding-block: 2.5rem;
  border-top: 3px solid var(--brand);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--gap);
}
.site-footer h4 {
  font-family: var(--font-head);
  color: var(--on-brand);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.site-footer a:not([class]) { color: #C9CDD1; text-decoration: none; }
.site-footer a:not([class]):hover { color: var(--brand-text); }
.footer-note {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.85rem;
  color: var(--steel);
}
.footer-note p { margin-bottom: 0.5rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .main-nav { display: none; }
  .header-actions { display: none; }   /* CTAs move into drawer */
  .nav-toggle { display: inline-flex; }
  .header-actions-mobile { display: flex; align-items: center; gap: 0.5rem; }
  .grid-3, .grid-2, .map-grid, .footer-grid { grid-template-columns: 1fr; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
}

@media (min-width: 861px) {
  .header-actions-mobile { display: none; }
  .mobile-drawer, .drawer-backdrop { display: none; }
}

@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
  .hero-cta .btn, .drawer-cta .btn { width: 100%; justify-content: center; }
  .hero-cta { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   QA fixes: orange text on always-dark surfaces (fixed in both themes),
   and the 320px header overflow.
   ========================================================================== */
.main-nav a:not([class]):hover,
.main-nav a[aria-current="page"],
.mobile-drawer nav a[aria-current="page"],
.site-footer a:not([class]):hover,
.hero h1 .accent,
.hero .eyebrow,
.hero .chip-confirm,
.site-footer .chip-confirm,
.mobile-drawer .chip-confirm { color: var(--accent-on-dark); }

.brand-wordmark { flex: 0 1 auto; min-width: 0; }
@media (max-width: 520px) {
  .brand-wordmark .sub { display: none; }
}

/* Always-dark map band: orange text/outline buttons use the on-dark accent in both themes */
.map-band .eyebrow,
.map-band .nap-list a.value,
.map-band .nap-list .icon-wrap .icon,
.map-band .btn-outline { color: var(--accent-on-dark); }
.map-band .nap-list .icon-wrap .icon { stroke: var(--accent-on-dark); }
.map-band .btn-outline { border-color: var(--accent-on-dark); }

/* Inline always-dark page-intro bands + CTA-band ghost button */
section[style*="--band"] .eyebrow { color: var(--accent-on-dark); }
.cta-band .btn-ghost { background: rgba(0,0,0,0.22); }
