/* ==========================================================================
   HYDRO WASH — styles.css
   Palette & typography from research/design-language.md.
   Every fix in design-language §2 "Known kiro bugs" is implemented and
   cross-referenced with a (bug N) comment.
   ========================================================================== */

/* ---- Tokens (bug 1/6/7/8/9: separate roles so no token does two jobs) ---- */
:root {
  --ground: #EEF5F7;      /* page background */
  --surface: #FFFFFF;     /* cards */
  --ink: #0A2230;         /* body text */
  --muted: #44606C;       /* secondary text (>=4.5:1 on ground) */
  --brand: #00657F;       /* CTA fill (white >=4.5:1) */
  --brand-text: #00657F;  /* accent text / ticks / links on normal surfaces */
  --accent-dark: #8FE3F2; /* accent text on ALWAYS-DARK bands — fixed both themes */
  --lime: #CDEB4B;        /* highlight fill — dark text only */
  --ink-fixed: #0A2230;   /* dark text on lime — fixed both themes */
  --on-brand: #FFFFFF;    /* text on brand fills — fixed both themes */
  --cream: #E8F4F7;       /* text on always-dark bands — fixed both themes */
  --band: #0A2230;        /* always-dark header/hero/footer/CTA/planner */

  --border: #CBDDE3;      /* card border in light mode (bug 16) */
  --note-bg: #DDEFF3;     /* note chip tint (light) */
  --note-text: #0A2230;   /* note chip text (bug 17: >=4.5:1 on tint) */

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

  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

[data-theme="dark"] {
  --ground: #071820;
  --surface: #0F2A35;     /* card fill in dark (>=1.2:1 vs ground) */
  --ink: #E8F4F7;
  --muted: #B5CBD3;       /* >=4.5:1 on dark ground */
  --brand: #00657F;       /* identical; white still >=4.5:1 (bug 7) */
  --brand-text: #6FD6EC;  /* link/accent on normal dark surfaces (>=4.5:1) */
  /* --accent-dark, --lime, --ink-fixed, --on-brand, --cream unchanged (fixed) */
  --band: #030D12;

  --border: #27454F;
  --note-bg: #123642;
  --note-text: #E8F4F7;   /* >=4.5:1 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;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand-text); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--brand-text); outline-offset: 2px; border-radius: 4px; }

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

/* bug 4: never "padding: X 0" on an element that is ALSO .container.
   Section vertical rhythm lives on .section, horizontal padding on .container. */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .8rem;
  color: var(--brand-text);
  margin: 0 0 .5rem;
}
.muted { color: var(--muted); }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

/* overflow safety everywhere (bug 3) */
h1, h2, h3, h4, p, li, dd, a { overflow-wrap: anywhere; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.1;
  padding: .8rem 1.35rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, background .15s ease, color .15s ease, border-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: #00566b; border-color: #00566b; 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--lime { background: var(--lime); color: var(--ink-fixed); border-color: var(--lime); }
.btn--lime:hover { background: #bfe02f; border-color: #bfe02f; 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;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: .85rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: .02em;
  color: var(--cream);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  margin-right: auto;
  overflow-wrap: anywhere;   /* bug 3: brand name may wrap */
}
.brand .brand-accent { color: var(--accent-dark); }  /* bug 1: fixed accent on dark band */
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.1rem;
  margin: 0; padding: 0;
}
.site-nav a {
  color: var(--cream);              /* bug 1: light-on-dark nav links */
  text-decoration: none;
  font-weight: 500;
  padding: .35rem 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-tools { display: flex; align-items: center; gap: .6rem; }

/* bug 6: link-colour rules in dark sections must not override button text.
   Explicit button exceptions inside every always-dark band incl. header. */
.site-header a.btn--primary,
.hero a.btn--primary,
.band a.btn--primary,
.site-footer a.btn--primary { color: var(--on-brand); }
.site-header a.btn--primary:hover,
.hero a.btn--primary:hover,
.band a.btn--primary:hover,
.site-footer a.btn--primary:hover { color: var(--on-brand); }

/* Ghost buttons on dark bands: light border/text, legible hover (bug 1 & 6) */
.site-header a.btn--ghost, .site-header button.btn--ghost,
.hero a.btn--ghost, .hero button.btn--ghost,
.band a.btn--ghost, .band button.btn--ghost,
.site-footer a.btn--ghost, .site-footer button.btn--ghost {
  color: var(--cream);
  border-color: var(--cream);
  background: transparent;
}
.site-header a.btn--ghost:hover, .site-header button.btn--ghost:hover,
.hero a.btn--ghost:hover, .hero button.btn--ghost:hover,
.band a.btn--ghost:hover, .band button.btn--ghost:hover,
.site-footer a.btn--ghost:hover, .site-footer button.btn--ghost:hover {
  color: var(--band);
  background: var(--cream);
  border-color: var(--cream);
}
/* lime buttons keep fixed dark text even inside dark bands (bug 6/8) */
.site-header a.btn--lime, .hero a.btn--lime, .band a.btn--lime, .site-footer a.btn--lime { color: var(--ink-fixed); }

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 2px solid var(--cream);
  color: var(--cream);
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex: none;
}
.theme-toggle:hover { background: var(--cream); color: var(--band); }
.theme-toggle svg { width: 20px; height: 20px; }
.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; }

