/* Mise en scène reprise de la landing de Polyptyque : titres révélés, blocs rejoués à
   l'arrivée par le bas, fenêtres flottantes, scène temporisée dans les deux sens. */
:root { --ease-out: cubic-bezier(.16,1,.3,1); }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
.reading-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 50; pointer-events: none; }
.reading-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

.title-line { display: block; overflow: clip; padding-bottom: .1em; margin-bottom: -.1em; }
.title-line > span { display: inline-block; }
.hero h1 > .title-line { color: inherit; }
.hero h1 .title-line:last-child { color: var(--accent); }
.hero h1 > span:not(.title-line) { color: var(--accent); }

/* Ouverture : trois vraies captures en fenêtres */
.hero { position: relative; isolation: isolate; }
.hero::before { content: ''; position: absolute; z-index: -2; top: 300px; left: 50%; width: min(120vw, 1500px); height: 720px; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 60%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 65%); pointer-events: none; }
.hero-stack { position: relative; height: 430px; max-width: 1060px; margin: 54px auto 0; perspective: 1400px; }
.hero-pane { position: absolute; top: 40px; width: 44%; will-change: transform; text-align: left; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: 0 30px 70px #0008; overflow: hidden; transition: scale .6s var(--ease-out), border-color .4s, box-shadow .4s; }
.hero-pane img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.pane-top { height: 30px; display: flex; justify-content: space-between; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--line); font: var(--caps); letter-spacing: .12em; color: var(--muted); }
.pane-top .win-dots i { width: 8px; height: 8px; }
/* Profondeur explicite : WebKit trie par profondeur les éléments en 3D sous une perspective,
   sans tenir compte du z-index. Les fenêtres latérales restent donc derrière dans tous les cas. */
.pane-left { left: 0; z-index: 1; transform: translateY(44px) translateZ(-80px) rotateY(14deg) rotateZ(-4deg); }
.pane-center { left: 22%; width: 56%; top: 0; z-index: 2; transform: translateZ(0); border-color: var(--accent-line); box-shadow: 0 34px 90px #000a, var(--glow); }
.pane-right { right: 0; z-index: 1; transform: translateY(44px) translateZ(-80px) rotateY(-14deg) rotateZ(4deg); }
.hero-pane { animation: window-float 6.5s ease-in-out infinite; animation-play-state: paused; }
.pane-center { animation-delay: -2.2s; animation-duration: 7.5s; }
.pane-right { animation-delay: -4.5s; animation-duration: 7s; }
.hero-stack.is-floating .hero-pane { animation-play-state: running; }
@keyframes window-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@media (hover: hover) and (pointer: fine) {
  .hero-pane:hover { scale: 1.03; border-color: var(--accent); z-index: 3; }
}
.explore-link { display: flex; align-items: center; justify-content: center; gap: 14px; width: fit-content; margin: 18px auto 0; color: var(--muted); font-size: 13px; font-weight: 600; padding: 12px 0; }
.explore-link:hover { color: var(--text); }
.explore-line { width: 1px; height: 20px; background: var(--accent); position: relative; }
.explore-line::after { content: ''; position: absolute; bottom: 0; left: -2px; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; corner-shape: round; }

/* Scène : deux modes, une interface */
.principle { padding-bottom: 0; }
.mode-story { --spread: 1; --shared: 1; margin-top: 56px; }
.story-chapters { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; color: var(--muted); font-size: 13px; font-weight: 600; }
.story-chapters > span { display: flex; align-items: center; gap: 10px; transition: color .3s; }
.story-chapters b { border: 1px solid var(--line); border-radius: 8px; padding: 4px 7px; font-size: 12px; font-weight: 800; }
.story-chapters > i { height: 1px; flex: 1; background: var(--line); }
.story-chapters .is-active { color: var(--text); }
.story-chapters .is-active b { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.mode-console { position: relative; padding: 0 26px 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent), var(--bg)); isolation: isolate; }
.console-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 20px 0; border-bottom: 1px solid var(--line); font: var(--caps); letter-spacing: .12em; color: var(--muted); }
.console-top > span:first-child { display: flex; align-items: center; gap: 12px; }
.console-summary { color: var(--accent); white-space: nowrap; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; padding-top: 28px; perspective: 1200px; }
.mode-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; box-shadow: 0 20px 50px #0007; transition: border-color .3s; --shift: 0%; --turn: 0deg; transform: translateX(calc(var(--shift) * (1 - var(--spread)))) translateY(calc(18px * (1 - var(--spread)))) rotate(calc(var(--turn) * (1 - var(--spread)))); }
.mode-desk { --shift: 27%; --turn: -3deg; z-index: 2; }
.mode-pad { --shift: -27%; --turn: 3deg; }
.mode-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 38px; padding: 0 12px; font-size: 13px; font-weight: 700; }
.mode-title b { color: var(--accent); padding-right: 6px; }
.mode-title > span:last-child { font: var(--caps); letter-spacing: .12em; color: var(--muted); }
.mode-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
/* Embranchement : un trait sous chaque capture (centre de colonne, grille à 2 colonnes et 26 px
   d'écart), une barre horizontale, puis une branche vers le centre de chacune des 4 tuiles
   (grille à 4 colonnes et 12 px d'écart : centres à 0, 1/3, 2/3 et 1 de la barre). */
