/* ============================================================
   Happy Days — brand tokens
   Mill-to-market sourdough. Warm, honest, unfussy.
   $4 a loaf is everyday bread, so the brand is not luxury:
   cream paper, crust brown, wheat gold. No greys, no gloss.
   ============================================================ */
:root {
  --cream:      #f6efe2;
  --cream-2:    #fbf7ef;
  --paper:      #fffdf8;
  --crust:      #a9541d;
  --crust-dk:   #7d3c12;
  --ink:        #2a1c11;
  --ink-2:      #5a4636;
  --ink-3:      #8b7660;
  --gold:       #d9a441;
  --gold-soft:  #f0dfb8;
  --sage:       #6f7f52;
  --line:       #e6dac6;
  --ok:         #3f7d3f;
  --err:        #b4402c;

  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --wrap: 1140px;

  --sh-1: 0 1px 2px rgba(42,28,17,.05), 0 4px 14px rgba(42,28,17,.05);
  --sh-2: 0 2px 6px rgba(42,28,17,.07), 0 18px 44px rgba(42,28,17,.11);
  --ease: cubic-bezier(.22,.68,.32,1);
}

*, *::before, *::after { box-sizing: border-box; }

/* `hidden` must actually hide.
 *
 * The browser's user-agent sheet has `[hidden] { display: none }`, but ANY
 * author declaration of `display` beats the user-agent sheet regardless of
 * specificity. `.drawer { display: flex }` and `.modal { display: grid }` below
 * therefore overrode it: the basket and the checkout modal both rendered on
 * page load, the modal's dark blurred backdrop covered the page, and the ✕
 * button set `hidden = true` — which changed nothing on screen. An unclosable
 * popup.
 *
 * Re-asserted here with !important so no later component rule can silently
 * defeat it. This is the same guard normalize.css ships for this reason. */
[hidden] { display: none !important; }


html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.018em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 6.4vw, 4.35rem); }
h2 { font-size: clamp(1.95rem, 4.1vw, 2.95rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1em; }
a  { color: var(--crust-dk); }

:focus-visible {
  outline: 2.5px solid var(--crust);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--cream);
  padding: .8rem 1.2rem; border-radius: 0 0 var(--r-sm) 0; font-weight: 600;
}
.skip:focus { left: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }

.eyebrow {
  font-size: .74rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--crust); margin: 0 0 .85rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  --bg: var(--crust); --fg: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 600; font-size: .98rem; line-height: 1;
  padding: .95rem 1.5rem; border: 1.5px solid transparent; border-radius: 999px;
  background: var(--bg); color: var(--fg);
  text-decoration: none; cursor: pointer;
  transition: transform .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(0); }
.btn--primary:hover { --bg: var(--crust-dk); }
.btn--ghost { --bg: transparent; --fg: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { --bg: var(--ink); --fg: var(--paper); }
.btn--quiet { --bg: transparent; --fg: var(--ink-3); font-weight: 500; padding: .7rem; }
.btn--quiet:hover { --bg: transparent; --fg: var(--crust); box-shadow: none; transform: none; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(246,239,226,.9);
  backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.topbar__in { display: flex; align-items: center; gap: 1.1rem; min-height: 68px; }

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--crust); color: var(--paper);
  font-family: var(--f-display); font-weight: 700; font-size: .82rem;
  border-radius: 50% 50% 50% 8px; letter-spacing: -.02em;
}
.brand__name { font-family: var(--f-display); font-weight: 600; font-size: 1.24rem; letter-spacing: -.02em; }

.nav { display: flex; gap: 1.6rem; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .93rem; font-weight: 500; }
.nav a:hover { color: var(--crust); }

.cart-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-weight: 600; font-size: .93rem;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: .55rem 1rem; cursor: pointer;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.cart-btn:hover { border-color: var(--crust); transform: translateY(-1px); }
.cart-btn__count {
  display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--crust); color: var(--paper);
  border-radius: 999px; font-size: .76rem; font-variant-numeric: tabular-nums;
}
.cart-btn__count[data-empty="true"] { background: var(--line); color: var(--ink-3); }


/* ── Hero ──────────────────────────────────────────────── */
.hero { padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 7vw, 5.5rem); overflow: hidden; }
.hero__in { display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }

