/* Design system (DESIGN.md). Mobile first: base rules are the
   phone layout at 375 px; wider layouts are added in min-width queries.
   Brand colors and fonts live only in the tokens block below. */

/* @font-face rules live in _Layout.cshtml so they can use the fingerprinted,
   long-cached font URLs (L2). */

/* ---- Tokens ---- */
:root {
  --bg: #FFFACD; /* pale yellow (Jackie, 0.0.62); contrast of every text token is at or above the old cream */
  --surface: #FFFFFF;
  --ink: #2B2522;
  --muted: #6E625B;
  --line: #E8DFD6;
  --accent: #C9787E;
  /* Links, chips, checkboxes and the page focus ring use the rose; links and
     the ring use the deeper rose (6.1:1 on the pale yellow). */
  --accent-dark: #8E4A51;
  /* Buttons and badges (Jackie, 0.0.71): the mint wash behind her logo, with
     the logo's dark green lettering as the text (12.6:1). Hover, focus and
     active turn the button dark green with white text (14.2:1). Sampled from
     her logo file as the median of the wash and of the title strokes. Links,
     chips and checkboxes keep the rose accent. */
  --btn: #C8FDE3;
  --btn-ink: #17310A;
  --btn-strong: #17310A;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  --tap: 44px;
  --gap: 16px;
  --page-pad: 16px;
  --max: 1200px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: break-word;
  /* The cookie notice (_CookieNotice.cshtml, cookie-notice.js) publishes its own height here
     while shown, so content can always scroll clear of it. Zero when the notice is hidden or
     absent (JavaScript off). */
  padding-bottom: var(--cookie-notice-height, 0);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

a { color: var(--accent-dark); }

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

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.muted { color: var(--muted); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 2px; }

/* Skip link: hidden until focused, then the first thing on screen. */
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 50;
  background: var(--surface); color: var(--ink);
  padding: 12px 16px; border: 2px solid var(--accent-dark); border-radius: var(--radius);
  min-height: var(--tap);
}
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

/* Inline text links inside summaries, panels and policy text: padding grows the
   tap area to 44 px tall without changing the line layout. */
.policy a, .summary-list a, .check a, .panel p:not(.link-row) a:not(.btn), p.panel a:not(.btn), a.tap { padding: 12px 2px; margin: -12px -2px; }

main { padding: 24px 0 48px; }

/* ---- Header and menu ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 60px;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}
.header-actions { display: flex; align-items: center; gap: 4px; }
.header-actions .btn { white-space: nowrap; }

.nav-desktop { display: none; }

/* Phone menu: a details element (no script). Its panel opens as a sheet at
   the bottom of the screen so every link is in thumb reach. */
.menu > summary {
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px var(--page-pad) 24px;
  z-index: 30;
}
.menu-panel a {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 1.1rem;
}
.menu-panel a:last-child { border-bottom: 0; }

/* ---- Footer ---- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 32px 0 calc(32px + env(safe-area-inset-bottom));
  font-size: 0.95rem;
}
.site-footer .contact-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.site-footer .notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 0 16px; padding: 0; margin: 0 0 16px; list-style: none; }
.footer-links a { color: var(--muted); }
/* Standalone text links: every one is a full 44 by 44 tap target. */
.footer-links a, .section-head a, .link-row a, .carousel-more a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: var(--tap);
}
.link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 10px 20px;
  border: 1px solid var(--btn);
  border-radius: var(--radius);
  background: var(--btn);
  color: var(--btn-ink);
  font: 600 1rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.btn-ghost { padding: 10px 12px; }
/* Button states (0.0.71). Every button, whatever its variant (secondary,
   ghost, dark), is the logo mint with dark green text (12.6:1); Jackie wants
   one button colour across the site. Hover, focus and active go dark green
   with white text (14.2:1), and the focus ring is dark green (13.4:1 on the
   pale yellow page). Hover is only for real pointers, so a tap on a phone
   never leaves a sticky hover. */
