/* ============================================================
   Mellow Nello Coffee — styles.css
   Design language: "Slow morning" — sand / forest / clay / sage.
   Two colour roles kept separate from the start:
     --on-brand / --cream  = light text on always-dark/brand bands (NEVER remapped)
     --surface             = card/panel fill (legitimately flips in dark mode)
   ============================================================ */

/* ---------- Palette tokens ---------- */
:root {
  --ground: #F6F1E7;      /* page background */
  --surface: #FFFFFF;     /* cards (visible border in light) */
  --ink: #1D2B22;         /* body text */
  --muted: #4B5A50;       /* secondary text */
  --brand: #9A4A2A;       /* CTA fill */
  --brand-text: #9A4A2A;  /* accent text / ticks / links on normal surfaces */
  --accent-dark: #C6E0AE; /* accent text on always-dark bands — fixed */
  --sage: #BFD8A8;        /* highlight fill — dark text on it, never white */
  --ink-fixed: #1D2B22;   /* dark text on sage — fixed */
  --on-brand: #FFFFFF;    /* text on brand fills — fixed */
  --cream: #F3EDE0;       /* text on always-dark bands — fixed */
  --band: #1D2B22;        /* always-dark header/hero/footer/CTA/planner */

  --border: #E2D9C7;      /* card border in light */
  --radius: 14px;
  --maxw: 1080px;

  --font-head: "DM Serif Display", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

[data-theme="dark"] {
  --ground: #0F1812;
  --surface: #18261D;     /* card fill flips dark */
  --ink: #F3EDE0;
  --muted: #C5D0C6;
  --brand: #9A4A2A;       /* identical in dark; white ≥4.5:1 (bug 7) */
  --brand-text: #F0A982;  /* lighter accent on dark surfaces */
  --accent-dark: #C6E0AE; /* fixed */
  --sage: #BFD8A8;        /* fixed */
  --ink-fixed: #1D2B22;   /* fixed */
  --on-brand: #FFFFFF;    /* fixed */
  --cream: #F3EDE0;       /* fixed */
  --band: #09100B;

  --border: #2C3C30;      /* card border in dark (≥1.2:1 vs surface) */
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--ground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 .4em;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
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: 20px;
}
/* bug 4: never put vertical padding on a .container; use section padding */
section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand-text);
  margin: 0 0 .6rem;
}
.muted { color: var(--muted); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 52ch; }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* ---------- 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;
  padding: .85rem 1.4rem;
  border-radius: 999px;
  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: #863d22; border-color: #863d22; color: var(--on-brand); }
.btn--ghost { background: transparent; color: var(--brand-text); border-color: currentColor; }
.btn--ghost:hover { background: rgba(154,74,42,.08); color: var(--brand-text); }
.btn--sage { background: var(--sage); color: var(--ink-fixed); border-color: var(--sage); }
.btn--sage:hover { background: #aecb92; color: var(--ink-fixed); border-color: #aecb92; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Chips / notes ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: rgba(154,74,42,.1);
  /* bug 17: dark-enough text on the tint for ≥4.5:1 in light mode */
  color: #7a3a21;
  border: 1px solid rgba(154,74,42,.25);
}
[data-theme="dark"] .chip {
  background: rgba(240,169,130,.14);
  color: var(--brand-text);
  border-color: rgba(240,169,130,.3);
}
.note {
  display: inline-block;
  font-size: .82rem;
  font-weight: 600;
  color: #7a3a21;              /* bug 17 */
  background: rgba(191,216,168,.3);
  padding: .25rem .6rem;
  border-radius: 8px;
}
[data-theme="dark"] .note { color: var(--accent-dark); background: rgba(198,224,174,.12); }
.img-note {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--band);
  color: var(--cream);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: .9rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: var(--cream);
  text-decoration: none;
  margin-right: auto;
  line-height: 1.1;
  /* bug 3: allow brand name to wrap */
  overflow-wrap: anywhere;
}
.brand small { display: block; font-family: var(--font-body); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-dark); }
.site-nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--cream);
  text-decoration: none;
  font-weight: 500;
  padding: .4rem .7rem;
  border-radius: 8px;
}
.site-nav a:hover { background: rgba(243,237,224,.12); color: var(--cream); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: .6rem; }

/* theme toggle */
.theme-toggle {
  background: transparent;
  border: 2px solid rgba(243,237,224,.4);
  color: var(--cream);
  width: 40px; height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}
