/* Cake ring: cut-out cakes on a tilted ring that follows the finger. Used by the home page hero and /cakes.
   Colours come from the --cr-* variables on .cring. Position/size/opacity of every cake is set by cake-ring.js each frame.
   Backgrounds: .cring[data-bg="warm" | "liquid" | "spot"], none = transparent. */
.cring { --cr-ink: #1d1410; --cr-muted: #7a6a5f; --cr-word: #d3e1fa; --cr-btn: #1d1410; --cr-accent: #155dfc; --cr-cw: 300px;
  position: relative; height: clamp(520px, calc(100svh - 62px), 780px); overflow: hidden; color: var(--cr-ink);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; cursor: grab; }
.cring.grab { cursor: grabbing; }
.cring button { font: inherit; color: inherit; cursor: pointer; }
.cring-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.cring-word { position: absolute; z-index: 1; left: 0; right: 0; top: 40%; transform: translateY(-50%); text-align: center; pointer-events: none;
  font: 400 clamp(64px, 17vw, 280px)/.86 "Archivo Black", system-ui, sans-serif; color: var(--cr-word); letter-spacing: -.03em; white-space: nowrap; transition: opacity .4s; }
.cring-stage { position: absolute; z-index: 2; inset: 0 0 var(--foot, 76px); }

/* every cake is as wide as the front cake; JS scales the ones further round the ring down */
.cring .ck { position: absolute; left: 50%; top: var(--cy, 50%); width: var(--cw, 300px); aspect-ratio: 1; padding: 0; border: 0; background: none;
  will-change: transform, opacity; touch-action: pan-y; filter: drop-shadow(0 26px 20px rgba(60, 30, 10, .26)); }
.cring .ck img { width: 100%; height: 100%; object-fit: contain; animation: cr-bob 6s ease-in-out infinite; animation-delay: var(--d, 0s); pointer-events: none; user-select: none; -webkit-user-drag: none; }
@keyframes cr-bob { 50% { transform: translateY(-8px) rotate(-.8deg); } }
.cring .ck:focus-visible { outline: 3px solid var(--cr-accent); outline-offset: -14%; border-radius: 50%; }

.cring-foot { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, 4vw) var(--foot-pad, 18px); transition: opacity .35s; pointer-events: none; }
.cring-foot > * { pointer-events: auto; }
.cring-idx { font: 400 28px/1 "Archivo Black", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.cring-idx span { font: 500 13px system-ui, sans-serif; color: var(--cr-muted); margin-left: 6px; }
.cring-now { text-align: center; flex: 1; min-width: 0; }
.cring-now strong { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cring-now em { font-style: normal; color: var(--cr-muted); font-size: 13px; }
.cring-arrows { display: flex; gap: 8px; }
.cring-arrows button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--cr-ink) 22%, transparent); background: color-mix(in srgb, var(--cr-ink) 6%, transparent); font-size: 20px; }