.hero__h1 { margin-bottom: .38em; }
.hero__lede { font-size: clamp(1.05rem, 1.9vw, 1.2rem); color: var(--ink-2); max-width: 30ch; margin-bottom: 1.9rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 2.4rem; }

.hero__facts { display: flex; flex-wrap: wrap; gap: 1.6rem 2.4rem; list-style: none; margin: 0; padding: 1.5rem 0 0; border-top: 1px solid var(--line); }
.hero__facts li { font-size: .88rem; color: var(--ink-3); line-height: 1.35; }
.hero__facts strong { display: block; font-family: var(--f-display); font-size: 1.85rem; color: var(--crust); line-height: 1; margin-bottom: .18rem; }

/* Hero loaf — pure CSS, no image weight */
.hero__art { position: relative; display: grid; place-items: center; padding: 1.5rem 0; }
.loaf { width: min(100%, 380px); position: relative; }
.loaf__body {
  position: relative; aspect-ratio: 5 / 3.4;
  background: linear-gradient(168deg, #e5b06a 0%, #cf8c42 46%, #a9541d 100%);
  border-radius: 46% 46% 22% 22% / 62% 62% 26% 26%;
  box-shadow: inset 0 -16px 34px rgba(94,44,10,.32), var(--sh-2);
  animation: rise 1s var(--ease) both .1s;
}
.loaf__slash {
  position: absolute; top: 26%; width: 27%; height: 15%;
  background: rgba(122,58,17,.55);
  border-radius: 50% 50% 44% 44% / 60% 60% 40% 40%;
  transform: rotate(-18deg);
  box-shadow: inset 0 2px 3px rgba(255,236,205,.4);
}
.loaf__slash:nth-child(1) { left: 17%; }
.loaf__slash:nth-child(2) { left: 38%; top: 31%; }
.loaf__slash:nth-child(3) { left: 59%; }
.loaf__board {
  height: 16px; margin: -4px auto 0; width: 92%;
  background: linear-gradient(#9c6a3f, #7b4f2a);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(42,28,17,.22);
}
.hero__price { margin: 1.6rem 0 0; text-align: center; font-size: .9rem; color: var(--ink-3); letter-spacing: .04em; }
.hero__price span { font-family: var(--f-display); font-size: 2.1rem; color: var(--ink); margin-right: .3rem; }

@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.97); } to { opacity: 1; transform: none; } }

/* ── Section heads ─────────────────────────────────────── */
.sec-head { max-width: 58ch; margin: 0 auto clamp(2.2rem, 4.5vw, 3.2rem); text-align: center; }
.sec-head--left { text-align: left; margin-inline: 0; }
.sec-lede { font-size: 1.08rem; color: var(--ink-2); margin: 0; }

