/* ═══════════════════════════════════════════
   Pick a Film — Main Stylesheet
   ═══════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────── */
:root {
  --bg:           #0d0d0f;
  --surface:      #18181d;
  --surface-2:    #222228;
  --border:       rgba(255,255,255,.08);
  --text:         #f0f0f5;
  --text-muted:   #888;
  --text-faint:   #555;
  --accent:       #f5a623;
  --accent-hover: #e09620;
  --apple-bg:     #1a1a1a;
  --apple-hover:  #2a2a2a;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
  --transition:   .2s ease;
  --container:    1200px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: 0; background: none; }
input { font: inherit; }

/* ── Container ────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Site Header ──────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,15,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}
.logo-icon { font-size: 1.3rem; line-height: 1; }
.logo-text  { color: var(--text); }
.site-nav a {
  color: var(--text-muted);
  font-size: .9rem;
  transition: color var(--transition);
}
.site-nav a:hover { color: var(--text); }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn--apple {
  background: var(--text);
  color: var(--bg);
}
.btn--apple:hover { opacity: .88; }
.btn--ghost {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: rgba(255,255,255,.14); }
.btn--sm { padding: .45rem .9rem; font-size: .82rem; }
.btn--full { width: 100%; justify-content: center; }

.apple-icon { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }
.btn-icon   { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Tags ─────────────────────────────────── */
.tag {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
  background: rgba(255,255,255,.1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag--light {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.15);
}

/* ── Meta separators ──────────────────────── */
.hero__meta, .film-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: rgba(255,255,255,.7);
}
.meta-sep { color: rgba(255,255,255,.3); }

/* ── Section ──────────────────────────────── */
.section { padding: 4rem 0; }
.section--alt { background: var(--surface); }
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.75rem;
  letter-spacing: -.02em;
}

/* ══════════════════════════════════════════
   HERO (random pick)
   ══════════════════════════════════════════ */
.hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero__backdrop {
  position: absolute;
  inset: 0;
  background-image: var(--backdrop, none);
  background-size: cover;
  background-position: center top;
  filter: brightness(.35) saturate(.8);
  transform: scale(1.04);
  transition: background-image .5s ease;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(13,13,15,.96) 0%,
    rgba(13,13,15,.7)  55%,
    rgba(13,13,15,.2)  100%
  );
}

.hero__content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2.5rem;
  align-items: center;
  padding-block: 3.5rem;
}
.hero__poster-wrap { flex-shrink: 0; }
.hero__poster {
  width: 160px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.hero__poster:hover { transform: scale(1.03); }

.hero__eyebrow {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}
.hero__title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: .75rem;
}
.hero__title a:hover { color: var(--accent); }
.hero__summary {
  color: rgba(255,255,255,.7);
  font-size: .95rem;
  line-height: 1.65;
  margin-top: .85rem;
  margin-bottom: 1.5rem;
  max-width: 52ch;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.hero__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.hero__empty { color: var(--text-muted); }

/* ── Spinner ──────────────────────────────── */
.spinner,
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 3rem auto;
}
.loading-spinner { display: flex; align-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   TRENDING GRID
   ══════════════════════════════════════════ */
.trending-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

/* ── Trending card ────────────────────────── */
.trending-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: transform var(--transition), box-shadow var(--transition);
}
.trending-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.trending-card__poster-wrap { position: relative; aspect-ratio: 2/3; overflow: hidden; }
.trending-card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.trending-card:hover .trending-card__img { transform: scale(1.05); }
.trending-card__rank {
  position: absolute;
  top: .5rem; left: .5rem;
  background: var(--accent);
  color: #000;
  font-size: .7rem;
  font-weight: 800;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.trending-card__info {
  padding: .75rem;
}
.trending-card__title {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: .45rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.trending-card__placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

/* ══════════════════════════════════════════
   FILM GRID (related / search)
   ══════════════════════════════════════════ */
.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}

/* ── Film card ────────────────────────────── */
.film-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.film-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.film-card__poster-wrap {
  position: relative;
  display: block;
  aspect-ratio: 2/3;
  overflow: hidden;
}
.film-card__poster {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.film-card:hover .film-card__poster { transform: scale(1.05); }
.film-card__poster--placeholder {
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  height: 100%;
}
.film-card__rank {
  position: absolute;
  top: .5rem; left: .5rem;
  background: var(--accent);
  color: #000;
  font-size: .7rem;
  font-weight: 800;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.film-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  padding: 1rem;
  display: flex;
  align-items: flex-end;
}
.film-card:hover .film-card__overlay { opacity: 1; }
.film-card__summary { font-size: .75rem; color: rgba(255,255,255,.85); line-height: 1.4; }

.film-card__info { padding: .75rem; }
.film-card__title { font-size: .85rem; font-weight: 600; line-height: 1.3; margin-bottom: .4rem; }
.film-card__title a:hover { color: var(--accent); }
.film-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  margin-bottom: .6rem;
}
.film-card__year { font-size: .75rem; color: var(--text-muted); }

/* ══════════════════════════════════════════
   FILM DETAIL PAGE
   ══════════════════════════════════════════ */
.film-hero {
  position: relative;
  height: 380px;
  overflow: hidden;
}
.film-hero__backdrop {
  position: absolute;
  inset: 0;
  background-image: var(--backdrop, none);
  background-size: cover;
  background-position: center 30%;
  filter: brightness(.3) saturate(.6);
}
.film-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 60%);
}
.film-hero__content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 2.5rem;
}
.film-hero__title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .6rem;
}
.film-hero__meta { gap: .5rem; }

/* ── Detail layout ────────────────────────── */
.film-detail {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  align-items: start;
}
.film-detail__poster {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.film-detail__sidebar { display: flex; flex-direction: column; gap: 1rem; }

.film-detail__summary {
  font-size: 1.05rem;
  line-height: 1.75;
  color: rgba(255,255,255,.85);
  margin-bottom: 2rem;
}

.film-detail__credits {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .5rem 1.5rem;
  font-size: .9rem;
}
.film-detail__credits dt {
  color: var(--text-muted);
  font-weight: 500;
  padding-top: .1em;
}
.film-detail__credits dd {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

/* ── Share box ────────────────────────────── */
.film-detail__share { margin-top: .5rem; }
.share-label {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: .4rem;
  font-weight: 500;
}
.share-url { display: flex; gap: .4rem; }
.share-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: .4rem .6rem;
  font-size: .78rem;
}
.share-input:focus { outline: 1px solid var(--accent); }

/* ══════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  align-items: center;
  text-align: center;
}
.footer-logo { font-weight: 700; font-size: 1rem; color: var(--text-muted); }
.footer-note {
  font-size: .78rem;
  color: var(--text-faint);
  line-height: 1.6;
  /*max-width: 75ch;*/
}
.footer-note a { color: var(--text-muted); text-decoration: underline; }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
  .trending-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: .75rem;
  }
  .film-detail { grid-template-columns: 180px 1fr; gap: 2rem; }
}

@media (max-width: 720px) {
  .hero__content { grid-template-columns: 1fr; }
  .hero__poster-wrap { display: none; }

  .trending-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
  }

  .film-detail {
    grid-template-columns: 1fr;
  }
  .film-detail__sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .film-detail__poster { width: 140px; }
  .film-detail__share  { width: 100%; }
}

@media (max-width: 480px) {
  .trending-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__title   { font-size: 1.5rem; }
  .hero__actions { flex-direction: column; }
  .btn--apple, .btn--ghost { width: 100%; justify-content: center; }
}
