/* Dev-Graph, mouvement et finitions.
   Deux courbes seulement: --ease (sortie, tout ce qui arrive) et --io (la lame: ce qui coupe, ferme ou change de page).
   Les états de départ cachés n'existent que sous html.move: sans JS, en mouvement réduit ou en pause, tout est déjà là. */
:root {
  --io: cubic-bezier(.76, 0, .24, 1);
  --t1: .16s; --t2: .32s; --t3: .64s; --t4: 1s; --t5: 1.4s; --step: 80ms;
  --tilt: 3deg; --cut0: polygon(0 0, 0 0, -45% 100%, -45% 100%); --cut1: polygon(0 0, 145% 0, 100% 100%, -45% 100%);
}
[dir="rtl"] { --tilt: -3deg; --cut0: polygon(100% 0, 100% 0, 145% 100%, 145% 100%); --cut1: polygon(100% 0, -45% 0, 0 100%, 145% 100%); }

/* ---- finitions communes ---- */
html { scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: var(--bg); } ::-webkit-scrollbar-thumb { background: var(--edge); border: 3px solid var(--bg); border-radius: 99px; }
.statement ::selection, .fog ::selection { background: var(--espresso); color: var(--sand); }
a, button { transition: color var(--t2), background-color var(--t2), opacity var(--t2); }
.btn { transition: transform var(--t3) var(--ease), background-color var(--t2), color var(--t2); }
.btn:active, .round:active, .filters button:active, .langs button:active { scale: .97; }
.round { transition: background-color var(--t2), color var(--t2), border-color var(--t2), transform var(--t3) var(--ease); }

/* ---- ouverture: la marque, puis la coupe; le nom glisse en place pendant que les lames s'ouvrent ---- */
.intro .wipe b { animation: mark-in .36s var(--ease) both, gone .2s .36s both; }
@keyframes mark-in { from { opacity: 0; transform: scale(.94); } }
[dir="rtl"] .intro .wipe b { animation: mark-in-r .36s var(--ease) both, gone .2s .36s both; }
@keyframes mark-in-r { from { opacity: 0; transform: scaleX(-1) scale(.94); } to { transform: scaleX(-1); } }
.first .word { animation: settle 1.1s .42s var(--ease) both; }
.first .info > * { animation: in-up var(--t3) calc(.66s + var(--i, 0) * var(--step)) var(--ease) both; }
.info > :nth-child(2) { --i: 1; } .info > :nth-child(3) { --i: 2; } .info > :nth-child(4) { --i: 3; }
@keyframes in-start { from { transform: translate3d(-4%, 0, 0); } }
@keyframes in-end { from { transform: translate3d(4%, 0, 0); } }
@keyframes in-up { from { opacity: 0; transform: translate3d(0, 60%, 0); } }

/* ---- titres: ligne après ligne, chaque ligne sort de sous sa coupe ---- */
/* la coupe déborde un peu (accents, signes arabes) sans agrandir la boîte du titre */
.ln { display: block; overflow: clip; overflow-clip-margin: .26em; }
.li { display: inline-block; white-space: nowrap; transform-origin: 0 0; }
[dir="rtl"] .li { transform-origin: 100% 0; }
.move [data-split]:not(.on) .li { transform: translate3d(0, 150%, 0) rotate(var(--tilt)); }
.move [data-split].on .li { transition: transform var(--t4) var(--ease) calc(var(--i) * var(--step)); }

/* ---- images: une lame diagonale ouvre l'image, qui se pose ---- */
.move .rv:not(.on) { clip-path: var(--cut0); }
.move .rv:not(.on) > * { transform: scale(1.12); }
.move .rv { overflow: clip; clip-path: var(--cut1); transition: clip-path var(--t4) var(--io) calc(var(--i, 0) * var(--step)); }
.move .rv > * { transition: transform var(--t5) var(--ease) calc(var(--i, 0) * var(--step)); }

/* ---- aperçu vidéo d'une carte ---- */
.pv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t2); pointer-events: none; }
.pv.on { opacity: 1; }
/* vidéo verticale dans une carte large: une bande à droite, ouverte par la lame */
.pv.side { inset: 0 0 0 auto; width: auto; aspect-ratio: var(--vr); max-width: 46%; opacity: 1; clip-path: var(--cut0); transition: clip-path var(--t3) var(--io); }
[dir="rtl"] .pv.side { inset: 0 auto 0 0; }
.pv.side.on { clip-path: var(--cut1); }

/* ---- scène: les images qui suivent la première ---- */
.sf { position: absolute; inset: 0; overflow: hidden; clip-path: var(--cut0); }
.sf img { width: 100%; height: 100%; object-fit: cover; }
.segs { display: flex; gap: 6px; inline-size: min(100%, 22rem); margin-block-end: .4rem; }
.segs i { flex: 1; height: 3px; background: color-mix(in srgb, var(--heading) 30%, transparent); overflow: hidden; }
.segs b { display: block; height: 100%; background: var(--heading); transform: scaleX(var(--k, 0)); transform-origin: 0 50%; }
[dir="rtl"] .segs b { transform-origin: 100% 50%; }