/* details card */
.cring-panel { position: absolute; z-index: 200; right: max(12px, 4vw); top: 50%; width: min(420px, 92vw); max-height: calc(100% - 32px); overflow: auto;
  transform: translate(30px, -50%); opacity: 0; visibility: hidden; transition: transform .55s cubic-bezier(.2,.9,.25,1.12), opacity .4s, visibility 0s .55s;
  background: rgba(255,255,255,.82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.9); border-radius: 26px;
  padding: 26px; box-shadow: 0 30px 60px -30px rgba(30, 40, 80, .45); text-align: left; color: #1d1410; }
.cring.open .cring-panel { transform: translate(0, -50%); opacity: 1; visibility: visible; transition-delay: 0s; }
.cring.open .cring-foot { opacity: 0; pointer-events: none; }
.cring.open .cring-word { opacity: .5; }
.cring.open { cursor: default; }
.cring-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .08); font-size: 20px; }
.cring-panel h2 { margin: 4px 40px 4px 0; font: 400 28px/1.08 "Archivo Black", system-ui, sans-serif; color: #1d1410; text-wrap: balance; }
.cring-sub { margin: 0 0 10px; font-weight: 600; }
.cring-desc { margin: 0 0 16px; color: #6b5d52; font-size: 14.5px; }
.cring-label { font-size: 12px; font-weight: 700; color: #6b5d52; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .1em; }
.cring-sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cring-sizes button { padding: 10px 16px; border-radius: 14px; border: 1.5px solid rgba(15, 23, 42, .15); background: #fff; font-weight: 700; text-align: left; line-height: 1.2; }
.cring-sizes button small { display: block; font-weight: 500; color: #6b5d52; }
.cring-sizes button[aria-pressed="true"] { border-color: var(--cr-btn); background: var(--cr-btn); color: #fff; }
.cring-sizes button[aria-pressed="true"] small { color: rgba(255,255,255,.8); }
.cring-row { display: flex; align-items: center; gap: 12px; }
.cring-qty { display: flex; align-items: center; border: 1.5px solid rgba(15, 23, 42, .15); border-radius: 14px; background: #fff; }
.cring-qty button { width: 44px; height: 48px; border: 0; background: none; font-size: 20px; }
.cring-qty output { min-width: 28px; text-align: center; font-weight: 700; }
.cring-add { flex: 1; height: 52px; border: 0; border-radius: 14px; background: var(--cr-btn); color: #fff !important; font-weight: 700; font-size: 16px; }
.cring-add:active { transform: scale(.98); }
.cring-done { margin: 12px 0 0; font-size: 14px; min-height: 1.5em; }
.cring-done a { color: var(--cr-accent); font-weight: 700; }

@media (max-width: 760px) {
  .cring-panel { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 64%; border-radius: 26px 26px 0 0; transform: translateY(40px);
    padding: 22px max(20px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: rgba(255,255,255,.95); }
  .cring.open .cring-panel { transform: none; }
  .cring-arrows { display: none; }
}

/* ---------- background options ---------- */
.cring-track { position: absolute; top: 0; bottom: 0; left: 0; width: 200%; will-change: transform; }
.cring-track i { position: absolute; display: block; }
/* turntable the front cake sits on */
.cring-table { position: absolute; left: 50%; top: calc(var(--cy, 50%) + var(--cw, 300px) * .17); width: calc(var(--cw, 300px) * 1.75); height: calc(var(--cw, 300px) * .46); transform: translateX(-50%); }

/* A: warm bakery table, light from the top left, sprinkles drifting with the ring */
.cring[data-bg="warm"] { --cr-word: rgba(106, 150, 236, .3);
  background: radial-gradient(70% 60% at 22% 8%, #fffaf0 0, rgba(255, 250, 240, 0) 70%), radial-gradient(90% 55% at 50% 108%, #f2cf93 0, rgba(242, 207, 147, 0) 72%), linear-gradient(180deg, #fff1d3 0%, #fbe2b6 100%); }
.cring[data-bg="warm"] .cring-table { background: radial-gradient(closest-side at 50% 44%, #fffaf0 0 64%, #f0d4a4 65% 70%, rgba(240, 212, 164, 0) 72%), radial-gradient(closest-side at 50% 62%, rgba(86, 44, 16, .34), rgba(86, 44, 16, 0) 100%); }

/* B: liquid, brand-colour blobs merged by an SVG filter; they slide and stretch with the swipe */
.cring[data-bg="liquid"] { --cr-word: rgba(70, 118, 226, .26); background: radial-gradient(80% 70% at 50% 40%, #fffaf0, #ffeec6); }
.cring-goo { position: absolute; inset: 0; filter: url(#cring-goo); opacity: .85; }
.cring-goo i { position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform; }

/* C: spotlight, deep brand blue with a light cone and a glossy turntable; chocolate pops against it */
.cring[data-bg="spot"] { --cr-ink: #fff; --cr-muted: rgba(255, 255, 255, .74); --cr-word: rgba(160, 196, 255, .2); --cr-btn: #0043b6;
  background: radial-gradient(75% 95% at 50% 36%, #3d78ff 0%, #1450c8 36%, #08236a 100%); }
.cring[data-bg="spot"] .cring-cone { position: absolute; left: 50%; top: 0; width: 78%; height: 86%; transform: translateX(-50%); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 88%); filter: blur(12px); }
.cring[data-bg="spot"] .cring-table { background: radial-gradient(closest-side at 50% 44%, #86adff 0 60%, #2f63d9 61% 71%, rgba(47, 99, 217, 0) 73%), radial-gradient(closest-side at 50% 62%, rgba(2, 10, 40, .55), rgba(2, 10, 40, 0) 100%); }
.cring[data-bg="spot"] .cring-arrows button { border-color: rgba(255, 255, 255, .4); }

@media (prefers-reduced-motion: reduce) { .cring .ck img { animation: none; } .cring-panel { transition: none; } }
