/* ================= Design tokens ================= */
:root {
  --bg-color: #000000;
  --surface-color: #1D1D1F;
  --text-primary: #F5F5F7;
  --text-secondary: #86868B;
  --accent-color: #FFFFFF;
  --nav-glass: rgba(29, 29, 31, 0.72);
  --pill-secondary: #333336;
  --glass-material: rgba(29, 29, 31, 0.72);
  --font-system: system-ui, -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-system);
  background-color: var(--bg-color);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ================= Navbar (Liquid Glass) ================= */
.navbar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4vw;
  background: var(--nav-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-links { display: flex; gap: 8px; }

.nav-pill {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.nav-pill:hover { color: var(--text-primary); }

.nav-pill:focus-visible {
  outline: 2px solid white;
  outline-offset: 4px;
}

.nav-pill.active {
  background: var(--accent-color);
  color: #000;
  font-weight: 600;
}

.nav-search {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 9999px;
}

.nav-search .search-icon { width: 16px; height: 16px; color: var(--text-secondary); margin-right: 8px; flex-shrink: 0; }

.nav-search input {
  background: transparent;
  border: none;
  color: white;
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  width: 200px;
}

.nav-search input::placeholder { color: var(--text-secondary); }

/* ================= Hero ================= */
.hero-section {
  position: relative;
  width: 100%;
  height: 75vh;
  min-height: 480px;
  background-size: cover;
  background-position: top center;
  background-color: var(--surface-color);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 4vw;
  transition: background-image 0.4s ease;
}

.hero-fade-bottom {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 55%;
  background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
  z-index: 1;
}

.hero-fade-left {
  position: absolute; top: 0; left: 0; width: 65%; height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,0.85) 0%, transparent 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 10;
  max-width: 650px;
  padding-bottom: 2vh;
}

.hero-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero-overview {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 9999px;
  border: none;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  font-family: inherit;
}

.primary-btn { background: var(--accent-color); color: #000; }
.primary-btn:hover, .primary-btn:focus-visible { transform: scale(1.04); background: #E5E5EA; }

.secondary-btn { background: rgba(255,255,255,0.12); color: var(--text-primary); }
.secondary-btn:hover, .secondary-btn:focus-visible { background: rgba(255,255,255,0.2); }

.action-btn:focus-visible { outline: 2px solid white; outline-offset: 4px; }

/* ================= Shelves / carousels ================= */
.content-main { margin-top: -30px; position: relative; z-index: 10; }

.shelf { margin-bottom: 50px; }
.shelf[hidden] { display: none; }

.shelf-title { padding-left: 4vw; font-size: 1.3rem; margin-bottom: 16px; font-weight: 600; }

.empty-state { padding-left: 4vw; color: var(--text-secondary); font-size: 0.95rem; }

.carousel-container { position: relative; }

.carousel-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 10px 4vw 40px 4vw;
}

.carousel-track::-webkit-scrollbar { display: none; }

.card {
  flex: 0 0 clamp(140px, 15vw, 220px);
  scroll-snap-align: start;
  position: relative;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  font-family: inherit;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.35s ease;
}

.card-image-wrapper {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-image-wrapper .no-art {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: center;
  padding: 12px;
}

.card-image-wrapper::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
  z-index: 2;
}

.card:hover, .card:focus-visible {
  transform: scale(1.06) translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}
.card:hover .card-image-wrapper::after, .card:focus-visible .card-image-wrapper::after { left: 150%; }

.card:focus-visible { outline: 2px solid white; outline-offset: 4px; }

.card-info { margin-top: 12px; }
.card-title { font-size: 0.95rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

.nav-arrow {
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  background: rgba(29, 29, 31, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s, transform 0.2s;
}

.carousel-container:hover .nav-arrow, .nav-arrow:focus-visible { opacity: 1; }
.nav-arrow:hover { transform: translateY(-50%) scale(1.1); background: rgba(29, 29, 31, 0.9); }
.nav-arrow:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.left-arrow { left: 1vw; }
.right-arrow { right: 1vw; }

/* ================= Modal ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  position: relative;
  width: min(720px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface-color);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.modal-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: #0a0a0a;
  border-radius: 16px 16px 0 0;
}

.modal-body { padding: 28px 32px 32px; }

.modal-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; }
.modal-meta { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 16px; }
.modal-overview { font-size: 1rem; line-height: 1.55; color: var(--text-primary); margin-bottom: 20px; }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
}
.modal-close:hover { background: rgba(0,0,0,0.8); }
.modal-close:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.episode-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }

.episode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s;
}
.episode-row:hover, .episode-row:focus-visible { background: rgba(255,255,255,0.1); }
.episode-row:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.episode-name { font-size: 0.92rem; }
.episode-download-icon { flex-shrink: 0; opacity: 0.8; }

/* ================= Responsive ================= */
@media (max-width: 768px) {
  .nav-arrow { display: none; }
  .nav-search input { width: 120px; }
  .action-btn { width: 100%; justify-content: center; }
  .hero-actions { flex-direction: column; }
  .hero-fade-left { width: 100%; background: linear-gradient(to top, rgba(0,0,0,0.9) 10%, rgba(0,0,0,0.5) 60%, transparent 100%); }
}
