/*!
 * NGA 911 Video Slider Component
 * All selectors namespaced under .nga-vs to avoid conflicts with host site CSS.
 *
 * Customize via CSS variables on .nga-vs (or via the :root override block):
 *   --nga-vs-blue, --nga-vs-amber, --nga-vs-orange, --nga-vs-red
 *   --nga-vs-ink, --nga-vs-ink-soft, --nga-vs-line
 *   --nga-vs-font, --nga-vs-rotate-ms (set via JS)
 */

/* DM Sans is loaded by the host page in most cases. If not, uncomment:
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,700&display=swap');
*/

.nga-vs {
  /* Brand palette */
  --nga-vs-blue:   #b9d0d6;
  --nga-vs-amber:  #ec9d2a;
  --nga-vs-orange: #d96a32;
  --nga-vs-red:    #c9213c;

  --nga-vs-ink:       #1a1a1a;
  --nga-vs-ink-soft:  #5a5a5a;
  --nga-vs-line:      rgba(26, 26, 26, 0.12);

  --nga-vs-bg:        #0a0a0c; /* component background */

  --nga-vs-font: "DM Sans", Helvetica, Arial, sans-serif;
  --nga-vs-rotate-ms: 5000ms;

  font-family: var(--nga-vs-font);
  color: var(--nga-vs-ink);
  background: var(--nga-vs-bg);
  padding: 2rem;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  width: 100%;
}

.nga-vs *,
.nga-vs *::before,
.nga-vs *::after { box-sizing: border-box; }

/* --- Brand bar --- */
.nga-vs__brand-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 5fr;
  height: 8px;
  margin-bottom: 2rem;
}
.nga-vs__brand-bar > div:nth-child(1) { background: var(--nga-vs-blue); }
.nga-vs__brand-bar > div:nth-child(2) { background: var(--nga-vs-amber); }
.nga-vs__brand-bar > div:nth-child(3) { background: var(--nga-vs-orange); }
.nga-vs__brand-bar > div:nth-child(4) { background: var(--nga-vs-red); }

/* --- Header --- */
.nga-vs__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  margin-top: 0;
}

.nga-vs__brand-mark {
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1;
}

.nga-vs__brand-sub {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.4rem;
}

.nga-vs__count {
  display: none; /* hidden per spec — was "Now Playing X / Y" */
}

/* --- Reel --- */
.nga-vs__reel {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #0a0a0a;
  overflow: hidden;
  border-radius: 4px;
}

.nga-vs__click-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
  background: transparent;
}

/* When the user has clicked to play, let pointer events pass through
   to the iframe/video so YouTube/video controls work */
.nga-vs.is-focused .nga-vs__click-overlay {
  pointer-events: none;
  cursor: default;
}

/* When focused, fade out the overlay UI (gradient, caption, hint)
   so it doesn't obstruct the YouTube/video controls */
.nga-vs.is-focused .nga-vs__gradient,
.nga-vs.is-focused .nga-vs__caption,
.nga-vs.is-focused .nga-vs__hint {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.nga-vs__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 700ms ease;
  pointer-events: none;
}

.nga-vs__slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.nga-vs__media-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.nga-vs__slide iframe,
.nga-vs__slide video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: cover;
}

/* YouTube poster fallback (shown in preview mode) */
.nga-vs__yt-poster {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nga-vs__yt-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nga-vs__yt-fallback {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1.4rem;
  text-decoration: none;
  color: #fff;
  pointer-events: none; /* let click overlay handle the click in normal flow */
  transition: transform 280ms ease;
}

.nga-vs__reel:hover .nga-vs__yt-fallback {
  transform: scale(1.05);
}

.nga-vs__yt-fallback svg {
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5));
}

.nga-vs__yt-fallback-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.4rem 0.75rem;
  border-radius: 2px;
}

/* Focused-mode trouble link — appears bottom-right of the iframe in case
   the iframe load is blocked or the video shows "Video unavailable" inside.
   z-index is high enough to sit above all other reel elements. */
.nga-vs__yt-trouble {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  color: #fff !important;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.65rem 1rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 180ms ease, transform 180ms ease;
  cursor: pointer;
  pointer-events: auto;
  display: inline-block;
}

.nga-vs__yt-trouble:hover,
.nga-vs__yt-trouble:focus {
  background: var(--nga-vs-red);
  border-color: var(--nga-vs-red);
  transform: translateY(-1px);
  outline: none;
}

.nga-vs__gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.25) 35%,
    rgba(0, 0, 0, 0) 60%
  );
  pointer-events: none;
  z-index: 3;
}

/* --- Caption --- */
.nga-vs__caption {
  position: absolute;
  left: 2rem;
  right: 2rem;
  bottom: 1.75rem;
  z-index: 6;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  color: #fff;
}

.nga-vs__label-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  background: var(--nga-vs-red);
  color: #fff;
  margin-bottom: 0.85rem;
}

