/* CRUMBLE: the signature moment after the hero. Phone first; uses the tokens in styles.css :root. */

.crumble {
  --cr-ink: var(--ink);
  --cr-soft: #D9DAD7;            /* body text on charcoal: 11.9:1 */
  --cr-line: rgb(255 255 255 / .14);
  position: relative;
  overflow: clip;
  padding: 88px var(--gutter) 96px;
  background:
    radial-gradient(60% 40% at 15% 8%, rgb(232 150 72 / .16), transparent 70%),   /* torch warmth behind the word */
    radial-gradient(55% 45% at 85% 70%, rgb(229 131 170 / .12), transparent 70%),
    var(--cr-ink);
  color: var(--paper);
  scroll-margin-top: 0;
}
[dir=rtl] .crumble {
  background:
    radial-gradient(60% 40% at 85% 8%, rgb(232 150 72 / .16), transparent 70%),
    radial-gradient(55% 45% at 15% 70%, rgb(229 131 170 / .12), transparent 70%),
    var(--cr-ink);
}
.crumble__defs { position: absolute; width: 0; height: 0; }

.crumble__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "torch" "stage" "info";
  gap: 32px;
  max-width: 1280px;
  margin-inline: auto;
}

/* ---------- headline ---------- */
.crumble__head { grid-area: head; position: relative; }
.crumble__kicker {
  display: flex; align-items: center; gap: 10px;
  color: var(--pink);
  font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}
:lang(ar) .crumble__kicker { font-size: .875rem; }
.crumble__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 4px rgb(229 131 170 / .2); }

.crumble__title { margin: 14px 0 0; font-weight: 600; }
/* the giant word, filled with a looping macro of the torched crust (video/crumble-macro.*).
   The word is real text: white on black, multiplied over the video (letters show the video, the rest goes black),
   and the whole group is screened onto the charcoal, so the black drops out. Vector-sharp at any size, any script. */
.crumble__word {
  position: relative; display: block;
  margin-inline-start: -.04em;
  font-size: clamp(5rem, 22.5vw, 13rem);
  font-weight: 700;
  line-height: .86;
  letter-spacing: -.045em;
  mix-blend-mode: screen;
}
.crumble__vid {
  position: absolute; inset: 1px; width: calc(100% - 2px); height: calc(100% - 2px); /* 1px in: no hairline at the box edge */
  object-fit: cover; object-position: 50% 45%;
  filter: brightness(1.12) saturate(1.06);   /* lifts the burnt spots so the letters stay readable */
}
.crumble__wordtext {
  position: relative; display: block;
  color: #fff; background: #000;
  mix-blend-mode: multiply;
  padding-block-end: .06em;
}
:lang(ar) .crumble__word { font-size: clamp(5.4rem, 26vw, 14rem); line-height: 1.15; }
:lang(ar) .crumble__wordtext { padding-block: 0 .02em; }
/* keyboard: a pause button that shows when focused (focus also pauses the loop); hover pauses it for mouse users */
.crumble__vidbtn {
  position: absolute; z-index: 2; inset-inline-start: 0; top: 0;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer;
  opacity: 0; pointer-events: none;
}
.crumble__vidbtn[hidden] { display: none; }
.crumble__vidbtn:focus-visible { opacity: 1; pointer-events: auto; outline: 2px solid var(--pink); outline-offset: 3px; }
.crumble__vidbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.crumble__ico-play { fill: currentColor; stroke: none; display: none; }
.crumble__vidbtn.is-paused .crumble__ico-pause { display: none; }
.crumble__vidbtn.is-paused .crumble__ico-play { display: block; }
.crumble__q {
  display: block; margin-top: 10px;
  font-size: clamp(2rem, 1.3rem + 3vw, 3.75rem);
  line-height: 1; letter-spacing: -.025em;
}
:lang(ar) .crumble__q { line-height: 1.35; font-size: clamp(2.1rem, 1.4rem + 3vw, 3.9rem); }
.crumble__q em { font-style: normal; color: var(--pink); }
.crumble__lead {
  max-width: 34ch; margin-top: 18px;
  color: var(--cr-soft); font-size: clamp(1rem, .93rem + .3vw, 1.1875rem); line-height: 1.5;
}
:lang(ar) .crumble__lead { line-height: 1.8; }

