/* =========================================================
   Page d'accueil
   ========================================================= */

/* ---------- Bandeau héros ---------- */
.hero {
  position: relative; margin: -24px -24px 0; height: clamp(440px, 68vh, 680px);
  overflow: hidden; isolation: isolate; background: var(--bg);
}
.hero-stage { position: absolute; inset: 0; z-index: -2; }
/* Glissement des fonds : la nouvelle image pousse l'ancienne (qui recule un peu et s'assombrit) */
.hero-bg { position: absolute; inset: 0; visibility: hidden; overflow: hidden; background: var(--bg); }
.hero-bg.on { visibility: visible; z-index: 2; }
.hero-bg.from-right, .hero-bg.from-left { visibility: visible; z-index: 2; transition: none; }
.hero-bg.from-right { transform: translateX(100%); }
.hero-bg.from-left { transform: translateX(-100%); }
.hero-bg.sliding { transform: translateX(0); transition: transform 1s var(--ease-out, ease); box-shadow: 0 0 80px rgba(0,0,0,.7); }
.hero-bg.to-left, .hero-bg.to-right {
  visibility: visible; z-index: 1; filter: brightness(.35);
  transition: transform 1s var(--ease-out, ease), filter 1s ease;
}
.hero-bg.to-left { transform: translateX(-35%); }
.hero-bg.to-right { transform: translateX(35%); }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transform: scale(1.12); }
.hero-bg:is(.on, .to-left, .to-right) img { animation: kenburns var(--hero-delay, 9s) linear both; }
.hero-shade {
  position: absolute; inset: -2px; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(21,24,27,.97) 0%, rgba(21,24,27,.82) 30%, rgba(21,24,27,.25) 62%, rgba(21,24,27,0) 80%),
    linear-gradient(0deg, var(--bg) 0%, rgba(21,24,27,.6) 18%, rgba(21,24,27,0) 45%),
    linear-gradient(180deg, rgba(21,24,27,.55) 0%, rgba(21,24,27,0) 18%);
}
.hero-content {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 48px 56px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.hero-info { max-width: 620px; }
.hero-info.swap > * { animation: hero-in .7s var(--ease-out, ease) both; }
.hero-info.swap > :nth-child(2) { animation-delay: .06s; }
.hero-info.swap > :nth-child(3) { animation-delay: .12s; }
.hero-info.swap > :nth-child(4) { animation-delay: .18s; }
.hero-info.swap > :nth-child(5) { animation-delay: .24s; }
.hero-kicker { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 12px; }
.hero-kicker span { color: var(--text-2); font-weight: 600; letter-spacing: .06em; }
.hero-title {
  font-size: clamp(30px, 4.6vw, 58px); line-height: 1.02; font-weight: 800; letter-spacing: -.03em;
  text-shadow: 0 4px 30px rgba(0,0,0,.5); text-wrap: balance;
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--text-2); margin: 14px 0; font-weight: 500; }
.hero-meta .rating { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 700; }
.hero-meta .rating .ic { width: 15px; height: 15px; }
.hero-overview {
  margin: 0 0 24px; color: #d6dadd; font-size: 15.5px; line-height: 1.6; max-width: 560px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-play { position: relative; overflow: hidden; height: 50px; padding: 0 28px; font-size: 16px; }
.hero-play .ic { width: 22px; height: 22px; }
.hero-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.25); }
.hero-progress i { display: block; height: 100%; background: #141414; opacity: .55; }
.hero-more { height: 50px; padding: 0 24px; font-size: 16px; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.14); backdrop-filter: blur(8px); }
.hero-more:hover { background: rgba(255,255,255,.2); }

/* Navigation du carrousel */
.hero-nav { display: flex; align-items: center; gap: 10px; flex: none; }
.hero-arrow {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(255,255,255,.16); background: rgba(0,0,0,.35); color: #fff; backdrop-filter: blur(8px);
  transition: background .2s, transform .2s var(--ease-spring, ease);
}
.hero-arrow:hover { background: rgba(255,255,255,.18); transform: scale(1.08); }
.hero-arrow.next .ic { transform: rotate(180deg); }
.hero-dots { display: flex; gap: 6px; }
.hero-dot { width: 26px; height: 4px; padding: 0; border: 0; border-radius: 2px; background: rgba(255,255,255,.25); cursor: pointer; overflow: hidden; transition: width .4s var(--ease-out, ease), background .2s; }
.hero-dot:hover { background: rgba(255,255,255,.45); }
.hero-dot.on { width: 52px; }
.hero-dot i { display: block; height: 100%; width: 0; background: var(--accent); }
.hero-dot.on i { width: 100%; }
.hero-dot.run i { animation: dot-fill var(--hero-delay, 9s) linear both; }

