/* =====================================================================
   LOT 4D · C4 — « LE CP VIVANT »
   Évolution de C3. Le monogramme officiel (7 tracés de logo-emblem.svg) est
   reconstruit avec une géométrie exacte (sources/render-c4.html + relief.js) :
   biseaux par distance au contour, normales analytiques, silhouette identique
   au SVG. Sept passes de lumière : arêtes, matière, Play allumé, et quatre
   éclairages (gauche, droite, haut, bas) que le visiteur fait glisser.
   Composition : un faisceau de studio entre par le haut à gauche et vient
   éclairer le CP ; c'est la lumière principale de la scène.
   Seul le contenu de .scene change ; ouverture, textes et sections inchangés.
   ===================================================================== */
@property --cp-r { syntax: '<length>'; inherits: false; initial-value: 80vh; }
.hero .scene { background: #0c0817; }

/* Repère : chaque calque de parallaxe (.layer, inset −4 %) contient un cadre ramené aux dimensions du Hero */
.c4-frame { position: absolute; inset: 3.7037%; pointer-events: none; user-select: none; }

/* ---------- Le mur du studio ---------- */
.c4-back { position: absolute; inset: 0;
  background:
    radial-gradient(60% 82% at 71% 32%, rgba(112, 76, 196, .58) 0%, rgba(80, 52, 156, .4) 30%, rgba(50, 30, 108, .24) 58%, transparent 90%),
    radial-gradient(46% 52% at 18% 22%, rgba(120, 86, 220, .1), transparent 72%),
    radial-gradient(40% 30% at 86% 90%, rgba(255, 130, 60, .07), transparent 70%),
    linear-gradient(180deg, #221545 0%, #1a1036 40%, #120b24 72%, #0d0919 100%); }
.c4-back::after { content: ""; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- Le CP : taille calculée pour ne jamais toucher le titre ----------
   Hauteur utile = 82 % du Hero − bloc titre (1,8 × corps du titre + 57 px) − en-tête et marges (209 px). */
.c4-box {
  --fs: clamp(56px, 7.6vw, 140px); --H: max(100vh, 680px);
  --avail: calc(var(--H) * .82 - 1.8 * var(--fs) - 209px);
  --bb: max(150px, min(38vh, var(--avail)));          /* hauteur du dessin du CP */
  --bh: calc(var(--bb) / .904);                         /* hauteur de l'image (marges du rendu comprises) */
  position: absolute; height: var(--bh); aspect-ratio: 1107 / 837;
  left: calc(72% - var(--bh) * .6613); top: calc(104px + (var(--avail) - var(--bb)) / 2 - .048 * var(--bh)); }
.c4-shadow { opacity: .5; transform: translate(3.2%, 5%) scale(1.01); }
.c4-shadow img, .c4-obj picture, .c4-obj img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.c4-playwall { position: absolute; left: 68.1%; top: 40.6%; width: 120%; aspect-ratio: 1.25; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 82, 124, .26), rgba(255, 110, 70, .1) 40%, rgba(170, 80, 255, .04) 68%, transparent 100%); }
.c4-obj .p-edge, .c4-obj .p-glint, .c4-obj .p-rl { opacity: 0; }
/* lueur du « Play » : répond à la présence du visiteur (--play, piloté par le script) */
.c4-playglow { position: absolute; left: 68.1%; top: 40.6%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 120, 140, .5), rgba(255, 90, 110, .16) 45%, transparent 100%); mix-blend-mode: screen; opacity: calc(var(--play, 0) * .9); }

/* ---------- Le faisceau du studio (haut gauche → CP) ----------
   Origine hors champ à gauche, sous l'en-tête (il ne passe pas derrière le menu) ; angle et longueur calculés par le script à partir de la position
   réelle du CP (valeurs de repli pour un écran 16:10 sans script). */
