/* Lecteur animé : boucle du hero, film de 75 s, fenêtre modale. Aucune dépendance, aucun style en ligne. */

/* Moteur de timeline : hors JavaScript, tout reste visible (état fixe défini plus bas). */
[data-loop].is-live [data-at]:not(.is-in),
.film-frame [data-at]:not(.is-in) { display: none; }
.t-ghost { visibility: hidden; }
.typed.is-typing > :first-child::after { display: inline-block; width: .09em; height: 1em; margin-left: 2px; background: currentColor; content: ""; vertical-align: -.14em; animation: caret 1s steps(1) infinite; }

/* Hero : état fixe sans JavaScript (panier prêt, paiement chez le marchand) */
[data-loop]:not(.is-live) .shop-idle,
[data-loop]:not(.is-live) .shop-done,
[data-loop]:not(.is-live) .loop-toggle,
[data-loop]:not(.is-live) .loop-captions p:not(:nth-child(3)) { display: none; }

/* Hero : animations d'entrée et appuis */
[data-loop].is-live .bubble.is-in,
[data-loop].is-live .product-chip.is-in,
[data-loop].is-live .layer.is-in { animation: pop-in .34s cubic-bezier(.2, .9, .3, 1.15) both; }
[data-loop].is-live .loop-captions p.is-in { animation: rise-in .3s ease both; }
[data-loop].is-live .relay.is-in { animation: relay-pulse 1.1s ease-in-out infinite; }
.mock-button, .pay-button { transition: transform .12s ease, background-color .12s ease, color .12s ease; }
.mock-button.is-pressed { background: var(--acid); color: var(--ink); transform: translate(2px, 2px) scale(.97); }
.pay-button.is-pressed { background: var(--acid); color: var(--ink); transform: translate(2px, 2px) scale(.97); }

/* Film : cadre */
.film { max-width: 1060px; margin-inline: auto; }
.film-host:empty { display: none; }
.film-nojs { margin: 0; padding: 18px; border: 2px dashed var(--ink); border-radius: 14px; background: var(--paper); font-weight: 700; }
.film-frame { position: relative; overflow: hidden; border: 3px solid var(--ink); border-radius: 22px; background: var(--ink); color: var(--white); box-shadow: 10px 10px 0 var(--acid); }
.film-frame:focus { outline: none; }
.film-stage { position: relative; }
.film-screen { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: var(--ink); container-type: inline-size; }
.shot { position: absolute; inset: 0; overflow: hidden; font-size: 2.1cqw; }
.shot.is-in { animation: fade-in .4s ease both; }
.film-screen img { max-width: none; }

