/* ============ A11Y UTILITIES ============ */
:focus-visible {
  outline: 3px solid #e50914;
  outline-offset: 3px;
  border-radius: 4px;
}
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  top: -100px; left: 8px;
  background: #e50914; color: #fff;
  padding: 10px 16px; border-radius: 4px;
  z-index: 999; font-weight: 700;
  transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background:#141414; color:#fff; font-family: "Netflix Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; min-height:100vh; overflow-x:hidden; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; background: none; color: inherit; }
img { display:block; max-width:100%; }
.hidden { display: none !important; }
.muted { color:#a3a3a3; font-size:.9rem; }
/* Nav buttons inherit link-style by default — preserves visual */
.nav-links button { padding: 0; font-size: inherit; color: #e5e5e5; transition: color .2s; }
.nav-links button:hover { color: #b3b3b3; }
.nav-links button.active { font-weight: 600; color: #fff; }
.nav-bell { font-size: 1.2rem; background: none; padding: 0; }

/* ============ NAVBAR (2-row layout) ============ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background .3s ease;
  background: linear-gradient(180deg, rgba(0,0,0,.85) 10%, transparent);
  display: flex; flex-direction: column;
}
.navbar.scrolled { background:#141414; }
.navbar-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4%;
}
.navbar-row-primary { padding-bottom: 8px; }
.navbar-row-secondary {
  padding-top: 4px; padding-bottom: 10px;
  gap: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
  justify-content: flex-start;
}
.nav-tool-spacer { flex: 1; }

.nav-left { display:flex; align-items:center; gap: 18px; }
.logo {
  color:#e50914; font-weight:900; font-size: 1.7rem; letter-spacing: -1px;
  /* No text-shadow — real Netflix logo has zero glow. */
}
.nav-links { display:flex; gap: 22px; }
.nav-links a {
  color:#e5e5e5; font-size:.92rem; transition: color .2s;
  position: relative;
}
.nav-links a.active { font-weight: 600; color:#fff; }
.nav-links a:hover { color:#b3b3b3; }

.nav-right { display:flex; align-items:center; gap: 18px; }
.search-box {
  display:flex; align-items:center; gap: 8px;
  background: rgba(0,0,0,.65); border:1px solid #fff;
  padding: 6px 10px; border-radius: 2px;
  transition: all .2s;
}
.search-box svg { color:#fff; }
.search-box input {
  background: transparent; border:none; color:#fff;
  width: 200px; outline:none; font-size: .9rem;
}
.search-box input::placeholder { color:#b3b3b3; }
.nav-bell { font-size: 1.2rem; cursor:pointer; }
.avatar {
  width: 32px; height: 32px; border-radius: 4px;
  background: linear-gradient(135deg, #e50914, #b30710);
  cursor:pointer;
}

/* ============ HERO ============ */
.hero {
  position: relative;
  height: 85vh; min-height: 600px;
  width: 100%; overflow: hidden;
  display:flex; align-items: flex-end;
  padding: 0 4% 8vh;
}
.hero-bg {
  position:absolute; inset:0;
  background-size: cover; background-position: center top;
  filter: brightness(.85);
  transition: opacity .8s;
}
.hero-fade {
  position:absolute; inset:0;
  background:
    linear-gradient(to right, rgba(0,0,0,.85) 0%, rgba(0,0,0,.45) 40%, transparent 60%),
    linear-gradient(to top, #141414 0%, transparent 30%);
}
.hero-content {
  position: relative; z-index:2;
  max-width: 620px;
}
.hero-badge {
  display:inline-block;
  background: rgba(229,9,20,.15); color: #e50914;
  border: 1px solid rgba(229,9,20,.4);
  font-size: .75rem; font-weight: 700; letter-spacing: 1px;
  padding: 4px 10px; border-radius: 2px; margin-bottom: 14px;
}
.hero-title {
  font-size: 3.6rem; font-weight: 900; line-height: 1;
  margin-bottom: 14px; text-shadow: 2px 2px 6px rgba(0,0,0,.6);
}
.hero-meta {
  font-size: .95rem; color:#d2d2d2; margin-bottom: 12px;
  display:flex; gap: 12px; align-items:center;
}
.hero-meta .match { color:#46d369; font-weight:600; }
.hero-desc {
  font-size: 1.05rem; line-height: 1.4; color:#e5e5e5;
  margin-bottom: 22px;
  text-shadow: 1px 1px 3px rgba(0,0,0,.6);
}
.hero-buttons { display:flex; gap: 12px; }

.btn {
  display:inline-flex; align-items:center; gap: 8px;
  padding: 11px 26px; border-radius: 4px;
  font-size: 1.05rem; font-weight: 700;
  transition: opacity .15s ease, transform .15s;
}
.btn:hover { transform: scale(1.02); }
.btn-play { background:#fff; color:#000; }
.btn-play:hover { background: rgba(255,255,255,.85); }
.btn-info { background: rgba(109,109,110,.7); color:#fff; }
.btn-info:hover { background: rgba(109,109,110,.5); }
.btn-icon {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  background: rgba(42,42,42,.6); color:#fff;
  font-size: 1.2rem; display:inline-flex; align-items:center; justify-content:center;
}
.btn-icon:hover { border-color:#fff; background: rgba(42,42,42,.9); }

/* ============ ROWS ============ */
.rows {
  margin-top: -10vh; position: relative; z-index: 3;
  padding-bottom: 60px;
}
.row { margin: 0 0 36px; padding: 0 4%; }
.row-title {
  font-size: 1.35rem; font-weight: 700; margin-bottom: 12px;
  color:#e5e5e5;
}
.row-track {
  display:flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
  scroll-behavior: smooth; padding: 8px 0 50px;
  scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display:none; }

.card {
  flex: 0 0 240px; aspect-ratio: 16/9;
  background:#222; border-radius: 4px; overflow: hidden;
  position: relative; cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, z-index 0s .25s;
  background-size: cover; background-position: center;
}
.card:hover, .card:focus-visible {
  transform: scale(1.2) translateY(-18px); z-index: 10;
  box-shadow: 0 20px 50px rgba(0,0,0,.75);
  transition: transform .25s ease, box-shadow .25s ease, z-index 0s 0s;
  will-change: transform;
}
.card-fallback {
  position:absolute; inset:0; display:flex; align-items:flex-end;
  padding: 12px; font-weight:700; font-size:.95rem;
  background: linear-gradient(135deg, #2d2d2d, #4a4a4a);
  color:#e5e5e5;
}
.card-overlay {
  position: absolute; inset:0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.92));
  display:flex; flex-direction:column; justify-content:flex-end;
  padding: 10px; opacity: 0; transition: opacity .2s;
}
.card:hover .card-overlay { opacity: 1; }
.card-title { font-size: .85rem; font-weight:700; margin-bottom: 6px; }
.card-actions { display:flex; gap: 6px; }
.card-actions button {
  width: 26px; height: 26px; border-radius: 50%;
  background:#fff; color:#000; font-size: .85rem;
  display:flex; align-items:center; justify-content:center;
}
.card-actions button.ghost {
  background: rgba(42,42,42,.7); color:#fff; border:1.5px solid rgba(255,255,255,.5);
}

/* ============ MODALS ============ */
.modal, .player-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  display: none; align-items:flex-start; justify-content:center;
  z-index: 200; padding: 30px 0;
  overflow-y: auto;
}
.modal.show, .player-modal.show { display:flex; }

.modal-content {
  width: min(900px, 92%);
  background:#181818; border-radius: 8px; overflow: hidden;
  box-shadow: 0 4px 30px rgba(0,0,0,.7);
  position: relative;
}
.modal-close, .player-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  background:#181818; color:#fff; font-size: 1.5rem;
  display:flex; align-items:center; justify-content:center;
  z-index: 5;
}
.modal-close:hover, .player-close:hover { background:#2a2a2a; }

.modal-hero {
  position: relative; aspect-ratio: 16/9; overflow: hidden;
}
.modal-hero-bg {
  position:absolute; inset:0; background-size: cover; background-position: center;
}
.modal-hero-fade {
  position:absolute; inset:0;
  background: linear-gradient(to top, #181818 5%, transparent 60%);
}
.modal-hero-info {
  position: absolute; bottom: 24px; left: 28px; right: 28px; z-index:2;
}
.modal-hero-info h2 {
  font-size: 2.1rem; font-weight: 900;
  margin-bottom: 14px; text-shadow: 2px 2px 4px rgba(0,0,0,.7);
}
.modal-actions { display:flex; gap: 8px; align-items:center; }

.modal-body { padding: 22px 28px 28px; }
.modal-grid {
  display:grid; grid-template-columns: 2fr 1fr;
  gap: 28px; margin-bottom: 22px;
}
.modal-meta {
  color:#d2d2d2; margin-bottom: 12px;
  display:flex; gap: 10px; align-items:center; flex-wrap:wrap;
}
.modal-meta .match { color:#46d369; font-weight:600; }
.modal-desc { line-height: 1.4; color:#e5e5e5; }
.modal-side p { margin-bottom: 6px; font-size:.92rem; }

.season-picker {
  border-top: 1px solid #2a2a2a; padding-top: 18px; margin-bottom: 18px;
}
.season-picker h3 { margin-bottom: 12px; font-size: 1.15rem; }
.season-controls { display:flex; gap: 16px; flex-wrap:wrap; }
.season-controls label {
  display:flex; flex-direction:column; gap: 6px;
  font-size:.85rem; color:#b3b3b3;
}
.season-controls select {
  background:#2a2a2a; color:#fff; border: 1px solid #444;
  padding: 8px 12px; border-radius: 4px; min-width: 120px; font-size: .95rem;
}

.vidking-settings {
  border-top: 1px solid #2a2a2a; padding-top: 14px;
  margin-top: 8px;
}
.vidking-settings summary {
  cursor:pointer; font-weight:600; padding: 6px 0;
  color:#e5e5e5; user-select:none;
}
.vk-grid {
  margin-top: 14px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.vk-grid label {
  display:flex; align-items:center; gap: 8px;
  font-size:.9rem;
}
.vk-grid input[type="color"] {
  width: 40px; height: 28px; border:none; background:transparent;
  cursor:pointer;
}

/* ============ PLAYER MODAL ============ */
.player-modal { background: #000; padding: 0; align-items: stretch; }
.player-wrap {
  flex: 1; display:flex; align-items:center; justify-content:center;
  background:#000;
}
.player-wrap iframe { width: 100%; height: 100%; min-height: 80vh; }
.player-close {
  position: fixed; top: 18px; right: 22px;
  background: rgba(0,0,0,.7); z-index: 10;
}
.player-status {
  position: fixed; bottom: 12px; left: 12px;
  background: rgba(0,0,0,.7); padding: 6px 12px;
  border-radius: 4px; font-size: .8rem; color: #b3b3b3;
  font-family: monospace; max-width: 60%;
  pointer-events: none;
}

/* ============ FOOTER ============ */
.footer {
  padding: 40px 4% 30px; color:#8c8c8c; max-width: 1000px; margin: 0 auto;
  font-size: .85rem;
}
.footer-social { display:flex; gap: 18px; font-size:1.4rem; margin-bottom: 22px; }
.footer-links {
  display:grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px 18px; margin-bottom: 22px;
}
.footer-links a:hover { text-decoration: underline; }
.footer-note { font-size:.78rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 800px) {
  .nav-links { display:none; }
  .hero-title { font-size: 2.2rem; }
  .hero-desc { font-size: .95rem; }
  .card { flex: 0 0 160px; }
  .modal-grid { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: repeat(2, 1fr); }
  .search-box input { width: 120px; }
}

@media (max-width: 500px) {
  .hero { padding: 0 4% 6vh; min-height: 500px; }
  .hero-title { font-size: 1.8rem; }
  .hero-buttons .btn { padding: 8px 18px; font-size: .9rem; }
  .card { flex: 0 0 140px; }
  .card:hover { transform: scale(1.1) translateY(-10px); }
}

/* ============ PREMIUM EFFECTS ============ */
/* GPU-accelerated, no-layout-thrash cinematic polish. */
/* All rules below are additive — they do not modify existing selectors. */

/* ---------- 6. Aurora ambient background (very subtle, behind everything) ---------- */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(229,9,20,.55), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(20,40,90,.45), transparent 50%),
    radial-gradient(circle at 60% 85%, rgba(120,0,15,.40), transparent 55%),
    radial-gradient(circle at 10% 80%, rgba(10,20,50,.40), transparent 50%);
  /* Aurora dialed down to preserve pure-black surface — red CTAs need exclusivity. */
  opacity: .025;
  filter: blur(60px);
  animation: aurora-drift 30s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-1%, 1%, 0) scale(1.02); }
}
/* Lift main content above aurora — but NOT modals (they need position:fixed for viewport overlay) */
.navbar, .hero, .rows, .footer { position: relative; }
.navbar { z-index: 100; }
.rows   { z-index: 3; }

/* ---------- 1. Glassmorphism navbar on scroll ---------- */
.navbar.glass {
  background: linear-gradient(180deg,
    rgba(20,20,20,.62) 0%,
    rgba(20,20,20,.45) 70%,
    rgba(20,20,20,.25) 100%);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid rgba(229,9,20,.18);
  box-shadow: 0 6px 28px rgba(0,0,0,.45), inset 0 -1px 0 rgba(229,9,20,.10);
  transition: background .35s ease, backdrop-filter .35s ease, border-color .35s ease, box-shadow .35s ease;
}
/* Soft red wash so the brand color bleeds through the glass */
.navbar.glass::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at top left, rgba(229,9,20,.10), transparent 55%);
  opacity: 1;
}

/* ---------- 2. Ken Burns hero + vignette + film grain ---------- */
.hero-bg {
  transform-origin: 55% 45%;
  animation: ken-burns 16s ease-in-out infinite alternate;
  will-change: transform;
}
.hero:hover .hero-bg { animation-play-state: paused; }
@keyframes ken-burns {
  0%   { transform: scale(1.00) translate3d(0%, 0%, 0); }
  50%  { transform: scale(1.08) translate3d(-1.5%, -1%, 0); }
  100% { transform: scale(1.12) translate3d(1.5%, 1%, 0); }
}
/* Cinematic vignette over hero */
.hero::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,.25) 0%, transparent 25%);
}
/* Film grain overlay (pure CSS — repeating SVG-noise via gradients) */
/* Film grain disabled — caused ~80-150ms TBT from constant repaints (mix-blend-mode forces software paint). */
.hero::before { display: none; }

/* ---------- 8. Premium typography polish ---------- */
.hero-title {
  letter-spacing: -.02em;
  text-shadow:
    0 2px 8px rgba(0,0,0,.75),
    0 0 28px rgba(229,9,20,.18);
}
.hero-desc { text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.row-title {
  letter-spacing: .005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.card-title { text-shadow: 0 1px 3px rgba(0,0,0,.85); }

/* ---------- 3. Cinematic card hover with simulated video preview ---------- */
.card.previewing {
  box-shadow:
    0 24px 60px rgba(0,0,0,.85),
    0 0 0 1px rgba(229,9,20,.45),
    0 0 40px rgba(229,9,20,.25);
}
/* The animated "fake video" layer fades in over the still background */
.card .card-preview {
  position: absolute; inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
  background:
    radial-gradient(circle at 30% 40%, rgba(229,9,20,.55), transparent 45%),
    radial-gradient(circle at 70% 65%, rgba(20,50,120,.50), transparent 50%),
    linear-gradient(125deg, #1a0608 0%, #2a0a10 35%, #0a1330 70%, #050510 100%);
  background-size: 200% 200%, 200% 200%, 300% 300%;
  filter: saturate(115%) contrast(105%);
  will-change: background-position, opacity, transform;
}
.card.previewing .card-preview {
  opacity: 1;
  animation: card-preview-pan 4.2s ease-in-out infinite alternate;
}
@keyframes card-preview-pan {
  0%   { background-position:   0%   0%,  100% 100%,   0%  50%; }
  50%  { background-position:  60%  40%,   40%  60%,  50%  50%; }
  100% { background-position: 100% 100%,    0%   0%, 100%  50%; }
}
/* Soft scanline / lens shimmer over the preview */
.card .card-preview::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0) 0,
    rgba(255,255,255,0) 3px,
    rgba(255,255,255,.04) 3px,
    rgba(255,255,255,.04) 4px);
  mix-blend-mode: overlay;
  opacity: .6;
}
/* Play-icon ripple — appears centered when preview triggers */
/* Play ripple — moved to TOP-RIGHT corner so it stops covering card text
   on hover. Smaller too (was 56px, now 38px) per "less is more" UX standard. */
.card .card-play-ripple {
  position: absolute; top: 10px; right: 10px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  display: flex; align-items: center; justify-content: center;
  color: #000; font-size: 0.95rem;
  opacity: 0; transform: scale(.7) translateZ(0);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  z-index: 4;
  will-change: transform, opacity;
}
.card .card-play-ripple::before {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.55);
  animation: play-ripple 1.8s ease-out infinite;
}
.card .card-play-ripple::after {
  content: "\25B6"; /* play triangle */
  display: inline-block;
  transform: translateX(2px);
}
.card.previewing .card-play-ripple {
  opacity: 1;
  transform: scale(1) translateZ(0);
}
@keyframes play-ripple {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ---------- 4. Top-10 row "giant number" overlay ---------- */
/* Top-N rank badge: ON the card top-left so it's ALWAYS readable on top
   of the backdrop image. Replaces the previous outside-the-card numbers
   that often disappeared on dark backdrops. Small, bold, high-contrast.
   Inspired by Netflix's Top-10 row which uses an in-card poster badge. */
.row-track[data-rank="true"] {
  gap: 12px;
  padding-left: 0;
}
.row-track[data-rank="true"] .card {
  flex: 0 0 240px;
  overflow: hidden;
}
.row-track[data-rank="true"] .card .card-rank {
  position: absolute;
  top: 6px; left: 6px;
  z-index: 5;
  font-family: "Bebas Neue", "Impact", "Helvetica Neue", sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #e50914 0%, #b9070f 100%);
  padding: 4px 8px 3px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(229, 9, 20, 0.45), 0 0 0 1px rgba(255,255,255,0.08) inset;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  transition: transform 0.2s ease;
  /* Always-visible badge style — no -webkit-text-stroke trick that vanishes on dark images */
}
.row-track[data-rank="true"] .card:hover .card-rank {
  transform: scale(1.08);
}
.row-track[data-rank="true"] .card.rank-10 .card-rank,
.row-track[data-rank="true"] .card[class*="rank-1"]:not(.rank-1) .card-rank {
  /* Two-digit (10+): a hair smaller so it still fits the same badge size */
  font-size: 1.4rem;
}
@media (max-width: 768px) {
  .row-track[data-rank="true"] .card .card-rank { font-size: 1.3rem; padding: 3px 7px 2px; }
}

/* ---------- 5. Parallax row reveal on scroll ---------- */
.row.reveal-init {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  will-change: transform, opacity;
}
.row.reveal-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition: opacity .7s ease, transform .7s cubic-bezier(.22,.61,.36,1);
}

/* ---------- 7. Cinematic modal entrance ---------- */
.modal, .player-modal {
  transition: background-color .35s ease;
}
.modal .modal-content,
.player-modal .player-wrap {
  transform: scale(.92) translateZ(0);
  opacity: 0;
  transition: transform .35s cubic-bezier(.22,.61,.36,1), opacity .35s ease;
  will-change: transform, opacity;
}
.modal.show .modal-content,
.player-modal.show .player-wrap {
  transform: scale(1) translateZ(0);
  opacity: 1;
}
/* Slightly deeper backdrop while open */
.modal.show, .player-modal.show {
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---------- Reduced motion fallbacks ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-bg { animation: none; }
  .hero::before { animation: none; }
  body::before { animation: none; }
  .card.previewing .card-preview { animation: none; }
  .card .card-play-ripple::before { animation: none; }
  .row.reveal-init { opacity: 1; transform: none; }
}
