.vocab-page .site-header {
  border-color: #25303b;
  background: #0e1520;
  color: var(--cup-ink);
}

.vocab-page .site-header-inner { min-height: 62px; }
.vocab-page .site-header .brand img { background: #f7f5ef; border-radius: 8px; padding: 3px; }

.cup-opening, .cup-rush {
  --opening-distance: clamp(31rem, 108svh, 63rem);
  position: relative;
  background: #090e14;
}

.cup-opening { --game-opacity: 0; --game-scale: .96; }
.cup-rush { --opening-distance: clamp(20rem, 54svh, 36rem); }

.cup-opening-stage { position: relative; isolation: isolate; }

.cup-opening-stage::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(0deg, #090e14 0%, #090e1480 48%, #090e14bd 100%),
    url("../assets/journey-art/vocab-cup.webp") 64% 60% / cover no-repeat;
}

.cup-opening-gate {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.cup-opening-gate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 63% 52%;
}

.cup-opening-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #080c12e8 0%, #080c12a6 29%, #080c120d 64%),
    linear-gradient(0deg, #090e14 1%, transparent 30%);
}

.cup-opening-intro {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: min(40rem, 86svh);
  padding-block: clamp(1.25rem, 4vh, 2.5rem) 2rem;
}

.cup-opening-intro .cup-back { justify-self: start; color: #ece5d8; }
.cup-opening-title { align-self: center; padding-block: 2.5rem; }
.cup-opening-title .eyebrow { color: #eed8a7; }
.cup-opening-title h1 {
  margin: .12em 0 .19em;
  font-size: clamp(3.65rem, 8.4vw, 9.5rem);
  letter-spacing: -.075em;
  line-height: .94;
  text-wrap: balance;
}

.vocab-page .cup-opening-title > p:not(.eyebrow) {
  max-width: 31ch;
  color: #e5e2da;
  font-size: clamp(1.02rem, 1.7vw, 1.42rem);
}

.cup-opening-links { column-gap: 1.1rem; }
.cup-opening-links .button.primary { background: #ead29e; }
.cup-opening-links .button.primary:hover { background: #f7e7c1; }
.cup-opening-links .cup-quiet-link { color: #e8dfd1; }

.cup-opening-game { position: relative; margin-block: 0; padding-block: 1rem 3rem; }

.cup-opening-screen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.cup-opening-screen img, .cup-opening-screen video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.cup-opening-screen video { display: none; }
.cup-opening-screen.is-ready .cup-opening-question,
.cup-opening-screen.is-ready video { grid-area: 1 / 1; }
.cup-opening-screen.is-ready video { display: block; }

.cup-opening-game figcaption {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding-top: 1rem;
  text-align: center;
}

.cup-opening-game figcaption > span:first-child {
  color: #e5cc96;
  font-size: .74rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.cup-opening-game figcaption strong {
  font-size: clamp(1.15rem, 2.8vw, 2.2rem);
  letter-spacing: -.04em;
  line-height: 1.15;
  text-wrap: balance;
}

.cup-opening-game figcaption h2 {
  margin: 0;
  color: #eed8a7;
  font-size: .84rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.cup-replay {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .25rem .75rem;
  border: 0;
  color: #efdfbc;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .25em;
  font-size: .88rem;
  pointer-events: auto;
}

.cup-replay[hidden] { display: none; }
.cup-replay:hover { color: #fff7df; }
.cup-replay:focus-visible { outline-color: #eed8a7; }

.cup-opening-solution { display: none; }
.cup-opening-transcript { max-width: 52ch; color: var(--cup-muted); }

:is(.cup-opening, .cup-rush).is-scrollable { min-height: calc(100svh + var(--opening-distance)); }
.is-scrollable > .cup-opening-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.cup-opening.is-scrollable .cup-opening-intro { height: 100%; opacity: var(--intro-opacity, 1); }
.cup-opening.is-scrollable .cup-opening-gate {
  opacity: var(--gate-opacity, 1);
}

.cup-opening.is-scrollable .cup-opening-gate img {
  transform: translateX(var(--gate-slide, 0%)) scale(var(--gate-scale, 1));
  transform-origin: 67% 58%;
}

.is-scrollable > .cup-opening-stage .cup-opening-game {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding-block: calc(var(--product-bar, 0px) + .5rem) 1rem;
  opacity: var(--game-opacity, 1);
  transform: scale(var(--game-scale, 1));
  pointer-events: none;
}

.is-scrollable > .cup-opening-stage .cup-opening-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 68rem, calc((100svh - var(--product-bar, 0px)) * 1.3));
  overflow: hidden;
  gap: 0;
  border: 1px solid #bb9b5966;
  border-radius: .65rem;
  background: #111b24;
  box-shadow: 0 1.4rem 5rem #0008;
}

.is-scrollable > .cup-opening-stage .cup-opening-screen > * { grid-area: 1 / 1; }
.is-scrollable > .cup-opening-stage .cup-opening-answer { opacity: var(--answer-opacity, 0); }
.is-scrollable > .cup-opening-stage video { display: block; opacity: 0; }
.is-scrollable > .cup-opening-stage .is-ready video { opacity: 1; }
.cup-opening.is-scrollable .cup-opening-solution {
  display: inline;
  color: #f4eee0;
  letter-spacing: .025em;
  opacity: var(--answer-opacity, 0);
  text-transform: none;
}

.is-scrollable > .cup-opening-stage .cup-opening-transcript {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cup-opening-mark { display: block; }
.cup-opening.is-scrollable > .cup-opening-mark { position: absolute; top: calc(var(--opening-distance) * .48); }
.cup-rush .cup-rush-screen { grid-template-columns: minmax(0, 1fr); }
.cup-rush figcaption strong { color: var(--cup-ink); }

@media (max-width: 720px) {
  .cup-opening { --opening-distance: clamp(33rem, 106svh, 56rem); }
  .cup-opening-gate img { object-position: 63% 42%; }
  .cup-opening-gate::after {
    background: linear-gradient(0deg, #090e14 3%, #090e14f2 23%, #090e1490 42%, transparent 68%);
  }
  .cup-opening-intro { min-height: min(43rem, 86svh); padding-bottom: clamp(1rem, 4svh, 2.75rem); }
  .cup-opening.is-scrollable .cup-opening-intro { padding-bottom: calc(3.25rem + 4svh); }
  .cup-opening-title { align-self: end; padding-block: 1.3rem; }
  .cup-opening-title h1 { font-size: clamp(3.45rem, 15.5vw, 6.9rem); }
  .cup-opening-links { margin-top: 1.12rem; }
  .cup-opening-links .cup-quiet-link { display: inline-flex; align-items: center; width: auto; min-height: 44px; }
  .cup-opening-screen { grid-template-columns: minmax(0, 1fr); }
  .is-scrollable > .cup-opening-stage .cup-opening-screen { border-radius: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cup-opening-stage { scroll-margin-top: 1rem; }
}
