/* =========================================================================
   One Stop Auto Care Ballito — shared styles
   Design language: "Workshop bay" — bone-white, petrol green, safety yellow.
   Headings: Saira Condensed. Body: Barlow.
   ------------------------------------------------------------------------
   Bug-avoidance notes (see design-language.md §2 and the build brief):
   (1) Always-dark bands/hero/footer AND the always-dark job-card preview
       panel set LIGHT colours on h1-h3, buttons, links and "to confirm"
       chips so nothing goes dark-on-dark in LIGHT theme.
   (2) Light cards inside dark bands set their own ink colour.
   (3) 320px: header CTA + subtitle hidden <=480px, CTA nowrap + hidden
       <=1100px, min-width:0 on grid children, overflow-wrap:anywhere on
       NAP text, big buttons allowed to wrap.
   (4) Canonicals/JSON-LD use pages.dev, handled in HTML, never example.com.
   (5) Never white text on yellow fills -> --ink-on-signal (#17211E).
   (6) .site-footer a (coloured link rule) must NOT override button text.
   ========================================================================= */

/* ---- Tokens: LIGHT (default) ---- */
:root {
  --ground: #F6F4EC;
  --surface: #FFFFFF;
  --ink: #17211E;
  --muted: #4C5A55;
  --brand: #0E3B38;
  --brand-text: #0E3B38;
  --signal: #F2C230;
  --signal-text: #7A5A00;
  --ink-on-signal: #17211E; /* text on yellow fills — fixed both themes */
  --on-brand: #FFFFFF;      /* text on brand/dark bands — fixed both themes */
  --accent-on-dark: #F7D260;/* yellow light text on always-dark bands */
  --band: #0B2B29;          /* always-dark header/hero/footer/CTA band */

  --border: #E0DED3;
  --border-on-dark: rgba(255,255,255,.18);
  --shadow: 0 2px 10px rgba(14,59,56,.08);
  --radius: 10px;
  --maxw: 1120px;

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

/* ---- Tokens: DARK override ---- */
[data-theme="dark"] {
  --ground: #101513;
  --surface: #1B2421;
  --ink: #EDF1EC;
  --muted: #A7B4AE;
  --brand: #1F5A55;
  --brand-text: #BFE6DD;
  --signal: #F2C230;
  --signal-text: #F7D260;
  --ink-on-signal: #17211E; /* fixed */
  --on-brand: #FFFFFF;      /* fixed */
  --accent-on-dark: #F7D260;/* fixed */
  --band: #081211;

  --border: #2A3531;
  --border-on-dark: rgba(255,255,255,.16);
  --shadow: 0 2px 12px rgba(0,0,0,.4);
}

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

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}
.section { padding: clamp(40px, 7vw, 72px) 0; }
.section--tint { background: var(--surface); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: .02em;
  padding: .7em 1.2em;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  /* bug (3): allow big buttons to wrap at 320px */
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.15;
}
.btn--call, .btn--accent {       /* primary: brand fill */
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}
.btn--call:hover, .btn--accent:hover { background: #0b302d; }
[data-theme="dark"] .btn--call:hover,
[data-theme="dark"] .btn--accent:hover { background: #246a64; }

.btn--signal {                    /* yellow fill — dark ink, never white (bug 5) */
  background: var(--signal);
  color: var(--ink-on-signal);
  border-color: var(--signal);
}
.btn--signal:hover { background: #e4b526; }

.btn--ghost {                     /* outline on normal ground */
  background: transparent;
  color: var(--brand-text);
  border-color: var(--brand);
}
.btn--ghost:hover { background: rgba(14,59,56,.08); }
[data-theme="dark"] .btn--ghost:hover { background: rgba(191,230,221,.12); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: stretch;
}

/* =========================================================================
   Header / nav
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--band);
  color: var(--on-brand);
  border-bottom: 1px solid var(--border-on-dark);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  margin-right: auto;
  min-width: 0; /* bug (3) */
}
.brand__name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--on-brand);
  line-height: 1;
  letter-spacing: .02em;
}
.brand__name b { color: var(--accent-on-dark); font-weight: 700; }
.brand__sub {
  font-size: .72rem;
  color: var(--accent-on-dark);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 3px;
}
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .9rem;
  align-items: center;
}
.main-nav a {
  color: var(--on-brand);
  text-decoration: none;
  font-weight: 500;
  font-size: .98rem;
  padding: .3em .1em;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { border-bottom-color: var(--accent-on-dark); }
.main-nav a[aria-current="page"] {
  color: var(--accent-on-dark);
  border-bottom-color: var(--accent-on-dark);
}

.header-cta {                     /* brief: nowrap, hidden <=1100px */
  white-space: nowrap;
  font-size: .95rem;
  padding: .5em .9em;
}

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 2px solid var(--border-on-dark);
  color: var(--on-brand);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  padding: 0;
}
.theme-toggle:hover { border-color: var(--accent-on-dark); }
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* =========================================================================
   Open-now strip (written, not colour-only)
   ========================================================================= */
