:root {
  --color-bg: #ffffff;
  --color-surface: #f7f7f8;
  --color-text: #1a1a1a;
  --color-muted: #6b7280;
  --color-accent: #2563eb;
  --color-border: #e5e7eb;
  --color-dark: #111418;
  --radius-card: 8px;
  --radius-btn: 6px;
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Header / nav */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { display: block; color: var(--color-text); flex: 0 0 auto; }
.brand-accent { color: var(--color-accent); }
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a { color: var(--color-text); font-weight: 500; }

.site-main { padding-top: 22px; padding-bottom: 48px; min-height: 60vh; }

/* Breadcrumbs */
.breadcrumbs { margin: 0 0 18px; font-size: 0.85rem; }
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
}
.breadcrumbs li { display: flex; align-items: center; color: var(--color-muted); }
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 6px;
  color: var(--color-border);
}
.breadcrumbs a { color: var(--color-muted); }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs li[aria-current="page"] { color: var(--color-text); font-weight: 500; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.9rem;
  padding: 22px 0;
}

/* Headings / page head */
h1 { font-size: 1.9rem; margin: 0 0 12px; line-height: 1.2; }
h2 { font-size: 1.35rem; margin: 0 0 12px; line-height: 1.25; }
h3 { font-size: 1.1rem; margin: 0 0 10px; line-height: 1.3; }
.page-head { margin-bottom: 24px; }
.lead { color: var(--color-muted); margin-bottom: 16px; }

/* Hero */
.hero {
  padding: 28px 0 8px;
}
.hero h1 { font-size: 2.2rem; }
.hero-sub { color: var(--color-muted); font-size: 1.1rem; max-width: 640px; }

/* Sections on home */
.home-section { margin-top: 40px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; }
.more-link { font-size: 0.95rem; white-space: nowrap; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.premiere-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg);
  padding: 16px;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.card-title { font-size: 1.1rem; margin: 0; }
.card-title a { color: var(--color-text); }
.price { font-weight: 600; margin: 0; }
.platforms { color: var(--color-muted); font-size: 0.88rem; margin: 0; }

/* Cinema logo in cards */
.cinema-card-head { display: flex; align-items: center; gap: 12px; }
.cinema-logo-box {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cinema-logo {
  max-width: 80%;
  max-height: 80%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.cinema-logo-fallback {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-accent);
}
.cinema-card-head .card-title { font-size: 1.05rem; }

/* Logo on cinema detail page */
.detail-title { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.detail-title h1 { margin: 0; }
.detail-logo {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 6px;
  background: var(--color-bg);
}

/* Premiere cards */
.premiere-card { padding: 0; overflow: hidden; }
.poster-link { display: block; }
.poster {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--color-surface);
}
.poster-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}
.premiere-card .card-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.date { color: var(--color-muted); font-size: 0.85rem; }

/* Movie teaser cards (Смотреть на Tvigle.ru) */
.movie-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.movie-card { padding: 0; overflow: hidden; }
.poster.poster-portrait { aspect-ratio: 2 / 3; }
.movie-card .card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.movie-card .card-title { font-size: 0.98rem; line-height: 1.3; }
.movie-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  width: fit-content;
}
.badge-free { background: #dcfce7; color: #166534; }
.badge-cinema { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
a.badge-cinema:hover { text-decoration: none; border-color: var(--color-accent); }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--color-dark);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  width: fit-content;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Horizontal scroll on home */
.hscroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.hscroll-item {
  flex: 0 0 240px;
  scroll-snap-align: start;
}

/* Cinema detail */
.cinema-detail > section { margin-top: 32px; }
.detail-head .btn { margin-top: 8px; }
.price-big { font-size: 1.3rem; font-weight: 700; margin: 0 0 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; }
.facts dt { color: var(--color-muted); }
.facts dd { margin: 0; }
.premiere-list { list-style: none; padding: 0; margin: 0; }
.premiere-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

/* Premiere detail */
.premiere-detail .poster-lg {
  max-width: 480px;
  width: 100%;
  border-radius: var(--radius-card);
  margin-bottom: 16px;
}
.premiere-detail .meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.premiere-body { margin: 16px 0; }

/* Table */
.platform-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.platform-table th,
.platform-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
}
.platform-table thead th { background: var(--color-surface); font-size: 0.85rem; }
.platform-table tbody tr:nth-child(even) { background: var(--color-surface); }
.platform-table tbody tr:last-child td { border-bottom: none; }

.muted { color: var(--color-muted); }

/* Responsive */
@media (max-width: 720px) {
  .card-grid,
  .premiere-grid,
  .cols-3 { grid-template-columns: 1fr; }
  /* Постеры фильмов оставляем по 2 в ряд — так компактнее на телефоне. */
  .movie-grid { grid-template-columns: repeat(2, 1fr); }

  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.7rem; }
  .hero-sub { font-size: 1rem; }
  .site-nav { gap: 14px; }

  /* Stacked table rows */
  .platform-table { border: none; }
  .platform-table thead { display: none; }
  .platform-table,
  .platform-table tbody,
  .platform-table tr,
  .platform-table td { display: block; width: 100%; }
  .platform-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    margin-bottom: 12px;
    background: var(--color-bg) !important;
  }
  .platform-table td {
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }
  .platform-table td:last-child { border-bottom: none; }
  .platform-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-muted);
  }
  .platform-table td[data-label=""]::before { content: ""; }
}

@media (max-width: 520px) {
  .container { padding: 0 14px; }
  .header-inner { flex-wrap: wrap; gap: 10px 14px; }
  .hero { padding-top: 18px; }
  .hero h1 { font-size: 1.5rem; }
  .movie-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-title { gap: 12px; }
  .detail-logo { width: 48px; height: 48px; }
}
