/* ===========================================================
   Apprêt — Artisan Bakery, Salt Rock
   "Butter & layers" — butter ground, espresso ink, caramel action.
   Palette & rules from research/design-language.md.
   =========================================================== */

/* ---------- Tokens ---------- */
:root {
  --ground:     #FBF5E9;
  --surface:    #FFFFFF;
  --ink:        #2A1B12;
  --muted:      #665443;
  --brand:      #8A3B12;  /* CTA fill */
  --brand-text: #8A3B12;  /* accent text / ticks / links */
  --accent-dark: #F0B36A; /* accent text on always-dark bands — fixed both themes */
  --ink-fixed:  #2A1B12;  /* dark text on gold — fixed both themes */
  --gold:       #D9992B;  /* highlight fill — dark ink text on it */
  --on-brand:   #FFFFFF;  /* text on brand fills — fixed both themes */
  --butter:     #F6EBD8;  /* text on always-dark bands — fixed both themes */
  --band:       #2A1B12;  /* always-dark header/hero/footer/CTA/order panel */
  --line:       #E7D8BF;  /* layers-motif rules / card borders in light */
  --surface-line: #E2D2B8;

  --radius: 12px;
  --maxw: 1080px;
  --pad: clamp(1rem, 4vw, 2rem);

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

html[data-theme="dark"] {
  --ground:     #17110C;
  --surface:    #241A13;
  --ink:        #F6EBD8;
  --muted:      #CDBBA3;
  --brand:      #8A3B12;      /* identical in dark; white kept ≥4.5:1 via --on-brand */
  --brand-text: #F0B36A;      /* accent text / ticks / links on dark */
  --gold:       #D9992B;
  --on-brand:   #FFFFFF;
  --butter:     #F6EBD8;
  --band:       #0E0905;
  --line:       #3A2A1D;
  --surface-line: #3A2A1D;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
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;
}
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.2rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}
/* NB (bug 4): never use `padding: X 0` on an element that is also .container.
   Vertical rhythm is applied via .section, which is NOT a .container. */
.section { padding-block: clamp(2.5rem, 7vw, 5rem); }
.section--tight { padding-block: clamp(1.5rem, 4vw, 2.5rem); }

.skip-link {
  position: absolute; left: -9999px; 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-text); outline-offset: 2px; }

/* "Layers" motif — thin stacked rules like laminated dough */
.layers {
  border: 0;
  height: 6px;
  margin: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--line) 0, var(--line) 1px,
    transparent 1px, transparent 3px
  );
  background-size: 100% 6px;
}

/* ---------- 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; text-decoration: none; cursor: pointer;
  padding: .85rem 1.3rem; border-radius: var(--radius);
  border: 2px solid transparent; transition: filter .15s, background .15s, color .15s;
}
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { filter: brightness(1.12); }
.btn--gold { background: var(--gold); color: var(--ink-fixed); border-color: var(--gold); }
.btn--gold:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; color: var(--ink); border-color: currentColor; }
.btn--ghost:hover { background: var(--ink); color: var(--ground); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Header ---------- */
.site-header { background: var(--band); color: var(--butter); }
.site-header .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: 600; font-size: 1.4rem;
  color: var(--butter); text-decoration: none; letter-spacing: .01em;
  overflow-wrap: anywhere;
}
.brand span { color: var(--accent-dark); }
.site-header nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.site-header nav a {
  color: var(--butter); text-decoration: none; font-weight: 500; font-size: .98rem;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--accent-dark); }
.header-actions { display: flex; align-items: center; gap: .6rem; }

/* Theme toggle */
.theme-toggle {
  background: transparent; border: 2px solid var(--butter); color: var(--butter);
  border-radius: 50%; width: 42px; height: 42px; min-width: 42px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  padding: 0;
}
.theme-toggle:hover { background: rgba(246,235,216,.12); }
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Header CTA — hidden ≤480px (bug 3) */
.header-cta { }

