/* =========================================================================
   Mels Kitchen247 — shared stylesheet
   Palette: ivory / cocoa / raspberry / peach  ("the bakery box")
   Fonts: Fraunces (headings) + Figtree (body)
   Light default; [data-theme="dark"] on <html> overrides.
   ========================================================================= */

/* ---- Tokens: separate roles, never one token two jobs -------------------- */
:root {
  --ground:      #FFF9F4;   /* page background */
  --surface:     #FFFFFF;   /* card fill (flips dark in dark mode) */
  --surface-border: #EADFD6;/* card border (light needs a visible border) */
  --ink:         #3B1F1A;   /* body text */
  --muted:       #6B4A43;   /* secondary text */
  --brand:       #B3254F;   /* CTA fill */
  --brand-text:  #A01F45;   /* accent text / links on normal surfaces */
  --accent-dark: #F6C9A4;   /* accent text on ALWAYS-dark bands (fixed) */
  --sun:         #F6C9A4;   /* highlight fill — dark text on it, never white */
  --ink-fixed:   #3B1F1A;   /* dark text on sun (fixed, both themes) */
  --on-brand:    #FFFFFF;   /* text on brand fills (fixed, both themes) */
  --cream:       #FBEFE6;   /* text on always-dark bands (fixed, both themes) */
  --band:        #3B1F1A;   /* always-dark header/hero/footer/CTA/panel */
  --note-bg:     #FBE3D3;   /* chip / note tint (light) */
  --note-text:   #5A3A17;   /* chip / note text — ≥4.5:1 on note-bg (light) */

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

  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Figtree", system-ui, -apple-system, sans-serif;
}

