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

:root {
  --radius: 8px;
  --font: system-ui, -apple-system, sans-serif;
  --text-muted: #A0A0B0;
  --gap: 16px;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.main-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  order: 3;
  width: 100%;
}

.main-nav a {
  color: var(--text);
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.search-form {
  position: relative;
  display: flex;
  gap: 4px;
  margin-left: auto;
  order: 2;
}

.search-form input {
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  width: 140px;
}

@media (min-width: 768px) {
  .main-nav {
    order: 0;
    width: auto;
  }

  .search-form {
    order: 0;
  }

  .search-form input {
    width: 200px;
  }
}

.search-form button {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  margin-top: 4px;
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
}

.search-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 0.9rem;
}

.search-dropdown__item.active,
.search-dropdown a:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

/* Main heading (homepage H1) */
.main-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  line-height: 1.3;
}

/* Main content */
.main-content {
  padding: 24px 0;
}

/* Section titles */
.section-title,
.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* Category intro — SEO/GEO citability block, page 1 only */
.category-intro {
  color: var(--text);
  opacity: 0.8;
  line-height: 1.6;
  margin: 0 0 24px;
  padding: 12px 16px;
  border-left: 3px solid var(--primary);
  background: var(--card);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

/* Listing intro — SEO/GEO citability block for country/year/director, page 1 only */
.section-intro {
  color: var(--text);
  opacity: 0.8;
  line-height: 1.6;
  margin: 0 0 24px;
  padding: 12px 16px;
  border-left: 3px solid var(--primary);
  background: var(--card);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

/* Films grid */
.films-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--gap);
  margin-bottom: 32px;
}

@media (min-width: 480px) {
  .films-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (min-width: 768px) {
  .films-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
  }
}

/* Film card */
.film-card {
  position: relative;
}

.film-card a {
  display: block;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  transition: transform 0.2s, box-shadow 0.2s;
}

.film-card a:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.film-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.card-info {
  padding: 8px;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-rating {
  color: #ffd700;
}

/* Film hero */
.film-hero {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.film-poster img {
  width: 200px;
  border-radius: var(--radius);
}

.film-info {
  flex: 1;
  min-width: 200px;
}

.film-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
}

.film-title-en {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.film-ratings {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.rating-kp,
.rating-imdb {
  background: var(--card);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.rating-kp {
  color: #ffd700;
}

.rating-imdb {
  color: #f5c518;
}

.film-meta-table {
  border-collapse: collapse;
  font-size: 0.9rem;
}

.film-meta-table td {
  padding: 4px 12px 4px 0;
  vertical-align: top;
}

.film-meta-table td:first-child {
  color: var(--text-muted);
  white-space: nowrap;
}

/* Intent block */
.film-intent {
  color: var(--text);
  opacity: 0.85;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 24px;
  padding: 10px 16px;
  border-left: 3px solid var(--primary);
  background: var(--card);
  border-radius: var(--radius);
}

/* Player */
.player-section {
  margin-bottom: 32px;
}

.player-placeholder {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  height: clamp(380px, 110vw, 580px);
}

@media (min-width: 768px) {
  .player-placeholder {
    height: clamp(280px, 56.25vw, 740px);
  }
}

.player-placeholder img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  filter: blur(2px);
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 14px 28px;
  border-radius: 40px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, opacity 0.2s;
}

.play-button:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.play-icon {
  font-size: 1.2rem;
}

/* Film description */
.film-description {
  margin-bottom: 32px;
  line-height: 1.7;
}

.film-description h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

/* Related sections */
.related-films,
.recommendations,
.franchise,
.director-films,
.crosslinks {
  margin-bottom: 32px;
}

.related-films h2,
.recommendations h2,
.franchise h2,
.director-films h2,
.crosslinks h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

/* Franchise list */
.franchise-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.franchise-item {
  background: var(--card);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s;
}

.franchise-item:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.franchise-item.active {
  border: 2px solid var(--primary);
}

/* Crosslinks */
.crosslinks-list {
  list-style: none;
}

.crosslinks-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crosslink-site {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--primary);
}

/* Footer */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  margin-bottom: 12px;
}
.footer-nav a {
  color: var(--text-muted, #A0A0B0);
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-nav a:hover {
  color: var(--primary);
}

/* No results */
.no-results {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 24px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  padding: 16px 0;
}

.btn-prev,
.btn-next {
  display: inline-block;
  background: var(--card);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-prev:hover,
.btn-next:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.page-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Hub description */
.hub-description {
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Films section */
.films-section {
  margin-bottom: 48px;
}

/* Hub catalog (list page) */
.hub-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 24px;
  margin-bottom: 48px;
}

@media (min-width: 600px) {
  .hub-catalog {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.hub-catalog__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  border-top: 3px solid var(--primary);
  padding: 16px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.hub-catalog__item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  text-decoration: none;
}

.hub-catalog__icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.hub-catalog__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.hub-catalog__name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.hub-catalog__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hub list page intro */
.page-intro {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Trailer button ── */
.btn-trailer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 20px;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.btn-trailer:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

/* ── CSS-only trailer modal (:target) ── */
.trailer-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.trailer-modal:target {
  display: flex;
}
.trailer-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  cursor: pointer;
}
.trailer-modal__box {
  position: relative;
  z-index: 1;
  width: min(900px, 96vw);
  aspect-ratio: 16 / 9;
}
.trailer-modal__box iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
  display: block;
}
.trailer-modal__close {
  position: absolute;
  top: -44px;
  right: 0;
  font-size: 2rem;
  color: #fff;
  text-decoration: none;
  line-height: 1;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trailer-modal__close:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

/* ── Film stills grid ── */
.film-stills {
  margin-bottom: 32px;
}
.film-stills h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}
.stills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 1024px) {
  .stills-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .stills-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
}
.still-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: calc(var(--radius) / 2);
  background: var(--card);
  cursor: pointer;
}
.still-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.still-thumb:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* ── CSS-only stills lightbox (:target) ── */
.still-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9001;
  align-items: center;
  justify-content: center;
}
.still-overlay:target {
  display: flex;
}
.still-overlay__bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}
.still-overlay > img {
  position: relative;
  z-index: 1;
  max-width: 96vw;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
  display: block;
}
.still-overlay__close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  font-size: 2rem;
  color: #fff;
  text-decoration: none;
  line-height: 1;
  background: rgba(0, 0, 0, 0.6);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.still-overlay__close:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

