/* Home page: "from one plate to a container" story, the three doors and small extras.
   Only transform and opacity animate, so the scene stays smooth on phones. */

/* ---------- Story layout ---------- */
.scale { position: relative; padding-top: var(--header-h); }
.scale__stage {
  position: sticky; top: var(--header-h); z-index: 5;
  height: 44svh; min-height: 290px;
  display: flex; flex-direction: column; padding: 10px 0 8px;
  background: var(--brown);
}
.scale__stage::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 36px; background: linear-gradient(180deg, var(--brown), rgba(28,25,23,0)); pointer-events: none; }
.scale__steps { padding: 0 24px; }
.scale__step { min-height: 74svh; padding: 26px 0 48px; }
.scale__step:last-child { min-height: 90svh; }
.scale__step h1, .scale__step h2 { font-size: clamp(32px, 8.4vw, 64px); line-height: 1.08; margin: 6px 0 14px; }
.scale__step > p:not(.eyebrow) { color: var(--ivory-dim); max-width: 44ch; }
.scale__step .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

@media (min-width: 821px) {
  .scale {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px;
    width: min(var(--wrap), 100% - 48px); margin: 0 auto;
  }
  .scale__steps { order: 1; padding: 0; }
  .scale__stage { order: 2; height: calc(100svh - var(--header-h)); padding: 30px 0; background: none; }
  .scale__stage::after { display: none; }
  .scale__step { min-height: calc(100svh - var(--header-h)); display: flex; flex-direction: column; justify-content: center; padding: 40px 0; }
  .scale__step:last-child { min-height: calc(100svh - var(--header-h)); }
  .scale__step h1, .scale__step h2 { font-size: clamp(40px, 4.4vw, 64px); }
}

/* ---------- Scene ---------- */
.sc-scene { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; overflow: hidden; }
.sc-glow { position: absolute; inset: 6% 10%; border-radius: 50%; background: radial-gradient(closest-side, rgba(184,151,106,.16), rgba(184,151,106,0)); }
.sc-scene > * { transition: transform .8s cubic-bezier(.2,.7,.2,1), opacity .6s ease; }

.sc-plate {
  position: absolute; left: 50%; top: 50%; height: 86%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
}
.sc-plate img { display: block; width: 100%; height: 100%; max-width: none; animation: sc-spin 70s linear infinite; }
.scale:not([data-stage="1"]) .sc-plate img { animation-play-state: paused; }
@keyframes sc-spin { to { rotate: 360deg; } }

.sc-cartons {
  position: absolute; left: 50%; bottom: 4%; width: auto; height: 62%; aspect-ratio: 1.2;
  transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4%;
  opacity: 0;
}
.sc-cartons i {
  display: block; border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255,248,232,.55) 44% 56%, transparent 56%),
    linear-gradient(180deg, #D9BE94, #B9976A);
  box-shadow: inset 0 0 0 1px rgba(28,25,23,.25);
  opacity: 0; transform: translateY(40%);
  transition: transform .6s cubic-bezier(.2,.7,.2,1), opacity .5s ease;
  transition-delay: calc((8 - var(--i)) * 55ms);
}

.sc-buffet { position: absolute; inset: 0; opacity: 0; }
.sc-buffet img {
  position: absolute; width: auto; height: 36%; aspect-ratio: 1; max-width: none;
  left: calc(2% + var(--i) * 16.5%); top: calc(46% - var(--i) * 7%);
  opacity: 0; transform: translateY(18%) scale(.9);
  transition: transform .7s cubic-bezier(.2,.7,.2,1), opacity .5s ease;
  transition-delay: calc(var(--i) * 80ms);
}
.sc-lights {
  position: absolute; left: 4%; right: 4%; top: 12%; height: 10px;
  background: radial-gradient(circle, rgba(232,196,126,.9) 0 2px, transparent 3px) 0 0 / 22px 10px repeat-x;
  transform: rotate(-8deg);
}