/* Vignettes des affiches à droite : colonne bornée au bandeau, les vignettes rétrécissent pour tenir */
.hero-thumbs {
  position: absolute; right: 48px; top: 36px; bottom: 120px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 10px;
}
.hero-thumb {
  flex: none; aspect-ratio: 2 / 3; width: auto;
  height: min(87px, calc((100% - (var(--n, 7) - 1) * 10px) / var(--n, 7))); padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden;
  background: var(--bg-3); cursor: pointer; opacity: .45; transform: scale(.92);
  transition: opacity .3s, transform .35s var(--ease-spring, ease), border-color .3s, box-shadow .3s;
}
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-thumb span { font-size: 9px; padding: 4px; display: block; }
.hero-thumb:hover { opacity: .85; transform: scale(.98); }
.hero-thumb.on { opacity: 1; transform: scale(1.04); border-color: var(--accent); box-shadow: 0 8px 26px rgba(0,0,0,.6); }

/* ---------- Rangées ---------- */
.home-rows { position: relative; margin-top: -26px; z-index: 1; }
.shelf-head { align-items: center; }
.shelf-ic { width: 28px; height: 28px; border-radius: 7px; background: rgba(229,160,13,.12); color: var(--accent); display: grid; place-items: center; }
.shelf-ic .ic { width: 16px; height: 16px; }
.shelf-count { font-size: 12px; color: var(--text-3); background: var(--bg-3); padding: 1px 8px; border-radius: 10px; font-weight: 600; }
.shelf-head a { margin-left: auto; font-weight: 500; transition: color .2s, transform .2s; }
.shelf-head a:hover { transform: translateX(3px); }

/* La zone qui défile coupe tout ce qui dépasse : on lui laisse 20 px de marge au-dessus
   pour que l'affiche soulevée au survol ne soit pas rognée (compensé par la marge négative) */
.shelf-body { position: relative; margin: -14px -24px 0; }
.shelf-body .scroller { padding: 22px 24px 14px; scroll-padding: 0 24px; scroll-snap-type: x proximity; scrollbar-width: none; }
.shelf-body .scroller::-webkit-scrollbar { display: none; }
.shelf-body .scroller > * { scroll-snap-align: start; }
.shelf-arrow {
  position: absolute; top: 22px; bottom: 50px; z-index: 3; width: 46px; border: 0; cursor: pointer; color: #fff;
  display: grid; place-items: center; opacity: 0; transition: opacity .25s;
}
.shelf-arrow.left { left: 0; background: linear-gradient(90deg, var(--bg) 20%, transparent); }
.shelf-arrow.right { right: 0; background: linear-gradient(270deg, var(--bg) 20%, transparent); }
.shelf-arrow.right .ic { transform: rotate(180deg); }
.shelf-arrow .ic { width: 30px; height: 30px; transition: transform .2s var(--ease-spring, ease); }
.shelf-arrow.left:hover .ic { transform: scale(1.2); }
.shelf-arrow.right:hover .ic { transform: rotate(180deg) scale(1.2); }
.shelf-body:hover .shelf-arrow:not(.hidden) { opacity: 1; }
.shelf-arrow.hidden { pointer-events: none; }

