/* Video styling for MkDocs Material theme */

/* Base styling for all videos and iframes generated by mkdocs-video */
iframe[src*="youtube.com"],
iframe[src*="vimeo.com"],
iframe[src*=".mp4"],
iframe[src*=".webm"],
iframe[src*=".ogg"],
video {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 250px !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  display: block;
  margin: 1.5em auto;
  border: none;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure proper height on mobile devices */
@media screen and (max-width: 768px) {
  iframe[src*="youtube.com"],
  iframe[src*="vimeo.com"],
  iframe[src*=".mp4"],
  iframe[src*=".webm"],
  iframe[src*=".ogg"],
  video {
    min-height: 200px !important;
    max-height: 50vh;
    width: 100% !important;
  }
}

/* For very small screens */
@media screen and (max-width: 480px) {
  iframe[src*="youtube.com"],
  iframe[src*="vimeo.com"],
  iframe[src*=".mp4"],
  iframe[src*=".webm"],
  iframe[src*=".ogg"],
  video {
    min-height: 180px !important;
    max-height: 45vh;
  }
}

/* Responsive video container */
.video-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 1.5em auto;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 4px;
  min-height: 0 !important;
}

/* Video with controls */
video[controls] {
  background: #000;
}

/* Responsive video wrapper */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 1.5em auto;
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
}

/* Center aligned videos */
.video-center {
  text-align: center;
  margin: 1.5em 0;
}

.video-center video {
  display: inline-block;
}

/* Video caption styling */
.video-caption {
  text-align: center;
  font-style: italic;
  color: var(--md-default-fg-color--light);
  margin-top: 0.5em;
  margin-bottom: 1.5em;
  font-size: 0.9em;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] video,
[data-md-color-scheme="slate"] iframe {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Lazy loading optimization */
iframe[loading="lazy"] {
  content-visibility: auto;
}

/* Performance: Reduce repaints on mobile */
@media screen and (max-width: 768px) {
  iframe,
  video {
    will-change: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
}

