/* ===========================================================
   Movies Hub — Professional Cinematic UI
   Design: Deep black with gold accents, Netflix-grade UX
   Animations: 3D cards, shimmer, parallax, skeleton loaders
   Font: Bebas Neue display / Inter body
=========================================================== */

/* ===================== CSS CUSTOM PROPERTIES ===================== */
:root {
  /* Core palette */
  --bg: #0a0a0f;
  --bg-panel: #111118;
  --bg-elevated: #16161f;
  --bg-card: #1a1a26;
  --line: #2a2a3d;
  --line-soft: #1e1e2d;

  /* Text */
  --text: #f0eaff;
  --text-muted: #9d9ab5;
  --text-faint: #5a5870;

  /* Brand colors */
  --gold: #f5c842;
  --gold-dim: #c49a2a;
  --gold-glow: rgba(245, 200, 66, 0.25);
  --red: #e05252;
  --teal: #4ecdc4;
  --purple: #9b59b6;
  --blue: #3498db;

  /* Category colors */
  --cat-action: #e74c3c;
  --cat-adventure: #e67e22;
  --cat-comedy: #f1c40f;
  --cat-family: #2ecc71;
  --cat-fantasy: #9b59b6;
  --cat-scifi: #3498db;
  --cat-thriller: #e74c3c;
  --cat-hindi: #ff6b6b;
  --cat-animated: #a29bfe;
  --cat-hollywood: #74b9ff;

  /* Radii */
  --radius-card: 10px;
  --radius-pill: 999px;
  --radius-lg: 16px;

  /* Layout */
  --max-width: 1400px;
  --header-h: 120px;

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-med: 0.25s ease;
  --t-slow: 0.45s ease;
  --t-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(245, 200, 66, 0.1);
  --shadow-glow-gold: 0 0 40px rgba(245, 200, 66, 0.3);
}

/* ===================== RESET & BASE ===================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Animated background noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

a { color: inherit; text-decoration: none; }

.display {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  letter-spacing: 0.04em;
  font-weight: 400;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===================== SCROLLBAR ===================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ===================== HEADER ===================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--t-med), box-shadow var(--t-med);
}

.site-header.scrolled {
  background: rgba(10, 10, 15, 0.97);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 28px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

/* Logo */
.wordmark {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: transform var(--t-spring);
}
.wordmark:hover { transform: scale(1.05); }

.wordmark-icon {
  width: 28px;
  height: 28px;
  background: var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
}
.wordmark-icon svg { display: block; }

.wordmark-reel { color: var(--text); }
.wordmark-house { color: var(--gold); }

