/* A native, swipeable film strip. Every player retains its own aspect ratio. */
.video-reel {
  --reel-media-height: 320px;
  --reel-gap: 26px;
  width: 100%;
  min-width: 0;
}

.video-reel-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.video-reel-tools[hidden] {
  display: none;
}

.video-reel-hint {
  max-width: 440px;
  color: #5b6959;
  font-size: 13px;
  line-height: 1.7;
}

.video-reel-controls {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
}

.video-reel-position {
  min-width: 48px;
  margin-inline: 6px;
  color: var(--olive);
  font: 500 12px/1.3 var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.video-reel-arrow {
  display: inline-grid;
  width: 48px;
  height: 48px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--forest);
  border-radius: 50%;
  background: transparent;
  color: var(--forest);
  font: 24px/1 var(--sans);
  transition: color .2s, background .2s, border-color .2s;
}

.video-reel-arrow:hover:not(:disabled) {
  background: var(--forest);
  color: var(--paper);
}

.video-reel-arrow:disabled {
  border-color: #cbcdbf;
  background: #e8e7dc;
  color: #9b9f90;
  cursor: default;
}

.video-reel .video-grid {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: flex-start;
  gap: var(--reel-gap);
  padding: 4px 0 24px;
  column-count: auto;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: auto;
  scrollbar-color: #7b8975 #dedfd2;
}

.video-reel .video-grid::-webkit-scrollbar {
  height: 9px;
}

.video-reel .video-grid::-webkit-scrollbar-track {
  border-radius: 9px;
  background: #dedfd2;
}

.video-reel .video-grid::-webkit-scrollbar-thumb {
  border: 2px solid #dedfd2;
  border-radius: 9px;
  background: #7b8975;
}

.video-reel .video-grid::-webkit-scrollbar-thumb:hover {
  background: var(--forest);
}

.video-reel .video-grid:focus-visible {
  outline-offset: -2px;
}

.video-reel .video-card {
  display: grid;
  flex: 0 0 calc(var(--reel-media-height) * 16 / 9);
  width: auto;
  min-width: 0;
  grid-template-rows: var(--reel-media-height) auto;
  margin: 0;
  break-inside: auto;
  scroll-snap-align: start;
}

.video-reel .video-card.is-portrait {
  flex-basis: calc(var(--reel-media-height) * 9 / 16);
}

.video-reel .video-frame {
  width: 100%;
  height: auto;
  min-height: 0;
  align-self: end;
  aspect-ratio: 16 / 9;
  border-radius: var(--media-radius);
}

.video-reel .is-portrait .video-frame {
  max-width: none;
  aspect-ratio: 9 / 16;
}

.video-reel .video-meta {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 17px 2px 0;
}

.video-reel .video-format {
  font-size: 9px;
  letter-spacing: 1.1px;
}

.video-reel .video-title {
  max-width: 420px;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.4;
}

.video-reel .video-external {
  justify-self: start;
  padding-top: 0;
  font-size: 11px;
  line-height: 1.8;
}

@media (max-width: 900px) {
  .video-reel {
    --reel-media-height: 300px;
    --reel-gap: 22px;
  }
}

