/* Scene 4 · The pour and the cup. A normal section: nothing moves while you scroll past.
   Only taps change it. Words are concept placeholders. */
.cup { position: relative; background: #120b07; }
.cup__stage { position: relative; min-height: max(100svh, 780px); overflow: hidden; isolation: isolate; user-select: none; }

/* the picture behind everything: one layer per drink and per grind, one visible at a time */
.cup__bg { position: absolute; inset: 0; z-index: 0; }
.cup__img, .cup__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0;
  filter: brightness(0.76) saturate(0.95); transition: opacity 0.7s ease;
}
.cup__img.on, .cup__video.on { opacity: 1; }
/* the milk clip is shot dark, so it gets a little more light than the rest */
.cup__video[data-clip="milk"] { filter: brightness(1.2) saturate(1); }
.cup__shade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(27, 17, 9, 0.88), rgba(27, 17, 9, 0.12) 36%, rgba(27, 17, 9, 0.22) 54%, rgba(27, 17, 9, 0.96));
}

/* steam and powder: soft, slow, only while something is happening */
.cup__steam { position: absolute; inset: 0; z-index: 2; pointer-events: none; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s ease; }
.cup__stage[data-state="pouring"][data-brew]:not([data-brew="cold"]) .cup__steam,
.cup__stage[data-state="ready"][data-brew]:not([data-brew="cold"]) .cup__steam { opacity: 0.75; }
.cup__steam path { fill: none; stroke: #F6EBD9; stroke-linecap: round; filter: blur(7px); animation: cup-rise 7s ease-in-out infinite; }
.cup__steam path:nth-child(2) { animation-delay: -2.4s; animation-duration: 8.5s; }
.cup__steam path:nth-child(3) { animation-delay: -4.6s; animation-duration: 6.5s; }
@keyframes cup-rise { 0% { transform: translateY(40px); opacity: 0; } 25% { opacity: 0.55; } 100% { transform: translateY(-90px); opacity: 0; } }
.cup__dust { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.cup__dust i {
  position: absolute; bottom: -10px; width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%;
  background: #F6EBD9; opacity: 0; animation: cup-float var(--d, 12s) linear infinite; animation-delay: var(--w, 0s);
}
@keyframes cup-float { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: var(--o, 0.35); } 100% { transform: translate(var(--x, 20px), -86vh); opacity: 0; } }
.cup__stage[data-state="grinding"] .cup__dust i { background: #b9814a; --o: 0.8; animation-duration: calc(var(--d, 12s) * 0.45); }

.cup__head { position: relative; z-index: 3; padding: clamp(26px, 5vw, 56px) clamp(20px, 5vw, 64px); }
.cup__head h2 { margin: 8px 0 0; font: 500 clamp(2.2rem, 5vw, 3.6rem)/1.05 var(--font-display); color: var(--cream); }
.cup__head h2 em { color: var(--butter); }

.cup__panel {
  position: absolute; left: 0; right: 0; bottom: clamp(22px, 4vw, 44px); z-index: 3;
  padding: 0 clamp(14px, 5vw, 64px); display: flex; flex-direction: column; align-items: center;
}
.cup__status { margin: 0; text-align: center; }
.cup__big { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55); display: block; font: 500 clamp(2rem, 4.4vw, 2.75rem)/1.05 var(--font-display); color: var(--butter); }
.cup__sub { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); display: block; margin-top: 8px; font: 12px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(246, 235, 217, 0.72); }
.cup__bar { width: min(560px, 100%); height: 6px; border-radius: 6px; background: rgba(246, 235, 217, 0.2); overflow: hidden; margin: 16px 0 16px; }
.cup__bar b { display: block; height: 100%; width: 0; background: var(--butter); border-radius: 6px; }
.cup__go {
  min-height: 48px; min-width: 190px; padding: 0 28px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--butter); color: var(--ink); font: 600 1rem/1 var(--font-body); margin-bottom: 18px;
}
.cup__go:disabled { opacity: 0.55; cursor: default; }
.cup__go:hover:not(:disabled) { filter: brightness(1.06); }

.cup__cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 1.4vw, 16px); width: min(880px, 100%); }
.cup__card {
  position: relative; display: block; padding: 0; border: 0; cursor: pointer; overflow: hidden; border-radius: 14px;
  aspect-ratio: 16 / 10; background: #120b07; outline: 1px solid rgba(246, 235, 217, 0.25); opacity: 0.72; transition: opacity 0.3s, outline-color 0.3s;
}
.cup__card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cup__card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(27, 17, 9, 0.88), rgba(27, 17, 9, 0) 62%); }
.cup__card span { position: absolute; left: 12px; right: 8px; bottom: 10px; z-index: 1; text-align: left; font: 12px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--cream); }
.cup__card[aria-pressed="true"] { opacity: 1; outline: 2px solid var(--butter); }
.cup__card[aria-pressed="true"] span { color: var(--butter); }

.cup__grinds { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; }
.cup__grinds .label { margin: 0 6px 0 0; line-height: 1; align-self: center; }
.cup__chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(246, 235, 217, 0.3); background: rgba(27, 17, 9, 0.6); color: rgba(246, 235, 217, 0.88); font: 0.9rem/1 var(--font-body);
}
.cup__chip[aria-pressed="true"] { border-color: var(--butter); color: var(--butter); background: rgba(243, 215, 122, 0.14); }
.cup__help { margin: 12px 0 0; font: 11px/1.5 var(--font-mono); letter-spacing: 0.04em; color: rgba(246, 235, 217, 0.78); text-align: center; }
.cup__note { margin: 14px 0 0; font: 11px var(--font-mono); letter-spacing: 0.05em; color: rgba(246, 235, 217, 0.55); text-align: center; }
.cup__card:focus-visible, .cup__chip:focus-visible, .cup__go:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
.cup__src { margin: 0; padding: 14px 20px 18px; text-align: center; background: #120b07; font: 11px/1.5 var(--font-mono); letter-spacing: 0.03em; color: rgba(246, 235, 217, 0.6); }

@media (max-width: 700px) {
  .cup__stage { min-height: max(100svh, 840px); }
  /* on a phone the picture sits in the top half and fades into the dark, so the buttons never cover the subject */
  .cup__steam { height: 56%; }
  .cup__bg { height: 56%; -webkit-mask-image: linear-gradient(#000 68%, transparent); mask-image: linear-gradient(#000 68%, transparent); }
  .cup__card { aspect-ratio: 3 / 4; }
  .cup__card span { font-size: 9.5px; left: 8px; right: 4px; letter-spacing: 0.06em; }
  .cup__grinds { gap: 6px; }
  .cup__grinds .label { flex-basis: 100%; text-align: center; margin: 0; }
  .cup__chip { padding: 0 9px; font-size: 0.8rem; }
  .cup__sub { font-size: 10.5px; }
  .cup__help { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .cup__img, .cup__video { transition: none; }
  .cup__steam path, .cup__dust i { animation: none; }
  .cup__dust { display: none; }
}