/* ==========================================================================
   Hero (ALWAYS-DARK band)
   ========================================================================== */
.hero {
  background: var(--band);
  color: var(--cream);
  position: relative;
  overflow: hidden;
}
/* bug 1: explicit light-on-dark for all text elements in hero */
.hero h1, .hero h2, .hero h3, .hero h4 { color: var(--cream); }
.hero p, .hero li { color: var(--cream); }
.hero .muted { color: #A9C6CF; }
.hero a:not(.btn) { color: var(--accent-dark); }   /* bug 1: accent-dark, not brand-text */
.hero .eyebrow { color: var(--accent-dark); }

/* diagonal sheen / water-bead motif */
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(143,227,242,.12), transparent 40%),
    linear-gradient(115deg, transparent 55%, rgba(143,227,242,.06) 55%, rgba(143,227,242,.06) 60%, transparent 60%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; padding-block: clamp(3rem, 8vw, 6rem); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--gap); align-items: center; }
.hero-copy { max-width: 36rem; }
.hero .btn-row { margin-top: 1.5rem; }

/* portrait photo in a fixed aspect-ratio frame (object-fit:cover) */
.frame {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: #0F2A35;
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame--hero { aspect-ratio: 4 / 5; }
.frame--card { aspect-ratio: 4 / 3; }
.frame--wide { aspect-ratio: 16 / 10; }

/* image attribution note */
.img-note {
  font-size: .75rem;
  margin: .4rem 0 0;
  color: var(--muted);
}
.hero .img-note { color: #A9C6CF; }   /* bug 1: legible on dark */

/* ==========================================================================
   Proof strip (ALWAYS-DARK .band)
   ========================================================================== */
.band {
  background: var(--band);
  color: var(--cream);
}
.band h1, .band h2, .band h3, .band h4 { color: var(--cream); }
.band p, .band li { color: var(--cream); }
.band .muted { color: #A9C6CF; }
.band a:not(.btn) { color: var(--accent-dark); }     /* bug 1 */
.band .eyebrow { color: var(--accent-dark); }

.proof {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  justify-content: center;
  align-items: center;
}
.proof .stat { text-align: center; }
.proof .stat b { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--accent-dark); }
.proof .stat span { color: var(--cream); font-size: .95rem; }   /* bug 1: stat/proof text light */

/* ==========================================================================
   Cards (normal surface)  — bug 16: visible border in light mode
   ========================================================================== */
.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);     /* bug 16 */
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card .card-body { padding: 1.25rem; }
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--muted); margin-bottom: 0; }

/* bug 2: NO light cards inside dark bands — cards live only on normal ground.
   (We never place .card inside .hero/.band/.site-footer.) */

/* note chip (bug 17 light contrast) */
.note {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note-text);
  font-size: .82rem;
  font-weight: 500;
  padding: .3rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.note--block { display: block; }

/* NEEDS CONTENT placeholder */
.needs-content {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  background: var(--note-bg);
  color: var(--note-text);
  font-size: .9rem;
}

/* ==========================================================================
   Lime highlight band (bug 8: dark text on lime; ghost inside lime uses
   ink-fixed border/text with own hover)
   ========================================================================== */
.band--lime { background: var(--lime); color: var(--ink-fixed); }
.band--lime h1, .band--lime h2, .band--lime h3, .band--lime p, .band--lime li { color: var(--ink-fixed); }
.band--lime .eyebrow { color: var(--ink-fixed); }
.band--lime a:not(.btn) { color: var(--ink-fixed); text-decoration: underline; }
.band--lime a.btn--ghost, .band--lime button.btn--ghost {
  color: var(--ink-fixed);
  border-color: var(--ink-fixed);
  background: transparent;
}
.band--lime a.btn--ghost:hover, .band--lime button.btn--ghost:hover {
  background: var(--ink-fixed);
  color: var(--lime);
  border-color: var(--ink-fixed);
}
.band--lime a.btn--primary { color: var(--on-brand); }

/* ==========================================================================
   NAP / find-us
   ========================================================================== */
.findus { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
.findus > * { min-width: 0; }        /* bug 3 */

dl.nap { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; }
dl.nap dt { font-family: var(--font-head); font-weight: 600; color: var(--brand-text); }
dl.nap dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }   /* bug 3 */

/* NAP inside a dark band gets explicit light colours (bug 1) */
.band dl.nap dt, .hero dl.nap dt, .site-footer dl.nap dt { color: var(--accent-dark); }
.band dl.nap dd, .hero dl.nap dd, .site-footer dl.nap dd { color: var(--cream); }

/* ==========================================================================
   Wash planner (signature feature) — the "Your wash" panel is ALWAYS DARK
   ========================================================================== */
.planner { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--gap); align-items: start; }
.planner > * { min-width: 0; }

.planner fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.35rem;
  margin: 0 0 1.25rem;
  background: var(--surface);
}
.planner legend {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0 .4rem;
  color: var(--ink);
}

