/* ─────────────────────────────────────────────────────────────────────────────
   Section 5 · Retoucher — styles, réglages, export Lightroom (.xmp).
   S'appuie sur sections.css (.sx, .sx__head--col, .gp, .go, .rv). Tout est
   rangé sous #retoucher : aucune règle ne déborde sur le reste de la page.

   Ordinateur (901px et plus) : UN ÉCRAN. La section prend au moins la hauteur
   de l'écran, contenu centré entre la place du menu (88px en haut : il revient
   par-dessus quand on remonte) et 24px en bas. À gauche : pastille, titre,
   chapeau, puis les trois points et le lien. À droite : le comparateur, les
   styles, les réglages, puis la planche du reportage et le dossier .zip.
   La largeur du visuel suit la HAUTEUR de l'écran (--rt-vw) : comparateur
   (3/2) + styles + réglages + planche (6 × 2, 3/2) tiennent dans
   100svh − 112px. Le texte prend le reste de la largeur.
   Téléphone (900px et moins) : pastille, titre, chapeau ; le comparateur en
   3/2 ; les styles en rangée qui glisse au doigt ; les réglages ; la planche,
   puis le dossier en bandeau ; les points et le lien.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Ordinateur : la section tient sur un écran ──────────────────────────── */
@media(min-width:901px){
  #retoucher{display:flex;flex-direction:column;justify-content:center;min-height:100vh;min-height:100svh;padding-top:88px;padding-bottom:24px;
    /* Visuel : hauteur = 0,889 × largeur + 58px (mesuré) ≤ 100vh − 112px. */
    --rt-vw:min(57%,max(440px,calc((100vh - 171px) * 1.125)))}
  @supports(height:100svh){#retoucher{--rt-vw:min(57%,max(440px,calc((100svh - 171px) * 1.125)))}}
  #retoucher>.sx__in{width:100%}
  #retoucher .rt-corps{grid-template-columns:minmax(0,1fr) var(--rt-vw);grid-template-rows:auto 1fr;row-gap:0}
  #retoucher .rt-tete{grid-column:1;grid-row:1;max-width:660px}
  #retoucher .rt-suite{grid-column:1;grid-row:2;align-self:start;max-width:620px;margin-top:clamp(18px,3.4vh,34px)}
  #retoucher .rt-vis{grid-column:2;grid-row:1/span 2;align-self:start}
  /* Le titre reste grand, mais suit aussi la hauteur de l'écran. */
  #retoucher .sx__head--col{gap:clamp(12px,2vh,18px)}
  #retoucher .sx__head--col h2{font-size:min(clamp(36px,3.9vw,64px),7.6vh)}
  #retoucher .gp{margin-bottom:clamp(10px,1.8vh,16px)}
  #retoucher .sx__ch{font-size:min(clamp(17px,1.3vw,20px),2.7vh)}
}
/* Entre 901 et 1180px : un visuel un peu plus étroit, pour que le texte respire. */
@media(min-width:901px) and (max-width:1180px){
  #retoucher{--rt-vw:min(52%,max(420px,calc((100vh - 171px) * 1.125)))}
  @supports(height:100svh){#retoucher{--rt-vw:min(52%,max(420px,calc((100svh - 171px) * 1.125)))}}
}
#retoucher .sx__ch{text-wrap:pretty}

/* ── Le comparateur .cmp ─────────────────────────────────────────────────────
   La photo AVANT dessous, l'APRÈS dessus, découpé par clip-path à --x (la
   position de la poignée, de 0 à 100 %). Les deux calques ont la même
   géométrie (hauteur 100 %, centrés). */
#retoucher .cmp{--x:50%;position:relative;aspect-ratio:3/2;overflow:hidden;isolation:isolate;border-radius:var(--r-ecran);background:#2A211C;
  box-shadow:var(--ombre-ecran),0 0 0 1px rgba(43,24,16,.08);
  /* Le défilement vertical reste au navigateur ; les gestes horizontaux
     déplacent la poignée. */
  touch-action:pan-y;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;cursor:ew-resize}