.c4-beam { position: absolute; left: -10%; top: 11%; width: var(--beam-l, 88%); aspect-ratio: 1600 / 760; transform-origin: 0 50%;
  transform: translateY(-50%) rotate(calc(var(--beam-a, 10deg) + var(--beam-d, 0deg))); pointer-events: none; }
.c4-beam picture, .c4-beam img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.c4-beam .c4-beam-light { opacity: .4; }
/* brume dans le faisceau : trois nappes très douces qui dérivent lentement le long de l'axe */
.c4-haze i { position: absolute; top: 50%; border-radius: 50%; translate: 0 -50%;
  background: radial-gradient(closest-side, rgba(255, 236, 246, .09), transparent); }
.c4-haze i:nth-child(1) { left: 22%; width: 30%; height: 34%; }
.c4-haze i:nth-child(2) { left: 46%; width: 36%; height: 46%; }
.c4-haze i:nth-child(3) { left: 66%; width: 28%; height: 52%; }
/* poussière dans la lumière : quelques grains, seulement dans le faisceau */
.c4-dust i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, rgba(255, 246, 250, .95), rgba(255, 220, 236, .3) 55%, transparent); }

/* ---------- L'ÉVEIL (ouverture inchangée, enchaînement continu .play → .done) ----------
   3,15 s  le studio s'allume : le faisceau apparaît en haut à gauche (1,6 s)
   3,35 s  le clic : la lumière part de la pointe du curseur et court sur les arêtes (1,6 s)
   4,3 s   la matière apparaît, l'ombre se pose sur le mur
   5,2 s   le « Play » s'allume et éclaire l'intérieur du C et du P
   6,6 s   la scène vit : la lumière se met à évoluer, la brume et la poussière dérivent */