:root[data-theme="dark"] {
  --ground:      #1A0E0B;
  --surface:     #2A1713;   /* card surface flips dark */
  --surface-border: #46302A;
  --ink:         #FBEFE6;
  --muted:       #D9C2B8;
  --brand:       #B3254F;   /* identical; still gives white ≥4.5:1 */
  --brand-text:  #FF9DB8;   /* links on normal (dark) surfaces */
  --accent-dark: #F6C9A4;   /* fixed */
  --sun:         #F6C9A4;   /* fixed */
  --ink-fixed:   #3B1F1A;   /* fixed */
  --on-brand:    #FFFFFF;   /* fixed */
  --cream:       #FBEFE6;   /* fixed */
  --band:        #120907;   /* always-dark bands go even deeper in dark mode */
  --note-bg:     #3A241D;
  --note-text:   #F6C9A4;   /* accent on dark tint */
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  font-size: 1.0625rem;
  overflow-wrap: anywhere;      /* bug #3: no overflow at 320 */
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-text); }
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(2rem, 6vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
p  { margin: 0 0 1rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---- Layout -------------------------------------------------------------- */
.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 handled by .section, which is NOT a .container. */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section--tight { padding-block: clamp(1.75rem, 4vw, 2.75rem); }
.muted { color: var(--muted); }
.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .8rem;
  color: var(--brand-text);
  margin: 0 0 .5rem;
}
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

/* ---- Scalloped divider (cake board edge) --------------------------------- */
.scallop {
  height: 18px;
  background-image: radial-gradient(circle at 10px -4px, transparent 10px, var(--ground) 10.5px);
  background-size: 20px 18px;
  background-repeat: repeat-x;
}
.band .scallop, .site-footer .scallop { display: none; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  padding: .7rem 1.25rem; border-radius: 999px; border: 2px solid transparent;
  text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 44px;
  transition: filter .15s ease, background .15s ease, color .15s ease;
}
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { filter: brightness(1.08); }
.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 { filter: brightness(1.05); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---- Chips / notes (bug #17: ≥4.5:1 in light) ---------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--note-bg); color: var(--note-text);
  font-size: .85rem; font-weight: 600;
  padding: .3rem .7rem; border-radius: 999px;
  overflow-wrap: anywhere;
}
.img-note {
  font-size: .8rem; color: var(--muted); margin-top: .5rem; font-style: italic;
}

/* ---- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);   /* bug #16: visible border in light */
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 0;                                /* bug #3 */
}
.card h3 { margin-top: 0; }
.card img { border-radius: var(--radius-sm); margin-bottom: 1rem; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }

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

/* =========================================================================
   ALWAYS-DARK BANDS: .site-header, .hero, .band, .site-footer, .footer-bottom,
   .plan-card (Cake-brief panel). Explicit light-on-dark everywhere.
   ========================================================================= */
.site-header, .hero, .band, .site-footer, .plan-card {
  background: var(--band);
  color: var(--cream);
}

/* text elements inside dark bands (bug #1) */
.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,
.plan-card h1, .plan-card h2, .plan-card h3, .plan-card h4 { color: var(--cream); }

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

/* .muted inside dark bands must stay readable */
.hero .muted, .band .muted, .site-footer .muted, .plan-card .muted,
.hero .lede, .band .lede { color: var(--accent-dark); }

/* eyebrow / accent text on dark bands uses fixed --accent-dark, never --brand-text (bug #1) */
.site-header .eyebrow, .hero .eyebrow, .band .eyebrow,
.site-footer .eyebrow, .plan-card .eyebrow,
.site-header .muted, .site-header .brand-sub { color: var(--accent-dark); }

/* plain links in dark bands */
.hero a:not(.btn), .band a:not(.btn), .site-footer a:not(.btn),
.plan-card a:not(.btn), .site-header a:not(.btn) { color: var(--accent-dark); }

/* NAP list inside dark bands (bug #1): dt + dd 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); }

/* chips inside dark bands */
.hero .chip, .band .chip, .site-footer .chip, .plan-card .chip {
  background: rgba(246,201,164,.16); color: var(--accent-dark);
}

/* img-note / notes inside dark bands */
.hero .img-note, .band .img-note, .site-footer .img-note, .plan-card .img-note { color: var(--accent-dark); }

/* ticks on dark surfaces use --accent-dark, never --brand (bug #9) */
.hero .tick, .band .tick, .site-footer .tick, .plan-card .tick { color: var(--accent-dark); }

/* bug #6 + #1: button text inside dark bands must NOT inherit link colour,
   incl :hover. Ghost buttons on dark bands use --accent-dark border+text. */
.site-header a.btn--primary, .hero a.btn--primary, .band a.btn--primary,
.site-footer a.btn--primary, .plan-card a.btn--primary {
  color: var(--on-brand); background: var(--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, .plan-card a.btn--primary:hover { filter: brightness(1.08); }

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

/* ghost buttons on dark bands — a AND button, incl :hover (bug #1, #6) */
.site-header a.btn--ghost, .hero a.btn--ghost, .band a.btn--ghost,
.site-footer a.btn--ghost, .plan-card a.btn--ghost,
.site-header button.btn--ghost, .hero button.btn--ghost, .band button.btn--ghost,
.site-footer button.btn--ghost, .plan-card button.btn--ghost {
  color: var(--accent-dark); border-color: var(--accent-dark); background: transparent;
}
.site-header a.btn--ghost:hover, .hero a.btn--ghost:hover, .band a.btn--ghost:hover,
.site-footer a.btn--ghost:hover, .plan-card 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, .plan-card button.btn--ghost:hover {
  color: var(--ink-fixed); background: var(--accent-dark);
}

/* bug #8: ghost buttons inside a SUN band use --ink-fixed border/text + own hover */
.sun-band { background: var(--sun); color: var(--ink-fixed); }
.sun-band h1, .sun-band h2, .sun-band h3, .sun-band h4, .sun-band p, .sun-band li { color: var(--ink-fixed); }
.sun-band .eyebrow { color: var(--ink-fixed); }
.sun-band a.btn--ghost, .sun-band button.btn--ghost {
  color: var(--ink-fixed); border-color: var(--ink-fixed); background: transparent;
}
.sun-band a.btn--ghost:hover, .sun-band button.btn--ghost:hover {
  background: var(--ink-fixed); color: var(--sun);
}
.sun-band a.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* =========================================================================
   Header
   ========================================================================= */
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid rgba(246,201,164,.18); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .75rem; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; text-decoration: none; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; color: var(--cream); line-height: 1.1; overflow-wrap: anywhere; }
.brand-sub { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-dark); }
.site-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.site-nav a { color: var(--cream); text-decoration: none; font-weight: 600; padding: .5rem .7rem; border-radius: 8px; font-size: .97rem; }
.site-nav a:hover { background: rgba(246,201,164,.14); color: var(--accent-dark); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); }
.header-actions { display: flex; align-items: center; gap: .5rem; }

/* theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 999px;
  background: transparent; border: 2px solid var(--accent-dark); color: var(--accent-dark);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--accent-dark); color: var(--ink-fixed); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* header CTA hidden ≤480 (bug #3) */
