/* MOUSSE — « Faire grandir les possibles » : habillage de la carte (voeux-interactifs.fr) */
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-italique-latin.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('fonts/lexend-latin-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0c1114; overflow: hidden; }
body { font-family: Lexend, system-ui, sans-serif; color: #fff; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.mo { position: fixed; inset: 0; overflow: hidden; --ease: cubic-bezier(.22, .7, .2, 1); --p: 0; --leaf: #d9f2a2; -webkit-user-select: none; user-select: none; }
.mo-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 2.4s ease .1s; touch-action: none; outline: none; -webkit-tap-highlight-color: transparent; }
.is-ready .mo-canvas { opacity: 1; }
.is-fading .mo-canvas { opacity: 0; transition: opacity .8s ease; }
.mo-canvas:focus-visible { outline: 2px solid var(--leaf); outline-offset: -4px; }
.mo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* secours sans WebGL : un sous-bois stylisé et les vœux */
.mo-fallback { display: none; position: absolute; inset: 0;
  background: radial-gradient(120% 70% at 50% 62%, rgba(255, 214, 140, .5), transparent 60%), linear-gradient(180deg, #24384a 0%, #7d8a72 46%, #3c5a22 62%, #16260e 100%); }
.mo--nogl .mo-fallback { display: block; }
.mo--nogl .mo-canvas, .mo--nogl .mo-hint, .mo--nogl .mo-ring { display: none; }

/* ─── accueil ─── */
.mo-intro { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px;
  background: radial-gradient(90% 70% at 50% 46%, rgba(8, 13, 16, .5), rgba(8, 13, 16, .86)); transition: opacity 1.6s var(--ease), visibility 0s 1.6s; }
.is-started .mo-intro { opacity: 0; visibility: hidden; pointer-events: none; }
.mo-intro__eyebrow { margin: 0 0 2.2vh; font-size: 12.5px; font-weight: 400; letter-spacing: .34em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.mo-intro__title { margin: 0; max-width: 14em; font: 400 clamp(40px, 7vw, 104px)/1.04 'Instrument Serif', Georgia, serif; letter-spacing: .002em; text-wrap: balance; text-shadow: 0 2px 40px rgba(0, 0, 0, .5); }
.mo-intro__title em { font-style: italic; color: var(--leaf); }
.mo-start { position: relative; overflow: hidden; margin-top: 5.4vh; display: inline-flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 26px 0 30px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: 15px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; transition: background .4s, border-color .4s, color .4s, transform .4s var(--ease); }
.mo-start::before { content: ''; position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(var(--load, 0)); background: rgba(217, 242, 162, .22); transition: transform .5s ease, opacity .8s ease .2s; }
.mo-start:not([aria-disabled])::before { opacity: 0; }
.mo-start > * { position: relative; }
.mo-start svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease); }
.mo-start[aria-disabled] { cursor: progress; color: rgba(255, 255, 255, .72); border-color: rgba(255, 255, 255, .35); }
.mo-start[aria-disabled] svg { opacity: 0; width: 0; margin-left: -14px; }
.mo-start:not([aria-disabled]):hover, .mo-start:not([aria-disabled]):focus-visible { background: var(--leaf); border-color: var(--leaf); color: #14210a; transform: translateY(-1px); }
.mo-start:not([aria-disabled]):hover svg { transform: translateX(4px); }
.mo-start:focus-visible, .mo-hint:focus-visible, .mo-icon:focus-visible, .mo-btn:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
.mo-intro__note { display: inline-flex; align-items: center; gap: 9px; margin: 3.4vh 0 0; font-size: 12.5px; letter-spacing: .05em; color: rgba(255, 255, 255, .62); }
.mo-intro__note svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.mo-intro__note svg path:first-child { fill: currentColor; stroke: none; }

/* ─── textes du voyage ─── */
.mo-say { position: absolute; left: 50%; z-index: 3; top: max(5.2vh, 22px); width: min(92vw, 1180px); margin: 0; transform: translateX(-50%);
  text-align: center; pointer-events: none; font: 400 clamp(27px, 3.7vw, 58px)/1.14 'Instrument Serif', Georgia, serif; letter-spacing: .004em;
  text-shadow: 0 2px 30px rgba(8, 16, 22, .6), 0 1px 3px rgba(8, 16, 22, .45); text-wrap: balance; }
.mo-w { display: inline-block; opacity: 0; filter: blur(10px); transform: translateY(.35em);
  transition: opacity 1.2s var(--ease), filter 1.4s var(--ease), transform 1.5s var(--ease); transition-delay: calc(var(--i) * 120ms + 300ms); }
.mo-say.is-in .mo-w, .is-wish .mo-final__wish .mo-w { opacity: 1; filter: blur(0); transform: none; }
.mo-say:not(.is-in) .mo-w { transition-duration: .9s; transition-delay: calc(var(--i) * 35ms); }

/* ─── invitation + progression ─── */
.mo-hint { position: absolute; z-index: 4; left: 50%; bottom: max(4.4vh, 20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: inline-flex; align-items: center; min-height: 46px; padding: 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .0); background: rgba(14, 22, 20, 0); color: rgba(255, 255, 255, .95); white-space: nowrap;
  opacity: 0; visibility: hidden; transition: opacity .9s var(--ease), visibility 0s .9s, background .7s, border-color .7s; }
.is-play .mo-hint { opacity: 1; visibility: visible; transition-delay: 0s; }
.mo-hint i { position: relative; flex: none; width: 36px; height: 36px; }
.mo-hint svg { width: 36px; height: 36px; display: block; transform: rotate(-90deg); }
.mo-hint svg circle { fill: none; stroke-width: 1.6; }
.mo-hint svg .bg { stroke: rgba(255, 255, 255, .26); }
.mo-hint svg .fg { stroke: var(--leaf); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 * (1 - var(--p))); transition: stroke-dashoffset .5s ease; }
.mo-hint svg path { fill: var(--leaf); transform: rotate(90deg); transform-origin: 18px 18px; opacity: .92; }
.mo-hint span { max-width: 0; overflow: hidden; opacity: 0; font-size: 13px; font-weight: 400; letter-spacing: .16em; text-transform: uppercase;
  transition: max-width 1s var(--ease), opacity .6s, padding 1s var(--ease); }
.is-hint .mo-hint { background: rgba(14, 22, 20, .34); border-color: rgba(255, 255, 255, .34); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.is-hint .mo-hint span { max-width: 34em; opacity: 1; padding: 0 20px 0 12px; }
.is-hint .mo-hint i::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid rgba(217, 242, 162, .75); animation: moPing 2.6s ease-out infinite; }
@keyframes moPing { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }

/* curseur : l'empreinte de la touche */
.mo-ring { position: absolute; left: 0; top: 0; z-index: 2; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .3s; --d: 96px; }
.mo-ring::before { content: ''; position: absolute; width: var(--d); height: var(--d); left: calc(var(--d) / -2); top: calc(var(--d) / -2); border-radius: 50%;
  border: 1px solid rgba(226, 250, 180, .8); background: radial-gradient(circle, rgba(200, 240, 130, .12), transparent 62%); box-shadow: 0 0 22px rgba(190, 240, 120, .22);
  transition: transform .35s var(--ease), border-color .3s; }
.mo-ring::after { content: ''; position: absolute; width: 5px; height: 5px; left: -2.5px; top: -2.5px; border-radius: 50%; background: #f1ffd0; }
@media (hover: hover) and (pointer: fine) {
  .is-play.is-over .mo-ring, .is-finale.is-over .mo-ring { opacity: 1; }
  .is-play.is-over .mo-canvas, .is-finale.is-over .mo-canvas { cursor: none; }
  .is-down .mo-ring::before { transform: scale(.82); border-color: #f1ffd0; }
}

/* ─── commandes discrètes ─── */
.mo-icon { position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 7;
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .34); background: rgba(10, 20, 24, .24); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .3s, border-color .3s; }
.mo-icon:hover, .mo-icon:focus-visible { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .7); }
.mo-icon svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mo-icon svg path:first-child { fill: #fff; stroke: none; }
.mo-sound[aria-pressed="true"] .off, .mo-sound[aria-pressed="false"] .on { display: none; }

/* ─── écran final ─── */
.mo-final { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; text-align: center; pointer-events: none;
  padding: max(5.2vh, 22px) 24px max(3.4vh, 16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(26, 30, 44, .4), rgba(26, 30, 44, .1) 26%, transparent 40%, transparent 66%, rgba(22, 16, 8, .46)); opacity: 0; transition: opacity 2s ease; }
.is-wish .mo-final { opacity: 1; }
.mo-final__wish { margin: 0; max-width: min(92vw, 1180px); font: 400 clamp(27px, 3.7vw, 58px)/1.14 'Instrument Serif', Georgia, serif; letter-spacing: .004em; text-wrap: balance;
  text-shadow: 0 2px 34px rgba(30, 22, 10, .6), 0 1px 3px rgba(30, 22, 10, .45); }
.mo-final__wish .mo-w { transition-duration: 1.5s, 1.7s, 1.8s; transition-delay: calc(var(--i) * 150ms + 300ms); }
.mo-final__foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; }
.mo-final__foot > * { pointer-events: auto; }
.mo-final__title { margin: 0; font: italic 400 clamp(36px, 5.4vw, 84px)/1.05 'Instrument Serif', Georgia, serif; letter-spacing: .004em; text-shadow: 0 2px 34px rgba(30, 20, 6, .65), 0 1px 3px rgba(30, 20, 6, .5); }
.mo-final__row { margin-top: clamp(12px, 2.2vh, 24px); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 26px; }
.mo-credit { margin: clamp(8px, 1.6vh, 16px) 0 0; font-size: 11.5px; letter-spacing: .05em; color: rgba(255, 255, 255, .82); text-shadow: 0 1px 8px rgba(30, 20, 10, .7); }
.mo-credit a { color: inherit; text-decoration: none; }
.mo-credit a:hover { text-decoration: underline; }
.mo-final__title, .mo-final__row, .mo-credit { opacity: 0; transform: translateY(16px); filter: blur(6px); transition: opacity 1.8s var(--ease), transform 2s var(--ease), filter 1.8s var(--ease); }
.is-wish2 .mo-final__title, .is-wish2 .mo-final__row, .is-wish2 .mo-credit { opacity: 1; transform: none; filter: blur(0); }
.is-wish2 .mo-final__row { transition-delay: 1.1s; } .is-wish2 .mo-credit { transition-delay: 1.7s; }

.mo-btn { display: inline-flex; align-items: center; gap: 11px; min-height: 46px; padding: 0 22px 0 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .6); background: rgba(40, 30, 14, .28); color: #fff; font-size: 14px; font-weight: 500; letter-spacing: .03em; text-decoration: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .35s, border-color .35s, transform .35s var(--ease); }
.mo-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mo-btn:hover, .mo-btn:focus-visible { background: rgba(255, 244, 214, .26); border-color: #fff; transform: translateY(-1px); }

.mo-logo { --logo-h: 46px; color: #fff; filter: drop-shadow(0 1px 10px rgba(30, 20, 10, .5)); }
.mo-logo img { height: var(--logo-h); width: auto; display: block; }
.mo-logo a { display: block; }
.mo-logo__ph { display: grid; place-items: center; height: 46px; padding: 0 22px; border-radius: 10px; border: 1px dashed rgba(255, 255, 255, .8);
  font-size: 12.5px; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; text-indent: .26em; background: rgba(40, 30, 14, .2); }
.mo-noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font: 400 32px/1.2 'Instrument Serif', serif; }

@media (max-width: 640px) {
  .mo-say, .mo-final__wish { top: 9vh; font-size: clamp(26px, 7.4vw, 40px); }
  .mo-final { padding-top: 9vh; }
  .mo-hint span { font-size: 11px; letter-spacing: .1em; white-space: normal; text-align: left; line-height: 1.35; }
  .is-hint .mo-hint span { max-width: min(72vw, 22em); padding: 4px 16px 4px 10px; }
  .mo-start { min-height: 52px; font-size: 14px; }
  .mo-final__row { gap: 12px; }
}
@media (max-height: 520px) {
  .mo-intro__title { font-size: clamp(32px, 11vh, 64px); }
  .mo-start { margin-top: 4vh; min-height: 46px; }
  .mo-final__title { font-size: clamp(28px, 9vh, 48px); }
  .mo-say, .mo-final__wish { font-size: clamp(22px, 7.4vh, 36px); top: 4vh; }
  .mo-final { padding-top: 4vh; }
  .mo-credit { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mo-w, .mo-final__foot > * { transition-duration: .01s !important; transition-delay: 0s !important; filter: none !important; transform: none !important; }
  .is-hint .mo-hint i::after { animation: none; }
}