/* ── "Зараз дивляться" pulse indicator ── */
.watching-now .section-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #e53e3e;
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1.4s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.85); }
}

/* ── Lucky nav link ── */
.nav-lucky {
  color: var(--primary) !important;
  font-weight: 600;
}

/* Skip-to-content link (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 16px;
  top: 8px;
  width: auto;
  height: auto;
  overflow: visible;
  z-index: 9999;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
}

/* Featured hubs grid on home page */
.hubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.hub-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 18px;
  background: var(--card);
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.07);
  transition: border-color .2s, transform .2s;
}
.hub-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.hub-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}
.hub-card__desc {
  font-size: .8rem;
  color: var(--text-muted, #999);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.all-hubs-link {
  display: inline-block;
  font-size: .9rem;
  color: var(--primary);
  text-decoration: none;
}
.all-hubs-link:hover { text-decoration: underline; }

/* FAQ section */
.faq { margin: 32px 0; }
.faq h2 { font-size: 1.25rem; margin-bottom: 16px; }
.faq details { margin-bottom: 8px; border: 1px solid var(--border, #333); border-radius: var(--radius, 8px); padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }
.faq p { margin: 0; }

/* Episode schedule */
.episode-schedule { margin: 32px 0; }
.episode-schedule h2 { font-size: 1.25rem; margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ep-progress { font-size: .85rem; font-weight: 400; color: var(--muted, #888); }
.ep-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ep-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ep-table th, .ep-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border, #333); }
.ep-table th { font-weight: 600; white-space: nowrap; }
.ep-table tbody tr:hover { background: var(--surface2, rgba(255,255,255,.04)); }
.ep-check-cell { text-align: center; }
.ep-check-label { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.ep-check-label input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary, #e50914); cursor: pointer; }
.ep-login-cta { margin-top: 12px; font-size: .9rem; color: var(--muted, #888); }
.ep-login-cta a { color: var(--primary, #e50914); }
.ep-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: .9rem; z-index: 9999; pointer-events: none; }
@media (max-width: 480px) {
  .ep-table th, .ep-table td { padding: 8px 8px; font-size: .82rem; }
}
