/* Madame : module « vie ». Des mouvements fins qui rendent la page vivante.
   Chargé APRÈS styles.css. Sans JavaScript, sous html.fige et en mouvement réduit,
   chaque élément garde son état final (les variables valent 0 par défaut).
   Surcharges de styles.css (même rendu au repos) : .cintre-corps, .ticket, .carte-cadeau. */

/* ---------- 1. Portant : les cintres se balancent (--balance écrite par vie.js) ---------- */
.cintre-corps { transform: rotate(calc(var(--penche, 0deg) + var(--balance, 0deg))); }

/* ---------- 7. Étiquettes des ventes privées et soldes (sous le portant) : balancement autour de l'œillet ---------- */
.ticket { transform-origin: 50% 1.45rem; }
.ticket:nth-child(odd) { transform: rotate(calc(-2deg + var(--balance, 0deg))); }
.ticket:nth-child(even) { transform: rotate(calc(1.5deg + var(--balance, 0deg))); }

/* ---------- 2. Carte cadeau : inclinaison 3D, reflet satiné, ombre qui suit ---------- */
.carte-cadeau {
  transform: perspective(900px) translateY(var(--flotte, 0px)) rotate(-4deg) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  box-shadow: var(--ox, 0px) calc(34px + var(--oy, 0px)) 50px -28px rgba(58, 34, 24, .65);
}
.carte-cadeau::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(60% 70% at var(--mx, 30%) var(--my, 20%), rgba(255, 238, 216, .75), rgba(255, 238, 216, 0) 70%),
    linear-gradient(110deg, rgba(255, 246, 232, 0) calc(var(--mx, 30%) - 30%), rgba(255, 246, 232, .35) var(--mx, 30%), rgba(255, 246, 232, 0) calc(var(--mx, 30%) + 30%));
  mix-blend-mode: soft-light; opacity: var(--brille, 0);
}

/* ---------- 3. Titres : les mots montent depuis un masque ---------- */
.vie-mot, .vie-lettre { display: inline-block; clip-path: inset(-.14em -.16em -.22em -.16em); }
.vie-mot > span, .vie-lettre > span { display: inline-block; }
.vie-lettre { clip-path: inset(-.25em -.25em -.05em -.25em); }   /* « Madame » n'a pas de jambage : masque au ras de la ligne */
.vie-titre:not(.vie-vu) .vie-mot > span { transform: translateY(125%); }
.vie-titre.vie-vu .vie-mot > span { animation: vie-monte .85s var(--doux) calc(var(--i, 0) * 50ms) both; }
@keyframes vie-monte { from { transform: translateY(var(--depart, 125%)); } to { transform: none; } }

/* ---------- 4. « Madame » : lettres une à une, puis le fil se coud ---------- */
/* en attendant vie.js, le nom reste caché ; s'il ne vient pas, il réapparaît seul */
@media (prefers-reduced-motion: no-preference) {
  .js:not(.fige) .accueil-nom:not(.vie-lettres) { opacity: 0; animation: vie-secours .6s 1.6s forwards; }
}
@keyframes vie-secours { to { opacity: 1; } }
.vie-lettres .vie-lettre > span { --depart: 135%; animation: vie-monte 1s var(--doux) calc(.12s + var(--i, 0) * 75ms) both; }
.vie-madame .fil path { animation-delay: 1.05s; animation-duration: 2s; }
/* le fil : styles.css combine pathLength="1" et vector-effect: non-scaling-stroke ; Chrome compte alors les tirets
   sur la longueur avant étirement, et le bout du fil manque. Tirets plus longs ici, valeur exacte réglée par vie.js. */
.fil path { stroke-dasharray: var(--fil-tiret, 1.5); stroke-dashoffset: var(--fil-tiret, 1.5); }
.fige .fil path { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) { .fil path { stroke-dashoffset: 0; } }