/* ---- métiers sans projet: le verbe du métier, coupé en trois bandes qui se rejoignent ---- */
.craft-art:has(.type) { height: 36svh; min-height: 220px; }
.type { display: grid; align-items: end; padding: var(--pad); background: var(--a); color: var(--b); }
.cutw { display: grid; --fz: min(9vw, calc((20vw - 2 * var(--pad)) / (var(--n, 5) * .62))); font: var(--w) var(--fz)/.86 var(--display); letter-spacing: var(--track); white-space: nowrap; }
[lang="ar"] .cutw { line-height: 1.2; }
.cutw i { grid-area: 1 / 1; font-style: normal; transition: transform var(--t3) var(--ease); }
.cutw i:nth-child(1) { clip-path: inset(-20% 0 64% 0); transform: translate3d(-.09em, 0, 0); }
.cutw i:nth-child(2) { clip-path: inset(36% 0 33% 0); transform: translate3d(.06em, 0, 0); }
.cutw i:nth-child(3) { clip-path: inset(67% 0 -20% 0); transform: translate3d(-.03em, 0, 0); }
.col.on .cutw i, .craft.open .cutw i, html:not(.move) .cutw i { transform: none; }
.type .cutw i:nth-child(n) { transition-delay: calc(var(--n, 0) * 40ms); }

/* ---- méthode: une seule ligne relie les quatre étapes ---- */
.move .method li { position: relative; border-color: transparent; }
.move .method li::after { content: ""; position: absolute; inset: -2px 0 auto; height: 2px; background: var(--text); transform: scaleX(var(--k, 0)); transform-origin: 0 50%; }
.move[dir="rtl"] .method li::after { transform-origin: 100% 50%; }
.move .method li::before { transform: translate3d(0, calc((1 - var(--k, 0)) * 30%), 0); opacity: calc(.12 + var(--k, 0) * .88); }
.move .method li > * { opacity: calc(var(--k, 0) * 1.6 - .6); }

/* ---- curseur ---- */
.tip span { transition: opacity var(--t1), scale var(--t3) var(--ease), background-color var(--t2), color var(--t2); }
.tip[data-k="drag"] span { background: var(--sand); color: var(--espresso); }
.tip[data-k="zoom"] span { background: var(--cream); color: var(--espresso); }
.tip.down span { scale: .86; }

/* ---- page projet ---- */
.p-cover > .surface { transform-origin: 50% 0; }
.move .p-cover img { animation: settle var(--t5) var(--ease) both; }
@keyframes settle { from { transform: scale(1.06); } }
.p-bar { position: sticky; inset-block-start: var(--top); z-index: 15; display: flex; align-items: center; gap: 1.2rem; min-height: 52px; padding-inline: var(--pad); background: var(--bg); border-block-end: 1px solid var(--line); font-size: var(--fs-s); }
.p-bar a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--muted); }
.p-bar b { font: 600 1.0625rem/1.2 var(--mark); letter-spacing: -.02em; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.p-bar span { color: var(--muted); white-space: nowrap; }
.p-bar a + a { margin-inline-start: auto; }
.p-bar i { position: absolute; inset: auto 0 -1px; height: 2px; background: var(--heading); transform: scaleX(0); transform-origin: 0 50%; }
[dir="rtl"] .p-bar i { transform-origin: 100% 50%; }
.zoom { display: block; width: 100%; padding: 0; cursor: zoom-in; }
.zoom img { width: 100%; height: auto; }
.p-nav { display: grid; }
.p-next { position: relative; display: grid; align-content: end; gap: .6rem; min-height: min(100svh, 62vw); overflow: hidden; isolation: isolate; color: var(--cream); }
.p-nav .p-next { border-block-start: 0; grid-column: 1 / -1; padding: var(--pad) var(--pad) calc(var(--pad) * 2.5); text-align: start; }
.p-nav > a:first-child:not(.p-next) { grid-column: 1 / -1; }
.p-next .surface { z-index: -1; }
.p-next .surface::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(var(--shade) / .95), rgb(var(--shade) / .82) 38%, rgb(var(--shade) / .4) 70%, rgb(var(--shade) / .15)); }
.p-next small { font-size: var(--fs-l); color: var(--cream); }
.p-next b { font: var(--w) clamp(3rem, 11vw, 15rem)/var(--lh-l) var(--display); letter-spacing: var(--track); color: var(--sand); text-align: start; overflow-wrap: anywhere; text-wrap: balance; }
html[dir] .p-nav .p-next b { text-align: start; }
@media (hover: hover) { .p-next:hover .surface img { transform: scale(1.03); } .p-next .surface img { transition: transform var(--t5) var(--ease); } .p-nav .p-next:hover { background: none; } }

