/* =====================================================================
   SugarPlumJelly Miami — v9 additions
   A shorter top section, the shop cards on the main page, the cookies
   and treats pages, the treat tiles, and a showcase phones scroll past.
   ===================================================================== */

/* ---------- Top section: shorter, so the menus are one scroll away ---------- */
.hero { --hero-h: min(64svh, 600px); min-height: var(--hero-h); padding-top: calc(var(--header-h) + var(--bar-h) + clamp(8px, 1.6vw, 20px)); padding-bottom: clamp(48px, 5.5vw, 72px); }
/* --bt-fs is the main page's title size; every page's title area is that tall, so all three tops match */
.hero { --bt-fs: clamp(3.4rem, 9.6vw, 8rem); --bt-lines: 1.82; }
.hero-lede { min-height: 3.2em; } /* two lines on every page, even when the words are short */
[data-theme="dark"] .hero { --bt-fs: clamp(3rem, 8.4vw, 7rem); }
.burst-wrap { padding-bottom: clamp(10px, 2vw, 26px); min-height: calc(var(--bt-fs) * var(--bt-lines) + clamp(10px, 2vw, 26px)); display: grid; align-content: center; }
.burst-title { font-size: var(--bt-fs); }
.burst-title .bt-1 { justify-self: start; margin-left: 8%; }
.burst-title .bt-2 { justify-self: end; margin-right: 8%; font-size: 1.04em; }
.hero-foot { margin-top: clamp(10px, 1.6vw, 20px); gap: 18px; }
.hero-lede { max-width: 66ch; }
[data-theme="dark"] .burst-title { font-size: var(--bt-fs); }