/* hand-drawn doodles (theirs: heart + smiley) */
.crumble__doodle { position: absolute; fill: none; stroke: var(--pink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.crumble__doodle--smile { width: 46px; height: 46px; inset-block-start: 4px; inset-inline-end: 4px; rotate: 12deg; }
.crumble__doodle--heart { width: 52px; height: 52px; inset-block-start: -20px; inset-inline-start: -18px; rotate: -14deg; fill: var(--pink); stroke: var(--ink); stroke-width: 2.2; }

/* ---------- Hasan with the torch (a sticker-ish print) ---------- */
.crumble__torch {
  grid-area: torch; position: relative;
  justify-self: end;
  width: min(62%, 300px);
  margin: -8px 0 0;
  padding: 8px 8px 12px;
  border-radius: 10px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 18px 40px rgb(0 0 0 / .35);
  rotate: 3deg;
}
[dir=rtl] .crumble__torch { rotate: -3deg; }
.crumble__torch img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 5px; background: var(--slate); }
.crumble__torch figcaption { margin-top: 10px; padding-inline: 4px; font-size: .8125rem; font-weight: 500; line-height: 1.3; }

/* ---------- the photo stage ---------- */
.crumble__stage { grid-area: stage; position: relative; margin: 0; width: 100%; max-width: 600px; justify-self: center; }
.crumble__photos {
  position: relative; aspect-ratio: 1;
  clip-path: url(#crumble-wave);
  background: var(--slate);
}
.crumble__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  /* the three photos are framed so the cup sits on the same spot: the new topping fades in on top, the old one stays
     underneath until it has, so it reads as one cup changing topping (no scale, no dip) */
  opacity: 0; z-index: 0;
  transition: opacity 0s .6s;
}
/* radio picker drives the photo (no JS) */
.crumble__img[data-f=apple],
.crumble:has(#crumble-banana:checked) .crumble__img[data-f=banana],
.crumble:has(#crumble-pineapple:checked) .crumble__img[data-f=pineapple] { opacity: 1; z-index: 1; transition: opacity .6s var(--ease); }
.crumble:has(#crumble-banana:checked) .crumble__img[data-f=apple],
.crumble:has(#crumble-pineapple:checked) .crumble__img[data-f=apple] { opacity: 0; z-index: 0; transition: opacity 0s .6s; }

.crumble__arrows {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  fill: none; stroke: var(--pink); stroke-width: .75; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 .5px .6px rgb(43 43 46 / .7));
}
.crumble__arrows path { stroke-dasharray: 1; stroke-dashoffset: 0; }
/* labels sit on the photo (physical sides: the picture is never mirrored) */
.crumble__note {
  position: absolute; left: var(--x); top: var(--y);
  padding: 7px 12px 8px;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: .8125rem; font-weight: 600; line-height: 1; white-space: nowrap;
  box-shadow: 0 6px 16px rgb(0 0 0 / .25);
}
:lang(ar) .crumble__note { line-height: 1.35; padding-block: 5px 6px; }
.crumble__note--end { left: auto; right: var(--x); }
/* "Granola + <fruit>": the label names the fruit in the photo, following the radio picker (no JS) */
.crumble__note [data-f] { display: none; }
.crumble__note [data-f=apple],
.crumble:has(#crumble-banana:checked) .crumble__note [data-f=banana],
.crumble:has(#crumble-pineapple:checked) .crumble__note [data-f=pineapple] { display: inline; animation: crumble-note-in .45s var(--ease); }
.crumble:has(#crumble-banana:checked, #crumble-pineapple:checked) .crumble__note [data-f=apple] { display: none; }
@keyframes crumble-note-in { from { opacity: 0; filter: blur(3px); } }
@media (prefers-reduced-motion: reduce) { .crumble__note [data-f] { animation: none; } }

/* ---------- info ---------- */
.crumble__info { grid-area: info; display: grid; gap: 22px; align-content: start; }
.crumble__pick { margin: 0; padding: 0; border: 0; min-width: 0; }
.crumble__pick legend {
  padding: 0; margin-bottom: 12px;
  color: var(--cr-soft); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}
:lang(ar) .crumble__pick legend { font-size: .875rem; }
.crumble__chips {
  display: inline-flex; gap: 4px; padding: 5px;
  border-radius: 999px; background: rgb(255 255 255 / .08); box-shadow: inset 0 0 0 1px var(--cr-line);
}
.crumble__chips input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.crumble__chips label {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding-inline: 16px;
  border-radius: 999px; cursor: pointer;
  font-size: var(--fs-nav); font-weight: 500;
  transition: background .35s var(--ease), color .35s var(--ease);
}
@media (hover: hover) { .crumble__chips input:not(:checked) + label:hover { background: rgb(255 255 255 / .1); } }
.crumble__chips input:checked + label { background: var(--pink); color: var(--ink); font-weight: 600; }
.crumble__chips input:focus-visible + label { outline: 2px solid var(--paper); outline-offset: 2px; }

.crumble__flavour { display: none; }
.crumble__flavour[data-f=apple],
.crumble:has(#crumble-banana:checked) .crumble__flavour[data-f=banana],
.crumble:has(#crumble-pineapple:checked) .crumble__flavour[data-f=pineapple] { display: block; animation: crumble-in .5s var(--ease); }
.crumble:has(#crumble-banana:checked) .crumble__flavour[data-f=apple],
.crumble:has(#crumble-pineapple:checked) .crumble__flavour[data-f=apple] { display: none; }
@keyframes crumble-in { from { opacity: 0; translate: 0 8px; } }
.crumble__flavour h3 { margin: 0; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
:lang(ar) .crumble__flavour h3 { line-height: 1.4; }
.crumble__flavour p { margin-top: 8px; max-width: 36ch; color: var(--cr-soft); line-height: 1.5; }
:lang(ar) .crumble__flavour p { line-height: 1.8; }

.crumble__facts {
  display: flex; gap: 32px; margin: 0; padding-block: 18px;
  border-block: 1px solid var(--cr-line);
}
.crumble__facts dt { color: var(--cr-soft); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
:lang(ar) .crumble__facts dt { font-size: .875rem; }
.crumble__facts dd { margin: 6px 0 0; font-size: 1.125rem; font-weight: 600; }
.crumble__price { font-size: 2rem; letter-spacing: -.02em; line-height: 1; }
.crumble__cur { color: var(--cr-soft); font-size: 1rem; font-weight: 500; }
.crumble__price { display: inline-flex; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; transform-origin: 50% 100%; }
/* odometer digits (js/crumble.js rolls them when the size changes) */
.crumble__dg { position: relative; display: inline-block; overflow: clip; line-height: 1.1; }
.crumble__dg > span { display: inline-block; }
.crumble__dg > .crumble__dg-in { position: absolute; left: 0; top: 0; }
/* M / L toggle: one pink thumb springs to the checked size */
.crumble__size {
  position: relative; isolation: isolate;
  display: inline-grid; grid-template-columns: 1fr 1fr; min-width: 0; margin: 0; padding: 4px; border: 0;
  border-radius: 999px; background: rgb(255 255 255 / .08); box-shadow: inset 0 0 0 1px var(--cr-line);
}
.crumble__size label { position: relative; display: grid; place-items: center; min-width: 52px; height: 40px; padding-inline: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.crumble__size input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.crumble__size span { font-size: .9375rem; font-weight: 600; transition: color .3s var(--ease) .05s; }
.crumble__size label:has(:checked) span { color: var(--ink); }
.crumble__size label:has(:focus-visible) { outline: 2px solid var(--paper); outline-offset: 2px; border-radius: 999px; }
@media (hover: hover) { .crumble__size label:not(:has(:checked)):hover span { color: var(--pink); } }
.crumble__size-thumb {
  position: absolute; z-index: -1; top: 4px; bottom: 4px; inset-inline-start: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--pink); box-shadow: 0 4px 10px rgb(0 0 0 / .3);
  transition: translate .55s var(--spring);
}
.crumble__size:has(input[value=L]:checked) .crumble__size-thumb { translate: 100% 0; }
[dir=rtl] .crumble__size:has(input[value=L]:checked) .crumble__size-thumb { translate: -100% 0; }
.crumble__cta { justify-self: start; }

/* ---------- tablet + desktop ---------- */
@media (min-width: 768px) {
  .crumble { padding-block: 120px 128px; }
  .crumble__inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    grid-template-areas: "head torch" "stage info";
    column-gap: clamp(32px, 5vw, 88px); row-gap: 56px;
  }
  .crumble__word { font-size: clamp(5rem, 11.5vw, 13rem); }
  :lang(ar) .crumble__word { font-size: clamp(5.4rem, 13vw, 14rem); }
  .crumble__torch { justify-self: center; align-self: center; width: min(100%, 320px); margin: 0; }
  .crumble__stage { justify-self: stretch; }
  .crumble__info { align-self: center; }
}
@media (min-width: 1024px) {
  .crumble { padding-block: 152px 160px; }
  .crumble__doodle--smile { width: 64px; height: 64px; inset-block-start: 40px; }
  .crumble__note { font-size: .9375rem; padding: 9px 15px 10px; }
  /* the word runs big across the top; Hasan's print sits beside it like a sticker */
  .crumble__inner { grid-template-areas: "head head" "stage info"; }
  .crumble__word { font-size: clamp(9rem, 15vw, 15rem); }
  :lang(ar) .crumble__word { font-size: clamp(9.5rem, 17vw, 16rem); }
  .crumble__q, .crumble__lead { max-width: min(36ch, 56%); }
  .crumble__q { max-width: 60%; }
  .crumble__torch { grid-area: head; z-index: 1; justify-self: end; align-self: end; width: clamp(260px, 22vw, 320px); margin-block-end: -24px; }
  .crumble__doodle--smile { inset-inline-end: auto; inset-inline-start: min(66%, 900px); }
}

@media (prefers-reduced-motion: reduce) {
  .crumble__img, .crumble__chips label, .crumble__size-thumb, .crumble__size span { transition: none; }
  .crumble__flavour { animation: none !important; }
}