/* Search */
.search-form {
  display: flex;
  align-items: center;
  max-width: 580px;
  width: 100%;
  justify-self: center;
  background: var(--bg-panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 5px 6px 5px 20px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.search-form:focus-within {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background: var(--bg-elevated);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 8px 8px 8px 0;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { outline: none; }

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: #0a0a0f;
  flex-shrink: 0;
  transition: transform var(--t-spring), background var(--t-fast), box-shadow var(--t-fast);
}
.search-btn:hover {
  background: #ffd557;
  box-shadow: 0 0 20px var(--gold-glow);
  transform: scale(1.08);
}
.search-btn:active { transform: scale(0.92); }

/* Menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 8px;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.menu-toggle:hover { background: var(--bg-elevated); border-color: var(--text-faint); }
.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--t-med), opacity var(--t-fast), width var(--t-fast);
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; width: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===================== FILTER RAIL ===================== */

.filter-rail {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-rail::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.06) 60%, transparent 80%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.chip:hover::before { transform: translateX(100%); }
.chip:hover {
  border-color: var(--gold-dim);
  color: var(--text);
  transform: translateY(-1px);
}
.chip:active { transform: scale(0.95) translateY(0); }
.chip.active {
  background: linear-gradient(135deg, var(--gold) 0%, #f0a800 100%);
  border-color: var(--gold);
  color: #0a0a0f;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--gold-glow), 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

/* Count badge on chips */
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}
.chip.active .chip-count { background: rgba(0,0,0,0.2); }

/* ===================== HERO SECTION ===================== */

.hero {
  position: relative;
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 32px 28px 0;
}

.hero-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 500px;
  display: flex;
  align-items: flex-end;
  padding: 50px 50px 50px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: box-shadow var(--t-slow);
}
.hero-card:hover {
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.hero-backdrop-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: 0;
  transform-origin: center;
}
.hero-backdrop-img.loaded {
  opacity: 1;
  animation: kenburns 18s ease-out forwards;
}

/* Multiple gradient overlays for depth */
.hero-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(10,10,15,0.9) 0%, rgba(10,10,15,0.3) 60%, rgba(10,10,15,0) 100%),
    linear-gradient(180deg, rgba(10,10,15,0) 0%, rgba(10,10,15,0.7) 70%, rgba(10,10,15,0.98) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.hero-content > * {
  animation: fadeUp 0.7s ease both;
}
.hero-eyebrow    { animation-delay: 0.05s; }
.hero-title      { animation-delay: 0.12s; }
.hero-meta       { animation-delay: 0.20s; }
.hero-desc       { animation-delay: 0.28s; }
.hero-actions    { animation-delay: 0.36s; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}

.hero-title {
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.94;
  margin: 0 0 16px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15.5px;
  max-width: 500px;
  line-height: 1.65;
  margin: 0 0 28px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* Hero navigation dots */
.hero-dots {
  position: absolute;
  bottom: 22px;
  right: 28px;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hero-dot {
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: rgba(240,234,255,0.2);
  border: none;
  padding: 0;
  transition: all var(--t-med);
  cursor: pointer;
}
.hero-dot.active {
  background: var(--gold);
  width: 40px;
  box-shadow: 0 0 10px var(--gold-glow);
}
.hero-dot:hover:not(.active) { background: rgba(240,234,255,0.5); }

/* Progress bar on active dot */
.hero-dot.active::after {
  content: '';
  display: block;
  height: 100%;
  background: rgba(255,255,255,0.4);
  border-radius: 3px;
  animation: heroProgress 7s linear forwards;
}

/* ===================== BADGES ===================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(4px);
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-hindi { color: var(--teal); border-color: rgba(78,205,196,0.4); background: rgba(78,205,196,0.08); }
.badge-hindi .badge-dot { background: var(--teal); }

.badge-animated { color: #a29bfe; border-color: rgba(162,155,254,0.35); background: rgba(162,155,254,0.08); }
.badge-animated .badge-dot { background: #a29bfe; }

.badge-rating { color: var(--gold); border-color: rgba(245,200,66,0.35); background: rgba(245,200,66,0.08); }
.badge-rating::before { content: '★'; margin-right: -2px; }

.badge-new { color: #2ecc71; border-color: rgba(46,204,113,0.35); background: rgba(46,204,113,0.08); }
.badge-trending { color: var(--red); border-color: rgba(224,82,82,0.35); background: rgba(224,82,82,0.08); }

/* ===================== BUTTONS ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: transform var(--t-spring), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.1) 60%, transparent 80%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.btn:hover::before { transform: translateX(100%); }
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #f0a800 100%);
  color: #0a0a0f;
  box-shadow: 0 4px 15px rgba(245,200,66,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #ffd557 0%, var(--gold) 100%);
  box-shadow: 0 8px 30px rgba(245,200,66,0.45);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.btn-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================== LOADING SKELETON ===================== */

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-panel) 25%,
    var(--bg-elevated) 50%,
    var(--bg-panel) 75%
  );
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton-card {
  flex-shrink: 0;
  width: 176px;
}
.skeleton-poster {
  aspect-ratio: 2/3;
  border-radius: var(--radius-card);
  margin-bottom: 10px;
}
.skeleton-title {
  height: 14px;
  width: 80%;
  margin-bottom: 6px;
}
.skeleton-meta {
  height: 12px;
  width: 50%;
}

/* ===================== SECTION ROWS ===================== */

.section-stack {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 0 80px;
}

.row-block {
  margin-top: 52px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.6s ease both;
}
.row-block:nth-child(1) { animation-delay: 0.05s; }
.row-block:nth-child(2) { animation-delay: 0.1s; }
.row-block:nth-child(3) { animation-delay: 0.15s; }
.row-block:nth-child(4) { animation-delay: 0.2s; }
.row-block:nth-child(5) { animation-delay: 0.25s; }
.row-block:nth-child(n+6) { animation-delay: 0.3s; }

.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  margin-bottom: 18px;
}

.row-title {
  font-size: 28px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.row-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.row-sub {
  font-size: 13px;
  color: var(--text-faint);
}

.row-seeall {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245,200,66,0.3);
  background: rgba(245,200,66,0.06);
  transition: all var(--t-fast);
}
.row-seeall:hover {
  background: rgba(245,200,66,0.15);
  border-color: var(--gold);
  transform: translateX(3px);
}
.row-seeall::after { content: '→'; font-size: 14px; }

.row-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 28px 18px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.row-scroll::-webkit-scrollbar { height: 4px; }
.row-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* ===================== MOVIE CARD ===================== */

.card {
  flex-shrink: 0;
  width: 180px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: transform var(--t-spring);
}

.poster-grid .card { width: auto; }

/* 3D perspective on hover */
.card:hover { transform: translateY(-4px); }

.poster {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1.5px solid var(--line);
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
  transform-style: preserve-3d;
}

/* Gradient overlay on poster */
.poster::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,0.8) 100%);
  pointer-events: none;
  opacity: 0.7;
  transition: opacity var(--t-fast);
}
.card:hover .poster::before { opacity: 1; }