@media (hover: hover) {
  .btn:hover { background: var(--btn-strong); border-color: var(--btn-strong); color: #FFFFFF; }
}
.btn:focus-visible { background: var(--btn-strong); border-color: var(--btn-strong); color: #FFFFFF; outline-color: var(--btn-strong); }
.btn:active { background: var(--btn-strong); border-color: var(--btn-strong); color: #FFFFFF; }
.btn-block { width: 100%; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.chip[aria-pressed="true"], .chip.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Cards ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.card-media {
  aspect-ratio: 4 / 3;
  background: var(--line);
  position: relative;
}
.card-media > svg { width: 100%; height: 100%; object-fit: cover; }
.card-media .badge { position: absolute; top: 8px; left: 8px; z-index: 1; }
.card-body { padding: 10px 12px 12px; }
.card-title { font-family: var(--font-body); font-size: 1rem; font-weight: 600; margin: 0; }
.card-price { color: var(--muted); margin: 2px 0 0; }
/* A collection's description under its card title: at most two lines. */
.card-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* ---- Photo frames (FR1) ---- */
/* Every photo frame is 4:3 and its photo fills it at cover, centered. Photos are cut 4:3 around
   the treats, so cover keeps the treats whole and large. */
.card-media, .lead-media, .slide { overflow: hidden; }
.card-media > img, .lead-media > img, .slide > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field legend { font-weight: 600; font-size: 0.95rem; }
.field .hint { color: var(--muted); font-size: 0.9rem; }
.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.4 var(--font-body); /* 16 px or more so iPhones do not zoom */
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-dark); outline: 2px solid var(--accent-dark); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--accent-dark); }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); padding: 10px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---- Sticky action bar (product, cart, quote pages on phones) ---- */
.action-bar {
  position: sticky;
  /* Sits above the cookie notice (cookie-notice.js) while it is shown; var() correctly does
     nothing where the bar is position: static (the 960px rule below). */
  bottom: var(--cookie-notice-height, 0);
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px var(--page-pad) calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
}
.action-bar .btn { flex: 1; }
.action-bar .total { font-weight: 600; white-space: nowrap; }

/* ---- Page sections used by the storefront ---- */
.hero {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--line);
  aspect-ratio: 4 / 3;
}
.hero > img, .hero > svg { width: 100%; height: 100%; object-fit: cover; }
.hero-copy {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 20px;
  background: rgba(255, 250, 205, 0.92);
}
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.product { display: grid; gap: 24px; }
.gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: var(--radius);
}
.gallery > * { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; }

details.disclosure { border-top: 1px solid var(--line); }
details.disclosure > summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 600; cursor: pointer; }

.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---- Wider screens ---- */
@media (min-width: 720px) {
  :root { --page-pad: 24px; --gap: 20px; }
  h1 { font-size: 2.5rem; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { aspect-ratio: 16 / 7; }
  .hero-copy { right: auto; max-width: 480px; margin: 24px; border-radius: var(--radius); }
}

/* Reserves room for the sticky action bar's own height (its 44px button, 10px top/bottom padding
   and safe-area inset) below the last page content, so a short page can never render required
   controls behind it, with or without the cookie notice on top. scroll-padding-bottom makes the
   browser's own "is this already in view" check (scrollIntoView, and a phone scrolling a tapped
   field into view) honour that same reserved band, so a control the sticky bar or the notice would
   otherwise cover is scrolled clear instead of being treated as already visible. Desktop is
   unaffected: there the action bar is position: static (the 960px rule below), so it never
   overlaps anything. */
@media (max-width: 959.98px) {
  html:has(.action-bar) { scroll-padding-bottom: calc(84px + var(--cookie-notice-height, 0)); }
  body:has(.action-bar) { padding-bottom: calc(84px + var(--cookie-notice-height, 0)); }
}

@media (min-width: 960px) {
  .nav-desktop { display: flex; gap: 4px; }
  .nav-desktop a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; color: var(--ink); text-decoration: none; }
  .nav-desktop a:hover { color: var(--accent-dark); }
  .menu { display: none; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 48px; }
  .action-bar { position: static; padding: 0; border: 0; background: none; }
  .checkout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
  .checkout .order-summary { position: sticky; top: 84px; }
}