/* ---------- 5. Le ruban qui défile ---------- */
.ruban {
  position: relative; z-index: 3; margin: -1.4rem -4vw; padding: clamp(1.1rem, 1.9vw, 1.6rem) 0;
  overflow: hidden; background: var(--bordeaux); color: var(--ecru-clair);
  transform: rotate(-1.5deg); box-shadow: 0 22px 34px -24px rgba(58, 34, 24, .75);
}
/* deux lignes de couture, comme sur les bords festonnés */
.ruban::before, .ruban::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1.5px; opacity: .4;
  background: repeating-linear-gradient(90deg, var(--ecru-clair) 0 9px, transparent 9px 16px);
}
.ruban::before { top: 8px; }
.ruban::after { bottom: 8px; }
.ruban-liste { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; row-gap: .1rem; padding: 0 var(--marge); }
.ruban-liste li { display: flex; align-items: center; font: italic 300 clamp(1.9rem, 4.3vw, 3.7rem)/1.18 var(--titre); letter-spacing: -.015em; white-space: nowrap; }
/* petite étoile brodée entre les mots */
.ruban-liste li::after {
  content: ""; flex: none; width: .46em; height: .46em; margin: .06em .55em 0; background: var(--sable);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-linecap='round'%3E%3Cpath d='M4.5 4.5l15 15M19.5 4.5l-15 15' stroke-width='3'/%3E%3Cpath d='M12 5.5v13M5.5 12h13' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-linecap='round'%3E%3Cpath d='M4.5 4.5l15 15M19.5 4.5l-15 15' stroke-width='3'/%3E%3Cpath d='M12 5.5v13M5.5 12h13' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ruban-liste li:last-child::after { display: none; }
.ruban:not(.vie-ruban) .ruban-liste li { font-size: clamp(1.5rem, 3.2vw, 2.7rem); }   /* liste fixe : plus petite, deux lignes */
/* en boucle (vie.js) : une seule ligne, la liste est clonée */
.vie-ruban .ruban-piste { display: flex; width: max-content; will-change: transform; }
.vie-ruban .ruban-liste { flex: none; flex-wrap: nowrap; padding: 0; }
.vie-ruban .ruban-liste li:last-child::after { display: block; }

/* ---------- 6. Le fil de progression sous l'en-tête ---------- */
.vie-progres { position: absolute; left: 0; right: 0; bottom: -6px; height: 12px; pointer-events: none; opacity: 0; transition: opacity .35s; }
.entete.colle .vie-progres { opacity: 1; }
.vie-progres-points {
  position: absolute; left: 0; right: 0; top: 5px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--rouille) 0 7px, transparent 7px 12px);
  clip-path: inset(0 calc(100% - var(--p, 0) * (100% - 40px)) 0 0);
}
.vie-progres-rail { position: absolute; left: 0; top: 0; width: calc(100% - 40px); height: 100%; transform: translate3d(calc((var(--p, 0) - 1) * 100%), 0, 0); }
.vie-aiguille { position: absolute; left: calc(100% - 3px); top: .7px; width: 40px; height: 10.6px; overflow: visible; }
.vie-aiguille .corps { fill: var(--chocolat); }
.vie-aiguille .reflet { fill: none; stroke: var(--ecru-clair); stroke-width: .7; stroke-linecap: round; opacity: .55; }

/* ---------- 8. Photos : zoom lent au survol ---------- */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .tissu img { transition: transform 1.8s var(--doux); }
  html:not(.fige) .tissu:hover img { transform: scale(1.045); }
}

/* ---------- Mouvement réduit, états figés et états posés (captures) ---------- */
@media (prefers-reduced-motion: reduce) {
  .vie-mot > span, .vie-lettre > span { animation: none !important; transform: none !important; }
  .vie-progres, .tissu img { transition: none; }
}
.fige .vie-progres, .fige .tissu img { transition: none; }
.vie-pose .vie-mot > span, .vie-pose .vie-lettre > span { animation: none !important; }
.vie-pose .vie-progres { transition: none; }
