/* Intro video popup + its header trigger. Mirrors the sign-in popup
   (css/login-modal.css) so both overlays feel like the same component,
   but the panel is sized to the 16:9 video instead of a form. */

/* Header trigger */
.btn-watch-icon {
  flex: none;
  margin-left: -2px;
}

/* The header row (brand, seven links, three buttons) no longer fits the
   1180px content container once this button is added: "How it fits
   together" wrapped onto three lines. So the header alone gets a wider
   container and slightly tighter gaps, and below 1280px viewport the
   trigger collapses to its play icon. */
.site-header .container {
  max-width: 1320px;
}

.site-nav {
  gap: 28px;
}

.nav-links {
  gap: 26px;
}

.btn-watch {
  flex: none;
  padding-left: 16px;
  padding-right: 16px;
}

/* Below the breakpoint where .nav-links disappears (base.css) the header
   still holds three buttons; tighten the gap so they fit. */
@media (max-width: 1140px) {
  .site-nav {
    gap: 10px;
  }
}

@media (max-width: 1279px) {
  .btn-watch {
    padding: 0;
    width: 42px;
    height: 42px;
  }

  .btn-watch-icon {
    margin-left: 2px;
  }

  .btn-watch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (max-width: 440px) {
  .site-header .container {
    padding: 0 16px;
  }

  .site-nav .btn {
    padding-left: 14px;
    padding-right: 14px;
  }

  .site-nav .btn-watch {
    padding: 0;
  }
}

/* Popup */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out), visibility 0s linear 0.25s;
}

.video-modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s var(--ease-out);
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 13, 0.86);
  backdrop-filter: blur(10px) saturate(140%);
}

.video-modal-panel {
  position: relative;
  /* Largest 16:9 box that fits the viewport minus the 24px padding. */
  width: min(1100px, 100%, calc((100vh - 48px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.7), 0 0 80px var(--primary-glow);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}

.video-modal.is-open .video-modal-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.video-modal-player {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.video-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(5, 7, 13, 0.7);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.video-modal-close:hover {
  background: rgba(5, 7, 13, 0.92);
  border-color: var(--text-dim);
}

@media (max-width: 600px) {
  .video-modal {
    padding: 12px;
  }

  .video-modal-panel {
    width: min(100%, calc((100vh - 24px) * 16 / 9));
    border-radius: var(--radius-md);
  }

  .video-modal-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-modal,
  .video-modal.is-open,
  .video-modal-panel {
    transition: none;
  }
}