@media (max-width: 640px) {
  .video-reel {
    --reel-media-height: 288px;
    --reel-gap: 18px;
  }

  .video-reel-tools {
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 18px;
  }

  .video-reel-hint {
    max-width: 210px;
    font-size: 12px;
    line-height: 1.6;
  }

  .video-reel-controls {
    gap: 6px;
  }

  .video-reel-position {
    min-width: 32px;
    margin-inline: 0;
    font-size: 11px;
  }

  .video-reel-arrow {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .video-reel .video-card.is-landscape {
    flex-basis: min(82vw, 480px);
  }

  .video-reel .video-cta {
    bottom: 16px;
    left: 16px;
    font-size: 11px;
  }

  .video-reel .video-play {
    width: 54px;
    height: 54px;
  }

  .video-reel .video-meta {
    padding-top: 14px;
  }
}

@media (max-width: 380px) {
  .video-reel-tools {
    align-items: center;
  }

  .video-reel-hint {
    max-width: 135px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-reel .video-grid {
    scroll-behavior: auto;
  }

  .video-reel-arrow,
  .video-reel .video-poster > img,
  .video-reel .video-play {
    transition: none;
  }
}

@media print {
  .video-reel-tools {
    display: none;
  }

  .video-reel .video-grid {
    flex-wrap: wrap;
    overflow: visible;
  }
}

/* A compact cinema: the current film and two neighboring frames. */
dialog.video-viewer {
  --viewer-space: 32px;
  --viewer-header-height: 72px;
  --viewer-footer-height: 64px;
  --viewer-dialog-height: calc(100vh - var(--viewer-space));
  --viewer-dialog-width: min(1200px, calc(100vw - var(--viewer-space)));
  --viewer-stage-padding: 24px;
  --viewer-side-width: 160px;
  --viewer-stage-gap: 24px;
  --viewer-ratio-width: 16;
  --viewer-ratio-height: 9;
  --viewer-central-width: calc(var(--viewer-dialog-width) - var(--viewer-stage-padding) * 2 - var(--viewer-side-width) * 2 - var(--viewer-stage-gap) * 2 - 2px);
  --viewer-stage-height: min(560px, calc(var(--viewer-dialog-height) - var(--viewer-header-height) - var(--viewer-footer-height) - 2px), calc(var(--viewer-central-width) * var(--viewer-ratio-height) / var(--viewer-ratio-width)));
  width: var(--viewer-dialog-width);
  max-width: calc(100vw - var(--viewer-space));
  max-height: var(--viewer-dialog-height);
  margin: auto;
  padding: 0;
  border: 1px solid #ffffff1a;
  border-radius: 20px;
  overflow: hidden;
  background: #111a15;
  background-image: radial-gradient(ellipse at 50% 30%, #30403255, transparent 70%);
  color: #f1eee5;
  box-shadow: 0 30px 120px #0009;
}

dialog.video-viewer[open] {
  display: grid;
  grid-template-rows: var(--viewer-header-height) var(--viewer-stage-height) var(--viewer-footer-height);
}

dialog.video-viewer::backdrop {
  background: #09110deb;
  backdrop-filter: blur(7px);
}

dialog.video-viewer.is-portrait {
  --viewer-ratio-width: 9;
  --viewer-ratio-height: 16;
}

.video-viewer-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px 12px 24px;
}

.video-viewer-header h2 {
  display: -webkit-box;
  min-width: 0;
  max-height: 50px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #f1eee5;
  font: 400 20px/1.25 var(--serif);
  letter-spacing:0;
  overflow-wrap: anywhere;
}

.video-viewer-close {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  place-items: center;
  border: 1px solid #e1e6d633;
  border-radius: 50%;
  background: #ffffff08;
  color: #f1eee5;
  font: 300 31px/1 var(--sans);
  transition: background .2s, border-color .2s;
}

.video-viewer-close:hover {
  border-color: #e1e6d680;
  background: #ffffff14;
}

.video-viewer-close:focus-visible,
.video-viewer-external:focus-visible,
.video-viewer-arrow:focus-visible,
.video-viewer-neighbor:focus-visible {
  outline: 2px solid #d0b18a;
  outline-offset: 3px;
}

.video-viewer-stage {
  display: grid;
  min-width: 0;
  height: var(--viewer-stage-height);
  grid-template-columns: var(--viewer-side-width) minmax(0, 1fr) var(--viewer-side-width);
  align-items: center;
  gap: var(--viewer-stage-gap);
  padding-inline: var(--viewer-stage-padding);
  touch-action: pan-y;
}

.video-viewer-player {
  position: relative;
  width: min(100%, calc(var(--viewer-stage-height) * var(--viewer-ratio-width) / var(--viewer-ratio-height)));
  max-height: var(--viewer-stage-height);
  margin-inline: auto;
  aspect-ratio: var(--viewer-ratio-width) / var(--viewer-ratio-height);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 12px 50px #0007;
}

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

.video-viewer-neighbor {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  align-content: center;
  justify-items: center;
  gap: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #bac4b5;
  cursor: pointer;
  transition: color .2s, transform .2s;
}

.video-neighbor-frame {
  display: block;
  width: 100%;
  max-height: calc(var(--viewer-stage-height) * .62);
  aspect-ratio: 16 / 9;
  border: 1px solid #dce4d329;
  border-radius: 9px;
  overflow: hidden;
  background: #080d0a;
  box-shadow: 0 10px 28px #0005;
  opacity: .62;
  transition: opacity .2s, border-color .2s;
}

.video-viewer-neighbor.is-portrait .video-neighbor-frame {
  width: min(100%, calc(var(--viewer-stage-height) * .62 * 9 / 16));
  aspect-ratio: 9 / 16;
}

.video-neighbor-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-neighbor-label {
  display: -webkit-box;
  max-width: 160px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 400 11px/1.55 var(--sans);
  text-align: center;
}

.video-viewer-neighbor:hover {
  color: #f1eee5;
  transform: translateY(-3px);
}

.video-viewer-neighbor:hover .video-neighbor-frame,
.video-viewer-neighbor:focus-visible .video-neighbor-frame {
  border-color: #d0b18a99;
  opacity: 1;
}

.video-viewer-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
}

.video-viewer-navigation {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.video-viewer-arrow {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid #e1e6d633;
  border-radius: 50%;
  background: transparent;
  color: #f1eee5;
  font: 400 23px/1 var(--sans);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.video-viewer-arrow:hover {
  border-color: #d0b18a99;
  background: #d0b18a14;
}

.video-viewer-position {
  min-width: 48px;
  color: #c4cbb9;
  font: 400 11px/1.3 var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.video-viewer-external {
  flex-shrink: 0;
  color: #c4cbb9;
  font: 400 11px/1.6 var(--sans);
  text-decoration: underline;
  text-decoration-color: #c4cbb94d;
  text-underline-offset: 4px;
}

.video-viewer-external:hover {
  color: #fff;
  text-decoration-color: currentColor;
}

@supports (height: 100dvh) {
  dialog.video-viewer {
    --viewer-dialog-height: calc(100dvh - var(--viewer-space));
  }
}

@media (max-width: 1000px) {
  dialog.video-viewer {
    --viewer-side-width: 110px;
    --viewer-stage-gap: 18px;
    --viewer-stage-padding: 18px;
  }
}

@media (max-width: 640px) {
  dialog.video-viewer {
    --viewer-space: 24px;
    --viewer-header-height: 64px;
    --viewer-footer-height: 62px;
    --viewer-side-width: 44px;
    --viewer-stage-gap: 0px;
    --viewer-stage-padding: 0px;
    border-radius: 14px;
  }

  .video-viewer-header {
    gap: 12px;
    padding: 10px 10px 10px 14px;
  }

  .video-viewer-header h2 {
    max-height: 45px;
    font-size: 18px;
  }

  .video-viewer-footer {
    gap: 8px;
    padding: 8px 12px;
  }

  .video-viewer-navigation {
    gap: 6px;
  }

  .video-viewer-position {
    min-width: 42px;
  }

  .video-viewer-external {
    font-size: 10px;
  }

  .video-viewer-neighbor {
    gap: 8px;
    padding-inline: 4px;
  }

  .video-neighbor-frame,
  .video-viewer-player {
    border-radius: 6px;
  }

  .video-neighbor-label {
    max-height: 32px;
    font-size: 9px;
    line-height: 1.5;
  }

}

@media (max-height: 500px) {
  dialog.video-viewer {
    --viewer-space: 16px;
    --viewer-header-height: 56px;
    --viewer-footer-height: 52px;
    --viewer-side-width: 88px;
    --viewer-stage-gap: 14px;
    --viewer-stage-padding: 18px;
    border-radius: 12px;
  }

  .video-viewer-header {
    padding-block: 6px;
  }

  .video-viewer-header h2 {
    max-height: 40px;
    font-size: 16px;
  }

  .video-viewer-footer {
    padding-block: 4px;
  }

  .video-viewer-neighbor {
    gap: 6px;
  }

  .video-neighbor-label {
    font-size: 9px;
    line-height: 1.35;
  }

}

@media (max-height: 500px) and (max-width: 640px) {
  dialog.video-viewer {
    --viewer-side-width: 44px;
    --viewer-stage-gap: 0px;
    --viewer-stage-padding: 0px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-viewer-close,
  .video-viewer-arrow,
  .video-viewer-neighbor,
  .video-neighbor-frame {
    transition: none;
  }

  .video-viewer-neighbor:hover {
    transform: none;
  }
}