.open-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .8rem;
  box-shadow: var(--shadow);
}
.open-strip__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); flex: none;
}
.open-strip.is-open .open-strip__dot { background: #2e9e5b; }
.open-strip.is-closed .open-strip__dot { background: #c2543f; }
.open-strip__status { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; }
.open-strip__note { color: var(--muted); font-size: .9rem; }
.chip-confirm {                   /* "to confirm" chip */
  display: inline-block;
  background: var(--signal);
  color: var(--ink-on-signal);   /* bug 5 */
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2em .6em;
  border-radius: 999px;
  white-space: nowrap;
}

/* =========================================================================
   Hero (always-dark band)
   ========================================================================= */
.hero {
  background: var(--band);
  color: var(--on-brand);
  position: relative;
  overflow: hidden;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  padding: clamp(40px, 7vw, 80px) 0;
}
.hero__grid > * { min-width: 0; } /* bug 3 */
.hero__img {
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  aspect-ratio: 16/11;
  object-fit: cover;
  width: 100%;
}
.hero__kicker {
  font-family: var(--font-head);
  color: var(--accent-on-dark);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .6rem;
}

/* =========================================================================
   Bug (1): always-dark band / hero / footer — force LIGHT colours on
   every child so LIGHT theme can't render dark-on-dark.
   ========================================================================= */
.hero,
.hero h1, .hero h2, .hero h3, .hero p,
.band-dark,
.band-dark h1, .band-dark h2, .band-dark h3, .band-dark p,
.site-footer,
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer p {
  color: var(--on-brand);
}
.hero .lede, .band-dark .lede, .site-footer .lede { color: rgba(255,255,255,.82); }

/* links inside dark bands */
.hero a:not(.btn),
.band-dark a:not(.btn),
.site-footer a:not(.btn) {
  color: var(--accent-on-dark);
}
.hero a:not(.btn):hover,
.band-dark a:not(.btn):hover,
.site-footer a:not(.btn):hover { color: #ffe08a; }

/* ghost button sitting on a dark band must read light (bug 1) */
.hero .btn--ghost,
.band-dark .btn--ghost,
.site-footer .btn--ghost {
  color: var(--on-brand);
  border-color: var(--on-brand);
}
.hero .btn--ghost:hover,
.band-dark .btn--ghost:hover,
.site-footer .btn--ghost:hover { background: rgba(255,255,255,.12); }

/* call/accent/signal buttons keep their own fills+ink on dark bands */
.hero .btn--call, .hero .btn--accent,
.band-dark .btn--call, .band-dark .btn--accent {
  background: var(--signal); color: var(--ink-on-signal); border-color: var(--signal);
}
.hero .btn--call:hover, .band-dark .btn--call:hover,
.hero .btn--accent:hover, .band-dark .btn--accent:hover { background: #e4b526; }
.hero .btn--signal, .band-dark .btn--signal, .site-footer .btn--signal {
  background: var(--signal); color: var(--ink-on-signal); border-color: var(--signal);
}

/* "to confirm" chip inside dark bands keeps dark ink on yellow (bugs 1+5) */
.hero .chip-confirm,
.band-dark .chip-confirm,
.site-footer .chip-confirm { color: var(--ink-on-signal); background: var(--signal); }

/* =========================================================================
   Bug (2): a LIGHT card placed inside a dark band sets its own ink.
   ========================================================================= */
.band-dark .card,
.hero .card {
  background: var(--surface);
  color: var(--ink);
}
.band-dark .card h1, .band-dark .card h2, .band-dark .card h3, .band-dark .card p,
.hero .card h1, .hero .card h2, .hero .card h3, .hero .card p {
  color: var(--ink);
}
.band-dark .card .lede, .hero .card .lede { color: var(--muted); }
.band-dark .card a:not(.btn), .hero .card a:not(.btn) { color: var(--brand-text); }

.band-dark { background: var(--band); color: var(--on-brand); }

/* =========================================================================
   Cards / grids
   ========================================================================= */
.grid {
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
}
.grid > * { min-width: 0; } /* bug 3 */
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow);
}
.card h3 { color: var(--ink); margin-top: 0; }
.card__icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--signal); color: var(--ink-on-signal);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1.2rem;
  margin-bottom: .6rem;
}

/* attribution + confirm note styling */
.attrib { font-size: .85rem; color: var(--muted); font-style: italic; }
.note-confirm { font-size: .85rem; color: var(--muted); }

/* rating badge (attributed) */
.rating {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 700;
}
.rating__stars { color: var(--signal-text); font-size: 1.1rem; }

/* =========================================================================
   Footer (always-dark band)
   ========================================================================= */
.site-footer {
  background: var(--band);
  color: var(--on-brand);
  padding: clamp(36px, 6vw, 56px) 0 1.5rem;
  border-top: 3px solid var(--signal);
}
.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: clamp(20px, 4vw, 40px);
}
.site-footer .footer-grid > * { min-width: 0; } /* bug 3 */
.site-footer h3 { color: var(--accent-on-dark); font-size: 1.1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .4rem; }
/* bug (6): this coloured link rule must NOT touch .btn text colour */
.site-footer a:not(.btn) { color: rgba(255,255,255,.9); text-decoration: none; }
.site-footer a:not(.btn):hover { color: var(--accent-on-dark); text-decoration: underline; }
.footer-nap { overflow-wrap: anywhere; } /* bug 3 */
.footer-bottom {
  margin-top: 2rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border-on-dark);
  font-size: .85rem; color: rgba(255,255,255,.7);
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between;
}

