/* =====================================================================
   The Fabric House Ballito — styles.css
   Design language: "Linen & thread" — oat linen ground, aubergine ink,
   mulberry action, marigold highlight. Fraunces + Figtree.
   Built to obey the 17 "Known kiro bugs" in research/design-language.md §2.
   ===================================================================== */

/* ---------- Tokens (bug rule: separate tokens per role) ---------- */
:root {
  --ground: #F5EFE4;      /* page background */
  --surface: #FFFFFF;     /* cards */
  --ink: #2B2230;         /* body text */
  --muted: #5B5060;       /* secondary text */
  --brand: #7A2E4F;       /* CTA fill */
  --brand-text: #7A2E4F;  /* accent text / links on normal surfaces */
  --accent-dark: #F2C879; /* accent text on always-dark bands (FIXED) */
  --marigold: #E9B44C;    /* highlight fill — dark text on it, never white */
  --ink-fixed: #2B2230;   /* dark text on marigold (FIXED) */
  --on-brand: #FFFFFF;    /* text on brand fills (FIXED) */
  --cream: #F4ECDD;       /* text on always-dark bands (FIXED) */
  --band: #2B2230;        /* always-dark header/hero/footer/CTA/brief panel */

  --border: #E3D8C6;      /* card border in light (bug rule 16) */
  --note-bg: #F3E4CF;     /* note chip tint */
  --note-text: #5A3A14;   /* note chip text — dark enough for ≥4.5:1 (rule 17) */

  --radius: 12px;
  --maxw: 1120px;
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Figtree", system-ui, sans-serif;
}

[data-theme="dark"] {
  --ground: #16101A;
  --surface: #221A28;     /* flips dark in dark mode */
  --ink: #F4ECDD;
  --muted: #CDC3D2;
  --brand: #7A2E4F;       /* identical in dark */
  --brand-text: #E9B0C9;  /* lighter accent for links on dark surfaces */
  /* --accent-dark, --marigold, --ink-fixed, --on-brand, --cream fixed */
  --band: #0D0910;

  --border: #3A3042;
  --note-bg: #2E2436;
  --note-text: #F2C879;   /* light enough on dark tint */
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere; /* rule 3: no overflow at 320 */
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand-text); }
img { max-width: 100%; display: block; }

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

/* Section spacing — NOT applied to .container (bug rule 4) */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand-text);
  margin: 0 0 .5rem;
}
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); }
.center { text-align: center; }

/* ---------- Stitch divider ---------- */
.stitch {
  border: 0;
  border-top: 2px dashed var(--border);
  margin: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  padding: .8rem 1.4rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, background .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: #65253f; border-color: #65253f; 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(--on-brand); }

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

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

/* ---------- Header (always-dark band) ---------- */
.site-header {
  background: var(--band);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: .9rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--cream);
  text-decoration: none;
  line-height: 1.1;
  overflow-wrap: anywhere; /* rule 3: brand name wraps */
}
.brand span { color: var(--accent-dark); }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--cream);
  text-decoration: none;
  font-weight: 500;
  padding: .3rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent-dark);
  border-bottom-color: var(--accent-dark);
}

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

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 2px solid var(--cream);
  color: var(--cream);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.theme-toggle:hover { border-color: var(--accent-dark); color: var(--accent-dark); }
.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; }

/* ---- Bug rule 6: in header band, button text must not be overridden by link rules ---- */
.site-header a.btn--primary { color: var(--on-brand); border-color: var(--brand); }
.site-header a.btn--primary:hover { color: var(--on-brand); }
.site-header a.btn--ghost { color: var(--cream); border-color: var(--cream); }
.site-header a.btn--ghost:hover { color: var(--band); background: var(--cream); }

/* =====================================================================
   ALWAYS-DARK BANDS — explicit light-on-dark colours (bug rule 1)
   Applies to .hero, .band, .site-footer, .brief-panel
   ===================================================================== */