.theme-toggle:hover { background: rgba(243,237,224,.12); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

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

/* ---------- Hero ---------- */
.hero {
  background: var(--band);
  color: var(--cream);
  position: relative;
  overflow: hidden;
}
.hero .container { position: relative; z-index: 2; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { color: var(--cream); }
.hero p { color: var(--cream); }
.hero .eyebrow { color: var(--accent-dark); }
.hero .lead { color: var(--cream); opacity: .92; }
.hero-media { border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(243,237,224,.15); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }
/* bug 6: hero buttons keep their own text colours */
.hero a.btn--primary { color: var(--on-brand); }
.hero a.btn--ghost { color: var(--cream); border-color: var(--cream); }
.hero a.btn--ghost:hover { color: var(--cream); background: rgba(243,237,224,.12); }
.hero a.btn--sage { color: var(--ink-fixed); }

/* ---------- Proof strip ---------- */
.proof {
  background: var(--sage);
  color: var(--ink-fixed);
}
.proof .container { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: center; justify-content: center; padding-block: 1.1rem; text-align: center; }
.proof .stat { font-family: var(--font-head); font-size: 1.25rem; color: var(--ink-fixed); }
.proof .stat span { font-family: var(--font-body); font-size: .85rem; font-weight: 500; display: block; color: var(--ink-fixed); opacity: .8; }
.proof a { color: var(--ink-fixed); font-weight: 700; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border); /* bug 16: visible border in light */
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.card-body { padding: 1.1rem 1.2rem 1.3rem; }
.card-body h3 { margin-bottom: .3rem; }
.card-body p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Generic band (always dark) ---------- */
.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 .eyebrow { color: var(--accent-dark); }
.band .muted { color: #cdd6cc; }
.band a { color: var(--accent-dark); }
.band .chip { background: rgba(198,224,174,.14); color: var(--accent-dark); border-color: rgba(198,224,174,.3); }
.band a.btn--primary { color: var(--on-brand); }
.band a.btn--ghost, .band button.btn--ghost { color: var(--cream); border-color: var(--cream); }
.band a.btn--ghost:hover, .band button.btn--ghost:hover { color: var(--cream); background: rgba(243,237,224,.12); }
.band a.btn--sage { color: var(--ink-fixed); }

.band-media { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
.band-media img { border-radius: var(--radius); aspect-ratio: 4/3; object-fit: cover; width: 100%; }

/* ---------- Find-us / NAP ---------- */
.findus { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.findus > * { min-width: 0; } /* bug 3 */
dl.nap { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; }
dl.nap dt { font-weight: 700; color: var(--ink); }
dl.nap dd { margin: 0; color: var(--muted); min-width: 0; overflow-wrap: anywhere; } /* bug 3 */
dl.nap dd a { color: var(--brand-text); }

/* ---------- Section intro ---------- */
.section-head { max-width: 60ch; margin-bottom: 2rem; }
.section-head.center { margin-inline: auto; }

/* ---------- Visit planner ---------- */
.planner-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: start; }
.planner-grid > * { min-width: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem 1.4rem; margin: 0 0 1.4rem; background: var(--surface); }
legend { font-family: var(--font-head); font-size: 1.2rem; padding: 0 .5rem; color: var(--ink); }
.field-hint { font-size: .88rem; color: var(--muted); margin: -.3rem 0 1rem; }

/* stepper */
.stepper { display: inline-flex; align-items: center; gap: .9rem; }
.stepper button {
  width: 46px; height: 46px; border-radius: 999px;
  border: 2px solid var(--brand); background: transparent; color: var(--brand-text);
  font-size: 1.5rem; line-height: 1; cursor: pointer; font-family: var(--font-body);
}
.stepper button:hover { background: rgba(154,74,42,.08); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { font-family: var(--font-head); font-size: 1.6rem; min-width: 2ch; text-align: center; color: var(--ink); }

/* radios as row */
.radio-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-pill label {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: 999px;
  border: 2px solid var(--border); cursor: pointer; font-weight: 500;
}
.radio-pill input:checked + label { border-color: var(--brand); color: var(--brand-text); background: rgba(154,74,42,.07); font-weight: 700; }
.radio-pill input:focus-visible + label { outline: 3px solid var(--sage); outline-offset: 2px; }

.date-field { margin-top: 1rem; }
.date-field[hidden] { display: none; }
.date-field input { font: inherit; padding: .6rem .7rem; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); color: var(--ink); width: 100%; max-width: 260px; }

/* checkbox tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; width: 0; height: 0; }
.tile label {
  display: flex; align-items: center; gap: .55rem;
  padding: .75rem .9rem; border-radius: 12px;
  border: 2px solid var(--border); cursor: pointer; font-weight: 500;
  height: 100%;
}
/* bug 13: selected visible via outline + tick, not colour alone */
.tile .tick { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: .8rem; line-height: 1; color: transparent; }
.tile input:checked + label { border-color: var(--brand); background: rgba(154,74,42,.07); font-weight: 700; }
.tile input:checked + label .tick { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.tile input:focus-visible + label { outline: 3px solid var(--sage); outline-offset: 2px; }

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

/* Your visit panel — always dark (bug 1) */
.visit-panel {
  background: var(--band);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.6rem;
  position: sticky;
  top: 90px;
}
.visit-panel h2, .visit-panel h3 { color: var(--cream); }
.visit-panel p, .visit-panel li { color: var(--cream); }
.visit-panel .eyebrow { color: var(--accent-dark); }
.visit-panel .muted { color: #cdd6cc; }
.visit-panel .summary-list { list-style: none; margin: 0 0 1.2rem; padding: 0; }
.visit-panel .summary-list li { padding: .5rem 0; border-bottom: 1px solid rgba(243,237,224,.14); }
.visit-panel .summary-list li:last-child { border-bottom: 0; }
.visit-panel .summary-list .k { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); margin-bottom: .1rem; }
.visit-panel a.btn--primary { color: var(--on-brand); }
.visit-panel a.btn--ghost, .visit-panel button.btn--ghost { color: var(--cream); border-color: var(--cream); }
.visit-panel a.btn--ghost:hover, .visit-panel button.btn--ghost:hover { color: var(--cream); background: rgba(243,237,224,.12); }
.visit-panel .empty-state { color: #cdd6cc; font-style: italic; }
.visit-panel .btn-row { margin-top: 1.2rem; flex-direction: column; }
.visit-panel .btn-row .btn { width: 100%; }
.copied-flag { font-size: .85rem; color: var(--accent-dark); margin-top: .5rem; min-height: 1.2em; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--band);
  color: var(--cream);
}
.site-footer .container { padding-block: 2.6rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-grid > * { min-width: 0; } /* bug 3 */
.site-footer h3, .site-footer h4 { color: var(--cream); }
.site-footer p, .site-footer li { color: #cdd6cc; }
.site-footer a { color: var(--cream); text-decoration: none; }
.site-footer a:hover { color: var(--accent-dark); text-decoration: underline; }
.site-footer .eyebrow { color: var(--accent-dark); }
.site-footer dl.nap dt { color: var(--cream); }
.site-footer dl.nap dd { color: #cdd6cc; }
.site-footer dl.nap dd a { color: var(--cream); }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-footer a.btn--primary { color: var(--on-brand); }
.site-footer a.btn--ghost, .site-footer button.btn--ghost { color: var(--cream); border-color: var(--cream); }
.site-footer a.btn--ghost:hover, .site-footer button.btn--ghost:hover { color: var(--cream); background: rgba(243,237,224,.12); }

.footer-bottom {
  border-top: 1px solid rgba(243,237,224,.14);
  margin-top: 2rem;
  padding-top: 1.4rem;
  font-size: .85rem;
  color: #cdd6cc;
}
.footer-bottom a { color: var(--cream); }
.demo-note {
  background: #09100B;         /* solid dark background (bug 1) */
  color: var(--cream);
  border: 1px solid rgba(243,237,224,.16);
  border-radius: 10px;
  padding: .8rem 1rem;
  font-size: .85rem;
  margin-bottom: 1.4rem;
}
.demo-note strong { color: var(--accent-dark); }

/* ---------- Utility ---------- */
.stack > * + * { margin-top: 1rem; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .band-media { grid-template-columns: 1fr; }
  .findus { grid-template-columns: 1fr; }
  .planner-grid { grid-template-columns: 1fr; }
  .visit-panel { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

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

@media (max-width: 560px) {
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .proof .container { flex-direction: column; gap: 1rem; }
}

/* bug 3: hide header CTA ≤480px */
@media (max-width: 480px) {
  .header-actions .btn { display: none; }
  .header-actions .theme-toggle { display: inline-flex; }
}
