/* ==========================================================================
   Videos: click-to-load YouTube players, the home promo, videos.html cards,
   the pop-up player and the Video button on publications (js/videos.js)
   ========================================================================== */
.yt-player {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 1rem;
  background: #0b1220;
  isolation: isolate;
}

.yt-16x9 { aspect-ratio: 16 / 9; }
.yt-9x16 { aspect-ratio: 9 / 16; }

.yt-player iframe,
.yt-player .yt-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt-play {
  display: block;
  cursor: pointer;
  color: inherit;
}

.yt-play img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.yt-play::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0);
  transition: background-color 200ms ease;
  pointer-events: none;
}

.yt-play:hover::after { background: rgba(2, 6, 23, 0.12); }

.yt-play:hover img,
.yt-play:focus-visible img {
  transform: scale(1.03);
}

.yt-play:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: -3px;
}

.yt-play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 4.5rem;
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.94);
  color: #2563eb;
  font-size: 2.4rem;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.35);
  transform: translate(-50%, -50%);
  transition: transform 200ms ease, background-color 200ms ease, color 200ms ease;
}

.yt-play-icon i { margin-left: 0.2rem; }

.yt-play:hover .yt-play-icon,
.yt-play:focus-visible .yt-play-icon {
  background: #2563eb;
  color: #ffffff;
  transform: translate(-50%, -50%) scale(1.08);
}

.yt-9x16 .yt-play-icon {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.8rem;
}

.yt-badge {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background: rgba(2, 6, 23, 0.68);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Home page: promotion video */
.promo-video-section {
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(37, 99, 235, 0.32), rgba(37, 99, 235, 0) 70%),
    radial-gradient(700px 360px at 85% 100%, rgba(244, 63, 94, 0.14), rgba(244, 63, 94, 0) 70%),
    linear-gradient(180deg, #0b1324 0%, #060b18 100%);
}

.promo-video-player {
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.22),
    0 30px 80px -24px rgba(37, 99, 235, 0.6);
}

.promo-video-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #cbd5e1;
  font-weight: 500;
  transition: color 200ms ease;
}

.promo-video-link:hover { color: #ffffff; }
.promo-video-link i { font-size: 1.25rem; color: #f43f5e; }

/* Sock page: explainer video */
.sock-video-player {
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 24px 60px -24px rgba(15, 23, 42, 0.45);
}

/* videos.html */
.videos-channel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
  font-weight: 600;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.videos-channel-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.videos-channel-link i { font-size: 1.35rem; color: #ef4444; }

.videos-section-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.videos-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  border-radius: 9999px;
  padding: 0.15rem 0.6rem;
}

.video-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 260ms ease, transform 260ms ease;
  scroll-margin-top: 6rem;
}

.video-card:hover {
  box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.28);
}

.video-card.is-target {
  box-shadow: 0 0 0 3px #2563eb, 0 18px 40px -18px rgba(37, 99, 235, 0.45);
}

.video-card .yt-player { border-radius: 0; }

.video-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.2rem 1.25rem;
}

.video-topic {
  align-self: flex-start;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.video-title {
  color: #111827;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.video-card:not(.video-card--short) .video-title { font-size: 1.3rem; }

.video-summary {
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.5;
}

.video-paper {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  color: #6b7280;
  font-size: 0.78rem;
  line-height: 1.45;
}

.video-paper cite { font-style: italic; color: #374151; }

.video-paper-label {
  font-weight: 600;
  color: #6b7280;
}

.video-paper--none {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.video-paper--none i { color: #f59e0b; font-size: 0.95rem; }

.video-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.4rem;
}

.video-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.7rem;
  border-radius: 9999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #ffffff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.video-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  color: #2563eb;
}

.video-link .ri-youtube-line { color: #ef4444; }

.video-link--paper {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.video-link--paper:hover { color: #ffffff; background: #1d4ed8; }

.video-load-error {
  grid-column: 1 / -1;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid #fee2e2;
  background: #fef2f2;
  color: #b91c1c;
}

/* Phones: smaller play button, and shorts sit beside their text instead of filling the screen */
@media (max-width: 639px) {
  .yt-play-icon {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.8rem;
  }

  .yt-9x16 .yt-play-icon {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.4rem;
  }

  .video-card--short {
    flex-direction: row;
    align-items: flex-start;
  }

  .video-card--short .yt-player {
    width: 40%;
    flex-shrink: 0;
  }

  .video-card--short .video-card-body {
    padding: 0.85rem 0.9rem 0.95rem;
    gap: 0.45rem;
    align-self: stretch;
  }

  .video-card--short .yt-badge { display: none; }
  .video-card--short .video-summary { font-size: 0.85rem; }
}

/* Publications page: Video button */
.publication-video-button i { color: #ef4444; font-size: 1rem; }

/* Pop-up player */
.yt-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem 1.5rem;
  background: rgba(2, 6, 23, 0.84);
  backdrop-filter: blur(4px);
}

.yt-modal.is-open { display: flex; }

.yt-modal-frame { width: min(100%, 1000px); }
.yt-modal-frame.is-short { width: min(100%, calc((100vh - 5rem) * 9 / 16), 420px); }

.yt-modal-frame .yt-player { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7); }

.yt-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 1.6rem;
  transition: background-color 200ms ease;
}

.yt-modal-close:hover,
.yt-modal-close:focus-visible { background: rgba(255, 255, 255, 0.24); }

.yt-modal-lock,
.yt-modal-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .yt-play img,
  .yt-play-icon,
  .video-card,
  .video-link { transition: none; }
}