/* ---------- Hero (always-dark band) ---------- */
.hero { background: var(--band); color: var(--butter); position: relative; }
.hero__grid {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center; padding-block: clamp(2.5rem, 7vw, 5rem);
}
.hero__grid > * { min-width: 0; }
.hero h1 { color: var(--butter); }
.hero p { color: var(--butter); }
.hero .eyebrow { color: var(--accent-dark); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.hero__media img { border-radius: var(--radius); width: 100%; object-fit: cover; aspect-ratio: 4/3; }
.img-note { font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.hero .img-note { color: #C9B79E; }

/* ---------- Generic always-dark band (bug 1) ---------- */
.band { background: var(--band); color: var(--butter); }
.band h1, .band h2, .band h3, .band h4 { color: var(--butter); }
.band p, .band li { color: var(--butter); }
.band a:not(.btn) { color: var(--accent-dark); }
.band .muted { color: #C9B79E; }
.band .img-note { color: #C9B79E; }

/* NAP in dark bands — explicit (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(--butter); }

/* Button-text exceptions inside dark sections (bug 6):
   link-colour rules above must NOT bleed into button text, incl. :hover. */
.hero a.btn--primary, .band a.btn--primary, .site-footer a.btn--primary, .site-header a.btn--primary,
.hero a.btn--primary:hover, .band a.btn--primary:hover, .site-footer a.btn--primary:hover, .site-header a.btn--primary:hover { color: var(--on-brand); }
.hero a.btn--gold, .band a.btn--gold, .site-footer a.btn--gold, .site-header a.btn--gold,
.hero a.btn--gold:hover, .band a.btn--gold:hover, .site-footer a.btn--gold:hover, .site-header a.btn--gold:hover { color: var(--ink-fixed); }
/* ghost buttons on dark: light outline+text in both states */
.hero a.btn--ghost, .band a.btn--ghost, .site-footer a.btn--ghost, .site-header a.btn--ghost,
.hero button.btn--ghost, .band button.btn--ghost, .site-footer button.btn--ghost, .site-header button.btn--ghost {
  color: var(--butter); border-color: var(--butter);
}
.hero a.btn--ghost:hover, .band a.btn--ghost:hover, .site-footer a.btn--ghost:hover, .site-header a.btn--ghost:hover,
.hero button.btn--ghost:hover, .band button.btn--ghost:hover, .site-footer button.btn--ghost:hover, .site-header button.btn--ghost:hover {
  background: var(--butter); color: var(--band);
}

/* ---------- Proof strip ---------- */
.proof { display: flex; flex-wrap: wrap; gap: clamp(1rem, 4vw, 3rem); justify-content: center; text-align: center; }
.proof__item { min-width: 0; }
.proof__big { font-family: var(--font-head); font-size: 1.8rem; font-weight: 600; color: var(--ink); display: block; }
.proof__label { color: var(--muted); font-size: .95rem; }
.band .proof__big { color: var(--butter); }
.band .proof__label { color: #C9B79E; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.cards > * { min-width: 0; }
.card {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--surface-line);   /* bug 15: light cards need a visible border on butter */
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.card img { aspect-ratio: 3/2; object-fit: cover; width: 100%; }
.card__body { padding: 1.1rem 1.1rem 1.3rem; }
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--muted); margin-bottom: 0; }
.card__body .img-note { margin-top: .6rem; }

/* ---------- Find-us / NAP block ---------- */
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; color: var(--ink); }
dl.nap a { color: inherit; }

/* ---------- Notes / chips ---------- */
.chip {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .03em;
  padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--surface-line);
  color: var(--muted); background: var(--surface);
}
.band .chip { color: var(--butter); border-color: rgba(246,235,216,.4); background: transparent; }
.needs-content {
  border: 1px dashed var(--surface-line); border-radius: var(--radius);
  padding: 1rem; color: var(--muted); background: transparent; font-size: .95rem;
}
.band .needs-content { color: #C9B79E; border-color: rgba(246,235,216,.3); }

/* Demo note — solid dark background (bug 1) */
.demo-note {
  background: var(--band); color: var(--butter);
  border-radius: var(--radius); padding: 1rem 1.2rem; font-size: .9rem;
}
.demo-note a { color: var(--accent-dark); }

/* ---------- CTA band ---------- */
.cta-band { background: var(--band); color: var(--butter); position: relative; overflow: hidden; }
.cta-band .cta-inner { position: relative; z-index: 1; padding-block: clamp(2.5rem,7vw,4.5rem); text-align: center; }
.cta-band h2 { color: var(--butter); }
.cta-band p { color: var(--butter); max-width: 48ch; margin-inline: auto; }
.cta-band .btn-row { justify-content: center; }
.cta-band__bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center; opacity: .18;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--band); color: var(--butter); }
.site-footer .footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem; padding-block: clamp(2rem, 5vw, 3rem);
}
.site-footer > div > .footer-grid > * { min-width: 0; }
.site-footer h3 { color: var(--butter); font-size: 1.1rem; }
.site-footer p, .site-footer li, .site-footer address { color: var(--butter); font-style: normal; }
.site-footer a:not(.btn) { color: var(--accent-dark); text-decoration: none; }
.site-footer a:not(.btn):hover { text-decoration: underline; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.footer-bottom { border-top: 1px solid rgba(246,235,216,.2); }
.footer-bottom .fb-inner { padding-block: 1rem; font-size: .85rem; color: #C9B79E; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
.footer-bottom a { color: #C9B79E !important; }

/* ===========================================================
   Signature feature — Order ahead list
   =========================================================== */
.order { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(1.5rem, 4vw, 2.5rem); align-items: start; }
.order > * { min-width: 0; }

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

/* Item rows with steppers */
.item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .8rem; border: 2px solid var(--surface-line); border-radius: var(--radius);
  margin-bottom: .6rem; background: var(--ground); flex-wrap: wrap;
}
.item-row__label { display: flex; align-items: center; gap: .55rem; font-weight: 500; min-width: 0; }
.item-row__tick {
  width: 20px; height: 20px; flex: none; opacity: 0; transition: opacity .12s;
  color: var(--brand-text);
}
.item-row__tick svg { width: 100%; height: 100%; fill: currentColor; }
.item-row[data-selected="true"] { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: -4px; }
.item-row[data-selected="true"] .item-row__tick { opacity: 1; }

.stepper { display: flex; align-items: center; gap: .3rem; flex: none; }
.stepper button {
  width: 40px; height: 40px; min-width: 40px; font-size: 1.3rem; line-height: 1;
  border: 2px solid var(--brand); background: var(--surface); color: var(--brand-text);
  border-radius: 10px; cursor: pointer; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.stepper button:hover:not(:disabled) { background: var(--brand); color: var(--on-brand); }
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper output {
  min-width: 2.2ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* "Something else" + textarea */
.text-item input[type="text"],
.order-group textarea,
.order-group input[type="date"] {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 2px solid var(--surface-line);
  border-radius: 10px; padding: .6rem .7rem;
}
.order-group textarea { resize: vertical; min-height: 4.5rem; }
.char-count { font-size: .8rem; color: var(--muted); text-align: right; }

/* Radio group */
.radio-list { display: grid; gap: .55rem; }
.radio-list label { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; }
.radio-list input[type="radio"] { margin-top: .25rem; width: 18px; height: 18px; accent-color: var(--brand); }
.date-wrap { margin: .7rem 0 0 1.75rem; max-width: 16rem; }
.date-wrap[hidden] { display: none; }

.collection-note {
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--ground); border: 1px solid var(--surface-line);
  border-radius: 10px; padding: .8rem .9rem; color: var(--ink);
}
.collection-note strong { color: var(--brand-text); }

/* Order list panel — ALWAYS DARK (bug 1) */
.order-panel {
  position: sticky; top: 1rem;
  background: var(--band); color: var(--butter);
  border-radius: var(--radius); padding: 1.3rem 1.4rem;
}
.order-panel h2, .order-panel h3 { color: var(--butter); }
.order-panel p, .order-panel li { color: var(--butter); }
.order-panel .muted { color: #C9B79E; }
.order-panel a:not(.btn) { color: var(--accent-dark); }
.order-panel ul.order-lines { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .45rem; }
.order-panel ul.order-lines li {
  display: flex; gap: .6rem; align-items: baseline;
  border-bottom: 1px solid rgba(246,235,216,.18); padding-bottom: .45rem;
}
.order-panel .qty { color: var(--accent-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.order-panel .order-meta { font-size: .88rem; color: #C9B79E; margin-top: .3rem; }
.order-panel .empty-hint { color: #C9B79E; font-style: italic; }
.order-panel .btn--ghost { color: var(--butter); border-color: var(--butter); }
.order-panel .btn--ghost:hover { background: var(--butter); color: var(--band); }
.order-panel .panel-actions { display: grid; gap: .6rem; margin-top: 1.1rem; }
.order-panel .copy-feedback { font-size: .82rem; color: var(--accent-dark); min-height: 1.1em; }

/* ---------- Page intro ---------- */
.page-head { background: var(--band); color: var(--butter); }
.page-head .page-head-inner { padding-block: clamp(2rem, 6vw, 3.5rem); }
.page-head h1 { color: var(--butter); }
.page-head p { color: var(--butter); max-width: 55ch; }
.page-head .eyebrow { color: var(--accent-dark); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }

/* ---------- Prose ---------- */
.prose { max-width: 62ch; }
.prose p { color: var(--ink); }

/* ---------- Contact methods ---------- */
.contact-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 1rem; }
.contact-methods > * { min-width: 0; }
.contact-card {
  border: 1px solid var(--surface-line); border-radius: var(--radius);
  padding: 1.2rem; background: var(--surface); display: grid; gap: .4rem;
}
.contact-card h3 { margin: 0; font-size: 1.1rem; }
.contact-card .btn { margin-top: .5rem; }

/* ===========================================================
   Responsive (bug 3)
   =========================================================== */
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
  .order { grid-template-columns: 1fr; }
  .order-panel { position: static; }
}

/* nav on its own row ≤700px */
@media (max-width: 700px) {
  .site-header .header-inner { flex-direction: column; align-items: stretch; gap: .6rem; }
  .site-header nav { order: 3; width: 100%; justify-content: flex-start; row-gap: .4rem; }
  .header-actions { position: absolute; right: var(--pad); top: .9rem; }
  .site-header { position: relative; }
}

/* ≤480px: hide header CTA, let brand wrap */
@media (max-width: 480px) {
  .header-cta { display: none !important; }
  .brand { font-size: 1.2rem; }
  .btn { width: 100%; }
  .btn-row .btn { width: auto; }
  .proof { gap: 1.2rem; }
  .item-row { gap: .6rem; }
}

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