/* ==========================================================================
   YouTube playlist (templates/section/video.html.twig): player + playlist.
   Desktop: playlist beside the player, as tall as it. Phones/tablets: the
   playlist is a swipeable row under the player.
   ========================================================================== */

/* Plain background: the tinted gallery cards come right before it on the home page
   and right after it on /vaizdo-irasai. */
.video-section { padding: 110px 0 100px; background: var(--surface); scroll-margin-top: var(--header-h); }
/* Page of its own (/vaizdo-irasai): less space above, like the other pages. */
.video-section--page { padding: 64px 0 96px; }

.video-browser {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel-dark);
  color: #fff;
  box-shadow: 0 2px 4px rgb(var(--shadow) / .08), 0 24px 56px rgb(var(--shadow) / .18);
}

/* ---- Player ------------------------------------------------------------- */
.video-stage { min-width: 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.video-player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video-poster { position: absolute; inset: 0; display: block; overflow: hidden; cursor: pointer; }
.video-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease, filter .4s ease; }
.video-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .45) 100%);
}
.video-poster:hover img { transform: scale(1.03); filter: brightness(.9); }
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  background: var(--btn-bg);
  color: #fff;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, .18), 0 10px 30px rgba(0, 0, 0, .35);
  transition: transform .25s ease, background-color .25s ease;
}
.video-play svg { width: 34px; height: 34px; margin-left: 4px; fill: currentColor; }
.video-poster:hover .video-play { transform: scale(1.08); background: var(--brand); }
.video-poster:focus-visible { outline: 3px solid #5fe0cc; outline-offset: -3px; }

.video-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 18px 24px 20px;
}
.video-now-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}
.video-now-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: #5fe0cc !important;
  text-decoration: none !important;
}
.video-now-link:hover { text-decoration: underline !important; }

/* ---- Playlist ----------------------------------------------------------- */
.video-list-wrap { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid rgba(255, 255, 255, .08); }
.video-list-head {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .6);
}
.video-list {
  margin: 0;
  padding: 6px 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
/* Desktop: the list is as tall as the player, and scrolls. */
/* contain: size keeps the list from adding height, so the row is as tall as the player. */
@media (min-width: 992px) {
  .video-list-wrap { contain: size; }
  .video-list { flex: 1 1 0; min-height: 0; }
}

.video-item {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px 20px 10px 17px;
  border-left: 3px solid transparent;
  color: rgba(255, 255, 255, .82) !important;
  text-decoration: none !important;
  transition: background-color .2s ease;
}
.video-item:hover { background: rgba(255, 255, 255, .06); }
.video-item[aria-current="true"] { border-left-color: var(--brand); background: rgba(95, 224, 204, .1); }
.video-item:focus-visible { outline: 3px solid #5fe0cc; outline-offset: -3px; }

.video-item-thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: #000; }
.video-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-item-num {
  position: absolute;
  left: 6px;
  bottom: 6px;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .72);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  color: #fff;
}
.video-item[aria-current="true"] .video-item-num { background: var(--btn-bg); }

.video-item-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.video-item-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.video-item[aria-current="true"] .video-item-title { color: #5fe0cc; }
.video-item-meta { font-size: 12px; color: rgba(255, 255, 255, .55); }

.video-more { margin: 32px 0 0; text-align: center; }

/* ---- Phones and tablets: playlist as a swipeable row --------------------- */
@media (max-width: 991.98px) {
  .video-section { padding: 80px 0; }
  .video-section--page { padding: 40px 0 72px; }
  .video-browser { grid-template-columns: minmax(0, 1fr); }
  .video-list-wrap { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
  .video-list-head { border-bottom: 0; padding-bottom: 4px; }
  .video-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(200px, 38%);
    gap: 4px;
    padding: 8px 12px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 12px;
  }
  .video-list li { scroll-snap-align: start; }
  .video-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    height: 100%;
    padding: 8px;
    border-left: 0;
    border-radius: 12px;
  }
  .video-item[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--brand); }
}
@media (max-width: 575.98px) {
  .video-section { padding: 64px 0; }
  .video-section--page { padding: 32px 0 64px; }
  .video-browser { margin: 0 calc(var(--gutter) / -2); border-radius: 12px; }
  .video-list { grid-auto-columns: 62%; }
  .video-play { width: 64px; height: 64px; margin: -32px 0 0 -32px; box-shadow: 0 0 0 7px rgba(255, 255, 255, .18), 0 8px 24px rgba(0, 0, 0, .35); }
  .video-play svg { width: 26px; height: 26px; }
  .video-now { padding: 14px 16px 16px; }
  .video-now-title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .video-poster img, .video-play, .video-item { transition: none; }
  .video-poster:hover img, .video-poster:hover .video-play { transform: none; }
}
