/* =====================================================================
   SugarPlumJelly Miami — v5 additions
   (cookie grid, a page for each cookie, the cake request page,
   same-shape cake photos, kind words with photos)
   ===================================================================== */

/* ---------- Cookie menu: a grid, 4 across on computers, 2 on phones ---------- */
.treat-grid { list-style: none; margin: 0 auto; padding: 0; max-width: 1180px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(28px, 3.4vw, 44px) clamp(16px, 2.4vw, 32px); }
@media (max-width: 1024px) { .treat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .treat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; } }

.treat { position: relative; display: grid; grid-template-rows: auto 1fr; gap: 10px; text-align: center; }
.treat .fm { width: min(100%, 220px); margin-inline: auto; cursor: pointer; text-decoration: none; }
.treat .fm-cookie { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; }
.treat .fm-cookie.is-photo { inset: 13%; width: 74%; height: 74%; object-fit: cover; }
.treat .fm-inside { width: 44%; right: -2%; bottom: 0; box-shadow: 0 0 0 4px var(--surface), var(--shadow-md); }
.treat .fm-crumbs i:nth-child(1) { --cx: -90px; --cy: -40px; } .treat .fm-crumbs i:nth-child(2) { --cx: 84px; --cy: -56px; }
.treat .fm-crumbs i:nth-child(3) { --cx: -70px; --cy: 56px; } .treat .fm-crumbs i:nth-child(4) { --cx: 96px; --cy: 26px; }
.treat .fm-crumbs i:nth-child(5) { --cx: -24px; --cy: -92px; } .treat .fm-crumbs i:nth-child(6) { --cx: 36px; --cy: 86px; }
/* hover: the halo swells softly behind the cookie */
.treat .fm:hover .fm-halo { transform: scale(1.04); }
/* one calm movement for every cookie, the same as "This week’s batch": grow a little and tilt */
.treat .fm-cookie { transition: transform 500ms var(--ease-spring), filter 500ms; }
.treat .fm:hover .fm-cookie, .treat .fm:focus-visible .fm-cookie { transform: rotate(calc(var(--tilt) - 8deg)) scale(1.06); animation: none; }
.treat .fm:hover .fm-inside { transform: none; opacity: 1; transition-delay: 120ms; }
.treat.is-soldout .fm-cookie { filter: grayscale(.6) brightness(1.05); }