/* Carte "Reprendre" : image = lecture, titre = fiche. Chaque zone réagit seule au survol */
.ccard { cursor: default; }
.ccard:hover .thumb, .ccard:hover .thumb img { transform: none; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.ccard:hover .hover-play { opacity: 0; }
.ccard a:hover .thumb { transform: translateY(-3px) scale(1.02); box-shadow: 0 0 0 2px var(--accent), 0 10px 26px rgba(0,0,0,.5); }
.ccard a:hover .thumb img { transform: scale(1.06); }
.ccard a:hover .hover-play { opacity: 1; }
.ccard a:hover .hover-play .ic { transform: scale(1); }
.ccard:hover .t { color: inherit; }
.ccard .t-link { display: block; width: fit-content; max-width: 100%; }
.ccard .t-link:hover { color: var(--accent); }
.scroller.wide .card .y.rem { color: var(--accent); font-size: 12px; font-weight: 600; }
.scroller.wide .card .y:not(.rem) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroller.wide .thumb { box-shadow: 0 6px 18px rgba(0,0,0,.35); }

/* Top classé : gros numéros */
.scroller.ranked { grid-auto-columns: 200px; }
.rank-wrap { position: relative; display: flex; align-items: flex-end; }
.rank {
  flex: none; width: 62px; margin-right: -14px; font-size: 118px; line-height: .78; font-weight: 900; letter-spacing: -.08em;
  color: var(--bg); -webkit-text-stroke: 2px var(--bg-4); align-self: flex-end; margin-bottom: 52px; user-select: none;
  transition: -webkit-text-stroke-color .3s;
}
.rank-wrap:hover .rank { -webkit-text-stroke-color: var(--accent); }
.rank-wrap .card { flex: 1; min-width: 0; position: relative; z-index: 1; }
.page-enter .rank-wrap { animation: pop-in .5s var(--ease-out, ease) both; animation-delay: calc(var(--i, 0) * 28ms + .08s); }
.page-enter .rank-wrap .card { animation: none; }

/* ---------- Sagas ---------- */
/* Carte de saga : effet de pile d'affiches derrière */
.saga-stack { position: relative; }
.saga-stack::before, .saga-stack::after {
  content: ''; position: absolute; left: 8%; right: 8%; top: -6px; bottom: 6px; border-radius: 6px;
  background: var(--bg-4); box-shadow: 0 2px 8px rgba(0,0,0,.4); transition: transform .3s var(--ease-out, ease);
}
.saga-stack::after { left: 4%; right: 4%; top: -3px; bottom: 3px; background: #454c52; }
.saga-stack .poster { z-index: 1; }
.saga-card:hover .saga-stack::before { transform: translateY(-6px) rotate(-3deg); }
.saga-card:hover .saga-stack::after { transform: translateY(-3px) rotate(2deg); }
.saga-count {
  position: absolute; left: 6px; bottom: 6px; z-index: 2; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 6px; border-radius: 12px; background: rgba(0,0,0,.75); color: #fff; font-size: 11.5px; font-weight: 700;
  backdrop-filter: blur(4px);
}
.saga-count .ic { width: 13px; height: 13px; color: var(--accent); }
.saga-num {
  position: absolute; left: 6px; top: 6px; z-index: 2; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  display: grid; place-items: center; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; font-weight: 800;
}
.saga-progress { height: 5px; max-width: 360px; border-radius: 3px; background: var(--bg-4); overflow: hidden; margin: -4px 0 4px; }
.saga-progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.page-enter .saga-progress i { animation: grow-x 1s var(--ease-out, ease) .3s both; transform-origin: left; }
.saga-missing .card { opacity: .55; filter: grayscale(.6); transition: opacity .25s, filter .25s; }
.saga-missing .card:hover { opacity: 1; filter: none; }
.saga-link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px; padding: 10px 14px; border-radius: 10px;
  background: rgba(229,160,13,.08); border: 1px solid rgba(229,160,13,.3); color: var(--text-2); transition: background .2s, transform .2s;
}
.saga-link b { color: var(--text); }
.saga-link > .ic:first-child { color: var(--accent); }
.saga-link > .ic:last-child { transform: rotate(180deg); width: 16px; height: 16px; color: var(--text-3); }
.saga-link:hover { background: rgba(229,160,13,.15); transform: translateX(3px); }
.btn.toggle-on { border-color: rgba(229,160,13,.5); color: var(--accent); background: rgba(229,160,13,.1); }

.home-foot { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 10px 0 20px; letter-spacing: .02em; }

@keyframes kenburns { from { transform: scale(1.12) translate(0, 0); } to { transform: scale(1.02) translate(-1.5%, -1%); } }
@keyframes hero-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 60px)); filter: blur(4px); } }
@keyframes dot-fill { from { width: 0; } to { width: 100%; } }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .hero { margin: -16px -16px 0; height: clamp(420px, 72vh, 560px); }
  .hero-content { padding: 0 18px 40px; flex-direction: column; align-items: stretch; }
  .hero-shade {
    background:
      linear-gradient(0deg, var(--bg) 0%, rgba(21,24,27,.85) 35%, rgba(21,24,27,.2) 70%),
      linear-gradient(180deg, rgba(21,24,27,.6) 0%, rgba(21,24,27,0) 20%);
  }
  .hero-overview { font-size: 14px; -webkit-line-clamp: 2; }
  .hero-play, .hero-more { height: 44px; padding: 0 18px; font-size: 15px; }
  .hero-nav { justify-content: center; }
  .hero-arrow { display: none; }
  .hero-thumbs { display: none; }
  .shelf-body { margin: -14px -16px 0; }
  .shelf-body .scroller { padding: 20px 16px 12px; }
  .shelf-arrow { display: none; }
  .scroller.ranked { grid-auto-columns: 150px; }
  .rank { font-size: 84px; width: 44px; margin-bottom: 48px; }
}
@media (max-width: 1100px) { .hero-thumbs { display: none; } }

/* Entrée de page : le bandeau apparaît en fondu, sans déplacement (évite un liseré horizontal) */
.page-enter > .hero { animation: hero-fade .6s ease both; }
@keyframes hero-fade { from { opacity: 0; } }
.ccard { position: relative; }
.continue-art { position: relative; }
.continue-close {
  position: absolute; top: -13px; right: -13px; z-index: 3;
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%; background: var(--accent); color: var(--bg);
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transform: translateY(-4px) scale(.9);
  transition: opacity .12s ease, transform .12s ease;
}
.continue-art:hover .continue-close,
.continue-art:focus-within .continue-close {
  opacity: 1; pointer-events: auto; transform: translateY(0) scale(1);
}
@media (hover: none) {
  .continue-close { opacity: 1; pointer-events: auto; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .continue-close { transition: none; } }
.continue-close:hover { background: var(--accent-2); }
.continue-close .ic { width: 12px; height: 12px; }
.continue-close:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.continue-close:disabled { opacity: .6; cursor: wait; }