.shared-links { position: relative; height: 44px; opacity: var(--shared); transform: scaleY(var(--shared)); transform-origin: top; }
.shared-links i { position: absolute; top: 0; height: 50%; width: 1px; background: linear-gradient(var(--line), var(--accent)); }
.shared-links i:first-child { left: calc((100% - 26px) / 4); }
.shared-links i:last-child { left: calc((100% - 26px) * 3 / 4 + 26px); }
.shared-links::before, .shared-links::after { content: ''; position: absolute; left: calc((100% - 36px) / 8); right: calc((100% - 36px) / 8); }
.shared-links::before { top: 50%; height: 1px; background: var(--accent); }
.shared-links::after { top: 50%; bottom: 0; background: linear-gradient(var(--accent), var(--accent)) 0 0, linear-gradient(var(--accent), var(--accent)) 33.333% 0, linear-gradient(var(--accent), var(--accent)) 66.667% 0, linear-gradient(var(--accent), var(--accent)) 100% 0; background-size: 1px 100%; background-repeat: no-repeat; }
.shared-row { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.shared-row li { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 14px; font-weight: 800; opacity: var(--shared); transform: translateY(calc(18px * (1 - var(--shared)))); }
.shared-row li small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.shared-row svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.simulation-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }
.mode-story .mode-card { transition: transform .85s var(--ease-out), border-color .3s; }
.mode-story .shared-links { transition: opacity .4s .3s, transform .55s .3s var(--ease-out); }
.mode-story .shared-row li { transition: opacity .5s calc(.45s + var(--i, 0) * .08s), transform .65s calc(.45s + var(--i, 0) * .08s) var(--ease-out); }
.shared-row li:nth-child(2) { --i: 1; } .shared-row li:nth-child(3) { --i: 2; } .shared-row li:nth-child(4) { --i: 3; }
.mode-story[data-phase=closing] .mode-card, .mode-story[data-phase=closed] .mode-card { transition: transform .85s .22s var(--ease-out), border-color .3s; }
.mode-story[data-phase=closing] .shared-links, .mode-story[data-phase=closed] .shared-links { transition: opacity .25s, transform .4s var(--ease-out); }
.mode-story[data-phase=closing] .shared-row li, .mode-story[data-phase=closed] .shared-row li { transition: opacity .25s, transform .4s var(--ease-out); }
.mode-story.is-instant * { transition: none !important; }
@media (hover: hover) and (pointer: fine) { .mode-card:hover { border-color: var(--accent-line); } }
.principle-outro { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 90px 0; border-bottom: 1px solid var(--line); }
.principle-outro > p { font-size: clamp(24px, 3.2vw, 40px); font-weight: 700; letter-spacing: -.03em; line-height: 1.2; color: var(--muted); }
.principle-outro strong { color: var(--text); font-weight: 800; }
.outro-note { font: var(--caps); line-height: 1.9; letter-spacing: .12em; color: var(--muted); white-space: nowrap; }

.faq details[open] p { animation: answer-in .3s var(--ease-out); }
@keyframes answer-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

@media (min-width: 901px) and (max-height: 759px) {
  .mode-card img { aspect-ratio: 16 / 8.2; object-position: top; }
  .console-top { padding-block: 14px; }
  .mode-grid { padding-top: 20px; }
  .shared-links { height: 32px; }
  .shared-row li { padding: 10px 12px; }
}
@media (max-width: 1000px) {
  .hero-stack { height: 360px; }
  .shared-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .outro-note { display: none; }
}
@media (max-width: 700px) {
  .hero-stack { height: 230px; margin-top: 38px; }
  .hero-pane { width: 50%; top: 30px; }
  .pane-left { left: -6%; transform: translateY(26px) translateZ(-80px) rotate(-6deg); }
  .pane-center { left: 17%; width: 66%; top: 0; }
  .pane-right { right: -6%; transform: translateY(26px) translateZ(-80px) rotate(6deg); }
  .pane-top { height: 24px; padding-inline: 8px; }
  .pane-top > span:first-child { display: none; }
  .pane-top .win-dots { margin-left: auto; }
  .explore-link { margin-top: 10px; }
  .mode-story { margin-top: 34px; }
  .story-chapters { gap: 8px; font-size: 12px; justify-content: space-between; }
  .story-chapters > span { flex-direction: column; align-items: start; gap: 7px; }
  .story-chapters > i { max-width: 24px; }
  .mode-console { padding: 0 12px 16px; }
  .console-summary { display: none; }
  .mode-grid { grid-template-columns: 1fr; gap: 14px; padding-top: 16px; }
  .shared-links { display: none; }
  .shared-row { margin-top: 14px; gap: 8px; }
  .shared-row li { padding: 10px; gap: 8px; font-size: 13px; }
  .shared-row svg { width: 20px; height: 20px; }
  .principle-outro { padding: 50px 0 60px; }
  .principle-outro > p { font-size: 25px; }
}

/* Préférence de mouvement pour la visite */
.motion-preference { display: flex; justify-content: end; padding-top: 14px; }
.motion-preference button { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; padding: 10px 13px; min-height: 38px; }
.motion-preference button::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 9px; background: var(--accent); vertical-align: middle; corner-shape: round; }
.motion-preference button[aria-pressed=true]::before { background: var(--muted); }
.motion-preference button:disabled { cursor: default; }
html.reduce-motion { scroll-behavior: auto; transition: none; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }
.reduce-motion .mode-card, .reduce-motion .shared-links, .reduce-motion .shared-row li { transform: none !important; opacity: 1 !important; }
@media (prefers-reduced-motion: reduce) {
  .mode-card, .shared-links, .shared-row li { transform: none !important; opacity: 1 !important; }
  .hero-pane { animation: none; }
}
/* Élément en attente sous l'écran : invisible, jamais à l'impression ni en mouvement réduit. */
@media screen { html:not(.reduce-motion) .is-waiting { opacity: 0; } }
