/* Merck page: one screen, recap video behind everything.
   Phones: video fills the screen under a cliff-colored tint, text on top.
   Laptops: text on the left, the full uncropped vertical video on the right.
   The whole page is the dark mass; counts use the amber of a rodeo scoreboard. */

.merck-page {
  /* Tint strength over the video. 0 = no tint, 1 = solid dark. */
  --tint-phone: 0.72;
  --tint-wide: 0.45;
  --tint-rgb: 35, 36, 27;

  background: var(--cliff);
  color: var(--on-mass);
}

.merck-page :focus-visible {
  outline-color: var(--sand);
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Video backdrop ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: var(--cliff);
  overflow: hidden;
}

.backdrop video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(var(--tint-rgb), var(--tint-phone));
}

.no-video .backdrop {
  display: none;
}

/* ---------- Text layer ---------- */
.content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(1.25rem, env(safe-area-inset-top))
    1.25rem
    max(1.5rem, env(safe-area-inset-bottom));
}

/* The top bar floats over the page, so leave room for it. */
.intro {
  padding-top: clamp(3.5rem, 9vh, 6rem);
}

.merck-page h1,
.merck-page h2 {
  color: var(--on-mass);
}

.intro h1 {
  font-size: clamp(3.25rem, 1.5rem + 7vw, 7rem);
  letter-spacing: -0.02em;
  line-height: 0.98;
}

.countdown {
  max-width: 48rem;
  min-height: 2.5em;
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.1rem + 1.2vw, 2.125rem);
  line-height: 1.22;
  color: var(--on-mass);
  font-variant-numeric: tabular-nums;
  text-wrap: pretty;
}

.countdown .until {
  display: block;
}

.countdown .n {
  color: var(--amber);
}

/* ---------- Mack vote ---------- */
.vote {
  max-width: 34rem;
}

.vote h2 {
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.75rem);
}

.vote-lede {
  margin-top: 0.4rem;
  color: var(--on-mass-2);
}

.vote-buttons {
  display: flex;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

.merck-page .vote-btn {
  flex: 1 1 0;
  min-height: 3.25rem;
  padding-inline: 0.75rem;
  border-color: var(--on-mass-2);
  background: rgba(var(--tint-rgb), 0.6);
  color: var(--on-mass);
  font-size: 1rem;
}

.merck-page .vote-btn:hover {
  border-color: var(--on-mass);
  background: rgba(var(--tint-rgb), 0.8);
}

.merck-page .vote-yes[aria-pressed="true"] {
  border-color: var(--sand);
  background: var(--sand);
  color: var(--cliff);
}

.merck-page .vote-no[aria-pressed="true"] {
  border-color: var(--bark);
  background: var(--bark);
  color: var(--haze);
}

.tally {
  margin-top: 1.5rem;
}

.tally-bar {
  display: flex;
  height: 0.5rem;
  border-radius: var(--r-photo);
  overflow: hidden;
  background: rgba(230, 234, 236, 0.16);
}

.tally-yes,
.tally-no {
  display: block;
  height: 100%;
  width: 0;
  transition: width 700ms var(--ease);
}

.tally-yes {
  background: #8fb4c0;
}

.tally-no {
  background: var(--bark);
}

.tally-counts {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  color: var(--on-mass-2);
  font-size: 0.9375rem;
}

.tally-counts-no {
  text-align: right;
}

/* The scoreboard numerals */
.tally-n {
  display: block;
  width: fit-content;
  min-width: 3ch;
  margin-bottom: 0.25rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--r-photo);
  background: #0d0e0a;
  font: 600 1.5rem / 1.1 var(--font-body);
  letter-spacing: 0.05em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.tally-counts-no .tally-n {
  margin-left: auto;
  text-align: right;
}

.vote-status {
  min-height: 1.55em;
  margin-top: 0.875rem;
  color: var(--on-mass-2);
  font-size: 0.9375rem;
}

.vote-status.is-error {
  color: #d8a387;
  font-weight: 500;
}

/* ---------- Sound button ---------- */
.merck-page .sound-btn {
  position: absolute;
  top: calc(max(1.25rem, env(safe-area-inset-top)) + 3.25rem);
  right: 1.25rem;
  z-index: 2;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  border-color: var(--on-mass-2);
  background: rgba(var(--tint-rgb), 0.6);
  color: var(--on-mass);
  font-size: 0.9375rem;
}

.sound-btn[hidden] {
  display: none;
}

.merck-page .sound-btn:hover {
  border-color: var(--on-mass);
  background: rgba(var(--tint-rgb), 0.8);
}

.merck-page .sound-btn[aria-pressed="true"] {
  border-color: var(--sand);
  background: var(--sand);
  color: var(--cliff);
}

.sound-btn .sound-waves {
  display: none;
}

.sound-btn[aria-pressed="true"] .sound-waves {
  display: inline;
}

.sound-btn[aria-pressed="true"] .sound-off {
  display: none;
}

/* ---------- Laptops and wider: text left, uncropped video right ---------- */
@media (min-width: 56rem) and (min-aspect-ratio: 5/4) {
  .stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: 100vh;
    height: 100dvh;
  }

  .backdrop {
    position: relative;
    inset: auto;
    grid-column: 2;
    grid-row: 1;
    height: 100%;
    aspect-ratio: 9 / 16;
  }

  .backdrop video {
    object-fit: contain;
  }

  .backdrop::after {
    background: rgba(var(--tint-rgb), var(--tint-wide));
  }

  .content {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    padding: clamp(1.75rem, 5vh, 3.5rem) clamp(2rem, 5vw, 4.5rem);
  }

  .intro h1 {
    font-size: clamp(3.5rem, 11vh, 7rem);
  }

  .merck-page .sound-btn {
    top: auto;
    bottom: 1.5rem;
    right: 1.5rem;
  }
}