/* ---- visionneuse ---- */
.lb { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(var(--shade) / .97); color: var(--cream); overflow: hidden; touch-action: none; }
.lb::backdrop { background: rgb(var(--shade) / .6); }
.lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lb-bar { display: flex; align-items: center; gap: .4rem; padding: .4rem var(--pad); }
.lb-bar output { margin-inline-end: auto; font-variant-numeric: tabular-nums; color: var(--stone); }
.lb-bar button { min-width: 48px; min-height: 48px; padding-inline: .8rem; border-radius: 99px; }
.lb-bar button:hover { background: rgb(246 237 221 / .1); }
.lb-stage { position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; min-height: 0; overflow: hidden; padding: 0 var(--pad) var(--pad); }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; cursor: zoom-in; will-change: transform; }
.lb.big .lb-stage img { cursor: grab; }
.lb:focus-visible, .lb-stage img:focus-visible { outline-offset: -4px; }
.lb, .lb-bar button { --focus: var(--sand); }

/* ---- 404 ---- */
.e404 { display: grid; align-content: end; gap: 1.6rem; min-height: calc(100svh - var(--top)); padding: var(--top) var(--pad) clamp(3rem, 6vw, 6rem); }
.e-num { display: flex; align-items: center; gap: .08em; font: 600 min(40vw, 56svh)/.7 var(--mark); letter-spacing: -.05em; color: var(--heading); direction: ltr; margin-left: -.05em; }
.e-num i { flex: 1; height: .115em; background: var(--sage); transform-origin: 0 50%; }
.move .e-num i { animation: hy .9s .2s var(--ease) both; }
.e404 h1 { font: var(--w) clamp(2.2rem, 5vw, 6rem)/var(--lh) var(--display); letter-spacing: var(--track); color: var(--heading); max-width: 18em; text-wrap: balance; }
.e404 .row { display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; align-items: center; }
.e404 .row a:not(.btn) { min-height: 48px; display: inline-flex; align-items: center; text-decoration: underline; text-underline-offset: .3em; }

/* ---- défilement lié (navigateurs qui le savent; sinon rien ne bouge) ---- */
@supports (animation-timeline: scroll()) {
  .move[data-mode="d"] .w1 { animation: in-start 1s linear both reverse; animation-timeline: scroll(root); animation-range: 0 90vh; }
  .move[data-mode="d"] .w2 { animation: in-end 1s linear both reverse; animation-timeline: scroll(root); animation-range: 0 90vh; }
  .move .p-cover > .surface { animation: sink linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  @keyframes sink { to { transform: translate3d(0, 22%, 0) scale(1.04); } }
  .p-bar i { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
  .move .p-next .surface { animation: open linear both; animation-timeline: view(); animation-range: entry 0% entry 90%; }
  @keyframes open { from { clip-path: var(--cut0); transform: scale(1.12); } to { clip-path: var(--cut1); transform: none; } }
}

/* ---- passage d'une page à l'autre: l'image de la carte devient la couverture ---- */
@view-transition { navigation: auto; }
.top { view-transition-name: top; } .bar { view-transition-name: bar; }
::view-transition-group(cover) { animation-duration: var(--t3); animation-timing-function: var(--io); }
::view-transition-old(cover), ::view-transition-new(cover) { height: 100%; object-fit: cover; overflow: clip; animation-duration: var(--t3); animation-timing-function: var(--io); }
::view-transition-old(root) { animation: var(--t2) var(--io) both vt-out; }
::view-transition-new(root) { animation: var(--t3) var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translate3d(0, 24px, 0); } }

/* ---- pause et mouvement réduit: rien de ce fichier ne bouge ---- */
html:not(.move) .w1, html:not(.move) .w2, html:not(.move) .word, html:not(.move) .info > *, html:not(.move) .p-cover > .surface, html:not(.move) .p-next .surface { animation: none; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .move [data-split] .li, .move .rv, .move .rv > * { transform: none !important; clip-path: none !important; }
  .sf { display: none; }
}

/* ---- impression: le texte et les images, sans l'habillage ---- */
@media print {
  .top, .bar, .float, .wipe, .tip, .trail, .filters, .reel, .cols, .cards, .pause, .langs, .menu-btn, #menu, .contact canvas, .letters, .p-bar, .lb, .segs, .sf, .pv { display: none !important; }
  html, body, main > section, .end, .statement, .method, .fog, .contact { background: none !important; color: black !important; }
  h1, h2, h3, p, li, dt, dd, b, small, span, a { color: black !important; }
  .stage { height: auto !important; } .stage-pin { position: static !important; height: auto !important; } .stage-frame { transform: none !important; position: relative !important; height: 60vh !important; }
  .hero { height: auto !important; min-height: 0 !important; }
  .project { padding-block-start: 0; } .p-cover { max-height: none; } .p-gal figure, .item, img { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
  .move [data-split] .li, .move .rv, .move .rv > * { transform: none !important; clip-path: none !important; }
}
