.hoba-video {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.hoba-video .hoba-video__poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hoba-video > .hoba-video__poster {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hoba-video .hoba-video__placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #1b1b1f;
}

.hoba-video__frame {
  position: relative;
  width: 100%;
  height: 0;
  z-index: 2;
}

.hoba-video__frame-iframe,
.hoba-video__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.hoba-video__note {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: #666;
}

.hoba-video--empty {
  background: #f2f2f4;
  border: 1px dashed #c9c9d1;
  border-radius: 12px;
  min-height: calc(720px * 9 / 16);
}

.hoba-video--empty .hoba-video__placeholder {
  position: static;
  min-height: inherit;
  background: transparent;
}

.hoba-video--empty .hoba-video__note {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0 16px;
  text-align: center;
  color: #6b6b76;
}

.hoba-video__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.hoba-video__play:hover,
.hoba-video__play:focus-visible {
  background: rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%) scale(1.06);
  outline: none;
}

.hoba-video__play-icon {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

/* The container reserves its ratio from data-ratio without measuring the media. */
.hoba-video[data-ratio="16:9"]:not(.hoba-video--empty) > .hoba-video__poster,
.hoba-video[data-source="collection"]:not(.hoba-video-gallery) {
  aspect-ratio: 16 / 9;
}

.hoba-video[data-ratio="4:3"]:not(.hoba-video--empty) > .hoba-video__poster,
.hoba-video[data-ratio="4:3"][data-source="collection"]:not(.hoba-video-gallery) {
  aspect-ratio: 4 / 3;
}

.hoba-video[data-ratio="1:1"]:not(.hoba-video--empty) > .hoba-video__poster,
.hoba-video[data-ratio="1:1"][data-source="collection"]:not(.hoba-video-gallery) {
  aspect-ratio: 1 / 1;
}

.hoba-video[data-ratio="9:16"]:not(.hoba-video--empty) > .hoba-video__poster,
.hoba-video[data-ratio="9:16"][data-source="collection"]:not(.hoba-video-gallery) {
  aspect-ratio: 9 / 16;
}

/* --- gallery ------------------------------------------------------------- */

.hoba-video-gallery {
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.hoba-video-gallery .hoba-video-gallery__track {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(var(--hoba-video-columns, 3), minmax(0, 1fr));
}

.hoba-video-gallery[data-columns="1"] { --hoba-video-columns: 1; }
.hoba-video-gallery[data-columns="2"] { --hoba-video-columns: 2; }
.hoba-video-gallery[data-columns="3"] { --hoba-video-columns: 3; }
.hoba-video-gallery[data-columns="4"] { --hoba-video-columns: 4; }
.hoba-video-gallery[data-columns="5"] { --hoba-video-columns: 5; }
.hoba-video-gallery[data-columns="6"] { --hoba-video-columns: 6; }

.hoba-video-gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  cursor: pointer;
}

.hoba-video-gallery__item:focus-visible {
  outline: 2px solid #4c8bf5;
  outline-offset: 2px;
}

.hoba-video-gallery__item .hoba-video__poster {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.hoba-video-gallery__item:hover .hoba-video__poster {
  transform: scale(1.03);
}

.hoba-video-gallery__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hoba-video-gallery__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

.hoba-video-gallery--carousel .hoba-video-gallery__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 6px;
}

.hoba-video-gallery--carousel .hoba-video-gallery__item {
  flex: 0 0 min(100%, calc(100% / var(--hoba-video-columns, 3)));
  scroll-snap-align: start;
}

.hoba-video-gallery--carousel .hoba-video-gallery__track {
  grid-template-columns: none;
}

.hoba-video-gallery__item .hoba-video__frame {
  position: relative;
  width: 100%;
  height: 0;
}

.hoba-video-gallery.is-playing .hoba-video-gallery__track {
  overflow: visible;
}

@media (max-width: 720px) {
  .hoba-video-gallery--grid .hoba-video-gallery__track {
    grid-template-columns: 1fr !important;
  }

  .hoba-video-gallery--carousel .hoba-video-gallery__item {
    flex-basis: min(100%, 85%);
  }
}

/* Dialog cards retain a usable file/provider link before JS enhancement. */
.hoba-video[data-presentation="dialog"]:not(.hoba-video-gallery) {
  aspect-ratio: auto;
}

.hoba-video__card {
  --hoba-video-ratio: 16 / 9;
  position: relative;
  display: flex;
  align-items: flex-end;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: var(--hoba-video-ratio);
  background: #1b1b1f;
  color: #fff;
  text-decoration: none;
  isolation: isolate;
}

.hoba-video__card[data-ratio="4:3"] { --hoba-video-ratio: 4 / 3; }
.hoba-video__card[data-ratio="1:1"] { --hoba-video-ratio: 1 / 1; }
.hoba-video__card[data-ratio="9:16"] { --hoba-video-ratio: 9 / 16; }

.hoba-video .hoba-video__card > .hoba-video__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  z-index: -1;
}

.hoba-video__card-title {
  width: 100%;
  padding: 24px 12px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  overflow-wrap: anywhere;
}

.hoba-video__card-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
}

.hoba-video__card:focus-visible {
  outline: 3px solid #80b6ff;
  outline-offset: -4px;
}

.hoba-video-dialog {
  box-sizing: border-box;
  width: min(960px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: #161619;
  color: #fff;
  overflow: auto;
}

.hoba-video-dialog::backdrop { background: rgba(0, 0, 0, .8); }
.hoba-video-dialog h2 { margin: 0 0 12px; font-size: 1.2rem; overflow-wrap: anywhere; }
.hoba-video-dialog__close {
  float: right;
  min-height: 44px;
  margin: 0 0 12px 12px;
  padding: 8px 16px;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.hoba-video-dialog__close:focus-visible { outline: 3px solid #80b6ff; outline-offset: 2px; }
.hoba-video-dialog > .hoba-video { clear: both; }
/* Portrait players fit the viewport while retaining their selected ratio. */
.hoba-video-dialog > .hoba-video[data-ratio="9:16"] {
  max-width: min(100%, calc((100dvh - 160px) * 9 / 16));
  margin-inline: auto;
}
