/* ==========================================================================
   Vitamin Horgoš — stages.css (ORBIS rebuild)
   3D stages (js/3d/stage.js): canvas over the static image, a still loading
   plate, the „Okrenite pakovanje“ / „Pogledaj poleđinu“ buttons and hint,
   the ingredient lens, lite stages (quick view, recipe), shelves, the reactive
   dust layer and small legacy pieces other pages still use (mill-stone, ripple).
   Every stage keeps an explicit aspect-ratio box, so nothing shifts when the 3D
   arrives or fails. Studio/plate looks for the catalogue pages: catalog.css.
   ========================================================================== */

/* ---------- generic stage ---------- */
.stage { position: relative; }
.stage__gl {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-reveal) var(--ease-out), visibility 0s linear var(--dur-reveal);
}
.stage.is-3d .stage__gl { opacity: 1; visibility: visible; transition-delay: 0s; }
.stage.is-3d .stage__static { opacity: 0; transition: opacity var(--dur-reveal) var(--ease-out); }
.stage__static { transition: opacity var(--dur-reveal) var(--ease-out); }
.stage.is-rotating .stage__gl { touch-action: pan-y; }
/* loading: the static image stays; no shimmer */
.stage__skeleton { display: none; }
.stage__ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* ---------- controls: „Okrenite pakovanje“ (toggle), „Pogledaj poleđinu“, the hint ---------- */
.stage__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-12); }
.stage__controls--overlay { position: absolute; left: var(--sp-16); right: var(--sp-16); bottom: var(--sp-16); justify-content: center; pointer-events: none; }
.stage__controls--overlay > * { pointer-events: auto; }
.stage__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  min-height: var(--tap);
  padding: 0 var(--sp-16);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--ground-black);
  color: var(--on-dark);
  font-family: var(--font-sans);
  font-size: var(--t-ui);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--track-ui);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-hover), color var(--dur-hover);
}
.stage__btn .icon { width: 18px; height: 18px; color: var(--gold); }
.stage__btn:hover { background: rgba(201, 162, 77, 0.14); }
.stage__btn[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.stage__btn[aria-pressed="true"] .icon { color: var(--ink); }
.stage__btn[hidden] { display: none; }
.stage__hint { flex: 1 1 100%; margin: 0; font-size: var(--t-card-body); line-height: 1.5; color: var(--on-dark-body); }
.stage__hint[hidden] { display: none; }
.stage__controls--overlay .stage__hint { flex: 0 1 auto; padding: var(--sp-8) var(--sp-12); border-radius: var(--radius); background: rgba(21, 17, 15, 0.82); color: var(--on-dark); }
/* light grounds */
.section--cream .stage__btn, .section--white .stage__btn { background: var(--warm-white); border-color: var(--ink); color: var(--ink); }
.section--cream .stage__btn .icon, .section--white .stage__btn .icon { color: var(--gold-ink); }
.section--cream .stage__btn[aria-pressed="true"], .section--white .stage__btn[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.section--cream .stage__hint, .section--white .stage__hint { color: var(--ink-body); }
@media (max-width: 560px) {
  .stage__btn { white-space: normal; text-align: left; }
}

/* ---------- ingredient lens: opens from a label (click / Enter), never on hover only ---------- */
.lens {
  position: absolute;
  z-index: 3;
  width: 272px;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--sp-4) var(--sp-12);
  align-items: center;
  padding: var(--sp-12);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--warm-white);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity var(--dur-hover) var(--ease-out), visibility 0s linear var(--dur-hover);
  pointer-events: none;
}
.lens.is-above { transform: translate(-50%, calc(-100% - 12px)); }
.lens.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }
.lens svg, .lens__cv { grid-row: 1 / 3; width: 96px; height: 96px; border-radius: 50%; }
.lens svg { padding: var(--sp-16); background: color-mix(in srgb, var(--c, #C8202A) 14%, white); }
.lens svg path { fill: var(--c, #C8202A); stroke: var(--c, #C8202A); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.lens__cv { box-shadow: 0 0 0 1px var(--line-light-strong); }
.lens b { font-weight: var(--fw-semibold); }
.lens span { font-size: 0.9375rem; color: var(--ink-body); }

/* ---------- lite stages: quick view and recipe aside ---------- */
.qv__media.stage { aspect-ratio: 1; }
.rprod {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: var(--sp-16);
  align-items: center;
  margin-top: var(--sp-24);
  padding: var(--sp-16);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  background: var(--warm-white);
}
.rprod__stage { position: relative; aspect-ratio: 1; border-radius: var(--radius); background: var(--plate); }
.rprod__stage img { width: 100%; height: 100%; object-fit: contain; padding: var(--sp-8); }
.rprod__title { font-size: var(--t-card-body); font-weight: var(--fw-semibold); line-height: 1.35; }
.rprod__title a { text-decoration: none; }
.rprod__title a:hover { text-decoration: underline; }

/* ---------- category shelf in heroes (season page keeps this markup) ---------- */
.phero__stack.stage { position: absolute; pointer-events: auto; }
.phero__stack.is-3d img { opacity: 0; }
.shelf-hero {
  position: absolute;
  right: max(var(--gutter), calc((100vw - var(--container)) / 2));
  bottom: var(--sp-48);
  width: min(44vw, 560px);
  aspect-ratio: 1.3;
  z-index: 0;
}

/* ---------- shelf marquee (home) ---------- */
.shelf { position: relative; padding-block: var(--sp-64) 0; }
.shelf__stage { position: relative; width: 100%; aspect-ratio: 16 / 5; min-height: 260px; max-height: 460px; }
.shelf__stage .stage__gl { touch-action: pan-y; }
.shelf__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--sp-24);
  padding: 0 var(--gutter) var(--sp-24);
  overflow: hidden;
}
.shelf__fallback img { width: clamp(72px, 9vw, 140px); height: auto; object-fit: contain; }
.shelf__fallback img:nth-child(n + 7) { display: none; }
.shelf__plank { position: absolute; left: var(--gutter); right: var(--gutter); bottom: var(--sp-16); height: 1px; background: var(--line-dark); }
.shelf__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--sp-16); margin-bottom: var(--sp-24); }
.shelf.is-3d .shelf__fallback { opacity: 0; transition: opacity var(--dur-reveal) var(--ease-out); }
@media (max-width: 820px) {
  .shelf__fallback img:nth-child(n + 5) { display: none; }
  .shelf__stage { aspect-ratio: 16 / 7; }
}

/* ---------- reactive dust layer (legacy home sections; dust.js) ---------- */
.dust-layer { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; opacity: 0.5; }

/* ---------- mill-stone timeline (o-nama, retired markup may remain) ---------- */
.millstone {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-24));
  float: right;
  width: 96px; height: 96px;
  margin: 0 0 calc(-96px - var(--sp-24)) 0;
  z-index: 1;
  color: var(--ink-body);
  pointer-events: none;
}
.millstone circle, .millstone path { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; }
.millstone .ms-top { transform-box: fill-box; transform-origin: 50% 50%; transform: rotate(calc(var(--turn, 0) * 360deg)); }
.millstone .ms-base { transform-box: fill-box; transform-origin: 50% 50%; transform: rotate(calc(var(--turn, 0) * -40deg)); }
.millstone .ms-label { font: var(--fw-semibold) 9px var(--font-sans); letter-spacing: 0.18em; text-transform: uppercase; fill: currentColor; stroke: none; }
.tl-item { position: relative; }
.tl-burst { display: none; }
@media (max-width: 1024px) { .millstone { display: none; } }

/* ---------- chip ripple (main.js), kept quiet ---------- */
.is-rippling { position: relative; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .stage__gl { display: none; }
  .lens, .stage__btn { transition: none; }
}
@media print {
  .stage__gl, .stage__ui, .stage__controls, .stage__skeleton, .millstone, .dust-layer { display: none !important; }
}