.treat-body { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.treat .flavor-tags { justify-content: center; min-height: 0; }
.treat .tag, .treat .stock-note { font-size: .72rem; padding: 3px 9px; }
.treat-name { font-size: clamp(1.15rem, 1.7vw, 1.45rem); line-height: 1.12; text-wrap: balance; }
.treat-name a { color: inherit; text-decoration: none; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1.5px; background-position: 50% 100%; background-repeat: no-repeat; transition: background-size var(--t-med) var(--ease-out); }
.treat-name a:hover { background-size: 100% 1.5px; }
.treat-name a::after { /* the words area opens the cookie page too (the picture is its own link) */ content: ""; position: absolute; inset: 0; z-index: 1; }
.treat-desc { color: var(--ink-soft); font-size: .92rem; line-height: 1.45; max-width: 30ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.treat-buy { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; min-height: 54px; }
.treat-price { font-family: var(--font-display); font-size: 1.45rem; color: var(--grape); line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.treat .card-actions { margin: 0; }
.treat .add-btn { width: auto; min-height: 44px; padding: 10px 18px; font-size: .95rem; }
.treat .stepper { width: auto; min-width: 136px; gap: 4px; }
.treat .stepper output { min-width: 2.4ch; font-variant-numeric: tabular-nums; }
.treat.is-soldout .treat-price { opacity: .5; }
.js .treat.reveal { transform: translateY(28px); }
.js .treat.reveal.is-in { transform: none; }
@media (max-width: 760px) {
  .treat .fm { width: min(100%, 170px); }
  .treat-desc { font-size: .86rem; }
  .treat-buy { gap: 8px; }
  .treat-price { font-size: 1.25rem; }
  .treat .add-btn { padding: 10px 14px; }
  .treat .stepper { min-width: 0; }
}
[data-theme="dark"] .treat-name { font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.2; }
[data-theme="dark"] .treat-price { color: var(--silver); font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; }

/* ---------- This week's batch: few cookies no longer float up over the line ---------- */
.showcase-stage { grid-template-rows: auto minmax(0, 1fr) auto; row-gap: 12px; }
.batch { align-items: center; align-content: center; }
.sc-item:nth-child(2) { margin-top: 0; }
.batch .sc-item:nth-child(3n+2) { transform-origin: 50% 60%; }
.batch.is-leaving .sc-item { filter: none; transform: translateY(-24px) scale(.96); }
.showcase.is-static .showcase-stage { padding-block: clamp(56px, 7vw, 88px); row-gap: clamp(20px, 3vw, 36px); }
.showcase.is-static .showcase-batches { align-self: auto; }
.showcase.is-static .batch { margin: 0; padding-top: 12px; }
.showcase.is-static .sc-cookie { width: min(100%, 240px); }
.showcase.is-static .sc-plinth { top: 58%; }

/* ---------- Cake photos: all the same shape ---------- */
.cake-gallery { columns: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cake-shot { margin: 0; }
.cake-shot figure, .cake-shot:nth-child(4n+1) figure, .cake-shot:nth-child(1) figure, .cake-shot:nth-child(6) figure { aspect-ratio: 4 / 5; border-radius: 18px; }
.cake-shot img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) { .cake-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .cake-shot { margin: 0; } }

/* ---------- Main page: the button to the cake request page ---------- */
.cake-cta { margin-top: clamp(48px, 7vw, 80px); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(18px, 3vw, 40px); padding: clamp(22px, 3.4vw, 40px) clamp(22px, 4vw, 48px); background: var(--paper); border-radius: 28px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.cake-cta .cr-quill { width: clamp(72px, 8vw, 110px); height: auto; color: var(--grape); }
.cake-cta-copy { display: grid; gap: 6px; color: var(--ink-soft); }
.cake-cta-copy .cr-title { font-size: clamp(1.7rem, 3.2vw, 2.4rem); color: var(--ink); line-height: 1.05; }
.cake-cta-copy p:last-child { max-width: 52ch; }
.cake-cta .btn { white-space: nowrap; }
@media (max-width: 760px) { .cake-cta { grid-template-columns: 1fr; justify-items: start; } .cake-cta .btn { width: 100%; justify-content: center; } }
[data-theme="dark"] .cake-cta { background: rgba(33, 26, 43, .82); box-shadow: 0 0 0 1px rgba(193, 181, 201, .22), var(--shadow-md); }
[data-theme="dark"] .cake-cta .cr-quill { color: var(--silver); }

/* ---------- Pages other than the main one ---------- */
.sub-header .header-inner { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; }
.sub-header .brand { margin: 0; justify-self: center; }
.sub-header .header-actions { justify-self: end; }
.back-link { justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px 8px 10px; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: .95rem; text-decoration: none; background: color-mix(in srgb, var(--lilac-soft) 70%, transparent); transition: background-color var(--t-med), transform var(--t-med) var(--ease-spring); }
.back-link svg { width: 20px; height: 20px; transition: transform var(--t-med) var(--ease-spring); }
.back-link:hover { background: var(--lilac-soft); }
.back-link:hover svg { transform: translateX(-3px); }
.back-link:active { transform: scale(.97); }
@media (max-width: 640px) { .back-link .bl-long { display: none; } .sub-header .brand img { height: 32px; } }
[data-theme="dark"] .back-link { color: var(--ink); background: rgba(96, 70, 110, .35); box-shadow: inset 0 0 0 1px rgba(193, 181, 201, .2); }
[data-theme="dark"] .back-link:hover { background: rgba(96, 70, 110, .55); }

.subpage { position: relative; padding-block: clamp(14px, 2vw, 24px) clamp(64px, 9vw, 110px); min-height: 70vh; }
.subpage .cakes-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .16; }
[data-theme="dark"] .subpage .cakes-bg { opacity: .05; }
.subpage > .container { position: relative; z-index: 1; }
.crumbs ol { list-style: none; margin: 0 0 clamp(18px, 3vw, 32px); padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--ink-soft); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .55; }
.crumbs a { color: inherit; text-underline-offset: 3px; }
.crumbs a:hover { color: var(--grape); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- Cake request page ---------- */
.cake-request.is-page { margin-top: 0; position: relative; }
.cake-request.is-page .cr-title { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: .98; color: var(--ink); }
.cr-paused { display: grid; justify-items: center; text-align: center; gap: 14px; max-width: 560px; margin: clamp(20px, 5vw, 60px) auto 0; color: var(--ink-soft); }
.cr-paused .cr-quill { width: 110px; height: auto; color: var(--grape); }
.cr-paused .cr-title { font-size: clamp(2.2rem, 5vw, 3.4rem); color: var(--ink); }
.page-gallery { margin-top: clamp(64px, 9vw, 110px); position: relative; }
.page-gallery .section-head { margin-bottom: clamp(22px, 3vw, 36px); }

/* ---------- A cookie's own page ---------- */
.cp { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.cp-gallery { position: relative; display: grid; gap: 14px; border-radius: 28px; }
.cp-gallery:focus-visible { outline: 3px solid var(--grape); outline-offset: 6px; }
.cp-stage { position: relative; aspect-ratio: 1; border-radius: 28px; background: var(--paper); box-shadow: var(--shadow-sm); overflow: hidden; touch-action: pan-y; }
.cp-track { display: flex; height: 100%; }
.cp-slide { position: relative; flex: 0 0 100%; height: 100%; margin: 0; display: grid; place-items: center; }
.cp-stage.is-draggable { cursor: grab; }
.cp-stage.is-dragging { cursor: grabbing; }
.cp-stage img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.cp-nav:disabled { opacity: .35; cursor: default; transform: none; }
.cp-slide .cp-img { width: 100%; height: 100%; object-fit: cover; }
.cp-slide.is-cut { background: radial-gradient(60% 60% at 50% 55%, var(--lilac-soft), transparent 72%); }
.cp-slide.is-cut .fm-halo { inset: 14%; }
.cp-slide.is-cut .cp-img { position: relative; width: 78%; height: auto; object-fit: contain; filter: drop-shadow(0 26px 26px rgba(60, 28, 50, .22)); }
.cp-nav { position: absolute; top: calc(50% - 30px); z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md); cursor: pointer; transition: transform var(--t-med) var(--ease-spring), background-color var(--t-med); }
.cp-nav svg { width: 22px; height: 22px; }
.cp-nav:hover { transform: scale(1.06); }
.cp-nav:active { transform: scale(.95); }
.cp-prev { left: 12px; } .cp-next { right: 12px; }
.cp-count { position: absolute; top: 14px; right: 16px; z-index: 2; margin: 0; font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cp-count:empty { display: none; }
.cp-thumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cp-thumb { width: 72px; height: 72px; padding: 0; border: 0; border-radius: 16px; overflow: hidden; cursor: pointer; background: var(--paper); box-shadow: 0 0 0 1px rgba(106, 61, 94, .14); opacity: .7; transition: opacity var(--t-med), box-shadow var(--t-med), transform var(--t-med) var(--ease-spring); }
.cp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cp-thumb.is-cut img { object-fit: contain; padding: 6px; }
.cp-thumb:hover { opacity: 1; transform: translateY(-2px); }
.cp-thumb[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 3px var(--grape); }

.cp-info { display: grid; gap: 16px; justify-items: start; padding-top: clamp(0px, 2vw, 24px); }
.cp-name { font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: .98; text-wrap: balance; }
.cp-desc { font-size: 1.12rem; color: var(--ink-soft); max-width: 46ch; margin: 0; }
.cp-buy { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 18px 0; border-block: 1px dashed rgba(106, 61, 94, .22); width: 100%; }
.cp-price { font-family: var(--font-display); font-size: 2.4rem; color: var(--grape); line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.cp .card-actions { margin: 0; min-width: 220px; }
.cp .add-btn { width: auto; }
.cp .stepper { width: 240px; }
.cp.is-soldout .cp-price { opacity: .5; }
.cp-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--ink-soft); font-size: .95rem; }
.cp-facts li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.cp-facts svg { width: 20px; height: 20px; color: var(--grape); margin-top: 1px; }
.cp-missing { display: grid; justify-items: center; text-align: center; gap: 14px; padding-block: clamp(40px, 8vw, 90px); color: var(--ink-soft); }
.cp-missing h1 { font-size: clamp(2rem, 4.4vw, 3rem); color: var(--ink); }
.cp-more { margin-top: clamp(64px, 9vw, 110px); }
.cp-more-title { text-align: center; font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin-bottom: clamp(24px, 3vw, 40px); }
@media (max-width: 860px) {
  .cp { grid-template-columns: 1fr; }
  .cp-info { padding-top: 0; }
  .cp-nav { width: 44px; height: 44px; }
  .cp .card-actions { min-width: 0; flex: 1; }
  .cp .add-btn, .cp .stepper { width: 100%; }
}
[data-theme="dark"] .cp-stage, [data-theme="dark"] .cp-thumb { background: rgba(33, 26, 43, .85); box-shadow: 0 0 0 1px rgba(193, 181, 201, .22), var(--shadow-md); }
[data-theme="dark"] .cp-slide.is-cut { background: radial-gradient(60% 60% at 50% 55%, rgba(96, 70, 110, .45), transparent 72%); }
[data-theme="dark"] .cp-slide.is-cut .cp-img { filter: drop-shadow(0 26px 26px rgba(0, 0, 0, .6)) drop-shadow(0 0 22px rgba(157, 130, 182, .3)); }
[data-theme="dark"] .cp-thumb[aria-current="true"] { box-shadow: 0 0 0 3px var(--silver); }
[data-theme="dark"] .cp-nav { background: #211A2B; color: var(--ink); box-shadow: 0 0 0 1px rgba(193, 181, 201, .3), var(--shadow-md); }
[data-theme="dark"] .cp-price { color: var(--silver); font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; }
[data-theme="dark"] .cp-buy { border-color: rgba(193, 181, 201, .22); }
[data-theme="dark"] .cp-facts svg { color: var(--silver); }
[data-theme="dark"] .cp-name { font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.08; }

/* ---------- Kind words: a photo (or initials) of who said it ---------- */
.quote figcaption { align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.q-avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--lilac-soft); color: var(--grape); font-weight: 700; font-size: 1rem; letter-spacing: .02em; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px rgba(143, 118, 169, .35); }
.q-avatar img { width: 100%; height: 100%; object-fit: cover; }
.q-who { display: grid; gap: 1px; line-height: 1.25; min-width: 0; flex: 1 1 9ch; }
.q-name { font-weight: 700; }
.q-detail, .q-who .handle { font-size: .85rem; color: var(--ink-soft); font-weight: 400; overflow-wrap: anywhere; }
.quote .sample-tag { margin-left: auto; }
[data-theme="dark"] .q-avatar { background: rgba(96, 70, 110, .5); color: var(--silver); box-shadow: 0 0 0 3px #211A2B, 0 0 0 4px rgba(193, 181, 201, .4); }


/* =====================================================================
   Apple-style polish
   ===================================================================== */

/* ---------- Everything you can press answers on the press ---------- */
.treat .fm, .sc-item, .cake-shot figure, .cp-thumb, .type-card .tc-face, .chip-btn, .insta-tile, .ev-map, .map-dir, .treat-name a { -webkit-tap-highlight-color: transparent; }
.treat .fm:active { transform: scale(.96); transition: transform 100ms ease-out; }
.cake-shot figure { transition: transform 160ms ease-out; }
.cake-shot:active figure { transform: scale(.97); transition-duration: 100ms; }
.batch.is-active .sc-item:active, .showcase.is-static .sc-item:active { transform: scale(.96); transition: transform 100ms ease-out; transition-delay: 0ms; }
.cp-thumb:active { transform: scale(.94); transition-duration: 100ms; }
.type-card:active .tc-face { transform: scale(.97); transition-duration: 100ms; }
.chip-btn:active, .ev-map:active, .map-dir:active { transform: scale(.96); }
.insta-tile:active { transform: scale(.97); }
.cp-nav:disabled:hover, .cp-nav:disabled:active { transform: none; }

/* ---------- Big headings: tighter letter spacing as type grows ----------
   (storybook theme only: the Night Court capitals keep their own spacing) */
:root:not([data-theme="dark"]) h1,
:root:not([data-theme="dark"]) h2,
:root:not([data-theme="dark"]) .cp-name,
:root:not([data-theme="dark"]) .cake-cta-copy .cr-title { letter-spacing: -.015em; }
:root:not([data-theme="dark"]) h2 em, :root:not([data-theme="dark"]) h1 em { letter-spacing: -.01em; }

/* ---------- Visitors who turn transparency down: solid surfaces ---------- */
@media (prefers-reduced-transparency: reduce) {
  .site-header.is-scrolled { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  [data-theme="dark"] .site-header.is-scrolled { background: #090810; }
  .cart-drawer::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(60, 28, 50, .6); }
  .back-link, .cp-count { background: var(--lilac-soft); }
  [data-theme="dark"] .cake-cta, [data-theme="dark"] .cp-stage { background: #211A2B; }
}

/* ---------- Visitors who ask for more contrast: clear edges ---------- */
@media (prefers-contrast: more) {
  .site-header.is-scrolled { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 1px 0 var(--ink); }
  .treat-desc, .cp-desc, .cp-facts, .crumbs ol, .q-detail, .section-lede { color: var(--ink); }
  .cp-stage, .cake-cta, .cr-form, .quote, .cake-card, .fb-col, .event, .map-card, .cp-thumb, .back-link { box-shadow: 0 0 0 1.5px var(--ink); }
  input, select, textarea { border-color: var(--ink) !important; }
  .tag, .stock-note { box-shadow: inset 0 0 0 1px currentColor; }
}

/* ---------- v6: scrolling words loop seamlessly at any screen width ---------- */
.marquee-track { gap: 0; animation-duration: var(--mq-dur, 42s); }
.marquee-track > .mq-set { display: flex; align-items: center; flex: none; margin: 0; }
.mq-set > * { flex: none; margin-inline-end: 32px; }

/* ---------- v6: Instagram photo (the chalkboard cookie spread) ---------- */
.ia-photo { position: absolute; left: 50%; top: 50%; z-index: 1; width: 66%; margin: 0; padding: 10px 10px 34px; background: var(--paper); border-radius: 6px; box-shadow: 0 2px 4px rgba(60, 28, 50, .08), 0 28px 50px -12px rgba(60, 28, 50, .35); transform: translate(-50%, calc(-50% + var(--p) * -20px)) rotate(-4deg); transition: transform 600ms var(--ease-spring); }
.ia-photo img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 2px; }
.insta-art:hover .ia-photo { transform: translate(-50%, calc(-51% + var(--p) * -20px)) rotate(-1.5deg) scale(1.02); }
.ia-bits { z-index: 2; }
[data-theme="dark"] .ia-photo { background: #E9E2EE; box-shadow: 0 0 0 1px rgba(193, 181, 201, .3), 0 30px 60px -10px rgba(0, 0, 0, .7); }
@media (max-width: 860px) { .ia-photo { width: 62%; } }

/* ---------- v6: the "next stop" card and the cart photo hang off the map's edges ---------- */
.spot-map { margin-bottom: clamp(56px, 7vw, 76px); }
.map-card { left: -6%; bottom: 0; transform: translateY(58%); }
.map-photo { right: -9%; top: 0; transform: translateY(-38%) rotate(6deg); width: 27%; }
@media (max-width: 860px) {
  .spot-map { margin-bottom: 104px; }
  .map-card { left: 0; max-width: min(84%, 300px); }
  .map-photo { right: -1%; width: 24%; transform: translateY(-30%) rotate(6deg); }
}