/* Film : légende, mention et commandes */
.film-note { margin: 0; padding: 7px 16px; border-top: 1px solid rgb(255 255 255 / 14%); background: #0b1511; color: #b9c9c0; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.film-caption { display: flex; min-height: 4.4em; align-items: center; margin: 0; padding: 12px 20px; background: #0b1511; color: var(--white); font-size: clamp(.98rem, 1.5vw, 1.18rem); font-weight: 700; line-height: 1.35; }
.film-caption.is-empty { visibility: hidden; }
.film-controls { display: flex; align-items: center; gap: 8px; padding: 6px 14px 12px; background: #0b1511; }
.fc-btn { display: grid; width: 44px; height: 44px; flex: none; place-items: center; padding: 0; border: 1.5px solid rgb(255 255 255 / 40%); border-radius: 50%; background: transparent; color: var(--white); cursor: pointer; }
.fc-btn svg { width: 20px; height: 20px; fill: currentColor; }
.fc-btn:hover { border-color: var(--acid); color: var(--acid); }
.fc-play { border-color: var(--acid); background: var(--acid); color: var(--ink); }
.fc-play:hover { background: var(--white); color: var(--ink); }
.fc-range { flex: 1; min-width: 0; min-height: 44px; margin: 0 4px; accent-color: var(--acid); cursor: pointer; }
.fc-time { min-width: 5.6em; color: #b9c9c0; font-size: .82rem; font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.film-frame :focus-visible { outline-color: var(--acid); }

/* Film : appel à l'action final (hors de l'écran animé, donc lisible par les lecteurs d'écran) */
.film-end { position: absolute; z-index: 6; right: 0; bottom: 3rem; left: 0; display: grid; justify-items: center; gap: 8px; padding-inline: 16px; text-align: center; }
.film-end .button { max-width: 100%; }
.film-end p { margin: 0; color: var(--white); font-size: .9rem; font-weight: 700; }
.film-end.is-in { animation: rise-in .5s ease both; }

/* Plan 1 : le salon, 21 h 15 */
.shot-room { background: radial-gradient(60% 80% at 22% 40%, #4a3a1c 0, #1a1c16 55%, #0b1511 100%); }
.lamp { position: absolute; top: 14%; left: 14%; width: 14em; height: 14em; border-radius: 50%; background: radial-gradient(circle, rgb(255 214 120 / 38%), transparent 68%); animation: glow 4s ease-in-out infinite; }
.phone { position: absolute; top: 50%; left: 50%; display: grid; width: 10em; height: 19em; place-items: center; border: .28em solid #2c3d36; border-radius: 1.6em; background: #0f1b16; transform: translate(-50%, -50%) rotate(-4deg); box-shadow: 0 0 6em rgb(217 255 99 / 28%); }
.phone-glow { position: absolute; inset: 0; border-radius: 1.3em; background: radial-gradient(circle at 50% 40%, rgb(217 255 99 / 22%), transparent 70%); }
.phone-time { position: relative; color: var(--acid); font: 900 2.6em/1 var(--display); letter-spacing: -.04em; }

/* Plan 2 : dix onglets */
.shot-tabs { background: #e9efe6; }
.serp { position: absolute; top: 9%; left: 22%; display: grid; width: 56%; height: 82%; align-content: start; gap: 1.1em; padding: 1.6em; border: .14em solid var(--ink); border-radius: 1em; background: var(--white); }
.serp-bar { height: 2.2em; border: .12em solid var(--line); border-radius: 2em; background: var(--paper); }
.serp-line { height: 1.1em; border-radius: .3em; background: var(--line); }
.serp-line:nth-child(3) { width: 78%; }
.serp-line:nth-child(4) { width: 60%; }
.tab-card { position: absolute; top: var(--y); left: var(--x); display: grid; width: 11em; height: 7.6em; align-content: start; gap: .6em; padding: .9em; border: .14em solid var(--ink); border-radius: .9em; background: var(--card); box-shadow: .4em .4em 0 var(--ink); transform: rotate(var(--r)); animation: tab-in .32s ease both; --c: var(--acid-dark); }
.tab-card b { display: block; width: 58%; height: 1.2em; border-radius: .3em; background: var(--c); }
.tab-card u { display: block; height: .62em; border-radius: .3em; background: var(--line); }
.tab-card u + u { width: 62%; }
.tab-2, .tab-5, .tab-8 { --c: var(--coral); }
.tab-3, .tab-6, .tab-9 { --c: var(--blue); }
.tab-1 { --x: 3%; --y: 6%; --r: -6deg; }
.tab-2 { --x: 20%; --y: 54%; --r: 5deg; }
.tab-3 { --x: 40%; --y: 4%; --r: 3deg; }
.tab-4 { --x: 62%; --y: 12%; --r: -4deg; }
.tab-5 { --x: 77%; --y: 54%; --r: 6deg; }
.tab-6 { --x: 5%; --y: 62%; --r: -3deg; }
.tab-7 { --x: 50%; --y: 58%; --r: -7deg; }
.tab-8 { --x: 70%; --y: 33%; --r: 4deg; }
.tab-9 { --x: 28%; --y: 28%; --r: -5deg; }
.tab-10 { --x: 82%; --y: 5%; --r: 7deg; }

/* Plan 3 : la conversation */
.shot-chat { background: linear-gradient(135deg, #10231d 0, #1c3b30 100%); }
.shot-chat::before { position: absolute; right: -8%; bottom: -30%; width: 46%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgb(217 255 99 / 22%), transparent 70%); content: ""; }
.gpt-window { position: absolute; top: 5%; left: 11%; display: flex; width: 78%; height: 84%; flex-direction: column; overflow: hidden; border: .16em solid var(--ink); border-radius: 1em; background: var(--card); box-shadow: .7em .7em 0 var(--acid); color: var(--ink); }
.gpt-bar { display: flex; flex: none; align-items: center; gap: .5em; padding: .7em 1em; border-bottom: .14em solid var(--ink); background: var(--paper-2); }
.gpt-bar i { width: .8em; height: .8em; border: .1em solid var(--ink); border-radius: 50%; background: var(--coral); }
.gpt-bar i:nth-child(2) { background: var(--acid); }
.gpt-bar i:nth-child(3) { background: var(--mint); }
.gpt-bar b { margin-left: .6em; font-size: .78em; font-weight: 850; }
.gpt-body { position: relative; min-height: 0; flex: 1; }
.gpt-thread { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: .8em; padding: 1em 1.2em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em); mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em); font-size: .8em; }
.msg { position: relative; max-width: 78%; padding: .7em 1em; border-radius: 1.1em; font-weight: 650; line-height: 1.4; animation: pop-in .34s cubic-bezier(.2, .9, .3, 1.15) both; }
.msg p { margin: 0; }
.msg-user { align-self: flex-end; border-bottom-right-radius: .3em; background: var(--blue); color: var(--white); }
.msg-ai { display: grid; align-self: flex-start; gap: .6em; width: 100%; border-bottom-left-radius: .3em; background: #e9efe6; }
.film-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.fcard, .zoom-card { display: grid; justify-items: start; gap: .1em; padding: .6em; border: .12em solid var(--ink); border-radius: .8em; background: var(--white); animation: pop-in .34s cubic-bezier(.2, .9, .3, 1.15) both; }
.fcard strong, .zoom-card strong { font-size: .9em; line-height: 1.2; }
.fcard small, .zoom-card small { color: var(--muted); font-size: .76em; }
.fcard em, .zoom-card em { padding: 0 .6em; border-radius: 2em; background: var(--mint); font-size: .68em; font-style: normal; font-weight: 850; }
.fcard .watch, .zoom-card .watch { margin-bottom: .3em; }
.film-screen .watch { width: 2.6em; height: 2.6em; border-radius: .8em; }
.film-screen .watch i { width: 1.3em; height: 1.3em; border-width: .22em; }
.msg-cart { gap: .5em; border: .14em solid var(--ink); background: var(--acid); }
.cart-title { display: flex; align-items: center; gap: .5em; font-weight: 900; }
.cart-title span { display: grid; width: 1.4em; height: 1.4em; place-items: center; border-radius: 50%; background: var(--ink); color: var(--acid); font-size: .8em; }
.cart-line { display: flex; align-items: center; gap: .7em; }
.cart-line strong { display: block; line-height: 1.2; }
.cart-line small { color: var(--ink-2); font-size: .8em; }
.cart-line b { margin-left: auto; white-space: nowrap; }
.film-pay, .sh-pay { display: flex; align-items: center; justify-content: center; gap: .5em; padding: .6em 1em; border: .14em solid var(--ink); border-radius: 2em; background: var(--ink); color: var(--acid); font-weight: 850; text-align: center; transition: transform .12s ease, background-color .12s ease, color .12s ease; }
.film-pay.is-pressed, .sh-pay.is-pressed { background: var(--white); color: var(--ink); transform: translate(.1em, .1em) scale(.97); }
.gpt-composer { position: absolute; right: 1.2em; bottom: 1.2em; left: 1.2em; display: flex; min-height: 3.2em; align-items: center; padding: .6em 1.2em; border: .14em solid var(--ink); border-radius: 2em; background: var(--white); font-size: .82em; font-weight: 650; }
.gpt-composer::after { display: grid; width: 1.9em; height: 1.9em; flex: none; place-items: center; margin-left: auto; border-radius: 50%; background: var(--ink); color: var(--white); content: "↑"; }
.gpt-composer .typed { padding-right: 1em; }
.film-source { position: absolute; top: 34%; left: 50%; max-width: 80%; padding: .7em 1.4em; border: .14em solid var(--ink); border-radius: 2em; background: var(--acid); font-size: 1.1em; font-weight: 850; text-align: center; transform: translateX(-50%); animation: rise-in .5s ease both; }
.zoom-card { position: absolute; z-index: 3; top: 50%; left: 50%; width: 15em; padding: 1.1em; border-width: .16em; box-shadow: .6em .6em 0 var(--ink); font-size: 1.15em; transform: translate(-50%, -50%); animation: zoom-in .5s cubic-bezier(.2, .9, .3, 1.1) both; }
.zoom-card .watch { width: 5em; height: 5em; }
.zoom-card strong { font-size: 1.1em; }
.cursor { position: absolute; z-index: 5; top: 82%; left: 44%; width: 1.7em; height: 2.1em; background: var(--ink); clip-path: polygon(0 0, 0 86%, 28% 68%, 48% 100%, 64% 91%, 43% 62%, 80% 62%); filter: drop-shadow(0 0 .1em var(--white)); animation: cursor-move 1s cubic-bezier(.4, 0, .2, 1) both; }

/* Plan 4 : la boutique */
.shot-shop { background: var(--blue); }
.shop-window { position: absolute; top: 5%; left: 15%; width: 70%; height: 84%; overflow: hidden; border: .16em solid var(--ink); border-radius: 1em; background: var(--white); box-shadow: .7em .7em 0 var(--coral); color: var(--ink); }
.shop-bar { display: flex; align-items: center; justify-content: space-between; padding: .8em 1.2em; border-bottom: .14em solid var(--ink); background: var(--paper-2); }
.shop-bar b { font: 900 1.1em var(--display); letter-spacing: -.02em; }
.shop-bar span { padding: .15em .9em; border-radius: 2em; background: var(--white); font-size: .72em; font-weight: 800; }
.shop-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.4em; padding: 1.4em; }
.shop-form { display: grid; align-content: start; gap: .7em; }
.sh-label { margin: 0; font-size: .8em; font-weight: 800; }
.sh-field { padding: .7em 1em; border: .12em solid var(--line); border-radius: .7em; color: var(--muted); font-size: .85em; font-weight: 650; letter-spacing: .04em; }
.sh-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7em; }
.sh-pay { margin-top: .4em; background: var(--blue); color: var(--white); }
.shop-summary { display: grid; align-content: start; justify-items: start; gap: .3em; padding: 1.1em; border: .12em solid var(--line); border-radius: .9em; background: var(--paper); }
.shop-summary small { color: var(--muted); }
.shop-summary b { margin-top: .6em; font-size: 1.1em; }
.shop-done { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: .3em; background: var(--white); text-align: center; animation: fade-in .35s ease both; }
.shop-done strong { margin-top: .5em; font: 900 2em/1.1 var(--display); letter-spacing: -.03em; }
.shop-done small { color: var(--muted); font-size: 1em; font-weight: 700; }
.done-badge { display: grid; width: 2.6em; height: 2.6em; place-items: center; border: .12em solid var(--ink); border-radius: 50%; background: var(--acid); font-size: 2em; font-weight: 900; }

/* Plan 5 : la nouvelle commande chez le marchand */
.shot-admin { background: #d8dcff; }
.admin { position: absolute; top: 5%; left: 15%; display: flex; width: 70%; height: 84%; overflow: hidden; border: .16em solid var(--ink); border-radius: 1em; background: var(--white); box-shadow: .7em .7em 0 var(--ink); color: var(--ink); }
.admin-side { display: grid; width: 15%; align-content: start; gap: 1em; padding: 1.4em 1em; background: var(--ink); }
.admin-side i { display: block; height: .8em; border-radius: .3em; background: rgb(255 255 255 / 30%); }
.admin-side i:first-child { background: var(--acid); }
.admin-main { display: flex; flex: 1; flex-direction: column; gap: .8em; padding: 1.4em; }
.admin-main h4 { order: -2; margin: 0 0 .3em; font: 900 1.5em var(--display); letter-spacing: -.03em; }
.admin-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 1em; padding: 1em; border: .12em solid var(--line); border-radius: .8em; }
.admin-row i { height: .7em; border-radius: .3em; background: var(--line); }
.admin-new { order: -1; display: grid; grid-template-columns: 1fr; gap: .2em; border-color: var(--ink); background: var(--acid); box-shadow: .3em .3em 0 var(--ink); animation: slide-in .5s cubic-bezier(.2, .9, .3, 1.1) both; }
.admin-new strong { font-size: 1.15em; }
.admin-new small { font-size: .9em; font-weight: 700; }

/* Plans 6 et 7 : fondu, trois mots, écran final */
.film-fade { position: absolute; z-index: 5; inset: 0; background: var(--ink); animation: fade-in 1s linear both; }
.shot-words { display: flex; flex-direction: column; justify-content: center; gap: .3em; padding-inline: 8%; background: var(--ink); }
.shot-words p { margin: 0; color: var(--white); font: 900 4.4em/1.05 var(--display); letter-spacing: -.05em; animation: rise-in .5s ease both; }
.shot-words p:nth-child(2) { color: var(--acid); }
.shot-words p:nth-child(3) { color: var(--coral); }
.shot-final { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6em; padding: 0 6% 7em; background: radial-gradient(50% 60% at 50% 45%, #1f4a39 0, var(--ink) 100%); text-align: center; }
.shot-final img { width: 11em; height: auto; }
.final-title { margin: 0; font: 900 3.2em/1.04 var(--display); letter-spacing: -.05em; text-wrap: balance; }
.final-title em { color: var(--acid); font-style: normal; }

/* Fenêtre modale */
body.modal-open { overflow: hidden; }
.film-modal { width: min(1120px, 96vw, calc((100dvh - 18rem) * 16 / 9 + 6px)); max-width: none; max-height: 96dvh; margin: auto; padding: 0; overflow: auto; border: 3px solid var(--ink); border-radius: 22px; background: var(--ink); color: var(--white); }
.film-modal::backdrop { background: rgb(9 23 19 / 84%); backdrop-filter: blur(4px); }
.film-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px 12px; }
.film-modal .film-modal-head h2 { margin: 0; color: var(--white); font-size: clamp(1.05rem, 1.8vw, 1.35rem); line-height: 1.1; }
.film-modal .film-modal-head .kicker { margin: 0 0 4px; font-size: .68rem; }
.film-modal-close { display: grid; width: 44px; height: 44px; flex: none; place-items: center; border: 1.5px solid rgb(255 255 255 / 45%); border-radius: 50%; background: transparent; color: var(--white); cursor: pointer; font-size: 1.7rem; line-height: 1; }
.film-modal-close:hover { border-color: var(--acid); color: var(--acid); }
.film-modal :focus-visible { outline-color: var(--acid); }
.film-modal .film-frame { border: 0; border-radius: 0; box-shadow: none; }

@keyframes pop-in { from { opacity: 0; transform: translateY(.6em) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(.5em); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tab-in { from { opacity: 0; transform: translateY(1em) rotate(var(--r)) scale(.9); } to { opacity: 1; transform: rotate(var(--r)); } }
@keyframes zoom-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.85); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-1em); } to { opacity: 1; transform: none; } }
@keyframes cursor-move { from { top: 56%; left: 70%; } to { top: 82%; left: 44%; } }
@keyframes glow { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes relay-pulse { 0%, 100% { box-shadow: 0 0 0 7px rgb(217 255 99 / 18%); } 50% { box-shadow: 0 0 0 14px rgb(217 255 99 / 4%); } }

/* Format vertical : la scène passe en 4:5 */
@media (max-width: 700px) {
  .film-frame { border-radius: 16px; box-shadow: 6px 6px 0 var(--acid); }
  .film-screen { aspect-ratio: 4 / 5; }
  .shot { font-size: 4.2cqw; }
  .film-controls { flex-wrap: wrap; row-gap: 0; }
  .fc-range { order: 5; flex-basis: 100%; margin: 0; }
  .fc-time { margin-left: auto; }
  .film-end { bottom: 2.6rem; }
  .film-end .button { padding-inline: 18px; font-size: .92rem; }

  .phone { height: 20em; }
  .serp { left: 8%; width: 84%; }
  .tab-card { width: 8.6em; height: 6.6em; }
  .tab-1 { --x: 4%; --y: 4%; }
  .tab-2 { --x: 52%; --y: 52%; }
  .tab-3 { --x: 44%; --y: 6%; }
  .tab-4 { --x: 8%; --y: 22%; }
  .tab-5 { --x: 8%; --y: 60%; }
  .tab-6 { --x: 56%; --y: 28%; }
  .tab-7 { --x: 30%; --y: 40%; }
  .tab-8 { --x: 50%; --y: 76%; }
  .tab-9 { --x: 14%; --y: 80%; }
  .tab-10 { --x: 62%; --y: 14%; }

  .gpt-window, .shop-window, .admin { left: 4%; width: 92%; }
  .gpt-window { top: 4%; height: 90%; }
  .shop-window, .admin { height: 74%; }
  .gpt-thread { gap: .6em; padding: .8em; }
  .msg { max-width: 92%; }
  .film-cards { grid-template-columns: 1fr; gap: .4em; }
  .fcard { grid-template-columns: auto 1fr auto; align-items: center; justify-items: start; column-gap: .7em; padding: .4em .6em; }
  .fcard .watch { grid-row: span 2; margin: 0; }
  .fcard em { grid-row: span 2; grid-column: 3; }
  .film-source { top: 30%; font-size: 1em; }
  .zoom-card { width: 14em; }
  .cursor { animation-name: cursor-move-vertical; }
  .shop-cols { grid-template-columns: 1fr; gap: .8em; padding: 1em; }
  .shop-summary { grid-row: 1; }
  .admin-side { width: 12%; padding: 1em .5em; }
  .shot-words p { font-size: 2.6em; }
  .shot-final { padding-bottom: 8em; }
  .final-title { font-size: 2.2em; }
  .shot-final img { width: 8em; }
}
@keyframes cursor-move-vertical { from { top: 62%; left: 60%; } to { top: 85%; left: 40%; } }

@media (prefers-reduced-motion: reduce) {
  .shot.is-in, .msg, .fcard, .zoom-card, .film-source, .tab-card, .cursor, .shop-done, .admin-new, .film-fade, .film-end.is-in,
  .shot-words p, .lamp, .typed.is-typing > :first-child::after,
  [data-loop].is-live .bubble.is-in, [data-loop].is-live .product-chip.is-in, [data-loop].is-live .layer.is-in,
  [data-loop].is-live .loop-captions p.is-in, [data-loop].is-live .relay.is-in { animation: none; }
  .film-pay, .sh-pay, .mock-button, .pay-button { transition: none; }
}
