/* ===========================================================================
   Khulakhaya — Tape-measure workshop
   Palette and roles from research/design-language.md.
   Token discipline: text-on-dark roles (--cream, --on-brand, --accent-dark,
   --ink-fixed) are FIXED and never remapped by theme. Only page-surface roles
   (--ground, --surface, --ink, --muted) flip in dark mode.
   =========================================================================== */

:root {
  /* page-surface roles (flip in dark) */
  --ground: #F8F5F0;
  --surface: #FFFFFF;
  --surface-border: #E3DCD1;
  --ink: #1F1F1F;
  --muted: #5A544C;
  --brand-text: #A33A0A;   /* accent text / links / ticks on normal surfaces */

  /* fixed roles — same value in both themes */
  --brand: #B8420C;        /* CTA fill */
  --on-brand: #FFFFFF;     /* text on brand fills */
  --sun: #E8C48A;          /* highlight fill */
  --ink-fixed: #1F1F1F;    /* dark text on sun — never white */
  --accent-dark: #E8C48A;  /* accent text on always-dark bands */
  --cream: #F3EEE6;        /* body text on always-dark bands */
  --cream-muted: #CFC8BD;  /* secondary text on always-dark bands */
  --band: #232323;         /* always-dark header/hero/footer/CTA/Job-brief */
  --band-line: #3A3A3A;    /* hairlines on dark bands */

  --maxw: 1080px;
  --radius: 10px;
  --tick: repeating-linear-gradient(90deg, var(--surface-border) 0 1px, transparent 1px 10px);

  --font-head: "Archivo", "Arial Narrow", Arial, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
}

html[data-theme="dark"] {
  --ground: #141414;
  --surface: #222222;
  --surface-border: #3A3A3A;
  --ink: #F3EEE6;
  --muted: #CFC8BD;
  --brand-text: #FF9F6B;
  --band: #0B0B0B;
  --band-line: #333333;
  --tick: repeating-linear-gradient(90deg, #3A3A3A 0 1px, transparent 1px 10px);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; font-weight: 800; }
h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 .5em; }
h3 { font-size: 1.25rem; margin: 0 0 .4em; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-text); }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.eyebrow {
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; font-size: .78rem; color: var(--brand-text); margin: 0 0 .6rem;
}
.lead { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); }
.ruler { height: 10px; background: var(--tick); border: 0; margin: 0; opacity: .9; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--on-brand);
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  padding: .7rem 1.2rem; border-radius: var(--radius); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 44px;
}
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: #9c3809; border-color: #9c3809; color: var(--on-brand); }
.btn--ghost { background: transparent; color: var(--brand-text); border-color: var(--brand-text); }
.btn--ghost:hover { background: var(--brand-text); color: var(--ground); }
.btn--sun { background: var(--sun); color: var(--ink-fixed); border-color: var(--sun); }
.btn--sun:hover { background: #dcb473; border-color: #dcb473; color: var(--ink-fixed); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ===========================================================================
   ALWAYS-DARK BANDS: header, hero, .band, footer, CTA, Job-brief panel.
   Explicit light-on-dark colours for every text element + button exceptions.
   =========================================================================== */
.site-header, .hero, .band, .site-footer, .cta-band, .plan-panel {
  background: var(--band);
  color: var(--cream);
}
.site-header h1, .site-header h2, .site-header h3, .site-header h4,
.hero h1, .hero h2, .hero h3, .hero h4,
.band h1, .band h2, .band h3, .band h4,
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4,
.cta-band h1, .cta-band h2, .cta-band h3, .cta-band h4,
.plan-panel h1, .plan-panel h2, .plan-panel h3, .plan-panel h4 { color: var(--cream); }

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

.site-header .muted, .hero .muted, .band .muted, .site-footer .muted,
.cta-band .muted, .plan-panel .muted,
.site-header .lead, .hero .lead, .band .lead, .site-footer .lead,
.cta-band .lead, .plan-panel .lead { color: var(--cream-muted); }

.site-header .eyebrow, .hero .eyebrow, .band .eyebrow, .site-footer .eyebrow,
.cta-band .eyebrow, .plan-panel .eyebrow { color: var(--accent-dark); }

/* accent text on dark bands uses the FIXED --accent-dark, never --brand-text */
.hero a:not(.btn), .band a:not(.btn), .site-footer a:not(.btn),
.cta-band a:not(.btn), .plan-panel a:not(.btn), .site-header a:not(.btn) { color: var(--accent-dark); }

/* NAP lists on dark bands */
.site-footer dl.nap dt, .band dl.nap dt, .cta-band dl.nap dt { color: var(--accent-dark); }
.site-footer dl.nap dd, .band dl.nap dd, .cta-band dl.nap dd { color: var(--cream); }

/* button exceptions inside dark bands — incl. :hover, both a. and button. */
.site-header a.btn--primary, .hero a.btn--primary, .band a.btn--primary,
.site-footer a.btn--primary, .cta-band a.btn--primary, .plan-panel a.btn--primary,
.plan-panel button.btn--primary {
  background: var(--brand); color: var(--on-brand); border-color: var(--brand);
}
.site-header a.btn--primary:hover, .hero a.btn--primary:hover, .band a.btn--primary:hover,
.site-footer a.btn--primary:hover, .cta-band a.btn--primary:hover, .plan-panel a.btn--primary:hover,
.plan-panel button.btn--primary:hover { background: #9c3809; border-color: #9c3809; color: var(--on-brand); }

/* ghost buttons on dark bands use --accent-dark text+border (light AND dark) */
.site-header a.btn--ghost, .hero a.btn--ghost, .band a.btn--ghost,
.site-footer a.btn--ghost, .cta-band a.btn--ghost, .plan-panel a.btn--ghost,
.site-header button.btn--ghost, .hero button.btn--ghost, .band button.btn--ghost,
.site-footer button.btn--ghost, .cta-band button.btn--ghost, .plan-panel button.btn--ghost {
  background: transparent; color: var(--accent-dark); border-color: var(--accent-dark);
}
.site-header a.btn--ghost:hover, .hero a.btn--ghost:hover, .band a.btn--ghost:hover,
.site-footer a.btn--ghost:hover, .cta-band a.btn--ghost:hover, .plan-panel a.btn--ghost:hover,
.site-header button.btn--ghost:hover, .hero button.btn--ghost:hover, .band button.btn--ghost:hover,
.site-footer button.btn--ghost:hover, .cta-band button.btn--ghost:hover, .plan-panel button.btn--ghost:hover {
  background: var(--accent-dark); color: var(--ink-fixed); border-color: var(--accent-dark);
}
/* sun buttons on dark bands keep fixed dark text */
.hero a.btn--sun, .band a.btn--sun, .cta-band a.btn--sun, .plan-panel button.btn--sun,
.plan-panel a.btn--sun { background: var(--sun); color: var(--ink-fixed); border-color: var(--sun); }
.hero a.btn--sun:hover, .band a.btn--sun:hover, .cta-band a.btn--sun:hover,
.plan-panel button.btn--sun:hover, .plan-panel a.btn--sun:hover {
  background: #dcb473; border-color: #dcb473; color: var(--ink-fixed);
}

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--band-line); }
.site-header .container { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-block: .8rem; }
.brand { display: flex; flex-direction: column; text-decoration: none; min-width: 0; }
.brand .brand-name {
  font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; color: var(--cream);
  letter-spacing: .01em; overflow-wrap: anywhere;
}
.brand .brand-sub {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent-dark); font-weight: 700;
}
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: .3rem; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a {
  display: inline-block; padding: .5rem .7rem; border-radius: 8px; text-decoration: none;
  color: var(--cream); font-weight: 600; font-size: .95rem;
}
.site-nav a:hover { background: rgba(255,255,255,.08); color: var(--cream); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); }
.header-actions { display: flex; gap: .5rem; align-items: center; }