/* radio / checkbox tiles (bug 13: selected visible via outline + tick, not colour alone) */
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem .9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  min-width: 0;
}
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile .mark {
  flex: none;
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand-text);
}
.tile input[type="radio"] + .mark { border-radius: 50%; }
.tile .mark svg { width: 14px; height: 14px; opacity: 0; }
.tile:hover { border-color: var(--brand-text); }
.tile:has(input:checked) { border-color: var(--brand-text); outline: 2px solid var(--brand-text); outline-offset: 1px; }
.tile:has(input:checked) .mark { border-color: var(--brand-text); }
.tile:has(input:checked) .mark svg { opacity: 1; }          /* tick */
.tile:has(input:focus-visible) { outline: 3px solid var(--brand-text); outline-offset: 2px; }

.field { margin-top: .75rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field input[type="text"],
.field input[type="date"],
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: .65rem .8rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 4rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin: .25rem 0 0; }
[hidden] { display: none !important; }   /* bug 14 dependent fields */

/* "Your wash" summary panel — ALWAYS DARK (bug 1 full light-on-dark treatment) */
.summary {
  position: sticky;
  top: 90px;
  background: var(--band);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
}
.summary h2, .summary h3, .summary h4 { color: var(--cream); }
.summary p, .summary li { color: var(--cream); }
.summary .muted { color: #A9C6CF; }
.summary .eyebrow { color: var(--accent-dark); }         /* bug 1: accent-dark */
.summary a:not(.btn) { color: var(--accent-dark); }
.summary ul.plan-list { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.summary ul.plan-list li {
  padding: .5rem 0 .5rem 1.6rem;
  position: relative;
  border-bottom: 1px solid rgba(143,227,242,.18);
}
.summary ul.plan-list li::before {
  content: "";
  position: absolute; left: 0; top: .9rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-dark);                        /* bug 9: ticks on dark use accent-dark, never brand */
}
.summary .msg-preview {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(143,227,242,.22);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .92rem;
  color: var(--cream);
  white-space: pre-wrap;
}
.summary .empty-state { color: #A9C6CF; font-style: italic; }
.summary .btn-row { margin-top: 1.1rem; }
.summary .btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.summary .btn--primary:hover { background: #0a7a96; border-color: #0a7a96; color: var(--on-brand); }
/* ghost on the always-dark summary (bug 1/6) */
.summary a.btn--ghost, .summary button.btn--ghost { color: var(--cream); border-color: var(--cream); background: transparent; }
.summary a.btn--ghost:hover, .summary button.btn--ghost:hover { background: var(--cream); color: var(--band); border-color: var(--cream); }
.copy-status { font-size: .85rem; color: var(--accent-dark); margin: .6rem 0 0; min-height: 1.2em; }

/* ==========================================================================
   Footer (ALWAYS-DARK band) — full light-on-dark (bug 1)
   ========================================================================== */
.site-footer { background: var(--band); color: var(--cream); }
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4 { color: var(--cream); }
.site-footer p, .site-footer li { color: var(--cream); }
.site-footer .muted { color: #A9C6CF; }
.site-footer a:not(.btn) { color: var(--accent-dark); }     /* bug 1 */
.site-footer .eyebrow { color: var(--accent-dark); }

.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--gap); }
.footer-grid > * { min-width: 0; }                          /* bug 3 */
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.footer-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; color: var(--cream); }
.footer-brand .brand-accent { color: var(--accent-dark); }

.footer-bottom {
  border-top: 1px solid rgba(143,227,242,.18);
  margin-top: 2rem;
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
  align-items: center;
}
.footer-bottom p { margin: 0; color: #A9C6CF; }             /* bug 1: footer-bottom light */

/* demo note — solid dark background, explicit light text (bug 1) */
.demo-note {
  background: #030D12;
  color: var(--cream);
  border: 1px solid rgba(143,227,242,.22);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .85rem;
}
.demo-note strong { color: var(--accent-dark); }           /* bug 1: .demo-note strong on dark band */

/* ==========================================================================
   Page intro
   ========================================================================== */
.page-intro { background: var(--band); color: var(--cream); }
.page-intro h1, .page-intro p { color: var(--cream); }
.page-intro .eyebrow { color: var(--accent-dark); }
.page-intro .container { padding-block: clamp(2.5rem, 6vw, 4rem); }

/* ==========================================================================
   Responsive  (bug 3: 320px safe, header CTA hidden <=480, nav own row <=700)
   ========================================================================== */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
  .frame--hero { aspect-ratio: 16 / 10; max-width: 520px; }
  .planner { grid-template-columns: 1fr; }
  .summary { position: static; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .findus { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  /* nav drops to its own full-width row (bug 3) */
  .site-header .container { flex-wrap: wrap; }
  .site-nav { order: 3; flex-basis: 100%; }
  .site-nav ul { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  /* bug 3: hide header CTA on very small screens (planner still reachable via nav) */
  .header-cta { display: none; }
}

@media (max-width: 360px) {
  .proof { gap: .75rem 1.25rem; }
  .btn { width: 100%; }           /* avoid overflow at 320px */
  .btn-row { flex-direction: column; }
}

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