/* ---- Storefront (C3) ---- */
/* Disabled keeps AA: muted text on cream is 5.5:1 (no opacity fade). */
.btn[disabled], .btn[disabled]:hover, .btn[disabled]:focus-visible, .btn[disabled]:active { cursor: not-allowed; background: var(--bg); border-color: var(--line); color: var(--muted); }
.filters { margin-bottom: 8px; }
.filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.chips .chip input { width: 20px; height: 20px; margin: 0 8px 0 0; accent-color: var(--accent); }
.filter-chips { margin-bottom: 12px; }
.filter-chips .chip { text-decoration: none; }
.field-label { font-weight: 600; font-size: 0.95rem; }
.contact-row { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Back office (L2) ----
   .admin wraps a back-office page built from the classes above (btn, card,
   field, input, select, textarea, check, link-row). .pa is the older wrapper
   for pages not yet moved over: it sizes bare controls to the same 44 px taps
   and 16 px text. */
.admin, .pa { max-width: 40rem; margin: 0 auto; }
.admin .card, .pa .card { padding: 12px 16px; margin: 0 0 12px; }
.admin .card > :last-child, .pa .card > :last-child { margin-bottom: 0; }
.admin-row, .pa .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-row form { margin: 0; }
.form-error, .pa .error { color: #9B1C24; font-weight: 600; }
.admin .badge, .pa .badge { background: var(--line); color: var(--ink); }
.admin .badge.is-off { background: var(--ink); color: var(--surface); }
.admin h2 { margin-top: 24px; }
.option-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 8px; }
.menu-grid .btn { min-height: 52px; }
.pa :where(button, .btn) { min-height: var(--tap); min-width: var(--tap); }
.pa :where(button) { padding: 0 16px; font-size: 1rem; }
.pa :where(input:not([type=checkbox]):not([type=radio]), select, textarea) { font-size: 16px; min-height: var(--tap); width: 100%; }
.pa :where(label) { display: block; margin: 8px 0 4px; }
.pa :where(label.check) { display: inline-flex; gap: 8px; align-items: center; min-height: var(--tap); margin: 0 16px 0 0; padding: 0; }

/* ---- Home lead item and carousel (W1) ---- */
.lead {
  display: grid;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.lead-media { display: block; position: relative; aspect-ratio: 4 / 3; background: var(--line); }
.lead-show .slideshow-controls { margin: 8px 0; }
.lead-copy { padding: 0 16px 20px; }
.lead-price { color: var(--muted); font-size: 1.1rem; }
.lead-copy .badge { margin-bottom: 8px; }
.lead ~ .hero, .lead ~ .panel { margin-top: 40px; }
.carousel-nav { display: flex; gap: 8px; flex-shrink: 0; }
.carousel-nav .btn { padding: 0; font-size: 1.5rem; }
/* Scroll-snap track: it scrolls inside itself, so the page never scrolls sideways. Fixed card
   widths and the cards' own aspect ratio mean nothing shifts as photos load. */
.carousel {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
}
.carousel-item { flex: 0 0 72%; scroll-snap-align: start; display: flex; }
.carousel-item > .card { flex: 1; }
.carousel-more { margin-top: 8px; }
@media (prefers-reduced-motion: no-preference) { .carousel { scroll-behavior: smooth; } }
@media (min-width: 720px) {
  .lead { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 32px; }
  .lead-copy { padding: 24px 24px 24px 0; }
  .carousel-item { flex-basis: calc((100% - 2 * var(--gap)) / 3); }
}
@media (min-width: 960px) {
  .carousel-item { flex-basis: calc((100% - 3 * var(--gap)) / 4); }
}

/* ---- Home logo (CT3) ---- */
/* Her round badge, centred above the slideshow: 240 px on phones, 320 px from the desktop breakpoint, never wider than the screen. */
.home-logo { display: flex; justify-content: center; margin: 4px 0 16px; }
.home-logo img { display: block; width: 240px; max-width: 100%; height: auto; }
@media (min-width: 720px) { .home-logo img { width: 320px; } }

/* ---- Home photo slideshow (H1) ---- */
/* Fixed 4:3 frame at every width, every slide stacked inside it, so the page never jumps. It is
   never taller than the window leaves room for (header and controls), centered. */
.slideshow { margin-bottom: 24px; }
.slideshow-frame { position: relative; aspect-ratio: 4 / 3; max-width: calc((100svh - 220px) * 4 / 3); margin: 0 auto; overflow: hidden; border-radius: var(--radius); background: var(--line); }
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; }
.slide.is-active { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .slide { transition: opacity .6s ease, visibility .6s; }
}
.slideshow-controls { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.slideshow-controls .btn { min-width: var(--tap); padding: 0 16px; }
.carousel-more { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

/* ---- Build your box (CF2) ---- */
.flavor-box [hidden] { display: none; }
.flavor-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.flavor-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.flavor-row:last-of-type { border-bottom: 0; }
.flavor-pick { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); font-weight: 400; cursor: pointer; }
.flavor-pick input { width: 24px; height: 24px; margin: 10px 0 0; flex: none; accent-color: var(--accent); }
.flavor-pick > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.flavor-desc { color: var(--muted); font-size: 0.9rem; }
.flavor-qty { display: flex; align-items: center; gap: 8px; margin: 6px 0 0 34px; }
.flavor-qty .btn { min-width: var(--tap); min-height: var(--tap); padding: 0; font-size: 1.25rem; }
.flavor-qty .input { width: 72px; font-size: 16px; text-align: center; }
.flavor-count { font-weight: 600; margin: 8px 0 0; }

/* ---- Custom cake pops listing (CO1) ---- */
.custom-photo { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.custom-photo img { display: block; width: 100%; height: auto; object-fit: contain; }
.custom-text h1 { margin-top: 0; }
.custom-price { color: var(--accent-dark); font-size: 1.375rem; font-weight: 600; }
.custom-group { font: 600 1rem/1.4 var(--font-body); margin: 16px 0 4px; }
.custom-flavors { margin: 0 0 12px; padding-left: 20px; }
.custom-rule { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.custom-details { background: var(--surface); border-radius: var(--radius); padding: 4px 16px; }
.custom-details p { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.custom-details svg { flex: none; color: var(--accent-dark); }
/* .btn-dark (the Design your own button here) is the same mint as every button since 0.0.71. */

/* ---- Back-office messages: likely spam (SP1) ---- */
.spam-flag { color: var(--muted); font-size: 0.875rem; font-weight: 700; }
.card.spam { opacity: 0.7; }