/* ── Proof / steps ─────────────────────────────────────── */
.proof { padding: clamp(3.5rem, 8vw, 6rem) 0; background: var(--paper); border-block: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.step {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1.7rem 1.4rem;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.step:hover { transform: translateY(-4px); box-shadow: var(--sh-1); border-color: var(--gold); }
.step--hi { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.step--hi p { color: #d9cbb8; }
.step--hi:hover { border-color: var(--ink); }
.step__n {
  display: block; font-family: var(--f-display); font-size: .88rem;
  color: var(--crust); letter-spacing: .08em; margin-bottom: .9rem;
}
.step--hi .step__n { color: var(--gold); }
.step h3 { margin-bottom: .35em; }
.step p { font-size: .93rem; color: var(--ink-2); margin: 0; }


/* ── Shop ──────────────────────────────────────────────── */
.shop { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 1.3rem; }

.card {
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sh-1); border-color: var(--gold); }
.card[data-sold-out="true"] { opacity: .58; }

.card__art { position: relative; aspect-ratio: 16 / 11; background: var(--gold-soft); overflow: hidden; }
.card__art::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 118%, rgba(125,60,18,.26), transparent 62%);
}
.card__loaf {
  position: absolute; left: 50%; top: 52%; width: 62%; aspect-ratio: 5 / 3.4;
  transform: translate(-50%, -50%);
  background: linear-gradient(168deg, var(--c1,#e5b06a), var(--c2,#cf8c42) 48%, var(--c3,#a9541d));
  border-radius: 46% 46% 22% 22% / 62% 62% 26% 26%;
  box-shadow: inset 0 -10px 22px rgba(94,44,10,.3), 0 10px 26px rgba(42,28,17,.2);
}
.card__loaf::before, .card__loaf::after {
  content: ""; position: absolute; top: 28%; width: 26%; height: 14%;
  background: rgba(122,58,17,.5); border-radius: 50% 50% 44% 44% / 60% 60% 40% 40%;
  box-shadow: inset 0 2px 3px rgba(255,236,205,.38);
}
.card__loaf::before { left: 19%; transform: rotate(-18deg); }
.card__loaf::after  { left: 46%; top: 33%; transform: rotate(-18deg); }

.card__tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--ink); color: var(--cream);
  font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: .3rem .6rem; border-radius: 999px;
}
.card__tag--sold { background: var(--err); }

.card__body { display: flex; flex-direction: column; flex: 1; padding: 1.3rem 1.35rem 1.4rem; }
.card__name { margin: 0 0 .3em; font-size: 1.22rem; }
.card__desc { font-size: .91rem; color: var(--ink-2); margin: 0 0 1.1rem; }
.card__meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.card__price { font-family: var(--f-display); font-size: 1.45rem; color: var(--ink); }
.card__price sub { font-size: .6em; color: var(--ink-3); font-family: var(--f-body); }
.card__add { padding: .68rem 1.15rem; font-size: .9rem; }

.stock-note { text-align: center; margin: 1.8rem 0 0; font-size: .9rem; color: var(--ink-3); }

/* ── How it works ──────────────────────────────────────── */
.how { padding: clamp(3rem, 7vw, 5rem) 0; background: var(--gold-soft); border-block: 1px solid var(--line); }
.how__in { max-width: 760px; }
.ticks { list-style: none; margin: 0 0 1.4rem; padding: 0; display: grid; gap: .8rem; }
.ticks li { display: flex; align-items: flex-start; gap: .8rem; font-size: 1.02rem; }
.ticks span {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-top: .12rem;
  background: var(--sage); color: var(--paper); border-radius: 50%; font-size: .82rem; font-weight: 700;
}
.how__note { margin: 0; font-size: .95rem; color: var(--ink-2); background: rgba(255,253,248,.72); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.2rem; }

/* ── Footer ────────────────────────────────────────────── */
.foot { background: var(--ink); color: #cdbda8; padding: clamp(2.8rem, 6vw, 4rem) 0 2rem; }
.foot__in { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; padding-bottom: 2.4rem; }
.foot__brand { font-family: var(--f-display); font-size: 1.5rem; color: var(--cream); margin: 0 0 .5rem; }
.foot__h { font-size: .76rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 .6rem; }
.foot__line { font-size: .93rem; margin: 0; line-height: 1.75; }
.foot a { color: var(--gold); }
.foot__legal { border-top: 1px solid rgba(205,189,168,.18); padding-top: 1.6rem; }
.foot__legal p { margin: 0; font-size: .8rem; color: #8d7a66; }


/* ── Scrim ─────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(42,28,17,.44);
  backdrop-filter: blur(2px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Cart drawer ───────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(430px, 100%);
  background: var(--cream-2);
  border-left: 1px solid var(--line);
  box-shadow: var(--sh-2);
  display: flex; flex-direction: column;
  animation: slide .26s var(--ease);
}
@keyframes slide { from { transform: translateX(100%); } to { transform: none; } }

.drawer__head, .modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.3rem 1.4rem; border-bottom: 1px solid var(--line);
}
.drawer__head h2, .modal__head h2 { margin: 0; font-size: 1.4rem; }
.drawer__x {
  font: inherit; font-size: 1rem; line-height: 1;
  width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; color: var(--ink-2);
  border: 1.5px solid var(--line); border-radius: 50%; cursor: pointer;
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.drawer__x:hover { border-color: var(--crust); color: var(--crust); }

.drawer__body { flex: 1; overflow-y: auto; padding: 1.1rem 1.4rem; }
.drawer__foot { padding: 1.2rem 1.4rem calc(1.2rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }

.line { display: grid; grid-template-columns: 54px 1fr auto; gap: .9rem; align-items: center; padding: .95rem 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line__art { width: 54px; height: 54px; border-radius: 12px; background: var(--gold-soft); position: relative; overflow: hidden; }
.line__art::after {
  content: ""; position: absolute; left: 50%; top: 52%; width: 64%; aspect-ratio: 5/3.4;
  transform: translate(-50%,-50%);
  background: linear-gradient(168deg, var(--c1,#e5b06a), var(--c3,#a9541d));
  border-radius: 46% 46% 22% 22% / 62% 62% 26% 26%;
}
.line__name { font-weight: 600; font-size: .98rem; line-height: 1.3; }
.line__unit { font-size: .84rem; color: var(--ink-3); }
.line__ctl { display: flex; align-items: center; gap: .1rem; margin-top: .35rem; }
.qty {
  width: 30px; height: 30px; display: grid; place-items: center;
  font: inherit; font-size: 1rem; line-height: 1;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer;
}
.qty:hover { border-color: var(--crust); color: var(--crust); }
.line__n { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; font-size: .95rem; font-weight: 600; }
.line__price { font-weight: 600; font-variant-numeric: tabular-nums; }

.drawer__row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .4rem; }
.drawer__row--big { font-family: var(--f-display); font-size: 1.4rem; font-weight: 600; margin-bottom: .9rem; }
.drawer__row span:last-child { font-variant-numeric: tabular-nums; }
.drawer__tiny { font-size: .8rem; color: var(--ink-3); text-align: center; margin: .7rem 0 0; }
.drawer__foot .btn + .btn { margin-top: .5rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-3); }
.empty__ico { font-size: 2.4rem; margin: 0 0 .6rem; }
.empty p { margin: 0 0 1.2rem; }


/* ── Checkout modal ────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center; padding: 18px;
  background: rgba(42,28,17,.5); backdrop-filter: blur(3px);
  animation: fade .2s var(--ease);
}
.modal__card {
  width: min(560px, 100%); max-height: min(92vh, 900px);
  display: flex; flex-direction: column;
  background: var(--cream-2); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); overflow: hidden;
  animation: pop .24s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.modal__body { flex: 1; overflow-y: auto; padding: 1.3rem 1.5rem; display: grid; gap: 1.05rem; }
.modal__foot { padding: 1.2rem 1.5rem calc(1.2rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }

.field { display: grid; gap: .4rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: .84rem; font-weight: 600; color: var(--ink-2); padding: 0; }
.field em { font-style: normal; color: var(--ink-3); font-weight: 400; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input:not([type]), .field select {
  font: inherit; font-size: .98rem; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line);
  border-radius: var(--r-sm); padding: .72rem .85rem; width: 100%;
  transition: border-color .16s var(--ease);
}
.field input:focus, .field select:focus { border-color: var(--crust); outline: none; box-shadow: 0 0 0 3px rgba(169,84,29,.12); }
.field input::placeholder { color: #b6a690; }
.field--inline { display: flex; align-items: center; gap: .6rem; }
.field--inline span { font-weight: 500; font-size: .9rem; }

.radios { display: grid; gap: .55rem; }
.radios label { display: flex; align-items: center; gap: .6rem; font-size: .95rem; cursor: pointer; }
.radios input { accent-color: var(--crust); width: 17px; height: 17px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.co-err { margin: 0; padding: .7rem .9rem; background: #fbe9e5; border: 1px solid #f0c4bb; border-radius: var(--r-sm); color: var(--err); font-size: .88rem; }

.done { padding: 2.6rem 1.8rem 2rem; text-align: center; }
.done__tick { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 1.1rem; background: var(--ok); color: var(--paper); border-radius: 50%; font-size: 1.9rem; font-weight: 700; }
.done h3 { font-size: 1.6rem; margin-bottom: .3em; }
.done__ref { font-family: var(--f-display); font-size: 1.1rem; color: var(--crust); margin: 0 0 .4rem; }
.done__line { font-size: .94rem; color: var(--ink-2); margin: 0 0 1.6rem; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero__in { grid-template-columns: 1fr; }
  .hero__art { order: -1; }
  .hero__lede { max-width: 46ch; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .foot__in { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .cart-btn__label { display: none; }
  .steps { grid-template-columns: 1fr; }
  .foot__in { grid-template-columns: 1fr; gap: 1.6rem; }
  .row2 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .modal { padding: 0; align-items: end; }
  .modal__card { max-height: 94vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

body.is-locked { overflow: hidden; }
