@import url(fonts/polices.css);

:root { --encre: #17130f; --creme: #fbf1e2; --klein: #2346e0; --ressort: cubic-bezier(.3, 1.6, .5, 1); }
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: Archivo, system-ui, sans-serif; color: var(--encre); background: var(--fond, #7f7cff);
  touch-action: none; overscroll-behavior: none; -webkit-font-smoothing: antialiased; user-select: none;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--creme); outline-offset: 3px; box-shadow: 0 0 0 6px var(--encre); }

/* Rideau : fondu à l'arrivée, violet au départ */
body::after { content: ''; position: fixed; inset: 0; z-index: 50; background: #7f7cff; pointer-events: none; animation: arrivee .5s ease .05s both; }
@keyframes arrivee { from { opacity: 1; } to { opacity: 0; } }
html.depart body::after { animation: none; opacity: 1; transition: opacity .38s ease; }

/* Entête */
.entete {
  position: fixed; inset: 0 0 auto; z-index: 10; max-width: 620px; margin: auto; padding: 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(12px, 5vw, 64px);
}
.entete > :first-child { justify-self: end; }
.entete > :last-child { justify-self: start; }
.lien {
  font: 700 16px/1 Archivo, sans-serif; color: inherit; text-decoration: none; background: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 99px; padding: 9px 18px; transition: border-color .2s;
}
.lien:hover, .lien[aria-current] { border-color: currentColor; }
.logo { display: flex; color: inherit; text-decoration: none; font-weight: 900; font-stretch: 125%; font-size: 40px; line-height: .8; letter-spacing: -.04em; }
.logo span { display: inline-block; transition: transform .3s var(--ressort); }
.logo span:nth-child(odd) { transform: translateY(-3px) rotate(-5deg); }
.logo span:nth-child(even) { transform: translateY(3px) rotate(4deg); }
.logo:hover span { transform: none; }

/* Accueil */
.accueil { --fond: #7f7cff; color: var(--creme); }
#decor { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.une { position: fixed; inset: 0; z-index: 5; display: grid; place-content: start center; gap: 22px; padding-top: max(110px, 15vh); text-align: center; pointer-events: none; }
.une h1 { font-weight: 900; font-stretch: 125%; font-size: clamp(72px, 12vw, 170px); line-height: .8; letter-spacing: -.05em; text-shadow: .03em .04em 0 var(--encre); }
.une h1 span { display: inline-block; animation: saut .8s var(--ressort) calc(.25s + var(--i) * .07s) both; }
.une h1 span:nth-child(odd) { rotate: -4deg; }
.une h1 span:nth-child(even) { rotate: 3deg; translate: 0 .04em; }
@keyframes saut { from { opacity: 0; transform: translateY(.4em) scale(.5); } }
.une p { font: 26px/1.1 'Patrick Hand', cursive; animation: saut .8s var(--ressort) .8s both; }
.bouton {
  pointer-events: auto; justify-self: center; text-decoration: none; cursor: pointer; border: 0;
  font: 800 clamp(22px, 2.6vw, 32px)/1 Archivo, sans-serif; color: var(--creme); background: var(--encre);
  border-radius: 99px; padding: 16px 30px 18px; transition: transform .25s var(--ressort);
  animation: saut .8s var(--ressort) 1s both;
}
.bouton:hover { transform: scale(1.06) rotate(-2deg); }
.macaron { position: fixed; z-index: 4; right: max(16px, 6vw); top: 26vh; width: clamp(96px, 11vw, 150px); }
.macaron .anneau { transform-box: fill-box; transform-origin: center; animation: tourne 16s linear infinite; }
@keyframes tourne { to { rotate: 1turn; } }
.plonge :is(.une, .macaron, .entete) { opacity: 0; scale: 1.25; transition: opacity .45s ease, scale .8s cubic-bezier(.5, 0, .8, .2); }

/* Pastille du bas (chapitres + lecteur) */
.pastille {
  position: fixed; left: 50%; bottom: max(24px, 5vh); z-index: 10; translate: -50% 0;
  display: flex; align-items: center; gap: 14px; width: min(440px, calc(100vw - 32px));
  background: var(--encre); color: var(--creme); border-radius: 99px; padding: 10px 24px 10px 12px;
}
.pastille h1 { font: 800 19px/1.1 Archivo, sans-serif; letter-spacing: -.01em; }
.pastille small { display: block; font: 500 14px/1.3 Archivo, sans-serif; opacity: .75; margin-top: 2px; }
.pastille .texte { flex: 1; min-width: 0; }
.pastille button { background: none; border: 0; color: inherit; cursor: pointer; display: grid; place-items: center; border-radius: 99px; }
.pastille button:disabled { opacity: .3; cursor: default; }
#lire { width: 58px; height: 58px; transition: transform .2s var(--ressort); }
#lire:not(:disabled):hover { transform: scale(1.12); }
#lire .cadenas, #lire.verrou .jouer { display: none; }
#lire.verrou .cadenas { display: block; }
#lire:disabled { opacity: 1; }
.fleches { display: flex; gap: 2px; }
.fleches button { width: 34px; height: 34px; }
#vignette canvas { display: block; width: 46px; height: 46px; border-radius: 6px; }
.piste { height: 4px; border-radius: 4px; background: rgb(251 241 226 / .25); margin-top: 8px; overflow: hidden; }
#barre { height: 100%; background: var(--creme); transform-origin: left; transform: scaleX(0); }

/* Lecteur */
.lecteur { --fond: #ff7a1a; }
.astuce { font: 18px/1 'Patrick Hand', cursive; opacity: .8; margin-top: 4px; }
html.lu .astuce { display: none; }
html:not(.lu) .piste { display: none; }
.fin { position: fixed; right: max(16px, 6vw); top: 50%; translate: 0 -50%; z-index: 9; opacity: 0; scale: .7; pointer-events: none; transition: opacity .3s, scale .4s var(--ressort); animation: none; }
html.fini .fin { opacity: 1; scale: 1; pointer-events: auto; }
#repli { display: none; }
.no3d #repli { position: fixed; inset: 90px 0 120px; display: flex; gap: 32px; padding: 0 16px; overflow-x: auto; touch-action: pan-x; }
.no3d #repli canvas { height: 100%; width: auto; }

/* À propos */
dialog {
  border: 0; border-radius: 28px; padding: 32px; max-width: min(520px, calc(100vw - 32px));
  background: var(--creme); color: var(--encre); box-shadow: 8px 10px 0 var(--encre); user-select: text;
}
dialog::backdrop { background: rgb(23 19 15 / .55); }
dialog h2 { font-weight: 900; font-stretch: 125%; font-size: 34px; letter-spacing: -.03em; margin-bottom: 14px; }
dialog p { font-size: 17px; line-height: 1.5; margin-bottom: 12px; }
dialog a { color: var(--klein); font-weight: 700; }
dialog .bouton { animation: none; font-size: 18px; padding: 12px 22px; margin-top: 8px; }

@media (max-width: 640px) {
  .lien { padding: 8px 10px; font-size: 15px; }
  .logo { font-size: 30px; }
  .macaron { top: 44vh; right: 16px; }
  .fin { top: auto; bottom: calc(max(24px, 5vh) + 90px); right: 50%; translate: 50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