/* the cookies and treats pages: three words on two lines, same height as the main page */
.hero-page .burst-title { font-size: clamp(2.8rem, 7.2vw, 6.4rem); line-height: .95; }
.hero-page .burst-title .bt-1 { margin-left: 4%; }
.hero-page .burst-title .bt-1 em { color: var(--moon-mist); font-weight: 600; }
.hero-page .burst-title .bt-2 { font-size: 1.32em; margin-right: 8%; }
[data-theme="dark"] .hero-page .burst-title { font-size: clamp(2.6rem, 6.6vw, 5.8rem); }
[data-theme="dark"] .hero-page .burst-title .bt-1 em { color: #D9C6EA; }

/* the cookies / treats titles always sit in front of the floating pictures */
.hero-page .burst-title { z-index: 3; }

/* Night court: a thin dark outline keeps the title readable where it crosses the moon */
[data-theme="dark"] .burst-title {
  text-shadow:
    -2px -2px 0 #0B0912, 2px -2px 0 #0B0912, -2px 2px 0 #0B0912, 2px 2px 0 #0B0912,
    0 -2px 0 #0B0912, 0 2px 0 #0B0912, -2px 0 0 #0B0912, 2px 0 0 #0B0912,
    0 0 40px rgba(157, 130, 182, .35), 0 10px 40px rgba(0, 0, 0, .6);
}
[data-theme="dark"] .hero-eyebrow, [data-theme="dark"] .hero-lede {
  text-shadow: -1px -1px 0 #0B0912, 1px -1px 0 #0B0912, -1px 1px 0 #0B0912, 1px 1px 0 #0B0912, 0 0 12px rgba(5, 4, 9, .8);
}

/* Night court: the moon sits up top, between the logo and the menu.
   js/app.js measures the gap and sets --moon-x, --moon-y and --moon-r (its size), so it fits at any width.
   The glow is kept short so it never washes over the menu words. */
[data-theme="dark"] .hero {
  --moon-r: 28px;
  background:
    radial-gradient(circle at var(--moon-x, 22%) var(--moon-y, 72px),
      rgba(236, 230, 241, .95) 0 var(--moon-r), rgba(193, 181, 201, .3) calc(var(--moon-r) + 2px),
      rgba(96, 70, 110, .14) calc(var(--moon-r) * 2.2), transparent calc(var(--moon-r) * 4)),
    radial-gradient(60% 50% at 50% 100%, rgba(96, 70, 110, .55), transparent 70%),
    linear-gradient(180deg, #050409 0%, #120E1A 55%, #211A2B 100%);
}
@media (max-width: 760px) {
  [data-theme="dark"] .hero { --moon-r: 18px; }
}

/* treat photos floating around the treats page title */
.ck.is-photo img { aspect-ratio: 1; object-fit: cover; border-radius: 24%; border: 5px solid var(--surface); box-shadow: 0 18px 34px -10px rgba(30, 10, 25, .45); }
.ck.is-photo .ck-shadow { display: none; }
[data-theme="dark"] .ck.is-photo img { border-color: #2A2036; filter: none; box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .7), 0 0 26px rgba(157, 130, 182, .3); }

.primary-nav a[aria-current="page"] { color: var(--grape); }
.primary-nav a[aria-current="page"]::after { transform: translateX(-50%) scale(1.6); }

@media (max-width: 760px) {
  .hero { --hero-h: 0px; min-height: 0; padding-bottom: 40px; --bt-fs: clamp(3.3rem, 18vw, 5.2rem); --bt-lines: 1.86; }
  [data-theme="dark"] .hero { --bt-fs: clamp(3rem, 16vw, 4.6rem); }
  .burst-title .bt-1, .burst-title .bt-2 { margin-inline: 0; }
  .burst-wrap { padding-block: 4px 150px; min-height: calc(var(--bt-fs) * var(--bt-lines) + 154px); align-content: start; }
  .hero-foot { gap: 14px; margin-top: 4px; }
  .hero-lede { font-size: .98rem; line-height: 1.5; min-height: 4.5em; }
  .hero-ctas { flex-wrap: nowrap; gap: 10px; width: 100%; justify-content: center; }
  .hero-ctas .btn { min-height: 48px; padding: .7em 1.1em; font-size: .95rem; white-space: nowrap; }
  .hero-page .burst-title { font-size: clamp(2.3rem, 11vw, 3.2rem); line-height: 1; }
  .hero-page .burst-title .bt-2 { font-size: 1.5em; }
}

/* main page: three buttons (cookies, treats, a cake); phones put the two order buttons side by side */
@media (max-width: 760px) {
  .hero-ctas-3 { flex-wrap: wrap; }
  .hero-ctas-3 .btn { flex: 1 1 40%; justify-content: center; }
  .hero-ctas-3 .btn-ghost-cream { flex-basis: 100%; }
}

/* the cake request page: links to the other two menus */
.cr-also { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.cr-also .btn { min-height: 44px; padding: .6em 1.1em; font-size: .95rem; }
.cr-also .btn svg { width: 1em; height: 1em; }

/* ---------- Main page: shop the bakery ---------- */
.shop { padding-block: clamp(48px, 7vw, 88px) clamp(40px, 6vw, 72px); }
.shop .section-head { margin-bottom: clamp(24px, 3.5vw, 40px); }
.shop-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.6vw, 32px); }
.shop-card { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 14px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.shop-photo { grid-column: 1 / -1; display: block; aspect-ratio: 5 / 4; border-radius: 30px; overflow: hidden; background: var(--lilac-soft); box-shadow: var(--shadow-sm); transition: transform 450ms var(--ease-spring), box-shadow 450ms var(--ease-out); margin-bottom: 12px; }
.shop-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 800ms var(--ease-out); }
.shop-text { display: grid; gap: 2px; }
.shop-name { font-family: var(--font-display); font-size: clamp(1.6rem, 2.4vw, 2.1rem); line-height: 1.05; }
.shop-sub { color: var(--ink-soft); font-size: .95rem; }
.shop-go { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--grape); color: var(--on-accent); transition: transform 350ms var(--ease-spring); }
.shop-go svg { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) {
  .shop-card:hover .shop-photo { transform: translateY(-8px) rotate(-1.5deg); box-shadow: var(--shadow-md); }
  .shop-card:hover .shop-photo img { transform: scale(1.06); }
  .shop-card:hover .shop-go { transform: translateX(4px); }
}
.shop-card:active .shop-photo { transform: scale(.97); transition-duration: 120ms; }
.shop-card:focus-visible { outline: none; }
.shop-card:focus-visible .shop-photo { outline: 3px solid var(--grape); outline-offset: 4px; }
[data-theme="dark"] .shop-go { background: var(--silver); color: #090810; }
[data-theme="dark"] .shop-photo { box-shadow: 0 0 0 1px rgba(193, 181, 201, .25), 0 20px 40px -12px rgba(0, 0, 0, .7); }
@media (max-width: 760px) {
  .shop-grid { gap: 12px; }
  .shop-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .shop-photo { width: 100%; aspect-ratio: 1; border-radius: 22px; margin-bottom: 8px; }
  .shop-name { font-size: 1.2rem; }
  .shop-sub, .shop-go { display: none; }
}

/* ---------- Treat tiles (the treats page) ---------- */
.tile-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(22px, 2.6vw, 32px) clamp(16px, 2.2vw, 28px); }
.tile { position: relative; display: flex; flex-direction: column; }
.tile-media { text-decoration: none; position: relative; display: block; aspect-ratio: 1; border-radius: 28px; overflow: hidden; background: var(--lilac-soft); box-shadow: var(--shadow-sm); transition: transform 450ms var(--ease-spring), box-shadow 450ms var(--ease-out); -webkit-tap-highlight-color: transparent; }
.tile-media > img { width: 100%; height: 100%; object-fit: cover; transition: transform 800ms var(--ease-out), filter 400ms; }
.tile-cat { position: absolute; left: 12px; top: 12px; padding: 7px 10px; border-radius: 999px; background: rgba(255, 251, 243, .92); color: var(--grape); font: 700 .66rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; }
.tile-ph { display: grid; place-items: center; align-content: center; gap: 10px; width: 100%; height: 100%; background: radial-gradient(circle at 50% 42%, #fff 0, var(--lilac-soft) 72%); }
.tile-ph img { width: 44%; height: auto; opacity: .5; }
.tile-ph span { font: 600 .68rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--grape); opacity: .75; }
.tile-body { display: flex; flex-direction: column; flex: 1; padding-top: 14px; }
.tile-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tile-name { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.12; text-wrap: balance; }
.tile-name a { color: inherit; text-decoration: none; }
.tile-name a::after { /* the words open the treat's page too */ content: ""; position: absolute; inset: 0; z-index: 1; }
.tile-price { font-family: var(--font-display); font-size: 1.3rem; color: var(--grape); line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.tile-desc { margin: 6px 0 0; font-size: .9rem; line-height: 1.45; color: var(--ink-soft); }
.tile-stock:empty { display: none; }
.tile-stock { margin-top: 6px; }
.tile .card-actions { position: relative; z-index: 2; margin-top: auto; padding-top: 14px; min-height: 0; }
.tile .add-btn, .tile .stepper { width: 100%; }
.tile .add-btn { min-height: 46px; padding: 0 14px; gap: 6px; white-space: nowrap; font-size: .95rem; }
.tile .add-btn svg { width: 1.05em; height: 1.05em; flex: none; }
.tile.is-soldout .tile-media > img { filter: grayscale(.6) opacity(.75); }
@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile-media { transform: translateY(-6px) rotate(-1.5deg); box-shadow: var(--shadow-md); }
  .tile:hover .tile-media > img { transform: scale(1.06); }
}
.tile:has(.tile-name a:active) .tile-media { transform: scale(.97); transition-duration: 120ms; }
.tile-name a:focus-visible { outline: none; }
.tile:has(.tile-name a:focus-visible) .tile-media { outline: 3px solid var(--grape); outline-offset: 4px; }
[data-theme="dark"] .tile-cat { background: rgba(33, 26, 43, .9); color: var(--silver); }
[data-theme="dark"] .tile-media { box-shadow: 0 0 0 1px rgba(193, 181, 201, .22), 0 16px 34px -12px rgba(0, 0, 0, .7); }
[data-theme="dark"] .tile-ph { background: radial-gradient(circle at 50% 42%, #3A2E4A 0, #221A2E 72%); }
[data-theme="dark"] .tile-ph span { color: var(--silver); }
[data-theme="dark"] .tile-price { color: var(--silver); }
@media (max-width: 1024px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 22px 12px; }
  .tile-media { border-radius: 22px; }
  .tile-cat { left: 8px; top: 8px; padding: 6px 8px; font-size: .6rem; }
  .tile-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .tile-name { font-size: 1.12rem; }
  .tile-price { font-size: 1.15rem; }
  .tile-desc { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tile-media, .tile-media > img, .shop-photo, .shop-photo img { transition: none; }
}

/* nothing on the menu yet */
.menu-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; text-align: center; padding: clamp(28px, 5vw, 48px) 20px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-sm); list-style: none; }
.menu-empty img { width: 72px; height: auto; opacity: .6; }
.menu-empty strong { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.15; text-wrap: balance; }
.menu-empty span { color: var(--ink-soft); max-width: 44ch; }
.menu-empty .btn { margin-top: 8px; }
[data-theme="dark"] .menu-empty { background: #1A1424; box-shadow: 0 0 0 1px rgba(193, 181, 201, .2); }

/* "More treats to try" on a treat's own page */
.cp-more .tile-grid { margin-top: 8px; }

/* ---------- Cookies / treats pages: a link to the other menu ---------- */
.other-menu { padding-block: 0 clamp(56px, 8vw, 96px); }
.other-card { display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; padding: clamp(22px, 3vw, 34px) clamp(22px, 3.5vw, 44px); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: transform 400ms var(--ease-spring), box-shadow 400ms; }
.oc-text { display: grid; gap: 4px; }
.oc-text strong { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.1; }
.oc-text span { color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) { .other-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); } }
.other-card:active { transform: scale(.98); }
[data-theme="dark"] .other-card { background: #1A1424; box-shadow: 0 0 0 1px rgba(193, 181, 201, .2); }
@media (max-width: 760px) { .other-card .btn { width: 100%; justify-content: center; } }

/* ---------- This week's batch on phones: no pause, every cookie in a grid ---------- */
@media (max-width: 760px) {
  .showcase.is-static .showcase-stage { padding-block: 56px 40px; }
  .showcase.is-static .showcase-batches { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 12px; margin-top: 22px; }
  .showcase.is-static .batch { display: contents; }
  .showcase.is-static .sc-item, .showcase.is-static .sc-item:nth-child(2) { grid-template-columns: none; direction: ltr; gap: 8px; }
  .showcase.is-static .sc-cookie { width: 100%; max-width: 170px; }
  .showcase.is-static .sc-label, .showcase.is-static .sc-item:nth-child(2) .sc-label { justify-items: center; text-align: center; }
  .showcase.is-static .sc-plinth, .showcase.is-static .sc-item:nth-child(2) .sc-plinth { top: 46%; left: 50%; right: auto; width: 90%; transform: translateX(-50%); }
}

/* ---------- A fairy tale forest, just out of sight behind the fog ----------
   Painted in assets/img/brand/forest.webp. "luminosity" keeps the page's own plum colors and borrows only
   the forest's light and shade, so it reads as a misty shape, not a green photo. */
.hero-forest, .page-forest {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("../assets/img/brand/forest.webp") center bottom / cover no-repeat;
  mix-blend-mode: luminosity; opacity: .42; filter: blur(1px);
  -webkit-mask: linear-gradient(180deg, transparent 0%, #000 18%, #000 86%, transparent 100%);
  mask: linear-gradient(180deg, transparent 0%, #000 18%, #000 86%, transparent 100%);
}
[data-theme="dark"] .hero-forest { opacity: .42; filter: blur(1px) brightness(.85); }
/* the cake request page: the forest fades in behind the heading only */
.page-forest { bottom: auto; height: min(620px, 80vh); opacity: .3;
  -webkit-mask: linear-gradient(180deg, transparent 0%, #000 20%, #000 55%, transparent 100%);
  mask: linear-gradient(180deg, transparent 0%, #000 20%, #000 55%, transparent 100%); }
[data-theme="dark"] .page-forest { opacity: .2; }
@media (max-width: 760px) {
  .hero-forest { background-position: 50% 100%; opacity: .4; }
}
@media (prefers-reduced-transparency: reduce) { .hero-forest, .page-forest { opacity: .2; } }

/* "Baked fresh" bubble: lilac with white text, so it can't be mistaken for the cream order buttons */
:root { --pill-3-bg: #7A5F96; --pill-3-fg: #FFFFFF; }
[data-theme="dark"] { --pill-3-bg: #211A2B; --pill-3-fg: #C1B5C9; }

/* Night court: no castle skyline, so the forest shows through */
[data-theme="dark"] .castle { display: none; }

/* Hero "Request a cake" / "Order a cake": a solid button so it reads clearly over the forest */
.hero .btn-ghost-cream { --b-bg: #3C1C32; --b-ink: #FCF5E8; border-color: rgba(252, 245, 232, .55); box-shadow: 0 8px 20px rgba(30, 10, 25, .25); }
.hero .btn-ghost-cream:hover { --b-bg: #4E2642; }
[data-theme="dark"] .hero .btn-ghost-cream { --b-bg: #2A2136; --b-ink: #ECE6F1; border-color: rgba(193, 181, 201, .55); }
[data-theme="dark"] .hero .btn-ghost-cream:hover { --b-bg: #362B45; }

/* Menu bar while scrolling: a lighter frosted blur (8px instead of 12px) on a slightly more solid bar,
   and the blur no longer animates, so scrolling stays smooth on slower phones */
.site-header { transition: background-color var(--t-med), box-shadow var(--t-med); }
.site-header.is-scrolled { background: rgba(252, 245, 232, .92); backdrop-filter: blur(8px) saturate(1.2); -webkit-backdrop-filter: blur(8px) saturate(1.2); }
/* …but visitors who turn transparency down or ask for more contrast still get a solid bar */
@media (prefers-reduced-transparency: reduce) {
  .site-header.is-scrolled { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@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); }
}