.sc-box {
  position: absolute; left: 4%; right: 4%; top: 50%; height: 42%;
  transform: translate(12%, -50%); opacity: 0;
  border: 2px solid var(--gold); border-radius: 6px;
  background: repeating-linear-gradient(90deg, #053A4A 0 7px, #0A4C60 7px 9px);
}
.sc-box__load { position: absolute; inset: 6% 9% 6% 4%; display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(4, 1fr); gap: 3px; }
.sc-box__load i {
  display: block; border-radius: 2px; background: linear-gradient(180deg, #DCC29A, #B9976A);
  transform: scaleY(0); transform-origin: bottom; opacity: 0;
  transition: transform .45s ease, opacity .3s ease;
  transition-delay: calc(var(--i) * 22ms);
}
.sc-box__door { position: absolute; right: -2px; top: -2px; bottom: -2px; width: 7%; border: 2px solid var(--gold); border-radius: 0 6px 6px 0; background: #0A4C60; transform-origin: right; transform: perspective(300px) rotateY(-55deg); }

.sc-count { margin: 4px 0 0; text-align: center; transition: opacity .18s ease; }
.sc-count b { display: block; font-weight: 300; font-size: clamp(30px, 7vw, 52px); line-height: 1.1; color: var(--gold); font-variant-numeric: tabular-nums; }
.sc-count span { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--ivory-dim); }
.scale.is-swapping .sc-count { opacity: 0; }

/* Stage 2: the plate steps aside and a month of cartons stacks up */
.scale[data-stage="2"] .sc-plate { transform: translate(-50%, -50%) translateY(-41%) scale(.26); }
.scale[data-stage="2"] .sc-cartons,
.scale[data-stage="2"] .sc-cartons i { opacity: 1; transform: translateX(-50%); }
.scale[data-stage="2"] .sc-cartons i { transform: none; }

/* Stage 3: a buffet line of thali trays */
.scale[data-stage="3"] .sc-plate,
.scale[data-stage="4"] .sc-plate { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
.scale[data-stage="3"] .sc-cartons { opacity: 0; transform: translateX(-50%) scale(.7); }
.scale[data-stage="3"] .sc-buffet, .scale[data-stage="3"] .sc-buffet img { opacity: 1; }
.scale[data-stage="3"] .sc-buffet img { transform: none; }

/* Stage 4: a container, filled carton by carton */
.scale[data-stage="4"] .sc-buffet { opacity: 0; }
.scale[data-stage="4"] .sc-box { opacity: 1; transform: translate(0, -50%); }
.scale[data-stage="4"] .sc-box__load i { opacity: 1; transform: none; }

@media (min-width: 821px) {
  .sc-scene { border-radius: var(--radius-lg); }
  .sc-buffet img { height: 34%; left: calc(2% + var(--i) * 14%); }
}

/* ---------- Calculators ---------- */
.calc { margin-top: 18px; padding: 18px 20px; border-radius: var(--radius-md); background: var(--brown-2); border: 1px solid rgba(184,151,106,.2); max-width: 520px; }
.calc label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; color: var(--ivory-dim); }
.calc output { font-size: 22px; color: var(--ivory); font-variant-numeric: tabular-nums; }
.calc input[type="range"] { width: 100%; margin: 12px 0 6px; accent-color: var(--gold); height: 28px; }
.calc__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc__row label { display: grid; gap: 6px; }
.calc select { font: inherit; font-size: 15px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--gold-line); background: var(--brown); color: var(--ivory); width: 100%; }
.calc__out { margin: 10px 0 4px; font-size: 17px; color: var(--ivory); }
.calc__note { margin: 0; font-size: 13px; color: rgba(237,232,223,.55); }
@media (max-width: 420px) { .calc__row { grid-template-columns: 1fr; } }

/* ---------- Three doors ---------- */
.doors-section { padding-top: 70px; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.door-card { display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; background: var(--brown-2); border: 1px solid rgba(184,151,106,.18); text-decoration: none; color: var(--ivory); transition: transform .3s ease, border-color .3s ease; }
.door-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.door-card .ph { aspect-ratio: 4 / 3; background: var(--sand); }
.door-card .ph img { width: 100%; height: 100%; object-fit: contain; }
.door-card .body { padding: 20px 22px 24px; display: grid; gap: 6px; }
.door-card .tag { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.door-card strong { font-size: 21px; font-weight: 400; line-height: 1.25; }
.door-card small { font-size: 15px; color: var(--ivory-dim); }
.door-card .go { margin-top: 8px; color: var(--gold); font-size: 15px; }
.door-card .go::after { content: "\00a0\2192"; }
.doors__home { margin: 26px 0 0; color: var(--ivory-dim); }
.doors__home a { color: var(--gold); }
@media (max-width: 820px) {
  .doors { grid-template-columns: 1fr; gap: 14px; }
  .door-card { flex-direction: row; align-items: center; }
  .door-card .ph { flex: 0 0 34%; aspect-ratio: 1; }
  .door-card .body { padding: 14px 16px; }
  .door-card strong { font-size: 18px; }
}

/* Lower sections render only when near the screen */
main > .section { content-visibility: auto; contain-intrinsic-size: auto 800px; }

@media (prefers-reduced-motion: reduce) {
  .sc-plate img { animation: none; }
  .sc-scene > *, .sc-cartons i, .sc-buffet img, .sc-box__load i, .sc-count { transition-duration: .01s !important; transition-delay: 0s !important; }
}

/* Phones: keep the three buyer choices on the first screen */
@media (max-width: 820px) {
  .scale__stage { height: 33svh; min-height: 210px; }
  .scale__step[data-step="1"] { padding-top: 14px; }
  .scale__step[data-step="1"] .eyebrow { display: none; }
  .scale__step[data-step="1"] h1 { font-size: clamp(30px, 8vw, 40px); margin: 0 0 8px; }
  .scale__step[data-step="1"] .lead { font-size: 16px; margin: 0; }
  .scale__step[data-step="1"] .pick__q { margin-top: 14px; }
}
@media (max-width: 820px) and (max-height: 780px) {
  .scale__stage { height: 25svh; min-height: 160px; }
  .scale__step[data-step="1"] .lead { display: none; }
  .scale__step[data-step="1"] h1 { margin-bottom: 0; }
}