.hero, .band, .site-footer, .brief-panel {
  background: var(--band);
  color: var(--cream);
}
.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,
.brief-panel h1, .brief-panel h2, .brief-panel h3, .brief-panel h4 {
  color: var(--cream);
}
.hero p, .hero li, .hero .lead,
.band p, .band li, .band .lead,
.site-footer p, .site-footer li,
.brief-panel p, .brief-panel li {
  color: var(--cream);
}
.hero .muted, .band .muted, .site-footer .muted, .brief-panel .muted {
  color: #D8CEDC; /* lighter muted on dark, ≥4.5:1 */
}
.hero a, .band a, .site-footer a, .brief-panel a {
  color: var(--accent-dark);
}
/* accent/eyebrow text on dark bands uses FIXED --accent-dark, never --brand-text */
.hero .eyebrow, .band .eyebrow, .site-footer .eyebrow, .brief-panel .eyebrow {
  color: var(--accent-dark);
}
/* NAP dl on dark bands (bug rule 1 explicit) */
.site-footer dl.nap dt, .band dl.nap dt { color: var(--accent-dark); }
.site-footer dl.nap dd, .band dl.nap dd { color: var(--cream); }
/* image note / notes / stat text on dark bands */
.hero .img-note, .band .img-note, .site-footer .img-note { color: #D8CEDC; }
.band .stat, .hero .stat { color: var(--cream); }
.band .stat strong, .hero .stat strong { color: var(--accent-dark); }

/* Buttons inside dark bands — text must stay correct incl. :hover (rule 6) */
.hero a.btn--primary, .band a.btn--primary, .site-footer a.btn--primary,
.brief-panel a.btn--primary {
  color: var(--on-brand); border-color: var(--brand);
}
.hero a.btn--primary:hover, .band a.btn--primary:hover,
.site-footer a.btn--primary:hover, .brief-panel a.btn--primary:hover { color: var(--on-brand); }

.hero a.btn--ghost, .band a.btn--ghost, .site-footer a.btn--ghost,
.brief-panel a.btn--ghost,
.hero button.btn--ghost, .band button.btn--ghost, .site-footer button.btn--ghost,
.brief-panel button.btn--ghost {
  color: var(--cream); border-color: var(--cream); background: transparent;
}
.hero a.btn--ghost:hover, .band a.btn--ghost:hover, .site-footer a.btn--ghost:hover,
.brief-panel a.btn--ghost:hover,
.hero button.btn--ghost:hover, .band button.btn--ghost:hover,
.site-footer button.btn--ghost:hover, .brief-panel button.btn--ghost:hover {
  color: var(--band); background: var(--cream); border-color: var(--cream);
}
.hero a.btn--marigold, .band a.btn--marigold, .brief-panel a.btn--marigold {
  color: var(--ink-fixed); border-color: var(--marigold);
}
.hero a.btn--marigold:hover, .band a.btn--marigold:hover,
.brief-panel a.btn--marigold:hover { color: var(--ink-fixed); }

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero .hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.hero-media { position: relative; }
.hero-media img {
  width: 100%;
  height: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.12);
}
.img-note {
  font-size: .78rem;
  margin-top: .5rem;
}

/* ---------- Proof strip ---------- */
.proof {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: center;
  padding-block: 1.25rem;
  list-style: none;
  margin: 0;
}
.proof li { color: var(--cream); font-size: .95rem; }
.proof .stat strong { color: var(--accent-dark); font-weight: 700; }

/* ---------- Cards grid ---------- */
.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border); /* rule 16: visible border in light */
  border-radius: var(--radius);
  overflow: hidden;
  /* selvedge-style edge */
  box-shadow: inset 3px 0 0 var(--marigold);
  min-width: 0; /* rule 3 */
}
.card img { width: 100%; height: 180px; object-fit: cover; }
.card .card-body { padding: 1.1rem 1.2rem 1.3rem; }
.card h3 { margin-bottom: .35rem; }
.card p { margin: 0; color: var(--muted); }

/* ---------- Note chip (rule 17) ---------- */
.note {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note-text);
  font-size: .82rem;
  font-weight: 600;
  padding: .3rem .7rem;
  border-radius: 999px;
}

/* ---------- NAP / find-us ---------- */
.findus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: start;
}
.findus > * { min-width: 0; } /* rule 3 */
dl.nap { margin: 0; }
dl.nap dt {
  font-weight: 700;
  color: var(--brand-text);
  margin-top: .9rem;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
dl.nap dd {
  margin: .15rem 0 0;
  overflow-wrap: anywhere; /* rule 3 */
}

/* ---------- CTA band ---------- */
.band .band-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
.band-media img {
  width: 100%; max-height: 320px; object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.12);
}