/* Image */
.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.3s ease, transform var(--t-slow);
  z-index: 0;
}
.poster-img.loaded { opacity: 1; }
.card:hover .poster-img.loaded { transform: scale(1.06); }

/* Shine sweep effect */
.poster-shine {
  position: absolute;
  inset: -50% -30%;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(75deg,
    transparent 40%,
    rgba(255,255,255,0.12) 50%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.7s ease;
}
.card:hover .poster-shine { transform: translateX(100%); }

/* Gold border glow on hover */
.card:hover .poster {
  border-color: rgba(245,200,66,0.5);
  box-shadow:
    0 20px 40px -10px rgba(0,0,0,0.7),
    0 0 0 1px rgba(245,200,66,0.15),
    inset 0 0 20px rgba(245,200,66,0.05);
}

/* Play button overlay */
.poster-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.card:hover .poster-play { opacity: 1; }
.poster-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(245,200,66,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8);
  transition: transform var(--t-spring);
  box-shadow: 0 0 20px rgba(245,200,66,0.5);
}
.card:hover .poster-play-btn { transform: scale(1); }

/* Content inside poster */
.poster-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
}

.poster-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  transition: opacity var(--t-fast);
}
.poster.has-image .poster-title { opacity: 0; }
.card:hover .poster.has-image .poster-title { opacity: 1; }

.poster-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* Rating chip on card */
.poster-rating {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(245,200,66,0.3);
  border-radius: var(--radius-pill);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 3px;
}
.poster-rating::before { content: '★'; }

/* Mini badge labels */
.mini-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(4px);
  color: var(--teal);
  border: 1px solid rgba(78,205,196,0.3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mini-badge.anim { color: #a29bfe; border-color: rgba(162,155,254,0.3); }
.mini-badge.hindi { color: var(--cat-hindi); border-color: rgba(255,107,107,0.3); }

.card-info { padding: 0 2px; }

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0 0 3px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--t-fast);
}
.card:hover .card-title { color: var(--gold); }

.card-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

/* ===================== RESULTS / GRID VIEW ===================== */

.view-results {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 28px 100px;
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}

.results-title {
  font-size: 36px;
  margin: 0 0 6px;
}
.results-count {
  color: var(--text-faint);
  font-size: 13px;
  margin: 0;
}

.clear-btn {
  background: var(--bg-panel);
  border: 1.5px solid var(--line);
  color: var(--text-muted);
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  transition: all var(--t-fast);
}
.clear-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(224,82,82,0.08);
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 24px 18px;
}

/* Staggered animation for grid items */
.poster-grid .card:nth-child(1)  { animation-delay: 0.02s; }
.poster-grid .card:nth-child(2)  { animation-delay: 0.04s; }
.poster-grid .card:nth-child(3)  { animation-delay: 0.06s; }
.poster-grid .card:nth-child(4)  { animation-delay: 0.08s; }
.poster-grid .card:nth-child(5)  { animation-delay: 0.10s; }
.poster-grid .card:nth-child(6)  { animation-delay: 0.12s; }
.poster-grid .card:nth-child(n+7){ animation-delay: 0.15s; }

/* Load more button */
.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  margin: 48px auto 0;
  padding: 14px 28px;
  background: var(--bg-panel);
  border: 1.5px solid var(--line);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast);
}
.load-more-btn:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}

.empty-state {
  color: var(--text-faint);
  padding: 80px 0;
  text-align: center;
  font-size: 15px;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

/* ===================== DETAIL VIEW ===================== */

.view-detail { padding-bottom: 100px; }

.detail-backdrop {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.detail-backdrop .poster-img {
  z-index: 0;
  animation: kenburns 20s ease-out;
}
.detail-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(10,10,15,0.8) 0%, rgba(10,10,15,0.2) 60%),
    linear-gradient(180deg, rgba(10,10,15,0.1) 0%, rgba(10,10,15,0.9) 80%, var(--bg) 100%);
}

.detail-inner {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 60px 28px 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: end;
}

.detail-poster {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 24px 48px -16px rgba(0,0,0,0.8), 0 0 0 1px rgba(245,200,66,0.1);
  animation: fadeUp 0.6s ease both;
  transition: transform var(--t-spring), box-shadow var(--t-med);
}
.detail-poster:hover {
  transform: translateY(-4px) rotate(1deg);
  box-shadow: 0 32px 64px -16px rgba(0,0,0,0.9), 0 0 40px rgba(245,200,66,0.15);
}
.detail-poster::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.8) 100%);
  pointer-events: none;
}
.detail-poster .poster-content {
  padding: 14px;
  justify-content: flex-end;
}
.detail-poster .poster-title { font-size: 20px; }

