/*
 * Shared styles for the CTA overlay component (cta-overlays.js).
 *
 * Class names are a contract with the JS — keep these in sync if the
 * component's emitted markup changes. Used by both:
 *   - /watch/<flow>            (welcome)
 *   - first-donation Slide 3   (cinematic end-slide)
 *
 * Pure component styles only. Stage/player/host-layout CSS lives next
 * to each surface (welcome/lib/watch.css, first-donation inline style).
 *
 * Tokens consumed:
 *   --rfi-black, --rfi-white, --rfi-pastel-blue
 *   Chakra Petch (display) + Inter (body) — must be loaded by host.
 */

/* Bottom-pinned timed CTA pills. Host page positions the container. */
.watch-cta {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  background: var(--rfi-pastel-blue);
  color: var(--rfi-black);
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 240ms ease, transform 240ms ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.watch-cta[data-visible="1"] {
  opacity: 1;
  transform: translateY(0);
}
.watch-cta:hover,
.watch-cta:focus-visible {
  background: var(--rfi-white);
  outline: none;
}

.watch-cta--secondary {
  background: transparent;
  color: var(--rfi-white);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.watch-cta--secondary:hover,
.watch-cta--secondary:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: var(--rfi-white);
}

/* Postroll end-card — full-bleed overlay that takes over the player frame
   on the video's `ended` event. z-index above the timed CTA pills (20),
   below any host error layer. */
.watch-end-card {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px)
          calc(env(safe-area-inset-right, 0px) + 20px)
          calc(env(safe-area-inset-bottom, 0px) + 24px)
          calc(env(safe-area-inset-left, 0px) + 20px);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.96) 100%),
    radial-gradient(120% 80% at 50% 100%, rgba(151, 206, 255, 0.18) 0%, transparent 60%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
}
.watch-end-card[data-visible="1"] {
  opacity: 1;
  pointer-events: auto;
}

.watch-end-card__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 480px;
  width: 100%;
}

.watch-end-card__headline {
  margin: 0;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--rfi-white);
  max-width: 28ch;
  text-wrap: balance;
  /* Honour explicit \n breaks in flow-JSON headlines (e.g. first-donation
     wants a hard break between brand line and CTA sentence). */
  white-space: pre-line;
}
@media (min-width: 768px) {
  .watch-end-card__headline {
    font-size: 24px;
    max-width: 32ch;
  }
}

.watch-end-card__buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.watch-end-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.watch-end-card__btn--primary {
  background: var(--rfi-pastel-blue);
  color: var(--rfi-black);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.watch-end-card__btn--primary:hover,
.watch-end-card__btn--primary:focus-visible {
  background: var(--rfi-white);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(151, 206, 255, 0.6);
}

.watch-end-card__btn--secondary {
  background: transparent;
  color: var(--rfi-white);
  border: 1px solid rgba(255, 255, 255, 0.32);
}
.watch-end-card__btn--secondary:hover,
.watch-end-card__btn--secondary:focus-visible {
  background: rgba(151, 206, 255, 0.12);
  border-color: var(--rfi-pastel-blue);
  color: var(--rfi-white);
  outline: none;
}

.watch-end-card__replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 16px;
  margin-top: 4px;
  cursor: pointer;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.watch-end-card__replay:hover,
.watch-end-card__replay:focus-visible {
  background: rgba(151, 206, 255, 0.12);
  color: var(--rfi-white);
  border-color: var(--rfi-pastel-blue);
  outline: none;
}

/* Pause-state overlay (brief 006) — used by welcome /watch/ only. The
   first-donation cinematic Slide 3 deliberately doesn't pass a pauseCard
   config, so these rules are inert there. */
.watch-pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.watch-pause-overlay[data-visible="1"] {
  opacity: 1;
  pointer-events: auto;
}

.watch-pause-play-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: var(--rfi-white);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
  padding: 0;
}
.watch-pause-play-icon svg {
  transform: translateX(2px);
}
.watch-pause-play-icon:hover,
.watch-pause-play-icon:focus-visible {
  background: rgba(0, 0, 0, 0.7);
  border-color: var(--rfi-pastel-blue);
  outline: none;
  transform: scale(1.04);
}

.watch-pause-card {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 56px);
  margin: 0 16px;
  padding: 14px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  text-align: center;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms ease;
}
.watch-pause-overlay[data-visible="1"] .watch-pause-card {
  transform: translateY(0);
  opacity: 1;
}

.watch-pause-card__headline {
  margin: 0;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--rfi-white);
  max-width: 28ch;
  text-wrap: balance;
}

.watch-pause-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  background: var(--rfi-pastel-blue);
  color: var(--rfi-black);
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.watch-pause-card__btn:hover,
.watch-pause-card__btn:focus-visible {
  background: var(--rfi-white);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -8px rgba(151, 206, 255, 0.6);
}

.watch-pause-card__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}
.watch-pause-card__close:hover,
.watch-pause-card__close:focus-visible {
  color: var(--rfi-white);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  transform: scale(1.06);
}

.watch-pause-overlay[data-placement="mid"] {
  background: transparent;
  pointer-events: none;
}
.watch-pause-overlay[data-placement="mid"] .watch-pause-play-icon {
  display: none;
}
.watch-pause-overlay[data-placement="mid"] .watch-pause-card {
  pointer-events: auto;
}

@media (max-height: 499px) {
  .watch-pause-card {
    margin: 0 12px;
    padding: 10px 14px 12px;
    gap: 8px;
  }
  .watch-pause-card__headline {
    font-size: 13px;
    max-width: 24ch;
  }
  .watch-pause-card__btn {
    min-height: 40px;
    padding: 0 18px;
    font-size: 13px;
  }
  .watch-pause-card__close {
    width: 28px;
    height: 28px;
    top: 4px;
    right: 4px;
  }
}
