/* Paradise Donut Co. — each shop gets its own frosting color; the box tray is the one loud element. */
:root {
  --ink: #2a1220;
  --ink-soft: #6b4d5c;
  --card: #ffffff;
  --line: rgba(42, 18, 32, 0.12);
  --kraft: #dcb88b;
  --kraft-deep: #b98f5d;
  --kraft-slot: #c9a170;
  --radius-lg: 32px;
  --radius-md: 20px;
  --display: "Bricolage Grotesque", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, sans-serif;
  --tray-h: 96px;
}
/* Default (Provo) theme; app.js swaps these to each store's own colors from its DynamoDB profile row */
body { --paper: #fff0f4; --paper-deep: #ffe0ea; --accent: #d6336c; --accent-ink: #ffffff; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  transition: background-color 0.4s ease;
  padding-bottom: calc(var(--tray-h) + 24px);
}
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.brand-mark { width: 34px; height: 34px; }
.store-switch { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.store-switch button {
  border: 0; background: transparent; padding: 8px 18px; border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft);
}
.store-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.store-switch .flag { font-size: 1.05rem; line-height: 1; }
.store-switch button { white-space: nowrap; }
.box-button {
  justify-self: end; display: inline-flex; align-items: center; gap: 10px;
  border: 2px solid var(--ink); background: transparent; border-radius: 999px; padding: 7px 8px 7px 16px; font-weight: 700;
}
.box-count { min-width: 28px; height: 28px; border-radius: 999px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 0.9rem; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(24px, 5vw, 72px);
  align-items: center; max-width: 1240px; margin: 0 auto; padding: clamp(32px, 6vw, 80px) clamp(16px, 4vw, 48px) 48px;
}
.status { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; font-weight: 600; font-size: 0.95rem; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: #9b8a92; }
.status.open .dot { background: #2f9e57; box-shadow: 0 0 0 4px rgba(47, 158, 87, 0.18); }
.status.closed .dot { background: #c0392b; }
.store-name {
  font-family: var(--display); font-weight: 800; font-size: clamp(4.2rem, 11vw, 9.5rem);
  line-height: 0.86; letter-spacing: -0.045em; margin: 0 0 18px; color: var(--accent);
  font-variation-settings: "opsz" 96;
}
.store-name.long { font-size: clamp(3.2rem, 6.4vw, 7rem); }
.tagline { font-family: var(--display); font-weight: 700; font-size: clamp(1.35rem, 2.4vw, 1.9rem); line-height: 1.15; margin: 0 0 12px; max-width: 22ch; }
.blurb { margin: 0 0 24px; max-width: 46ch; color: var(--ink-soft); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 0 28px; max-width: 520px; }
.facts dt { font-size: 0.85rem; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.cta {
  display: inline-block; background: var(--ink); color: #fff; text-decoration: none; font-weight: 700;
  padding: 14px 26px; border-radius: 999px;
}
.cta:hover { background: var(--accent); }
.hero-art { position: relative; margin: 0; }
.hero-art > img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-lg);
  background: var(--paper-deep);
}
.pick {
  position: absolute; left: -28px; bottom: -28px; display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 10px 22px 10px 10px; text-align: left;
  box-shadow: 0 18px 40px -18px rgba(42, 18, 32, 0.45);
}
.pick img { width: 84px; height: 84px; object-fit: contain; }
.pick small { display: block; color: var(--ink-soft); font-size: 0.8rem; }
.pick strong { display: block; font-family: var(--display); font-size: 1.15rem; line-height: 1.1; }

/* ---------- Menu ---------- */
.menu { max-width: 1240px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 48px) 24px; scroll-margin-top: 80px; }
.menu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.menu-head h2 { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.02em; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin: 20px 0 28px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; min-height: 46px;
}
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; padding: 10px 0; }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 0.92rem;
}
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--ink-soft); }
.sort select { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 12px; color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px 18px 20px;
}
.card-open { all: unset; cursor: pointer; display: block; border-radius: 16px; }
.card-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.card-art { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; margin: 4px 28px 14px; background: var(--disc, var(--paper-deep)); }
.card-art img { width: 86%; height: 86%; object-fit: contain; transition: transform 0.35s ease; }
.card-open:hover .card-art img { transform: rotate(-10deg) scale(1.04); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; min-height: 26px; }
.tag { font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.tag.hot { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card h3 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.15; margin: 10px 0 6px; }
.card p { margin: 0 0 16px; color: var(--ink-soft); font-size: 0.95rem; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-weight: 700; font-size: 1.1rem; }
.cal { color: var(--ink-soft); font-size: 0.85rem; font-weight: 500; margin-left: 6px; }
.add {
  border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; border-radius: 999px; padding: 10px 18px;
}
.add:hover { filter: brightness(1.08); }

.skeleton .card-art, .skeleton .line { background: linear-gradient(90deg, var(--paper-deep), var(--paper), var(--paper-deep)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .line { height: 14px; border-radius: 8px; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

.notice { text-align: center; padding: 48px 16px; }
.notice p { margin: 0 0 16px; font-size: 1.1rem; }
.notice button { border: 2px solid var(--ink); background: transparent; border-radius: 999px; padding: 10px 22px; font-weight: 700; }

/* ---------- Box tray (the signature element) ---------- */
.tray {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 15;
  width: min(1100px, calc(100% - 24px)); min-height: var(--tray-h);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 12px 14px 12px 14px; border-radius: 26px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 7px),
    var(--kraft);
  border: 2px solid var(--kraft-deep);
  box-shadow: 0 24px 50px -24px rgba(42, 18, 32, 0.6);
}
.tray-slots { display: grid; grid-template-columns: repeat(6, 32px); grid-template-rows: repeat(2, 32px); gap: 6px; padding: 6px; border-radius: 16px; background: var(--kraft-deep); }
.slot { width: 32px; height: 32px; border-radius: 50%; background: var(--kraft-slot); box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25); display: grid; place-items: center; }
.slot img { width: 34px; height: 34px; object-fit: contain; }
.slot.just-added img { animation: drop 0.45s cubic-bezier(.3,1.6,.5,1); }
@keyframes drop { from { transform: translateY(-26px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.tray-info { display: flex; flex-direction: column; color: #3b2414; }
.tray-info strong { font-family: var(--display); font-size: 1.2rem; }
.tray-info .muted { color: #5e4129; font-size: 0.92rem; }
.tray-review { border: 0; background: var(--ink); color: #fff; font-weight: 700; padding: 14px 22px; border-radius: 999px; }
.tray-review:disabled { opacity: 0.45; cursor: default; }

/* ---------- Dialogs ---------- */
.sheet { border: 0; padding: 0; color: var(--ink); background: var(--card); }
.sheet::backdrop { background: rgba(42, 18, 32, 0.45); backdrop-filter: blur(2px); }
.detail { width: min(880px, calc(100% - 24px)); border-radius: 28px; }
.close-row { display: flex; justify-content: flex-end; padding: 12px 12px 0; }
.icon-btn { border: 0; background: var(--paper); width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; line-height: 1; }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 0 32px 32px; align-items: center; }
.detail-art { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--disc, var(--paper)); }
.detail-art img { width: 88%; height: 88%; object-fit: contain; }
.detail-text h2 { font-family: var(--display); font-weight: 800; font-size: 2.3rem; line-height: 1; letter-spacing: -0.02em; margin: 12px 0 6px; }
.detail-price { font-weight: 700; font-size: 1.25rem; margin: 0 0 12px; }
.detail-facts { display: grid; gap: 10px; margin: 18px 0 24px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-facts div { display: flex; justify-content: space-between; gap: 16px; }
.detail-facts dt { color: var(--ink-soft); }
.detail-facts dd { margin: 0; font-weight: 600; text-align: right; }
.add-row { display: flex; gap: 12px; align-items: center; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { border: 0; background: transparent; width: 42px; height: 44px; font-size: 1.25rem; border-radius: 999px; }
.stepper output { min-width: 26px; text-align: center; font-weight: 700; }
.primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 13px 24px; border-radius: 999px; }
.primary.wide { width: 100%; padding: 15px; font-size: 1.05rem; }
.link { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; margin-top: 10px; width: 100%; }

.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(440px, 100%);
  border-radius: 28px 0 0 28px; display: none; flex-direction: column;
}
.drawer[open] { display: flex; animation: slide-in 0.28s ease; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px 8px; }
.drawer-head h2 { font-family: var(--display); font-weight: 800; margin: 0; font-size: 1.8rem; }
.box-list { list-style: none; margin: 0; padding: 8px 24px; overflow-y: auto; flex: 1; }
.box-list li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.box-list img { width: 56px; height: 56px; object-fit: contain; }
.box-list .name { font-weight: 700; }
.box-list .line-price { color: var(--ink-soft); font-size: 0.9rem; }
.box-list .stepper button { width: 34px; height: 34px; font-size: 1.05rem; }
.box-empty { padding: 32px 0; color: var(--ink-soft); }
.box-summary { padding: 16px 24px 24px; border-top: 1px solid var(--line); }
.box-summary p { display: flex; justify-content: space-between; margin: 0 0 8px; }
.box-summary .total { font-weight: 800; font-size: 1.2rem; }
.box-summary .muted { display: block; font-size: 0.9rem; margin-bottom: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tray-h) + 36px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 600; z-index: 30;
  transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer { max-width: 1240px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 16px; font-size: 0.9rem; }
.footer p { margin: 0 0 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; margin-bottom: 36px; }
  .pick { left: 12px; bottom: -24px; }
  .detail-body { grid-template-columns: 1fr; padding: 0 20px 24px; }
  .detail-art { max-width: 280px; margin: 0 auto; }
}
@media (max-width: 640px) {
  :root { --tray-h: 84px; }
  .topbar { grid-template-columns: 1fr auto; }
  .brand span { display: none; }
  .store-switch { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .box-button span:first-child { display: none; }
  .facts { grid-template-columns: 1fr; }
  .tray { gap: 10px; padding: 10px; bottom: 10px; }
  .tray-slots { grid-template-columns: repeat(6, 18px); grid-template-rows: repeat(2, 18px); gap: 4px; padding: 5px; }
  .slot, .slot img { width: 18px; height: 18px; }
  .tray-info strong { font-size: 0.95rem; line-height: 1.2; }
  .tray-info .muted { display: none; }
  .tray-review { padding: 10px 14px; font-size: 0.9rem; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
