/* =========================================================================
   D-TEC Auto Repairs — shared stylesheet
   "Clean workshop floor": concrete grey / near-black / service-blue /
   signal-yellow. Barlow Condensed + Barlow. Light + dark themes.
   Tokens follow research/design-language.md §2 exactly.
   ========================================================================= */

/* ---- Colour tokens -------------------------------------------------------
   Two-role separation: text-on-brand/band uses FIXED tokens that never flip
   (--on-brand, --cream, --accent-dark, --ink-fixed); only page surfaces flip.
*/
:root {
  --ground: #F3F5F7;
  --surface: #FFFFFF;
  --ink: #101820;
  --muted: #4A5866;
  --brand: #0B5CAD;
  --brand-text: #0A4F95;   /* accent text/links/ticks on normal surfaces */
  --accent-dark: #FFC629;  /* accent text on always-dark bands — fixed */
  --sun: #FFC629;          /* highlight fill — dark text on it, never white */
  --ink-fixed: #101820;    /* text on sun — fixed */
  --on-brand: #FFFFFF;     /* text on brand fills — fixed */
  --cream: #EEF2F6;        /* text on always-dark bands — fixed */
  --band: #101820;         /* always-dark header/hero/footer/CTA/panel */

  --surface-border: #D4DCE4;
  --note-bg: #FFF3CC;      /* sun tint for note chips (light) */
  --note-text: #5A4A00;    /* dark enough for >=4.5:1 on note-bg */

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

  --font-head: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
}

html[data-theme="dark"] {
  --ground: #0D1218;
  --surface: #1E2936;
  --ink: #EEF2F6;
  --muted: #C2CCD6;
  --brand: #0B5CAD;
  --brand-text: #8CC4FF;   /* links on normal (dark) surfaces */
  --surface-border: #2A3744;
  --band: #060A0E;
  --note-bg: #243040;
  --note-text: #FFD970;
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  overflow-wrap: anywhere;
  word-break: break-word;
}
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 6vw, 3.25rem); letter-spacing: 0.5px; }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 600; }
p { margin: 0 0 1rem; }
a { color: var(--brand-text); }
img { max-width: 100%; display: block; height: auto; }

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

/* sections handle their own vertical padding; never padding:X 0 on .container */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.eyebrow {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand-text);
  margin: 0 0 0.5rem;
}
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

/* ---- Hazard-stripe divider ---------------------------------------------- */
.hazard {
  height: 8px;
  border: 0;
  margin: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    var(--sun) 0, var(--sun) 14px,
    var(--band) 14px, var(--band) 28px
  );
}

/* ---- 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.3px;
  text-decoration: none;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: #094a8c; border-color: #094a8c; color: var(--on-brand); }

.btn--sun { background: var(--sun); color: var(--ink-fixed); border-color: var(--sun); }
.btn--sun:hover { background: #e6b216; border-color: #e6b216; color: var(--ink-fixed); }

.btn--ghost { background: transparent; color: var(--brand-text); border-color: var(--brand-text); }
.btn--ghost:hover { background: var(--brand-text); color: var(--on-brand); }

.btn--block { width: 100%; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* =========================================================================
   ALWAYS-DARK BANDS — .hero .band .site-header .site-footer + planner panel
   Every text role gets explicit light-on-dark colour. Accent uses the FIXED
   --accent-dark, never --brand-text. (bug #1)
   ========================================================================= */
.band, .hero, .site-header, .site-footer, .plan-card {
  background: var(--band);
  color: var(--cream);
}
.band h1, .band h2, .band h3, .band h4,
.hero h1, .hero h2, .hero h3, .hero h4,
.site-header h1, .site-header h2, .site-header h3, .site-header h4,
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4,
.plan-card h1, .plan-card h2, .plan-card h3, .plan-card h4 { color: var(--cream); }

.band p, .band li, .band dt, .band dd,
.hero p, .hero li, .hero dt, .hero dd,
.site-header p, .site-header li,
.site-footer p, .site-footer li, .site-footer dt, .site-footer dd,
.plan-card p, .plan-card li, .plan-card dt, .plan-card dd { color: var(--cream); }