.detail-heading { padding-bottom: 6px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  transition: all var(--t-fast);
}
.back-link:hover {
  color: var(--text);
  border-color: var(--text-faint);
  background: rgba(255,255,255,0.06);
  transform: translateX(-3px);
}
.back-link::before { content: '←'; }

.detail-title {
  font-size: clamp(36px, 5.5vw, 62px);
  margin: 0 0 14px;
  line-height: 1;
  animation: fadeUp 0.5s 0.1s ease both;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
  animation: fadeUp 0.5s 0.18s ease both;
}

.detail-body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px 28px 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
}

.detail-synopsis {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 660px;
  margin: 0 0 30px;
  line-height: 1.7;
  animation: fadeUp 0.5s 0.22s ease both;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 20px;
  max-width: 660px;
  margin-bottom: 36px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  animation: fadeUp 0.5s 0.28s ease both;
}

.fact-label {
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  font-weight: 600;
}
.fact-value {
  font-size: 14.5px;
  color: var(--text);
  font-weight: 500;
}

.watch-note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 12px;
  max-width: 440px;
  line-height: 1.6;
}

.related-block {
  max-width: var(--max-width);
  margin: 64px auto 0;
  padding: 0;
}

/* ===================== CATEGORY PAGE HEADER ===================== */

.cat-page-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 28px 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.cat-page-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* ===================== FOOTER ===================== */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 28px 60px;
  margin-top: 40px;
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,200,66,0.3), transparent);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-wordmark {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 0.04em;
}
.footer-wordmark span { color: var(--gold); }

.footer-desc {
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.65;
  max-width: 340px;
}

.footer-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.footer-link {
  color: var(--text-faint);
  font-size: 13px;
  transition: color var(--t-fast);
}
.footer-link:hover { color: var(--gold); }

.footer-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-faint);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===================== ANIMATIONS ===================== */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes kenburns {
  from { transform: scale(1) translateX(0); }
  to   { transform: scale(1.1) translateX(-2%); }
}

@keyframes heroProgress {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(245,200,66,0.2); }
  50%       { box-shadow: 0 0 40px rgba(245,200,66,0.5); }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* View transitions */
.view-fade { animation: fadeIn 0.3s ease both; }
.view-slide { animation: slideInRight 0.35s ease both; }

/* ===================== LOADING SPINNER ===================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ===================== TOAST NOTIFICATION ===================== */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: fadeUp 0.35s ease both;
  max-width: 320px;
}

/* ===================== SECONDARY PAGES ===================== */

.page-hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 28px 28px;
}
.page-hero h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.6rem, 5vw, 4rem);
  letter-spacing: 0.04em;
  margin: 0 0 12px;
  color: var(--text);
}
.page-hero p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 540px;
}

.legal-content, .section {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 28px 80px;
}
.legal-content h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.7rem;
  color: var(--gold);
  font-weight: 600;
}
.legal-content p, .legal-content li {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 14.5px;
}
.legal-content a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

/* ===================== RESPONSIVE — TABLET ===================== */

@media (max-width: 900px) {
  :root { --header-h: 110px; }

  .header-inner {
    padding: 14px 18px 12px;
    gap: 14px;
  }
  .wordmark { font-size: 24px; }
  .search-input { font-size: 13px; }
  .filter-rail { padding: 0 18px 12px; }

  .hero { padding: 20px 18px 0; }
  .hero-card { min-height: 400px; padding: 32px; }
  .hero-title { font-size: clamp(36px, 7vw, 60px); }

  .section-stack { padding: 8px 0 50px; }
  .row-head { padding: 0 18px; }
  .row-scroll { padding: 6px 18px 14px; }
  .card { width: 148px; }

  .view-results { padding: 28px 18px 70px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 12px; }

  .detail-inner, .detail-body {
    grid-template-columns: 140px 1fr;
    padding-left: 18px;
    padding-right: 18px;
    gap: 20px;
  }
  .detail-facts { grid-template-columns: repeat(2, 1fr); }

  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
}

/* ===================== RESPONSIVE — MOBILE ===================== */

@media (max-width: 600px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 12px 16px 10px;
  }
  .wordmark-house { display: inline; }
  .search-form { padding-left: 14px; }
  .menu-toggle { display: flex; }

  .hero-card { padding: 24px; min-height: 360px; }
  .hero-desc { display: none; }

  .card { width: 130px; }
  .row-scroll { gap: 12px; }

  .detail-inner, .detail-body { grid-template-columns: 1fr; }
  .detail-poster { width: 130px; }

  .hero-dots { bottom: 14px; right: 18px; }
  .footer-links { grid-template-columns: 1fr 1fr; }
}

/* ===================== HIGH-DPI / RETINA ===================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .poster-img { image-rendering: -webkit-optimize-contrast; }
}