.nga-vs__title {
  font-weight: 700;
  font-size: clamp(1.3rem, 2.6vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 75%;
  margin: 0;
  color: #fff;
}

.nga-vs__meta {
  display: none; /* hidden per spec — was "Slide XX" */
}

.nga-vs__num { display: none; }

/* --- Hint badge --- */
.nga-vs__hint {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--nga-vs-red);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: opacity 300ms ease, background 200ms ease, color 200ms ease;
  border-radius: 2px;
  pointer-events: none;
}

.nga-vs__reel:hover .nga-vs__hint {
  background: var(--nga-vs-red);
  color: #fff;
}

.nga-vs__hint svg { width: 12px; height: 12px; }

/* Play badge removed — replaced by simpler corner hint that doesn't
   cover the video. */

/* --- Thumbnail carousel --- */
.nga-vs__controls {
  position: relative;
  margin-top: 1rem;
  padding: 0 3rem; /* room for prev/next buttons */
}

.nga-vs__viewport {
  overflow: hidden;
  width: 100%;
}

.nga-vs__track {
  display: flex;
  gap: 0.75rem;
  transition: transform 450ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.nga-vs__thumb {
  position: relative;
  flex: 0 0 calc((100% - 0.75rem * 3) / 4); /* 4 visible, 3 gaps between them */
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  cursor: pointer;
  overflow: hidden;
  transition: transform 200ms ease, opacity 250ms ease;
  border-radius: 3px;
  opacity: 0.65;
}

.nga-vs__thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  z-index: 4;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  pointer-events: none;
  border-radius: 3px;
}

.nga-vs__thumb:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}
.nga-vs__thumb:hover::before { border-color: var(--nga-vs-amber); }

.nga-vs__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Strong highlight on the currently-playing thumbnail */
.nga-vs__thumb.is-active {
  opacity: 1;
}
.nga-vs__thumb.is-active::before {
  border-color: var(--nga-vs-red);
  border-width: 3px;
  box-shadow:
    0 0 0 2px rgba(201, 33, 60, 0.25),
    0 6px 20px rgba(201, 33, 60, 0.35);
}

/* Pulsing "LIVE" indicator on active thumb */
.nga-vs__thumb.is-active::after {
  content: '▶ NOW PLAYING';
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 5;
  background: var(--nga-vs-red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  animation: nga-vs-pulse 2s ease-in-out infinite;
}

@keyframes nga-vs-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Carousel nav buttons */
.nga-vs__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--nga-vs-red);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 180ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nga-vs__nav:hover {
  background: var(--nga-vs-orange);
  transform: translateY(-50%) scale(1.08);
}

.nga-vs__nav:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.nga-vs__nav svg { width: 16px; height: 16px; fill: currentColor; }

.nga-vs__nav--prev { left: 0; }
.nga-vs__nav--next { right: 0; }

.nga-vs__thumb-num {
  display: none; /* hidden per spec — was "01", "02" etc. on thumbs */
}

.nga-vs__thumb-title {
  position: absolute;
  bottom: 0.6rem;
  left: 0.7rem;
  right: 0.7rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: #fff;
  z-index: 2;
  line-height: 1.3;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Progress bar --- */
.nga-vs__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(
    to right,
    var(--nga-vs-amber),
    var(--nga-vs-orange),
    var(--nga-vs-red)
  );
  z-index: 3;
}

.nga-vs__thumb.is-active .nga-vs__progress {
  animation: nga-vs-fill var(--nga-vs-rotate-ms) linear forwards;
}

@keyframes nga-vs-fill {
  from { width: 0%; }
  to   { width: 100%; }
}

/* --- Description --- */
.nga-vs__description {
  margin-top: 1.5rem;
  padding: 1.25rem 1.4rem;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--nga-vs-red);
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
  transition: opacity 300ms ease;
}

.nga-vs__description.is-tags {
  color: var(--nga-vs-amber);
  font-weight: 500;
}

.nga-vs__description.is-quote p {
  font-style: italic;
  margin: 0 0 0.6rem 0;
  color: rgba(255, 255, 255, 0.92);
}

.nga-vs__description .attribution {
  display: block;
  font-style: normal;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--nga-vs-amber);
  margin-top: 0.4rem;
}

.nga-vs__description .role {
  display: block;
  font-style: normal;
  font-weight: 400;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.15rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .nga-vs__thumb {
    flex: 0 0 calc((100% - 0.75rem * 2) / 3); /* 3 visible */
  }
}

@media (max-width: 600px) {
  .nga-vs { padding: 1.25rem; }
  .nga-vs__caption {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
  .nga-vs__title { max-width: 100%; }
  .nga-vs__thumb {
    flex: 0 0 calc((100% - 0.75rem) / 2); /* 2 visible */
  }
  .nga-vs__thumb-title { font-size: 0.7rem; }
  .nga-vs__thumb.is-active::after { font-size: 0.55rem; padding: 0.2rem 0.4rem; }
  .nga-vs__controls { padding: 0 2.25rem; }
  .nga-vs__nav { width: 30px; height: 30px; }
}
