/**
 * video.css
 * Home page video section — dark band with a 16:9 YouTube embed.
 * The embed is a click-to-play facade: a poster image plus play button.
 * No YouTube iframe (and no third-party cookies) load until the user clicks.
 * Depends on: tokens.css, base.css, layout.css
 */

/* --------------------------------------------------------------------------
 * Section wrapper
 * -------------------------------------------------------------------------- */

.video-section {
  background-color: var(--color-spread-bg);
  padding-block: var(--section-py);
}

.video-section__intro {
  max-width: 60ch;
  margin-bottom: var(--space-12);
}

.video-section__intro .eyebrow {
  color: var(--color-brand-green);
  margin-bottom: var(--space-4);
}

.video-section__intro h2 {
  color: var(--color-spread-text);
  margin-bottom: var(--space-4);
}

.video-section__lede {
  font-size: var(--text-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--color-spread-muted);
}

/* --------------------------------------------------------------------------
 * Embed frame — fixed 16:9, hairline border
 * -------------------------------------------------------------------------- */

.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background-color: #000;
  border: 1px solid var(--color-spread-hairline);
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
  .video-embed {
    height: 0;
    padding-bottom: 56.25%;
  }
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* --------------------------------------------------------------------------
 * Facade — poster + play button (replaced by the iframe on click)
 * -------------------------------------------------------------------------- */

.video-embed__facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: block;
}

.video-embed__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-slow) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
}

.video-embed__facade:hover .video-embed__poster,
.video-embed__facade:focus-visible .video-embed__poster {
  transform: scale(1.02);
  opacity: 0.8;
}

.video-embed__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  background-color: var(--color-brand-green);
  color: var(--color-ink-900);
  transition: background-color var(--dur-fast) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}

.video-embed__facade:hover .video-embed__play,
.video-embed__facade:focus-visible .video-embed__play {
  background-color: var(--color-brand-green-hover);
  transform: translate(-50%, -50%) scale(1.08);
}

/* Nudge the triangle so it reads as optically centred in the square */
.video-embed__play .icon {
  margin-left: 4px;
}

/* Caption below the frame */
.video-section__caption {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-spread-muted);
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
 * Responsive
 * -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .video-section__intro {
    margin-bottom: var(--space-8);
  }

  .video-embed__play {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-embed__poster,
  .video-embed__play {
    transition: none;
  }

  .video-embed__facade:hover .video-embed__poster,
  .video-embed__facade:focus-visible .video-embed__poster {
    transform: none;
  }

  .video-embed__facade:hover .video-embed__play,
  .video-embed__facade:focus-visible .video-embed__play {
    transform: translate(-50%, -50%);
  }
}