.band .muted, .hero .muted, .site-footer .muted, .plan-card .muted,
.band .lead, .hero .lead { color: #AEBAC6; }  /* light-on-dark secondary, >=4.5:1 on #101820 */

.band .eyebrow, .hero .eyebrow, .site-footer .eyebrow, .plan-card .eyebrow,
.band a:not(.btn), .hero a:not(.btn), .plan-card a:not(.btn) { color: var(--accent-dark); }

.band .stat, .hero .stat, .site-footer .stat { color: var(--cream); }
.band .img-note, .hero .img-note, .plan-card .img-note { color: #AEBAC6; }

/* links in footer body (not buttons) use fixed accent, incl. hover */
.site-footer a:not(.btn) { color: var(--accent-dark); }
.site-footer a:not(.btn):hover { color: #ffd970; }

/* dl.nap inside bands */
.band dl.nap dt, .hero dl.nap dt, .site-footer dl.nap dt, .plan-card dl.nap dt { color: #AEBAC6; }
.band dl.nap dd, .hero dl.nap dd, .site-footer dl.nap dd, .plan-card dl.nap dd { color: var(--cream); }

/* No light cards in dark bands (bug #2) — surfaces inside bands stay dark */
.band .card, .hero .card { background: #18212B; border-color: #2A3744; color: var(--cream); }
.band .card h3, .hero .card h3, .band .card p, .hero .card p { color: var(--cream); }

/* Ghost buttons inside any always-dark band use --accent-dark text+border
   incl. hover — both a.btn--ghost and button.btn--ghost (bugs #1,#6,#8) */
.hero a.btn--ghost, .hero button.btn--ghost,
.band a.btn--ghost, .band button.btn--ghost,
.site-header a.btn--ghost, .site-header button.btn--ghost,
.site-footer a.btn--ghost, .site-footer button.btn--ghost,
.plan-card a.btn--ghost, .plan-card button.btn--ghost {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
  background: transparent;
}
.hero a.btn--ghost:hover, .hero button.btn--ghost:hover,
.band a.btn--ghost:hover, .band button.btn--ghost:hover,
.site-header a.btn--ghost:hover, .site-header button.btn--ghost:hover,
.site-footer a.btn--ghost:hover, .site-footer button.btn--ghost:hover,
.plan-card a.btn--ghost:hover, .plan-card button.btn--ghost:hover {
  background: var(--accent-dark);
  color: var(--ink-fixed);
  border-color: var(--accent-dark);
}

/* Primary/sun buttons in dark bands must keep their own text colour,
   not inherit the band's link colour, incl. hover (bug #6) */
.hero a.btn--primary, .band a.btn--primary, .site-header a.btn--primary,
.site-footer a.btn--primary, .plan-card a.btn--primary,
.hero a.btn--primary:hover, .band a.btn--primary:hover, .site-header a.btn--primary:hover,
.site-footer a.btn--primary:hover, .plan-card a.btn--primary:hover { color: var(--on-brand); }

.hero a.btn--sun, .band a.btn--sun, .site-header a.btn--sun,
.site-footer a.btn--sun, .plan-card a.btn--sun,
.hero a.btn--sun:hover, .band a.btn--sun:hover, .site-header a.btn--sun:hover,
.site-footer a.btn--sun:hover, .plan-card a.btn--sun:hover { color: var(--ink-fixed); }

/* Ghost button inside a sun band uses ink-fixed border/text + own hover (bug #8) */
.sunband { background: var(--sun); color: var(--ink-fixed); }
.sunband h1, .sunband h2, .sunband h3, .sunband p, .sunband li { color: var(--ink-fixed); }
.sunband .eyebrow { color: var(--ink-fixed); }
.sunband a.btn--ghost, .sunband button.btn--ghost {
  color: var(--ink-fixed); border-color: var(--ink-fixed); background: transparent;
}
.sunband a.btn--ghost:hover, .sunband button.btn--ghost:hover {
  background: var(--ink-fixed); color: var(--sun);
}

/* ---- Header -------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 2px solid #2A3744; }
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 0.7rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1;
  margin-right: auto;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  color: var(--cream);
  overflow-wrap: anywhere;
}
.brand-name .dash { color: var(--accent-dark); }
.brand-sub {
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-dark);   /* header sub-label fixed accent */
  margin-top: 2px;
}
.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--cream);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
}
.site-nav a:hover { background: rgba(255,255,255,0.08); color: var(--cream); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); }

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

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 2px solid var(--accent-dark);
  color: var(--accent-dark);
  width: 42px; height: 42px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  flex: 0 0 auto;
}
.theme-toggle:hover { background: var(--accent-dark); color: var(--ink-fixed); }
.theme-toggle .icon-dark { display: none; }
html[data-theme="dark"] .theme-toggle .icon-light { display: none; }
html[data-theme="dark"] .theme-toggle .icon-dark { display: inline; }

/* ---- Hero ---------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; }
.hero-media { position: relative; }
.hero-media img { width: 100%; height: clamp(220px, 40vw, 420px); object-fit: cover; opacity: 0.38; }
.hero-body { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.hero .lead { color: #D3DBE3; }

/* image label note */
.img-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
  font-style: italic;
}

/* ---- Cards --------------------------------------------------------------- */
.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);   /* visible border in light (bug #16) */
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card h3 { margin-top: 0; }
.card .icon { font-size: 1.6rem; display: block; margin-bottom: 0.5rem; }

