/* === MIHD Video Gallery — 16:9 YouTube slider === */

.mihd-video {
  --mihd-radius: 6px;
  --mihd-shadow: 0 2px 12px rgba(0,0,0,.08);
  --mihd-overlay: rgba(0,0,0,.55);
  --mihd-accent: var(--mihd-accent-color, #12499b);
  --mihd-text: #fff;
  --mihd-btn-bg: rgba(0,0,0,.45);
  --mihd-btn-bg-hover: rgba(0,0,0,.7);

  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 24px;
  font-family: inherit;
}

.mihd-video__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--mihd-radius);
  overflow: hidden;
  box-shadow: var(--mihd-shadow);
}

.mihd-video__track {
  position: absolute;
  inset: 0;
  display: flex;
  transition: transform .55s cubic-bezier(.4,.0,.2,1);
  will-change: transform;
}

.mihd-video__slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  background: #000;
}

/* Facade (thumbnail with play button) — what shows before user clicks */
.mihd-video__facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background-color: #1a1a1a;
  display: block;
  outline: none;
  transition: filter .2s ease;
  overflow: hidden;
}
.mihd-video__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none; /* clicks pass through to the facade button */
}
.mihd-video__facade:hover .mihd-video__play,
.mihd-video__facade:focus-visible .mihd-video__play {
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.6)) brightness(1.08);
  transform: translate(-50%, -50%) scale(1.06);
}
.mihd-video__facade:focus-visible {
  outline: 3px solid var(--mihd-accent);
  outline-offset: -3px;
}

.mihd-video__play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform .2s ease, filter .2s ease;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.45));
}
.mihd-video__play svg { display: block; }

/* When iframe is active, hide facade visually */
.mihd-video__slide.is-playing .mihd-video__facade { display: none; }

.mihd-video__iframe-wrap {
  position: absolute;
  inset: 0;
  background: #000;
}
.mihd-video__iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Caption */
.mihd-video__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 32px 20px 18px;
  background: linear-gradient(to top, var(--mihd-overlay), transparent);
  color: var(--mihd-text);
  font-size: 16px;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
  z-index: 2;
  pointer-events: none; /* so they don't block facade clicks */
}
.mihd-video__slide.is-playing .mihd-video__caption { display: none; }

/* Prev/Next */
.mihd-video__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--mihd-btn-bg);
  color: var(--mihd-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background .2s ease;
  padding: 0;
}
.mihd-video__btn:hover,
.mihd-video__btn:focus-visible {
  background: var(--mihd-btn-bg-hover);
  outline: none;
}
.mihd-video__btn:focus-visible { box-shadow: 0 0 0 3px var(--mihd-accent); }
.mihd-video__btn svg { width: 22px; height: 22px; }
.mihd-video__btn--prev { left: 12px; }
.mihd-video__btn--next { right: 12px; }

/* Dots */
.mihd-video__dots {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding: 4px 0;
}
.mihd-video__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.22);
  cursor: pointer;
  padding: 0;
  transition: background .2s ease, transform .2s ease;
}
.mihd-video__dot:hover { background: rgba(0,0,0,.4); }
.mihd-video__dot.is-active {
  background: var(--mihd-accent);
  transform: scale(1.2);
}
.mihd-video__dot:focus-visible {
  outline: 2px solid var(--mihd-accent);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .mihd-video__btn { width: 36px; height: 36px; }
  .mihd-video__btn--prev { left: 8px; }
  .mihd-video__btn--next { right: 8px; }
  .mihd-video__btn svg { width: 18px; height: 18px; }
  .mihd-video__play svg { width: 56px; height: 40px; }
  .mihd-video__caption { font-size: 13px; padding: 24px 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .mihd-video__track,
  .mihd-video__play { transition: none; }
}
