/* Twitch live embed. Only linked when TWITCH_CHANNEL is configured, and the section stays
   hidden until the channel is live. Twitch's embed rules forbid covering or obscuring the
   player, so nothing is layered over it and the embeds are never transformed or scaled. */

/* While the section is visible, stack it and the link card in the middle of the page
   instead of letting the full-height grid spread them apart. */
.page-wrap:has(> .twitch-live:not([hidden])) {
  align-content: center;
  row-gap: 1.5rem;
}

/* The page background gradient is sized to the viewport and repeats, which leaves a hard edge once the
   live section makes the page taller than the screen. Paint it once and continue in its darkest colour. */
html:has(.twitch-live:not([hidden])) body {
  background-repeat: no-repeat;
  background-color: #160a05;
}

.twitch-live {
  width: 100%;
  max-width: 1180px;
  background: rgba(30, 12, 6, 0.92);
  border: 1px solid rgba(255, 179, 71, 0.18);
  border-radius: 1rem;
  padding: 0.75rem;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.35);
}

.twitch-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(233, 25, 22, 0.7);
  border-radius: 999px;
  background: rgba(233, 25, 22, 0.18);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.twitch-live-dot {
  display: inline-block;
  animation: twitch-live-pulse 1.6s ease-in-out infinite;
}

@keyframes twitch-live-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .twitch-live-dot {
    animation: none;
  }
}

.twitch-live-stage {
  display: grid;
  gap: 0.75rem;
}

.twitch-live--with-chat .twitch-live-stage {
  grid-template-columns: minmax(0, 1fr) 340px;
}

/* 16:9 box for the player. On wide screens it stays well above the 400x300 Twitch needs for autoplay. */
.twitch-live-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  align-self: start;
  background: #000;
}

/* The chat column takes the player's height. */
.twitch-live-chat {
  position: relative;
  background: #18181b;
}

.twitch-live-player iframe,
.twitch-live-chat iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.twitch-live-chat iframe {
  position: absolute;
  inset: 0;
}

@media (min-width: 576px) {
  .twitch-live {
    padding: 1rem;
  }
}