#retoucher .cmp__img,#retoucher .cmp__ap canvas{position:absolute;top:0;left:50%;height:100%;width:auto;aspect-ratio:3/2;max-width:none;transform:translateX(-50%);display:block;pointer-events:none}
#retoucher .cmp__ap{position:absolute;inset:0;z-index:1;clip-path:inset(0 0 0 var(--x));pointer-events:none}
#retoucher .cmp__ap canvas{z-index:0;opacity:0;transition:opacity .25s ease}
#retoucher .cmp__ap canvas.on{z-index:2;opacity:1}
#retoucher .cmp__ap canvas.prec{z-index:1;opacity:1;transition:none}

/* Étiquettes AVANT / APRÈS : elles s'effacent quand la poignée les couvre. */
#retoucher .cmp__lab{position:absolute;top:14px;z-index:2;padding:7px 11px 6px;border-radius:100px;background:rgba(20,17,15,.66);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  font:600 12px/1 var(--m);letter-spacing:.14em;text-transform:uppercase;color:#fff;pointer-events:none;transition:opacity .2s ease}
#retoucher .cmp__lab--av{left:14px}
#retoucher .cmp__lab--ap{right:14px}
#retoucher .cmp__lab.off{opacity:0}

/* La poignée : une bande de 44px sur toute la hauteur (zone de glisse), un
   trait blanc de 2px et un rond de 44px. */
#retoucher .cmp__poi{position:absolute;top:0;bottom:0;left:var(--x);z-index:3;width:44px;margin-left:-22px;touch-action:none;cursor:ew-resize}
#retoucher .cmp__poi::before{content:'';position:absolute;top:0;bottom:0;left:50%;width:2px;margin-left:-1px;background:#fff;box-shadow:0 0 0 .5px rgba(20,17,15,.18),0 0 14px rgba(0,0,0,.35)}
/* Orange foncé sous les flèches blanches : 3,4:1 (l'orange vif n'en fait que 2,7). */
#retoucher .cmp__rond{position:absolute;top:50%;left:50%;width:44px;height:44px;margin:-22px 0 0 -22px;display:grid;place-items:center;border-radius:50%;
  background:var(--acc-d);border:2px solid #fff;color:#fff;box-shadow:0 10px 24px -8px rgba(0,0,0,.6);transition:transform .2s cubic-bezier(.2,.8,.2,1)}
#retoucher .cmp__rond svg{display:block}
#retoucher .cmp.tire .cmp__rond{transform:scale(1.08)}
@media(hover:hover){
  #retoucher .cmp__poi:hover .cmp__rond{transform:scale(1.08)}
  #retoucher .rt-styles button:hover{border-color:#FFD2A8}
}
#retoucher .cmp__rond:focus-visible{outline:3px solid #fff;outline-offset:3px;box-shadow:0 0 0 7px var(--acc-t),0 10px 24px -8px rgba(0,0,0,.6)}

/* Sans JavaScript, ou si la photo ne peut pas être calculée : la photo
   d'origine seule (étiquetée AVANT sans JavaScript), sans poignée ni styles. */
html:not(.js) #retoucher .cmp__ap,html:not(.js) #retoucher .cmp__lab--ap,html:not(.js) #retoucher .cmp__poi,
#retoucher.rt--repli .cmp__ap,#retoucher.rt--repli .cmp__lab,#retoucher.rt--repli .cmp__poi{display:none}
html:not(.js) #retoucher .cmp,#retoucher.rt--repli .cmp{cursor:default}
html:not(.js) #retoucher .rt-rang,html:not(.js) #retoucher .rt-val,#retoucher.rt--repli .rt-rang,#retoucher.rt--repli .rt-val{display:none}

/* ── Les styles ──────────────────────────────────────────────────────────── */
#retoucher .rt-rang{display:flex;align-items:center;margin-top:12px}
#retoucher .rt-defile{min-width:0}
#retoucher .rt-styles{display:flex;gap:8px}
#retoucher .rt-styles button{-webkit-appearance:none;appearance:none;flex:none;min-height:40px;margin:0;padding:0 17px;border:1px solid var(--line);border-radius:100px;background:#fff;
  font:600 15px/1 var(--s);letter-spacing:-.01em;color:var(--ink);white-space:nowrap;cursor:pointer;transition:background-color .2s,border-color .2s,color .2s}
