/* ═══════════════════════════════════════════
   VIDEO LIBRARY PAGE (NETFLIX STYLE)
   ═══════════════════════════════════════════ */

.lib-page {
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.09) 0%, transparent 28%),
    radial-gradient(circle at top left, rgba(139,92,246,0.07) 0%, transparent 24%),
    linear-gradient(180deg, #050505 0%, #060606 42%, #040404 100%);
  overflow-x: hidden;
  position: relative;
}

.lib-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent 85%);
  pointer-events: none;
  opacity: 0.22;
  z-index: 0;
}

/* Override nav for this page to float transparently at top */
.lib-nav {
  background: transparent !important;
  border-bottom: none !important;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%) !important;
}
.lib-nav.scrolled {
  background: #040404 !important;
}

/* ─── HERO / FEATURED TRAILER ────────────── */
.lib-hero {
  position: relative;
  height: 100svh;
  min-height: 760px;
  display: flex;
  align-items: flex-end;
  padding: 9rem 0 11rem;
  overflow: hidden;
}

.lib-hero::before {
  content: '';
  position: absolute;
  inset: auto auto 8% 5%;
  width: min(44vw, 620px);
  height: 420px;
  background: radial-gradient(circle, rgba(59,130,246,0.18) 0%, rgba(139,92,246,0.08) 42%, transparent 74%);
  filter: blur(40px);
  z-index: 0;
  pointer-events: none;
}

.lib-hero-video-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.lib-hero-video {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.5) saturate(0.92);
  transform: scale(1.08);
}

.lib-hero-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 70% 28%, rgba(59,130,246,0.12), transparent 22%),
    radial-gradient(circle at center, transparent 36%, rgba(4,4,4,0.76) 100%);
}
.lib-hero-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 46%;
  background: linear-gradient(to top, #040404 0%, rgba(4,4,4,0.88) 38%, transparent 100%);
}

.lib-hero-content {
  position: relative;
  z-index: 1;
  padding: 0 6%;
  max-width: 760px;
}

.lib-hero-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white);
  padding: 8px 16px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.lib-hero-title {
  font-family: var(--font-display);
  font-size: clamp(5rem, 9vw, 9rem);
  line-height: 0.82;
  letter-spacing: 0.01em;
  color: var(--white);
  margin-bottom: 1.4rem;
  text-shadow: 0 4px 20px rgba(0,0,0,0.8);
}
.lib-hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lib-hero-desc {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  margin-bottom: 2.8rem;
  max-width: 620px;
}

.lib-hero-actions {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.lib-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: none;
}
.lib-btn svg { width: 22px; height: 22px; }

.lib-btn-play {
  background: #fff;
  color: #000;
}
.lib-btn-play:hover {
  background: rgba(255,255,255,0.8);
  transform: scale(1.05);
}

.lib-btn-info {
  background: rgba(109,109,110,0.7);
  color: #fff;
  backdrop-filter: blur(5px);
}
.lib-btn-info:hover {
  background: rgba(109,109,110,0.4);
  transform: scale(1.05);
}

/* ─── ROWS CONTAINER ─────────────────────── */
.lib-rows-container {
  position: relative;
  z-index: 2;
  margin-top: -7rem;
  padding: 0 0 8rem;
}

.lib-row-wrapper {
  margin-bottom: 5.75rem;
  position: relative;
  padding: 0 0 0.5rem;
}

.lib-row-wrapper::before {
  content: '';
  position: absolute;
  inset: -1.5rem 4% -1rem;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0) 100%),
    radial-gradient(circle at top right, rgba(59,130,246,0.06), transparent 28%);
  border: 1px solid rgba(255,255,255,0.04);
  z-index: 0;
  pointer-events: none;
}

.lib-row-title {
  position: relative;
  z-index: 1;
  padding: 0 6%;
  font-family: var(--font-body);
  font-size: 1.9rem;
  font-weight: 600;
  margin-bottom: 1.4rem;
  color: #e5e5e5;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.lib-row-title span {
  font-size: 1rem;
  font-weight: 400;
  color: #8d8d8d;
}

/* SLIDER */
.lib-row-slider-container {
  position: relative;
  padding: 0 6%;
  z-index: 1;
}

.lib-row {
  display: flex;
  align-items: stretch;
  gap: 18px;
  overflow-x: scroll;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 2.8rem 0 3.6rem;
  margin: -2.8rem 0 -3rem;
  scrollbar-width: none; /* firefox */
}
.lib-row::-webkit-scrollbar { display: none; } /* chrome/safari */

