/* Mise en page : un programme de salle de cinéma — en-tête et navigation, filtres, grille d'affiches typographiques, fiche en surimpression */
:root {
  --paper: #eceef2;
  --surface: #ffffff;
  --ink: #1a1d38;
  --muted: #5a5f78;
  --line: #cfd3de;
  --lamp: #f0b72f;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  /* couleurs des affiches, par genre */
  --g-comedie: #e8583d;
  --g-drame: #2f4a8a;
  --g-sf: #14212e;
  --g-thriller: #6b1d2b;
  --g-animation: #2e8a76;
  --g-policier: #3a3227;
  --g-autre: #565d7c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111325; --surface: #1a1d33; --ink: #e8e9f2; --muted: #a2a6bf; --line: #2e3250;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111325; --surface: #1a1d33; --ink: #e8e9f2; --muted: #a2a6bf; --line: #2e3250;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Barre du haut */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding-block: 1.25rem;
}
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.reel {
  display: inline-block;
  width: .7em; height: .7em;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--paper) 0 11%, transparent 12%),
    radial-gradient(circle at 50% 22%, var(--paper) 0 13%, transparent 14%),
    radial-gradient(circle at 76% 64%, var(--paper) 0 13%, transparent 14%),
    radial-gradient(circle at 24% 64%, var(--paper) 0 13%, transparent 14%),
    var(--lamp);
}
nav.main ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
nav.main a {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: .98rem;
  color: var(--ink);
  text-decoration: none;
  padding: .45rem .8rem;
  border-radius: 6px;
}
nav.main a:hover { background: var(--surface); }
nav.main a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Titre de page */
.hero { padding-block: 1rem 1.25rem; }
.hero h1 {
  /* Police Art déco des enseignes de cinéma */
  font-family: "Limelight", var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: .01em;
  margin: 0;
  text-wrap: balance;
}
.hero p { max-width: 40rem; margin: .5rem 0 0; color: var(--muted); font-size: 1.05rem; }

/* Barre de filtres */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: center;
  padding-block: 1rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.search {
  flex: 1 1 16rem;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.genres { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font-family: var(--display);
  font-size: .9rem;
  font-weight: 600;
  padding: .4rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sort {
  font: inherit; font-size: .95rem;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.count { margin: 1.25rem 0 0; color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }

/* Grille d'affiches */
.grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 2rem 1.25rem;
}
.item button { all: unset; display: block; width: 100%; cursor: pointer; }
.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  color: #fff;
  background: var(--c, var(--g-autre));
  padding: 1rem 1rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .2s ease;
}
.poster::after {
  /* perforations de pellicule sur le bord gauche */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 10px;
  background: repeating-linear-gradient(to bottom, transparent 0 10px, rgba(255,255,255,.22) 10px 18px);
}
.poster.serie::after {
  /* pour les séries : trois bandes d'écran, comme des épisodes */
  inset: 0 0 auto 0;
  width: auto;
  height: 8px;
  background: repeating-linear-gradient(to right, rgba(255,255,255,.28) 0 30%, transparent 30% 35%);
}
/* Affiche officielle : l'image couvre toute la carte, le texte reste dessous en secours */
.poster > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  z-index: 1;
}
.poster.has-img::after { display: none; }
.poster.has-img .top { position: relative; z-index: 2; justify-content: flex-end; }
.poster.has-img .yr { display: none; }
.poster.has-img .kind { background: rgba(10, 12, 28, .75); }
.poster .top { display: flex; justify-content: space-between; gap: .5rem; font-family: var(--display); font-weight: 600; font-size: .9rem; }
.poster .yr { opacity: .85; font-variant-numeric: tabular-nums; }
.poster .kind {
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 0 .55em;
  font-size: .8rem;
  line-height: 1.6;
}
.poster .t {
  font-family: var(--display);
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.02em;
  font-size: var(--fs, 1.9rem);
  overflow-wrap: anywhere;
  hyphens: auto;
}
.poster .by { font-size: .85rem; opacity: .85; }
.item button:hover .poster { transform: translateY(-4px); }
.item button:focus-visible .poster { outline: 3px solid var(--lamp); outline-offset: 3px; }
.meta { margin-top: .6rem; }
.meta .name { font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.25; }
.meta .sub { color: var(--muted); font-size: .92rem; }

.empty { padding-block: 3rem; color: var(--muted); }
.empty button { font: inherit; color: var(--ink); text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 0; }

/* Top 10 */
.ranking { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.rank .rank-row {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  cursor: pointer;
  display: grid;
  grid-template-columns: 5.5rem 92px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--line);
}
button.rank-row:hover .rank-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
button.rank-row:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
.rank-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 4.5rem;
  line-height: .85;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.rank:nth-child(-n+3) .rank-num { color: var(--lamp); -webkit-text-stroke: 1.5px var(--ink); }