@media (max-width: 480px) { .header-cta { display: none; } }
/* nav its own row ≤700 (bug #3) */
@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; justify-content: flex-start; border-top: 1px solid rgba(246,201,164,.18); padding-top: .5rem; margin-top: .25rem; }
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero { position: relative; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--gap); align-items: center; padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.hero-media { position: relative; }
.hero-media img { border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.proof-strip { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 1.5rem; }
.proof { min-width: 0; }
.proof .num { font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; color: var(--accent-dark); display: block; }
.proof .lbl { font-size: .85rem; color: var(--cream); }
@media (max-width: 760px) { .hero-inner { grid-template-columns: 1fr; } }

/* =========================================================================
   Find-us / NAP
   ========================================================================= */
.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: .35rem 1rem; }
dl.nap dt { font-weight: 700; color: var(--brand-text); }
dl.nap dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }   /* bug #3 */
@media (max-width: 640px) { .findus { grid-template-columns: 1fr; } }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer { margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: var(--gap); padding-block: clamp(2.5rem, 5vw, 3.5rem); }
.footer-grid > * { min-width: 0; }             /* bug #3 */
.footer-grid h4 { color: var(--accent-dark); }
.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(246,201,164,.18); padding-block: 1.25rem; font-size: .85rem; color: var(--accent-dark); }
.demo-note { background: var(--band); color: var(--cream); font-size: .85rem; }
.demo-note strong { color: var(--accent-dark); }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }

/* =========================================================================
   Cake-brief signature feature
   ========================================================================= */
.planner { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--gap); align-items: start; }
.planner > * { min-width: 0; }
@media (max-width: 860px) { .planner { grid-template-columns: 1fr; } }

.planner-form fieldset { border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 1.25rem; margin: 0 0 1.25rem; background: var(--surface); min-width: 0; }
.planner-form legend { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; padding-inline: .4rem; color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.tile { position: relative; min-width: 0; }
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile label {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  border: 2px solid var(--surface-border); border-radius: var(--radius-sm);
  padding: .7rem .8rem; font-weight: 600; background: var(--ground);
  min-height: 48px; overflow-wrap: anywhere;
}
.tile label .tick { opacity: 0; font-weight: 700; color: var(--brand-text); margin-left: auto; }  /* bug #13 selected tick */
.tile input:checked + label { border-color: var(--brand); outline: 2px solid var(--brand); background: var(--note-bg); color: var(--note-text); }  /* bug #13 not colour alone: outline + tick */
.tile input:checked + label .tick { opacity: 1; }
.tile input:focus-visible + label { outline: 3px solid var(--brand); outline-offset: 2px; }

.stepper { display: flex; align-items: center; gap: .75rem; }
.stepper button { width: 48px; height: 48px; border-radius: 999px; border: 2px solid var(--brand-text); background: var(--ground); color: var(--brand-text); font-size: 1.4rem; font-weight: 700; cursor: pointer; line-height: 1; }
.stepper button:hover:not(:disabled) { background: var(--brand-text); color: var(--ground); }
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper .readout { font-weight: 700; min-width: 10ch; text-align: center; }

.field-row { margin-bottom: 1rem; }
.field-row label.q { display: block; font-weight: 700; margin-bottom: .4rem; }
input[type="date"], textarea {
  font-family: var(--font-body); font-size: 1rem; width: 100%;
  padding: .65rem .75rem; border-radius: var(--radius-sm);
  border: 2px solid var(--surface-border); background: var(--ground); color: var(--ink);
  min-width: 0;
}
textarea { resize: vertical; min-height: 84px; }
.char-count { font-size: .8rem; color: var(--muted); text-align: right; }
.countdown { margin-top: .5rem; font-weight: 700; color: var(--brand-text); }
[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; color: var(--cream); }
.plan-dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.plan-dl dt { color: var(--accent-dark); font-weight: 700; }
.plan-dl dd { margin: 0; color: var(--cream); min-width: 0; overflow-wrap: anywhere; }
.plan-empty { color: var(--accent-dark); font-style: italic; }
.plan-msg {
  background: rgba(246,201,164,.1); border: 1px solid rgba(246,201,164,.28);
  border-radius: var(--radius-sm); padding: 1rem; margin: 1rem 0; color: var(--cream);
  font-size: .97rem; line-height: 1.55; overflow-wrap: anywhere;
}
.copied-note { color: var(--accent-dark); font-size: .85rem; min-height: 1.2em; margin-top: .25rem; }
@media (max-width: 860px) { .plan-card { position: static; } }

/* =========================================================================
   Misc helpers
   ========================================================================= */
.skip-link { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; border-radius: 0 0 8px 0; z-index: 100; }
.skip-link:focus { left: 0; }
.page-wrap { display: flex; flex-direction: column; min-height: 100vh; }
.section-head { max-width: 62ch; margin-bottom: 2rem; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; gap: .5rem; margin-bottom: .5rem; }
.list-plain .tick { color: var(--brand-text); font-weight: 700; }
hr.rule { border: none; border-top: 1px solid var(--surface-border); margin: 2rem 0; }