.lib-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0,0,0,0.54);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 56px;
  height: calc(100% - 5rem);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
}
.lib-row-slider-container:hover .lib-nav-btn {
  opacity: 1;
}
.lib-nav-btn:hover {
  background: rgba(0,0,0,0.8);
  font-size: 2.5rem;
}
.lib-prev { left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.lib-next { right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ─── CARDS ──────────────────────────────── */
.lib-card {
  flex: 0 0 calc(24% - 13.8px);
  scroll-snap-align: start;
  position: relative;
  height: auto;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #171717 0%, #101010 100%);
  transition: transform 0.4s var(--ease), z-index 0s 0.4s;
  cursor: pointer;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.lib-row:not(.lib-row-vertical) .lib-card {
  height: clamp(320px, 25vw, 360px);
}

/* Vertical cards for shorts/reels */
.lib-card-vert {
  flex: 0 0 calc(18% - 14.8px);
  height: auto;
  aspect-ratio: 9/16;
}

.lib-card-thumb {
  position: absolute;
  inset: 0;
  background: #111;
}

.lib-card-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.22), transparent 55%);
  pointer-events: none;
}

.lib-card-thumb img,
.lib-card-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lib-card-video {
  /* position absolute to sit over image, hidden by default */
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

/* HOVER EFFECT */
.lib-card:hover {
  transform: scale(1.18) translateY(-3%);
  z-index: 99;
  transition: transform 0.4s 0.4s var(--ease-out), z-index 0s 0.3s; /* delay scale */
  box-shadow: 0 20px 40px rgba(0,0,0,0.9);
  border-radius: 20px;
}

/* specific logic to prevent cards on edges from going off-screen */
.lib-card:first-child:hover { transform: scale(1.18) translate(6%, -3%); }
.lib-card:last-child:hover { transform: scale(1.18) translate(-6%, -3%); }

.lib-card:hover .lib-card-video {
  opacity: 1;
  transition-delay: 0.5s;
}

/* ─── CARD INFO (Reveals on Hover) ───────── */
.lib-card-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(10,10,10,0.97) 58%, rgba(10,10,10,0.6) 84%, transparent 100%);
  padding: 1.2rem 1rem 1rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s 0.4s, transform 0.3s 0.4s;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lib-card:hover .lib-card-info {
  opacity: 1;
  transform: translateY(0);
}

.lib-card-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.lib-play-icon, .lib-add-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(8,8,8,0.6);
  color: #fff;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.lib-play-icon {
  background: #fff; color: #000; font-size: 0.82rem; padding-left: 2px;
}
.lib-play-icon:hover { background: #ccc; border-color: #ccc; }
.lib-add-icon:hover { border-color: #fff; background: rgba(255,255,255,0.2); }

.lib-card-info h4 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.lib-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
}
.lib-match { color: #46d369; font-weight: 600; }
.lib-age { color: #bcbcbc; }
.lib-quality { border: 1px solid rgba(255,255,255,0.4); border-radius: 3px; padding: 1px 4px; font-size: 0.55rem; color: #fff; }
.lib-duration { color: #bcbcbc; }

.lib-card-tags {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: #bcbcbc;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .lib-card { flex: 0 0 calc(30% - 12px); }
  .lib-card-vert { flex: 0 0 calc(22% - 14px); }
}

@media (max-width: 900px) {
  .lib-hero {
    min-height: 640px;
    padding: 8rem 0 8rem;
  }
  .lib-hero-title { font-size: 5rem; }
  .lib-hero-desc { font-size: 1.08rem; }
  .lib-rows-container { margin-top: -4rem; }
  .lib-row-wrapper { margin-bottom: 4rem; }
  .lib-row-title {
    font-size: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .lib-card { flex: 0 0 calc(42% - 11px); }
  .lib-card-vert { flex: 0 0 calc(28% - 13px); }
  .lib-row:not(.lib-row-vertical) .lib-card { height: 300px; }
  .lib-card:hover { transform: scale(1.2) translateY(-2%); }
  .lib-card:first-child:hover { transform: scale(1.2) translate(8%, -2%); }
  .lib-card:last-child:hover { transform: scale(1.2) translate(-8%, -2%); }
}

@media (max-width: 600px) {
  .lib-row { scroll-snap-type: none; }
  .lib-nav-btn { display: none; } /* hide arrows on touch */
  .lib-page::before { display: none; }
  .lib-hero {
    min-height: 560px;
    padding: 7rem 0 5rem;
  }
  .lib-hero-content,
  .lib-row-title,
  .lib-row-slider-container { padding-left: 5%; padding-right: 5%; }
  .lib-hero-title { font-size: 4rem; }
  .lib-hero-desc { font-size: 1rem; }
  .lib-row-wrapper::before { inset: -1rem 2.5% -0.5rem; }
  .lib-row { gap: 12px; padding: 2rem 0 2.5rem; margin: -2rem 0 -2rem; }
  .lib-card { flex: 0 0 calc(72% - 8px); }
  .lib-card-vert { flex: 0 0 calc(44% - 7px); }
  .lib-row:not(.lib-row-vertical) .lib-card { height: 260px; }
  .lib-card:hover { transform: none; box-shadow: none; } /* disable heavy hover on mobile */
  .lib-card:hover .lib-card-info { opacity: 0; } /* keep info hidden */
  .lib-card:hover .lib-card-video { opacity: 0; }
  .lib-rows-container { margin-top: -2rem; }
}