/* ---------- Footer ---------- */
.site-footer { margin-top: auto; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
}
.footer-grid > * { min-width: 0; } /* rule 3 */
.footer-grid h3 { color: var(--accent-dark); font-size: 1.05rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: .4rem; }
.footer-grid a { color: var(--cream); text-decoration: none; }
.footer-grid a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.14);
  padding-block: 1.1rem;
  font-size: .85rem;
  color: #D8CEDC;
}
.footer-bottom a { color: var(--accent-dark); }
/* .demo-note with solid dark background (bug rule 1) */
.demo-note {
  background: var(--band);
  color: #D8CEDC;
}
.demo-note strong { color: var(--accent-dark); }

/* =====================================================================
   FABRIC BRIEF — signature feature
   ===================================================================== */
.brief-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: start;
}
.brief-layout > * { min-width: 0; }

fieldset.brief-field {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.2rem;
  margin: 0 0 1.25rem;
  background: var(--surface);
}
fieldset.brief-field legend {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0 .4rem;
  color: var(--ink);
}
.field-hint { color: var(--muted); font-size: .9rem; margin: -.2rem 0 .8rem; }

/* Tile selectors (checkbox / radio) */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .6rem;
}
.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .7rem .8rem;
  cursor: pointer;
  background: var(--ground);
  font-weight: 500;
  min-width: 0;
}
.tile input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
}
.tile .tick {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: 2px solid var(--muted);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: .8rem;
  line-height: 1;
}
.tile input[type="radio"] ~ .tick { border-radius: 999px; }
/* Selected state — visible WITHOUT colour alone: outline + tick (rule 13) */
.tile input:checked ~ .tick {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}
.tile:has(input:checked) {
  border-color: var(--brand);
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.tile input:focus-visible ~ .tick {
  outline: 2px solid var(--brand-text);
  outline-offset: 2px;
}
/* colour-mood swatches */
.swatch {
  width: 18px; height: 18px; border-radius: 4px; flex: 0 0 auto;
  border: 1px solid rgba(0,0,0,.2);
}
.swatch--neutral { background: #D9CDB8; }
.swatch--bluegreen { background: linear-gradient(135deg,#3f7b78,#2f5f86); }
.swatch--warm { background: linear-gradient(135deg,#b9653f,#d99f32); }
.swatch--bold { background: repeating-linear-gradient(45deg,#7A2E4F 0 6px,#E9B44C 6px 12px); }
.swatch--unsure { background: #BCB3C2; }

/* Stepper (separate - / + buttons — bug rule 10, no nested buttons) */
.stepper { display: inline-flex; align-items: center; gap: .6rem; margin-top: .3rem; }
.stepper button {
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 2px solid var(--brand);
  background: var(--surface);
  color: var(--brand-text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.stepper button:hover { background: var(--brand); color: var(--on-brand); }
.stepper .count {
  min-width: 2.5ch;
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
}
.dependent[hidden] { display: none; }

textarea.brief-notes {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .7rem .8rem;
  font: inherit;
  color: var(--ink);
  background: var(--ground);
}
.char-count { font-size: .8rem; color: var(--muted); text-align: right; }

/* The always-dark brief panel (sticky on desktop) */
.brief-panel {
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem 1.4rem;
  position: sticky;
  top: 90px;
}
.brief-panel h2 { color: var(--cream); }
.brief-output { margin: .5rem 0 1rem; }
.brief-output .empty { color: #D8CEDC; font-style: italic; }
.brief-output ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.brief-output li { color: var(--cream); margin-bottom: .3rem; }
.brief-message {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  padding: .8rem .9rem;
  color: var(--cream);
  font-size: .95rem;
  margin: 0 0 1rem;
}
.brief-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.copy-status { font-size: .85rem; color: var(--accent-dark); margin: .6rem 0 0; min-height: 1.2em; }

/* ---------- Page intro ---------- */
.page-intro { padding-block: clamp(2rem, 5vw, 3rem); }

/* =====================================================================
   RESPONSIVE (bug rule 3)
   ===================================================================== */
@media (max-width: 900px) {
  .hero .hero-grid,
  .band .band-grid,
  .findus,
  .brief-layout,
  .footer-grid { grid-template-columns: 1fr; }
  .brief-panel { position: static; }
  .hero-media { order: -1; }
}

/* nav on its own row ≤700px */
@media (max-width: 700px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-nav { width: 100%; }
  .header-actions { width: 100%; justify-content: flex-start; }
}

/* hide header CTA ≤480px */
@media (max-width: 480px) {
  .header-actions .btn { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
}

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