:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #10182b;
  --surface: #151f35;
  --surface-strong: #1b2944;
  --line: rgba(148, 163, 184, 0.22);
  --text: #f8fafc;
  --muted: #9aa9c0;
  --accent: #fbbf24;
  --accent-strong: #f59e0b;
  --accent-ink: #1f2937;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(251, 191, 36, 0.14), transparent 32rem),
    radial-gradient(circle at 92% 0%, rgba(59, 130, 246, 0.14), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

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

a:hover {
  color: var(--accent);
}

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

h1,
h2,
h3,
p,
dl,
dd {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
}

h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

h3 {
  margin-bottom: 0.65rem;
  font-size: 1.2rem;
}

.wrap {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 32, 0.84);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(251, 191, 36, 0.12);
  color: var(--text);
}

.site-main {
  padding-block: 3rem 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1.5fr) minmax(220px, 0.7fr);
  gap: 2rem;
  align-items: stretch;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.09), transparent 44%),
    rgba(21, 31, 53, 0.78);
  box-shadow: var(--shadow);
}

.hero-empty {
  grid-template-columns: 1fr;
  min-height: 24rem;
  align-content: center;
}

.hero-poster,
.detail-poster {
  align-self: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
  aspect-ratio: 2 / 3;
}

.hero-poster img,
.detail-poster img,
.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 8rem;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(251, 191, 36, 0.3), transparent 55%),
    linear-gradient(145deg, #243657, #111a2d);
  color: var(--accent);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.eyebrow {
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lede {
  max-width: 65ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta-row span + span::before {
  content: "·";
  margin-right: 0.9rem;
  color: rgba(148, 163, 184, 0.55);
}

.genre-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.6rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  color: #dbe6f7;
  font-size: 0.8rem;
  font-weight: 700;
}

.tag-strong {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1);
}

.tag small {
  color: var(--accent);
  font-size: 0.72rem;
}

.hero-actions,
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.68rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  background: #fcd34d;
  color: var(--accent-ink);
  transform: translateY(-1px);
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.button-ghost:hover {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
  color: var(--text);
}

.text-link {
  color: var(--accent);
  font-weight: 750;
}

.message-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.message {
  margin: 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(21, 31, 53, 0.82);
}

.message.success {
  border-color: rgba(74, 222, 128, 0.4);
}

.message.error {
  border-color: rgba(248, 113, 113, 0.55);
}

.tmdb-fix {
  width: 100%;
  margin-top: 1.1rem;
}

.tmdb-fix summary {
  width: fit-content;
  list-style: none;
}

.tmdb-fix summary::-webkit-details-marker {
  display: none;
}

.tmdb-fix-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-top: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 16, 32, 0.6);
}

.tmdb-fix-form .field {
  flex: 1 1 11rem;
}

.tmdb-fix-form .button {
  flex: 0 0 auto;
}

.form-error {
  flex-basis: 100%;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(248, 113, 113, 0.55);
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.22);
  color: #fca5a5;
  font-size: 0.88rem;
}

.form-help {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-panel {
  align-self: stretch;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 16, 32, 0.5);
}

.panel-label,
.strip-label {
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stat-list {
  display: grid;
  gap: 1rem;
  margin-bottom: 0;
}

.stat-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.stat-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.stat-list dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-list dd {
  margin-bottom: 0;
  font-size: 1.7rem;
  font-weight: 850;
}

.section {
  margin-top: 3.5rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  margin-bottom: 0;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 1rem;
}

.movie-card {
  min-height: 14rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(27, 41, 68, 0.9), rgba(16, 24, 43, 0.9));
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.movie-card:hover {
  transform: translateY(-3px);
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.28);
}

.movie-card-link {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: stretch;
  height: 100%;
  padding: 0.9rem;
}

.movie-card-link:hover {
  color: inherit;
}

.card-poster {
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-strong);
  aspect-ratio: 2 / 3;
}

.card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.card-topline {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-genres,
.card-dates {
  color: var(--muted);
  font-size: 0.86rem;
}

.card-dates {
  margin-top: auto;
  margin-bottom: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stats-grid-large {
  margin-top: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 31, 53, 0.72);
}

.stat-value {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.genre-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.25rem;
}

.strip-label {
  margin: 0 0.4rem 0 0;
}

.join-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 3.5rem;
  padding: 1.7rem;
  border: 1px solid rgba(251, 191, 36, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(251, 191, 36, 0.12), rgba(21, 31, 53, 0.7));
}

.join-panel h2 {
  margin-bottom: 0.4rem;
}

.join-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.page-heading {
  max-width: 820px;
  margin-bottom: 2rem;
}

.page-heading h1 {
  margin-bottom: 0.8rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) minmax(160px, 1fr) minmax(140px, 0.8fr) auto;
  gap: 0.85rem;
  align-items: end;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 31, 53, 0.72);
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(11, 16, 32, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

input::placeholder {
  color: #73819a;
}

input:focus,
select:focus,
.button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.result-count {
  margin: 1.15rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  padding: 3rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.back-link {
  margin-bottom: 1.2rem;
}

.detail-hero {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding: clamp(1.5rem, 4vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(21, 31, 53, 0.78));
}

.timeline {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(21, 31, 53, 0.6);
  color: var(--muted);
}

.timeline-dot {
  width: 0.55rem;
  height: 0.55rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.12);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 31, 53, 0.78);
}

.chart-card img {
  width: 100%;
  border-radius: 12px;
  background: white;
}

.chart-card figcaption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.prose {
  max-width: 760px;
}

.prose h2 {
  margin-top: 2rem;
  font-size: 1.35rem;
}

.prose p {
  color: #cdd8e8;
  font-size: 1.02rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(11, 16, 32, 0.6);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .hero-panel {
    grid-column: 1 / -1;
  }

  .detail-hero {
    grid-template-columns: 140px minmax(0, 1fr);
  }
}

@media (max-width: 850px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-poster {
    max-width: 180px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .field-search {
    grid-column: 1 / -1;
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 0.9rem;
  }

  .site-nav {
    width: 100%;
  }

  .site-nav a {
    padding-inline: 0.6rem;
  }

  .site-main {
    padding-top: 2rem;
  }

  .stats-grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .join-panel,
  .section-heading,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading {
    gap: 0.5rem;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-poster {
    width: min(180px, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