.rank .poster { --fs: .95rem; padding: .5rem .5rem .5rem .9rem; border-radius: 3px; }
.rank .poster .top, .rank .poster .by, .rank .poster .t { display: none; }
.rank .poster::after { width: 6px; }
.rank .poster.serie::after { width: auto; height: 5px; }
.rank-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.3rem, 3vw, 1.9rem); line-height: 1.05; letter-spacing: -.02em; }
.rank-sub { color: var(--muted); margin-top: .3rem; }
.rank-pitch { margin-top: .4rem; max-width: 62ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Fiche */
dialog {
  width: min(880px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop { background: rgba(10, 12, 28, .7); }
.sheet { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 2rem; padding: 2rem; }
.sheet h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
  letter-spacing: -.02em;
  margin: 0 2.5rem .5rem 0;
  text-wrap: balance;
}
.facts { color: var(--muted); margin: 0 0 1.25rem; font-variant-numeric: tabular-nums; }
.synopsis { margin: 0 0 1.5rem; max-width: 62ch; }
.credits { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
.credits dt { font-family: var(--display); font-weight: 600; font-size: .95rem; }
.credits dd { margin: 0; }
.close {
  position: absolute;
  top: .75rem; right: .75rem;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.close:focus-visible, .chip:focus-visible, .search:focus-visible, .sort:focus-visible, nav.main a:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }

.legal { padding: 2rem; max-width: 62ch; }
.legal h2 { font-family: var(--display); font-weight: 800; margin: 0 0 1rem; }
.legal h3 { font-family: var(--display); font-weight: 600; font-size: 1.05rem; margin: 1.25rem 0 .25rem; }
.legal p { margin: 0; }
.legal mark { background: var(--lamp); color: #1a1d38; padding: 0 .2em; }

footer.site {
  margin-top: 4rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
}
footer.site a.tmdb { color: var(--ink); }
footer.site a.tmdb img { vertical-align: baseline; }
.credit-tmdb img { vertical-align: middle; margin-right: .35rem; }
footer.site button { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

@media (max-width: 640px) {
  .sheet { grid-template-columns: 1fr; padding: 1.25rem; gap: 1.25rem; }
  .sheet .poster { max-width: 200px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem .9rem; }
  .poster { padding: .75rem .75rem .75rem 1.2rem; }
  .rank .rank-row { grid-template-columns: 3.2rem 64px minmax(0, 1fr); gap: .8rem; }
  .rank-num { font-size: 2.8rem; }
  .rank-pitch { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .poster { transition: none; }
  .item button:hover .poster { transform: none; }
}
.legal a { color: var(--ink); }

/* ---------- Catalogue étendu : filtres, pagination, fiche ---------- */
.rank-sub { display: block; }
div.rank-row { cursor: default; }
.controls .sort { flex: 0 0 auto; }

.filters {
  border-bottom: 1px solid var(--line);
  padding-block: .25rem 1rem;
}
.filters summary {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  padding-block: .75rem .25rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary::before {
  content: "";
  width: .55em; height: .55em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
.filters[open] summary::before { transform: rotate(45deg); }
.filters summary:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; border-radius: 4px; }
.active-count {
  font-size: .8rem;
  background: var(--lamp);
  color: #1a1d38;
  border-radius: 999px;
  padding: 0 .55em;
}
.active-count:empty { display: none; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 1rem 1.25rem;
  margin-top: .75rem;
}
.filter-grid fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.filter-grid legend {
  font-family: var(--display);
  font-weight: 600;
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: .4rem;
  padding: 0;
}
.filter-grid legend .hint { font-weight: 400; }
.filter-grid select {
  width: 100%;
  font: inherit; font-size: .95rem;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.f-genres, .f-periode { grid-column: 1 / -1; }
.range { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.range label { display: flex; align-items: center; gap: .4rem; font-size: .95rem; }
.range select { width: auto; }
.decades { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.mini, .seg button {
  font-family: var(--display);
  font-weight: 600;
  font-size: .85rem;
  padding: .3rem .65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.mini[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.chip .n { font-weight: 400; opacity: .6; font-variant-numeric: tabular-nums; }
.filter-actions { margin-top: 1rem; }
button.link { font: inherit; font-size: .95rem; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.mini:focus-visible, .seg button:focus-visible, button.link:focus-visible, .filter-grid select:focus-visible, .more:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }

.meta .star, .note .star { color: var(--lamp); }
.more-wrap { display: flex; justify-content: center; margin-top: 2.5rem; }
.more {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  padding: .75rem 1.5rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.more:hover { background: var(--ink); color: var(--paper); }

.sheet .original { margin: -.25rem 0 .5rem; color: var(--muted); font-style: italic; }
.sheet .note { margin: -.5rem 0 1.1rem; font-family: var(--display); font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.sheet .note .sur { color: var(--muted); font-weight: 400; font-size: .9rem; }
.sheet .note .votes { color: var(--muted); font-weight: 400; font-family: var(--body); font-size: .9rem; margin-left: .5rem; }
.sheet .lang-note { color: var(--muted); font-size: .9rem; }
.sheet .ext { margin: 1.25rem 0 0; }
.sheet .ext a { color: var(--ink); }

@media (prefers-reduced-motion: reduce) { .filters summary::before { transition: none; } }

/* ---------- v3 : bande-annonce, version ---------- */
.sheet .ext a.trailer {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--display);
  font-weight: 600;
  text-decoration: none;
  padding: .6rem 1.1rem .6rem .8rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
}
.sheet .ext a.trailer.search { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.sheet .ext a.trailer:hover { filter: brightness(1.15); }
.sheet .ext a.trailer:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
.trailer .play {
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  background: var(--lamp);
  position: relative;
  flex: none;
}
.trailer .play::after {
  content: "";
  position: absolute;
  left: 52%; top: 50%;
  transform: translate(-40%, -50%);
  border-left: .45rem solid #1a1d38;
  border-top: .3rem solid transparent;
  border-bottom: .3rem solid transparent;
}
.foot-right { display: inline-flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: baseline; }
.version { font-variant-numeric: tabular-nums; opacity: .8; }