#retoucher .rt-styles button[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:#fff;cursor:default}
@media(pointer:coarse){#retoucher .rt-styles button{min-height:44px}}

/* ── Les réglages de la photo (ceux qu'écrit son .xmp) ───────────────────── */
#retoucher .rt-val{display:flex;flex-wrap:wrap;align-items:center;gap:4px 16px;margin-top:10px;min-height:22px;font-size:14px;line-height:1.3;color:var(--soft)}
#retoucher .rt-val__ico{flex:none;margin-right:-4px;fill:#FFF1E4;stroke:var(--acc-t);stroke-width:1.8;stroke-linecap:round}
#retoucher .rt-val__i{white-space:nowrap}
#retoucher .rt-val b{display:inline-block;margin-left:2px;padding:1px 4px;border-radius:5px;font:600 14px/1.2 var(--m);font-variant-numeric:tabular-nums;color:var(--ink)}
#retoucher .rt-val b.chg{animation:rt-chg 1.1s cubic-bezier(.2,.8,.2,1)}
@keyframes rt-chg{0%,25%{background:rgba(249,119,8,.2);color:var(--acc-t)}100%{background:rgba(249,119,8,0)}}
/* Ordinateur : TOUJOURS une seule ligne (la hauteur du visuel en dépend).
   Largeur naturelle : 605px en français, 596px en anglais (14px, écarts de
   16px) ; en dessous, écarts puis corps resserrés, selon la largeur du visuel. */
@media(min-width:901px){
  #retoucher .rt-vis{container:rt-vis/inline-size}
  #retoucher .rt-val{flex-wrap:nowrap}
  @container rt-vis (max-width:640px){#retoucher .rt-val{column-gap:10px}}
  @container rt-vis (max-width:600px){#retoucher .rt-val{column-gap:8px;font-size:13px}#retoucher .rt-val b{font-size:13px}}
  @container rt-vis (max-width:550px){#retoucher .rt-val{column-gap:7px;font-size:12.5px}#retoucher .rt-val b{font-size:12.5px;padding:1px 2px}#retoucher .rt-val__ico{display:none}}
  @container rt-vis (max-width:500px){#retoucher .rt-val{flex-wrap:wrap}}
}

/* ── La planche du reportage et le dossier .zip ─────────────────────────────
   Douze vignettes en 6 × 2, découpées dans une seule image (fond CSS : lisible
   sans JavaScript). retoucher.js pose par-dessus, dans chaque vignette, une
   toile par style ; la vague les allume l'une après l'autre. La vignette
   cerclée d'encre est la photo du comparateur. */
#retoucher .rt-film{position:relative;display:flex;gap:12px;margin-top:14px}
#retoucher .rt-planche{flex:1;min-width:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
#retoucher .rt-vg{position:relative;display:block;aspect-ratio:3/2;border-radius:6px;overflow:hidden;
  background:#2A211C url(../photos/anim-retoucher-planche.webp) no-repeat;background-size:600% 200%;background-position:calc(var(--c) * 20%) calc(var(--r) * 100%)}
#retoucher .rt-vg canvas{position:absolute;inset:0;z-index:0;display:block;width:100%;height:100%;opacity:0;transition:opacity .45s ease}
#retoucher .rt-vg canvas.on{z-index:2;opacity:1}
#retoucher .rt-vg canvas.prec{z-index:1;opacity:1;transition:none}
/* Le passage de la vague : un liseré orange et un reflet qui traverse. */
#retoucher .rt-vg::after{content:'';position:absolute;inset:0;z-index:3;border-radius:inherit;opacity:0;pointer-events:none;
  box-shadow:inset 0 0 0 2px var(--acc);background:linear-gradient(105deg,rgba(255,255,255,0) 35%,rgba(255,255,255,.55) 50%,rgba(255,255,255,0) 65%) no-repeat;background-size:260% 100%;background-position:130% 0}
#retoucher .rt-vg.onde::after{animation:rt-onde .75s cubic-bezier(.3,.6,.3,1)}
@keyframes rt-onde{0%{opacity:1;background-position:130% 0}70%{opacity:1}100%{opacity:0;background-position:-30% 0}}
/* La photo du comparateur. */
#retoucher .rt-vg--ici{overflow:visible}
#retoucher .rt-vg--ici::before{content:'';position:absolute;inset:-3px;z-index:4;border:2px solid var(--ink);border-radius:8px;pointer-events:none}
#retoucher .rt-vg--ici canvas{border-radius:6px}

/* Le dossier : « picktur-xmp.zip », un .xmp par photo, téléchargé d'un coup. */
#retoucher .rt-zip{flex:0 0 166px;display:grid;grid-template-columns:auto 1fr;grid-template-rows:1fr auto;align-items:center;column-gap:8px;row-gap:4px;
  padding:10px 12px 11px 13px;border:1px solid var(--line);border-radius:14px;background:#fff;box-shadow:0 24px 50px -40px rgba(43,24,16,.35)}
#retoucher .rt-zip__ico{grid-row:1;grid-column:1;display:block;width:44px;height:36px;transform-origin:50% 70%}
#retoucher .rt-zip__ico svg{display:block;overflow:visible}
#retoucher .rt-zip__dos{fill:#FFF1E4;stroke:var(--acc-t);stroke-width:1.7;stroke-linejoin:round}
#retoucher .rt-zip__dents{fill:none;stroke:var(--acc-t);stroke-width:2.6;stroke-linecap:round}
#retoucher .rt-zip__ok{opacity:0;transform:scale(.4);transform-origin:36px 28px;transition:opacity .25s,transform .35s cubic-bezier(.3,1.6,.5,1)}
#retoucher .rt-zip__ok circle{fill:var(--acc);stroke:#fff;stroke-width:1.6}
#retoucher .rt-zip__ok path{fill:none;stroke:var(--ink);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#retoucher .rt-zip--plein .rt-zip__ok{opacity:1;transform:none}
#retoucher .rt-zip__ico.recoit{animation:rt-recoit .32s cubic-bezier(.3,1.5,.5,1)}
@keyframes rt-recoit{40%{transform:scale(1.1) rotate(-2deg)}}
#retoucher .rt-zip__c{grid-row:1;grid-column:2;justify-self:end;white-space:nowrap;font:600 13px/1 var(--m);color:var(--soft)}
#retoucher .rt-zip__n{font:600 24px/1 var(--m);font-variant-numeric:tabular-nums;letter-spacing:-.02em;color:var(--ink)}
#retoucher .rt-zip__nom{grid-row:2;grid-column:1/-1;display:flex;align-items:center;gap:5px;min-width:0;font:600 12px/1.3 var(--m);letter-spacing:.01em;color:var(--soft);white-space:nowrap;overflow:hidden}
#retoucher .rt-zip__nom svg{flex:none;fill:none;stroke:var(--acc-t);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
/* Les .xmp en vol, de chaque vignette vers le dossier. */
#retoucher .rt-jeton{position:absolute;left:0;top:0;z-index:6;padding:4px 7px 5px;border:1px solid var(--line);border-radius:7px;background:#fff;box-shadow:0 8px 16px -8px rgba(43,24,16,.5);
  font:600 12px/1 var(--m);color:var(--ink);white-space:nowrap;pointer-events:none;opacity:0;will-change:transform,opacity}
#retoucher .rt-jeton::before{content:'';display:inline-block;width:6px;height:6px;margin:0 5px 1px 0;border-radius:2px;background:var(--acc);vertical-align:middle}

/* ── Les trois points ────────────────────────────────────────────────────── */
#retoucher .rt-points{list-style:none;margin:0;padding:0}
#retoucher .rt-points li{display:grid;grid-template-columns:32px minmax(0,1fr);column-gap:14px;align-items:start;padding:clamp(9px,1.6vh,14px) 0;border-top:1px solid var(--line)}
#retoucher .rt-points li:last-child{border-bottom:1px solid var(--line)}
#retoucher .rt-points h3{grid-column:2;font-size:17px;font-weight:600;line-height:1.3;letter-spacing:-.02em;color:var(--ink);text-wrap:balance}
#retoucher .rt-points p{grid-column:2;margin-top:2px;font-size:15.5px;line-height:1.45;color:var(--soft);text-wrap:pretty}
#retoucher .rt-ico{grid-row:1/span 2;grid-column:1;display:grid;place-items:center;width:32px;height:32px;margin-top:2px;border-radius:10px;background:#FFF1E4;color:var(--acc-t)}
#retoucher .rt-ico svg{display:block;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#retoucher .rt-ico .rt-ico__p{fill:currentColor;fill-opacity:.22;stroke:none}
#retoucher .rt-micro{margin-top:clamp(10px,1.8vh,16px);font-size:15px;line-height:1.45;color:var(--soft);text-wrap:pretty}
#retoucher .rt-suite>.go{margin-top:clamp(14px,2.6vh,24px)}

/* ── Téléphone ───────────────────────────────────────────────────────────── */
@media(max-width:900px){
  /* Compact : la section tient en un écran et demi au plus. */
  #retoucher{--sx-y:56px}
  #retoucher .rt-corps{row-gap:22px}
  #retoucher .sx__head--col{gap:12px}
  /* Les styles glissent au doigt dans leur seul conteneur, avec un fondu au
     bord droit (la marge intérieure laisse le dernier bouton sortir du fondu). */
  #retoucher .rt-rang{margin-top:12px}
  #retoucher .rt-defile{flex:1;margin:-6px calc(-1 * var(--pad)) -6px -6px;padding:6px calc(var(--pad) + 24px) 6px 6px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;
    -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 40px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 40px),transparent)}
  #retoucher .rt-defile::-webkit-scrollbar{display:none}
  #retoucher .rt-defile.fin{-webkit-mask-image:none;mask-image:none}
  #retoucher .rt-val{gap:4px 14px}
  #retoucher .rt-val__ico{display:none}
  /* La planche sur toute la largeur, le dossier en bandeau dessous. */
  #retoucher .rt-film{flex-direction:column;gap:10px}
  #retoucher .rt-planche{gap:5px}
  #retoucher .rt-vg{border-radius:5px}
  #retoucher .rt-zip{flex:none;grid-template-columns:auto 1fr auto;grid-template-rows:auto;padding:8px 14px 8px 10px}
  #retoucher .rt-zip__ico{grid-row:1;grid-column:1;width:40px;height:33px}
  #retoucher .rt-zip__ico svg{width:40px;height:33px}
  #retoucher .rt-zip__nom{grid-row:1;grid-column:2}
  #retoucher .rt-zip__c{grid-row:1;grid-column:3}
  #retoucher .rt-zip__n{font-size:22px}
  #retoucher .rt-points li{grid-template-columns:30px minmax(0,1fr);column-gap:12px;padding:10px 0}
  #retoucher .rt-points p{font-size:15px;line-height:1.4}
  #retoucher .rt-ico{width:30px;height:30px;border-radius:9px}
  #retoucher .rt-ico svg{width:18px;height:18px}
  #retoucher .rt-micro{margin-top:12px}
  #retoucher .rt-suite>.go{margin-top:16px}
}
/* Petits téléphones (360px) : quelques pixels de marge en moins. */
@media(max-width:380px){
  #retoucher{--sx-y:48px}
  #retoucher .rt-points li{padding:8px 0}
  #retoucher .rt-film{gap:8px}
}

/* ── « Réduire les animations » : états finaux, sans mouvement ───────────── */
@media(prefers-reduced-motion:reduce){
  #retoucher .cmp__ap canvas,#retoucher .cmp__lab,#retoucher .cmp__rond,#retoucher .rt-styles button,#retoucher .rt-vg canvas,#retoucher .rt-zip__ok{transition:none}
  #retoucher .rt-val b.chg,#retoucher .rt-vg.onde::after,#retoucher .rt-zip__ico.recoit{animation:none}
  #retoucher .cmp__poi:hover .cmp__rond,#retoucher .cmp.tire .cmp__rond{transform:none}
  #retoucher .rt-jeton{display:none}
}