/* demo disclaimer banner */
.demo-banner {
  background: var(--signal);
  color: var(--ink-on-signal); /* bug 5 */
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  padding: .5rem 1rem;
}
.demo-banner a { color: var(--ink-on-signal); }

/* =========================================================================
   Job-card builder (Signature Feature)
   ========================================================================= */
.jobcard {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
.jobcard > * { min-width: 0; } /* bug 3 */

.jc-step { margin-bottom: 1.8rem; }
.jc-step__legend {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 .15rem;
  color: var(--ink);
  border: 0; padding: 0;
}
.jc-step__hint { color: var(--muted); font-size: .92rem; margin: 0 0 .7rem; }

.chip-set { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; border: 0; }
.chip {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: .5em 1em;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  overflow-wrap: anywhere;
}
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] {
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}
.chip[disabled] {
  opacity: .5;
  cursor: not-allowed;
  background: var(--ground);
}
.chip--day[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

.jc-field { margin-bottom: .9rem; }
.jc-field label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: .3rem;
  color: var(--ink);
}
.jc-input, .jc-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: .6em .75em;
}
.jc-textarea { min-height: 90px; resize: vertical; }
.jc-input:focus, .jc-textarea:focus { border-color: var(--brand); outline: none; }
.inline-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.inline-fields > * { min-width: 0; }

.safety-line {
  background: var(--signal);
  color: var(--ink-on-signal); /* bug 5 */
  border-radius: 8px;
  padding: .7rem 1rem;
  font-weight: 600;
  margin: 1.2rem 0;
}

/* --- always-dark preview panel --- */
.jc-preview {
  position: sticky;
  top: 80px;
  background: var(--band);
  color: var(--on-brand);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid var(--border-on-dark);
}
/* bug (1) scoped to the ALWAYS-DARK preview panel: force light children */
.jc-preview,
.jc-preview h1, .jc-preview h2, .jc-preview h3, .jc-preview p { color: var(--on-brand); }
.jc-preview h3 { color: var(--accent-on-dark); }
.jc-preview a:not(.btn) { color: var(--accent-on-dark); }
.jc-preview .btn--ghost { color: var(--on-brand); border-color: var(--on-brand); }
.jc-preview .btn--ghost:hover { background: rgba(255,255,255,.12); }
.jc-preview .btn--call, .jc-preview .btn--accent {
  background: var(--signal); color: var(--ink-on-signal); border-color: var(--signal);
}
.jc-preview .btn--call:hover, .jc-preview .btn--accent:hover { background: #e4b526; }
.jc-preview .chip-confirm { color: var(--ink-on-signal); background: var(--signal); }

.jc-preview__msg {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border-on-dark);
  border-radius: 8px;
  padding: .9rem 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere; /* bug 3 */
  font-size: .95rem;
  line-height: 1.5;
  min-height: 80px;
  margin-bottom: 1rem;
}
.jc-preview .btn-row .btn { flex: 1 1 auto; }
.copy-feedback { font-size: .85rem; color: var(--accent-on-dark); min-height: 1.2em; margin-top: .4rem; }

/* =========================================================================
   Map
   ========================================================================= */
.map-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* NAP block */
.nap { overflow-wrap: anywhere; } /* bug 3 */
.nap dt { font-family: var(--font-head); font-weight: 600; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; margin-top: .8rem; }
.nap dd { margin: 0; font-size: 1.05rem; }

/* hours table */
.hours-list { list-style: none; padding: 0; margin: 0; }
.hours-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.hours-list li.is-today { font-weight: 700; }
.hours-list .day { font-family: var(--font-head); }

/* placeholder block for missing real content */
.placeholder {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  color: var(--muted);
  font-size: .92rem;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,.02) 10px, rgba(0,0,0,.02) 20px);
}

/* =========================================================================
   Responsive — bug (3): no horizontal overflow down to 320px
   ========================================================================= */
@media (max-width: 1100px) {
  .header-cta { display: none; } /* brief: hide header CTA <=1100px */
}
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__img { order: -1; }
  .jobcard { grid-template-columns: 1fr; }
  .jc-preview { position: static; }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .site-footer .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .site-footer .footer-grid { grid-template-columns: 1fr; }
  .inline-fields { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .brand__sub { display: none; }  /* brief: hide subtitle <=480px */
  .header-cta { display: none; }  /* brief: hide header CTA <=480px */
  .site-header .container { gap: .5rem; min-height: 56px; }
  .brand__name { font-size: 1.1rem; }
  .main-nav { gap: .2rem .6rem; }
  .main-nav a { font-size: .9rem; }
}

/* Safety line sits on a yellow fill, including inside the always-dark preview panel */
.safety-line, .jc-preview .safety-line, .band .safety-line, .panel-dark .safety-line, p.safety-line { color: var(--ink-on-signal); }