.hero:is(.play, .done) .c4-beam-light { animation: c4BeamOn 1.6s cubic-bezier(.4, 0, .2, 1) 3.15s both; }
.hero:is(.play, .done) .c4-obj .p-edge { animation: c4Front 1.6s cubic-bezier(.45, 0, .25, 1) 3.35s both, c4EdgeOut 1.1s ease-in-out 5.3s forwards; }
.hero:is(.play, .done) .c4-obj .p-base { animation: c4Fade 1.2s cubic-bezier(.4, 0, .2, 1) 4.3s both; }
.hero:is(.play, .done) .c4-obj .p-lit { animation: c4Fade 1.3s cubic-bezier(.4, 0, .2, 1) 5.2s both; }
.hero:is(.play, .done) .c4-shadow { animation: c4FadeShadow 1.4s ease-out 4.5s both; }
.hero:is(.play, .done) .c4-playwall { animation: c4Fade 1.8s ease-out 5.3s both; }
.c4-obj .p-edge { -webkit-mask-image: radial-gradient(circle at 28.4% 44.2%, #000 calc(var(--cp-r) - 9vh), transparent var(--cp-r));
                          mask-image: radial-gradient(circle at 28.4% 44.2%, #000 calc(var(--cp-r) - 9vh), transparent var(--cp-r)); }
@keyframes c4BeamOn { from { opacity: 0; } to { opacity: .4; } }
@keyframes c4Front { from { --cp-r: 0vh; opacity: 1; } to { --cp-r: 80vh; opacity: 1; } }
@keyframes c4EdgeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes c4Fade { from { opacity: 0; } }
@keyframes c4FadeShadow { from { opacity: 0; } to { opacity: .5; } }

/* ---------- LA VIE APRÈS L'OUVERTURE (décoratif, désactivable) ---------- */
/* reflet qui glisse sur les arêtes, comme une lumière qui passe : 5 s après l'ouverture, puis toutes les 17 s (2,6 s, sans éclat) */
.hero.done .c4-obj .p-glint { opacity: .55; animation: c4Glint 17s cubic-bezier(.45, 0, .55, 1) -9.3s infinite;
  -webkit-mask-image: linear-gradient(105deg, transparent 38%, #000 50%, transparent 62%); mask-image: linear-gradient(105deg, transparent 38%, #000 50%, transparent 62%);
  -webkit-mask-size: 320% 100%; mask-size: 320% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: 100% 0; mask-position: 100% 0; }
@keyframes c4Glint { 0%, 84% { -webkit-mask-position: 100% 0; mask-position: 100% 0; } 100% { -webkit-mask-position: 0% 0; mask-position: 0% 0; } }
.hero.done .c4-haze i { animation: c4Haze var(--d, 60s) ease-in-out var(--dl, 0s) infinite alternate; }
.c4-haze i:nth-child(1) { --d: 54s; } .c4-haze i:nth-child(2) { --d: 70s; --dl: -20s; } .c4-haze i:nth-child(3) { --d: 62s; --dl: -41s; }
@keyframes c4Haze { from { transform: translateX(-9%) scale(1); opacity: .6; } to { transform: translateX(11%) scale(1.12); opacity: 1; } }
.hero.done .c4-dust i { animation: c4Mote var(--d) ease-in-out var(--dl) infinite alternate; }
@keyframes c4Mote { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: var(--o); } 70% { opacity: var(--o); } 100% { opacity: 0; transform: translate(var(--tx), var(--ty)); } }
/* hors champ (défilement) : les animations décoratives se mettent en pause */
.hero.c4-off .c4-haze i, .hero.c4-off .c4-dust i, .hero.c4-off .c4-obj .p-glint { animation-play-state: paused; }
/* LOT 10B : l'indicateur « Découvrir » (animation drip, qui recalcule la mise en page) se met aussi en pause hors champ ;
   il reprend là où il s'était arrêté quand le Hero revient à l'écran. */
.hero.c4-off .scroll-cue span::after { animation-play-state: paused; }
/* effets décoratifs désactivés (bouton de la maquette, ou classe .c4-calme) */
.hero.c4-calme .c4-haze i, .hero.c4-calme .c4-dust i, .hero.c4-calme .c4-obj .p-glint { animation: none; opacity: 0; }

.hero .halo { opacity: .3; }
.hero .vignette { background:
  linear-gradient(180deg, rgba(8, 7, 11, .52) 0%, rgba(8, 7, 11, .26) 9%, transparent 17%, transparent 56%, rgba(8, 7, 11, .5) 84%, rgba(8, 7, 11, .82) 100%),   /* haut : protège le contraste du menu */
  radial-gradient(60% 66% at 10% 78%, rgba(8, 7, 11, .42) 0%, transparent 70%); }

@media (prefers-reduced-motion: reduce) {
  .hero .c4-obj picture, .hero .c4-shadow, .hero .c4-playwall, .hero .c4-beam-light, .hero .c4-haze i, .hero .c4-dust i { animation: none !important; }
  .hero .c4-dust i, .hero .c4-obj .p-glint { opacity: 0 !important; }
}

/* ---------- Portrait : le CP au-dessus du titre ---------- */
@media (orientation: portrait) and (min-width: 561px) {
  .c4-box { --bw: min(66vw, 620px); --bh: calc(var(--bw) / .928 * .7561);
    --tt: calc(var(--H) * .82 - 57px - 1.8 * var(--fs));
    height: var(--bh); left: calc(51% - var(--bh) * .6613); top: calc((100px + var(--tt) - 40px) / 2 - var(--bh) / 2); }
}
@media (orientation: portrait) and (max-width: 560px) {
  .c4-box { --bh: calc(84vw / .928 * .7561); height: var(--bh); left: calc(53% - var(--bh) * .6613); top: max(12vh, 80px); }   /* 80 px mini : jamais sous l'en-tête (320 × 568) */
  .c4-beam .c4-beam-light { opacity: .36; }
  @keyframes c4BeamOn { from { opacity: 0; } to { opacity: .36; } }
  /* Proposition de correctif (maquette seulement) : le mot « EXPÉRIENCES » dépasse de l'écran dans la V3
     à 390 px. On limite le corps du titre pour que le mot le plus long tienne dans la largeur. */
  .hero-title { font-size: min(56px, 10.7vw); }
}