.figure {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.figure img { width: 100%; height: 220px; object-fit: cover; }
.figure figcaption { padding: 0.75rem 1rem; font-size: 0.9rem; color: var(--muted); }

/* ---- Proof strip --------------------------------------------------------- */
.proof {
  display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem;
  align-items: baseline;
}
.proof .stat { font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; }
.proof .stat span { color: var(--accent-dark); }

/* ---- Chips --------------------------------------------------------------- */
.chip {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--note-bg);
  color: var(--note-text);          /* >=4.5:1 on tint (bug #17) */
  border: 1px solid rgba(0,0,0,0.08);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ---- Find-us / NAP ------------------------------------------------------- */
dl.nap { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
dl.nap dt { font-weight: 600; color: var(--muted); }
dl.nap dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.findus { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
.findus > * { min-width: 0; }

/* =========================================================================
   CAR BRIEF PLANNER
   ========================================================================= */
.planner-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: var(--gap); align-items: start; }
.planner-form fieldset { border: 1px solid var(--surface-border); border-radius: var(--radius); margin: 0 0 1.5rem; padding: 1.25rem; background: var(--surface); }
.planner-form legend { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; padding: 0 0.4rem; color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin-top: 0.5rem; }
.tile {
  position: relative;
  display: flex; align-items: center; gap: 0.55rem;
  border: 2px solid var(--surface-border);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  background: var(--ground);
  font-weight: 500;
}
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile .tick {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: 2px solid var(--muted);
  border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: transparent;
}
/* selected: outline + visible tick, not colour alone (bug #13) */
.tile:has(input:checked) { border-color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand-text); }
.tile:has(input:checked) .tick { background: var(--brand-text); border-color: var(--brand-text); color: var(--on-brand); }
.tile input:focus-visible ~ .tick { outline: 2px solid var(--brand-text); outline-offset: 2px; }

.radios { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.radio-row { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; }

.field { margin-top: 0.75rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field input[type="text"], .field input[type="number"], .field input[type="date"], .field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--ground);
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-inline { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-inline .field { flex: 1 1 140px; min-width: 0; margin-top: 0; }

.countdown { font-family: var(--font-head); font-weight: 600; color: var(--brand-text); margin-top: 0.4rem; }

.hidden { display: none !important; }

/* Live plan card — always dark panel */
.plan-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky; top: 90px;
}
.plan-card h3 { margin-top: 0; }
dl.plan-rows { margin: 0 0 1rem; }
dl.plan-rows > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.25rem 1rem; padding: 0.35rem 0; border-bottom: 1px solid #2A3744; }
dl.plan-rows > div:last-child { border-bottom: 0; }
dl.plan-rows dt { color: #AEBAC6; font-weight: 600; min-width: 0; margin: 0; }
dl.plan-rows dd { color: var(--cream); margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 360px) {
  dl.plan-rows > div { grid-template-columns: 1fr; gap: 0; }
}
.plan-empty { color: #AEBAC6; font-style: italic; }
.message-preview {
  background: #18212B;
  border: 1px solid #2A3744;
  border-radius: 8px;
  padding: 1rem;
  color: var(--cream);
  margin: 1rem 0;
  white-space: pre-wrap;
}
.copied-note { color: var(--accent-dark); font-size: 0.85rem; margin-top: 0.5rem; min-height: 1.2em; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--gap); padding-block: clamp(2.5rem, 5vw, 3.5rem); }
.footer-grid > * { min-width: 0; }
.footer-grid h4 { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; }
.footer-bottom { border-top: 1px solid #2A3744; padding-block: 1.25rem; font-size: 0.85rem; color: #AEBAC6; }
.footer-bottom .demo-note { color: #AEBAC6; }
.footer-bottom .demo-note strong { color: var(--accent-dark); }

.demo-note {
  background: #18212B;
  border: 1px solid #2A3744;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: var(--cream);
  font-size: 0.9rem;
}
.demo-note strong { color: var(--accent-dark); }
main .demo-note strong { color: inherit; }

.site-main { display: block; }
.page { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- Skip link ----------------------------------------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--sun); color: var(--ink-fixed);
  padding: 0.6rem 1rem; z-index: 100; border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* =========================================================================
   RESPONSIVE (bug #3)
   ========================================================================= */
@media (max-width: 920px) {
  .planner-grid { grid-template-columns: 1fr; }
  .plan-card { position: static; }
}
@media (max-width: 820px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .findus { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  /* nav gets its own row */
  .header-inner { flex-wrap: wrap; }
  .site-nav { order: 3; flex-basis: 100%; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  /* hide header CTA on very small screens (bug #3) */
  .header-cta { display: none; }
}
@media (max-width: 360px) {
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; justify-content: center; }
}