/* theme toggle */
.theme-toggle {
  background: transparent; border: 1px solid var(--band-line); color: var(--cream);
  width: 42px; height: 42px; border-radius: 8px; cursor: pointer; display: inline-grid;
  place-items: center; padding: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.08); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- hero ---------- */
.hero { position: relative; }
.hero .container { display: grid; gap: 2rem; grid-template-columns: 1.1fr 1fr; align-items: center; padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.hero-copy { min-width: 0; }
.hero-media { min-width: 0; }
.hero-media img { border-radius: var(--radius); width: 100%; object-fit: cover; aspect-ratio: 4/3; }
.img-note { font-size: .78rem; color: var(--cream-muted); margin-top: .5rem; }

/* ---------- cards / grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--surface-border);
  border-radius: var(--radius); overflow: hidden; min-width: 0;
}
.card .card-body { padding: 1.1rem; }
.card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.card h3 { margin-bottom: .25rem; }
.card p { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 1.2rem; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid > * { min-width: 0; }

/* note chip — needs >=4.5:1 in light mode */
.chip {
  display: inline-block; font-size: .78rem; font-weight: 700; font-family: var(--font-head);
  background: #F3E2D0; color: #7A2E05; border: 1px solid #E0B98F;
  padding: .2rem .55rem; border-radius: 999px; letter-spacing: .02em;
}
html[data-theme="dark"] .chip { background: #3A2A1C; color: #FFC79C; border-color: #5A442C; }

.needs-content {
  display: block; font-size: .85rem; color: var(--muted); font-style: italic;
  border-left: 3px solid var(--sun); padding: .4rem .75rem; margin: .5rem 0;
  background: color-mix(in srgb, var(--sun) 12%, transparent);
}

/* proof strip */
.proof {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.proof .stat { font-family: var(--font-head); font-weight: 800; font-size: 1.6rem; }

/* ---------- find us / NAP ---------- */
.findus { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.findus > * { min-width: 0; }
dl.nap { margin: 0; }
dl.nap dt { font-family: var(--font-head); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-text); margin-top: .8rem; }
dl.nap dd { margin: 0 0 .2rem; min-width: 0; overflow-wrap: anywhere; }
dl.nap dd a { font-weight: 600; }

/* ---------- CTA band ---------- */
.cta-band .container { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.cta-band .cta-copy { min-width: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--band-line); margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1.5rem; padding-block: 2.5rem; }
.footer-grid > * { min-width: 0; }
.site-footer .footer-brand .brand-name { font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; color: var(--cream); }
.site-footer nav ul { list-style: none; margin: .3rem 0 0; padding: 0; }
.site-footer nav li { margin-bottom: .3rem; }
.footer-bottom { border-top: 1px solid var(--band-line); padding-block: 1.2rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-bottom, .footer-bottom p { font-size: .85rem; color: var(--cream-muted); margin: 0; }
.demo-note {
  background: #1a1a1a; border: 1px solid var(--band-line); border-radius: 8px;
  padding: .7rem 1rem; font-size: .85rem; color: var(--cream-muted);
}
.demo-note strong { color: var(--accent-dark); }

/* =================== Job brief (Plan your job) =================== */
.planner { display: grid; grid-template-columns: 1.2fr .9fr; gap: 2rem; align-items: start; }
.planner > * { min-width: 0; }
.planner fieldset { border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 1.1rem; margin: 0 0 1.4rem; background: var(--surface); }
.planner legend { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; padding: 0 .4rem; }
.planner legend .q-num { color: var(--brand-text); }
.field-help { font-size: .9rem; color: var(--muted); margin: -.2rem 0 .8rem; }

/* tile options */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.tiles > * { min-width: 0; }
.tile {
  position: relative; display: flex; align-items: center; gap: .55rem;
  border: 2px solid var(--surface-border); border-radius: 8px; padding: .65rem .8rem;
  cursor: pointer; background: var(--ground); font-weight: 600; min-height: 44px;
}
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile .tick {
  flex: 0 0 auto; width: 20px; height: 20px; border: 2px solid var(--surface-border);
  border-radius: 5px; display: inline-grid; place-items: center; font-size: .8rem; color: transparent;
}
.tile--radio .tick { border-radius: 50%; }
.tile input:checked ~ .tick { border-color: var(--brand-text); color: var(--brand-text); background: color-mix(in srgb, var(--brand-text) 14%, transparent); }
.tile:has(input:checked) { border-color: var(--brand-text); outline: 2px solid var(--brand-text); outline-offset: -1px; }
.tile input:focus-visible ~ .tick { outline: 3px solid var(--brand); outline-offset: 2px; }

.planner label.inline-label { display: block; font-weight: 700; font-family: var(--font-head); margin-bottom: .4rem; }
.planner input[type="text"], .planner input[type="date"], .planner textarea {
  width: 100%; font: inherit; padding: .6rem .7rem; border-radius: 8px;
  border: 1px solid var(--surface-border); background: var(--ground); color: var(--ink);
}
.planner textarea { resize: vertical; min-height: 72px; }
.char-count { font-size: .78rem; color: var(--muted); text-align: right; }
[hidden] { display: none !important; }
.countdown { font-weight: 700; color: var(--brand-text); margin-top: .5rem; font-family: var(--font-head); }

/* live plan card — always dark */
.plan-panel { border-radius: var(--radius); padding: 1.3rem; position: sticky; top: 1rem; }
.plan-panel h2 { font-size: 1.2rem; }
.plan-dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 1rem 0; }
.plan-dl dt { font-weight: 700; color: var(--accent-dark); font-family: var(--font-head); font-size: .85rem; }
.plan-dl dd { margin: 0; color: var(--cream); min-width: 0; overflow-wrap: anywhere; }
.plan-empty { color: var(--cream-muted); font-style: italic; }
.plan-message {
  background: #1a1a1a; border: 1px solid var(--band-line); border-radius: 8px;
  padding: .9rem; color: var(--cream); font-size: .95rem; white-space: pre-wrap; margin: 1rem 0;
}
.copied-note { font-size: .82rem; color: var(--accent-dark); min-height: 1.2em; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .planner { grid-template-columns: 1fr; }
  .plan-panel { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .site-nav { margin-left: 0; width: 100%; }        /* nav own row */
  .header-actions { order: -1; margin-left: auto; }
}
@media (max-width: 560px) {
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .findus { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .header-cta { display: none; }                     /* hide header CTA <=480px */
  body { font-size: 16px; }
}

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