
/* ============================================================
   PORTFOLIO REYEN FOURATI
   ANIMATIONS AVEC DÉCOR VIDÉO

   0,0 s : decor.png
   0,2 s : allumage (onde, écrans, enseigne, lampes)
   3,2 s : les hologrammes s'allument un par un
   3,2 s : lancement de decor-loop.mp4

   La vidéo fonctionne ensuite en boucle.

   Au survol :
   - décor assombri
   - hologramme sélectionné plus lumineux
   - image spécifique au bouton
============================================================ */


/* ============================================================
   1. SCÈNE PRINCIPALE
============================================================ */

.landing__stage {
  position: absolute;

  top: 50%;
  left: 50%;

  width: max(100vw, 177.68svh);
  aspect-ratio: 1672 / 941;

  transform: translate(-50%, -50%);

  z-index: 0;

  overflow: hidden;
  pointer-events: auto;
}


/* ============================================================
   2. ALIGNEMENT DES IMAGES ET DE LA VIDÉO
============================================================ */

.scene-layer,
.scene-hover-image {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: fill;

  user-select: none;
  pointer-events: none;
}


/* ============================================================
   3. DÉCOR ÉTEINT
============================================================ */

.scene-layer--decor {
  z-index: 0;
  opacity: 1;
}


/* ============================================================
   4. SÉQUENCE D'ALLUMAGE

   0,15 s : étincelle sous le bureau
   0,35 s : une onde d'énergie part du bureau et parcourt
            les néons du sol, des murs et des étagères
   0,90 s : les écrans s'allument un par un
   1,15 s : l'enseigne PORTFOLIO grésille
   1,90 s : les deux lampes s'allument
   2,40 s : lumiere.png se fond par-dessus (état final)
   3,20 s : fin -> les hologrammes prennent le relais

   Tous les calques sont décoratifs : aucun ne capte les clics.
============================================================ */

/* Rayon de l'onde, animable grâce à @property */
@property --onde {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.scene-boot {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.scene-boot > * {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}

/* --- 1. Étincelle d'origine ------------------------------- */
.boot__etincelle {
  inset: auto;
  left: 50%;
  top: 54%;
  width: 14%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #f2fdff 0 6%, rgba(90, 220, 255, .85) 14%, rgba(20, 150, 255, .25) 38%, transparent 68%);
  mix-blend-mode: screen;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.1);
  animation: boot-etincelle .75s .15s cubic-bezier(.2, .8, .3, 1) both;
}

@keyframes boot-etincelle {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.1); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(.55); }
  30%  { opacity: .6; }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}

/* --- 2. Onde d'énergie dans les néons --------------------- */
.boot__neons,
.boot__onde {
  --onde: 0%;
  animation: boot-onde 1.9s .35s cubic-bezier(.4, 0, .3, 1) both;
}

/* Néons allumés derrière le front de l'onde */
.boot__neons {
  -webkit-mask-image: radial-gradient(ellipse at 50% 54%, #000 var(--onde), transparent calc(var(--onde) + 4%));
          mask-image: radial-gradient(ellipse at 50% 54%, #000 var(--onde), transparent calc(var(--onde) + 4%));
}

/* Front de l'onde : anneau surexposé qui court le long des lignes */
.boot__onde {
  filter: brightness(2.6) saturate(1.4);
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse at 50% 54%, transparent calc(var(--onde) - 10%), #000 calc(var(--onde) - 1.5%), #000 var(--onde), transparent calc(var(--onde) + 3%));
          mask-image: radial-gradient(ellipse at 50% 54%, transparent calc(var(--onde) - 10%), #000 calc(var(--onde) - 1.5%), #000 var(--onde), transparent calc(var(--onde) + 3%));
  animation:
    boot-onde 1.9s .35s cubic-bezier(.4, 0, .3, 1) both,
    boot-onde-eteinte .4s 2.1s ease-out forwards;
}

@keyframes boot-onde {
  from { --onde: 0%; }
  to   { --onde: 115%; }
}

@keyframes boot-onde-eteinte {
  to { opacity: 0; }
}

/* --- 3. Écrans : allumage façon tube cathodique ----------- */
/* Zone de chaque écran dans index.html :
   --t --r --b --l = inset de l'écran ; --tm --bm = ligne centrale */
.boot__ecran {
  opacity: 0;
  clip-path: inset(var(--tm) var(--r) var(--bm) var(--l));
  animation: boot-ecran .7s calc(.9s + var(--n, 0) * .11s) ease-out both;
}

@keyframes boot-ecran {
  0% {
    opacity: 0;
    clip-path: inset(var(--tm) var(--r) var(--bm) var(--l));
    filter: brightness(4) saturate(0);
  }
  12% {
    opacity: 1;
  }
  35% {
    clip-path: inset(var(--t) var(--r) var(--b) var(--l));
    filter: brightness(2.4) saturate(.4);
  }
  45% {
    opacity: .3;
  }
  58% {
    opacity: 1;
    filter: brightness(1.5) saturate(1);
  }
  100% {
    opacity: 1;
    clip-path: inset(var(--t) var(--r) var(--b) var(--l));
    filter: brightness(1) saturate(1);
  }
}

/* --- 4. Enseigne PORTFOLIO et lampes ----------------------- */
.boot__enseigne {
  /* Masque adouci : pas de bord rectangulaire visible */
  -webkit-mask-image: radial-gradient(ellipse 19% 17% at 50.2% 15.8%, #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 19% 17% at 50.2% 15.8%, #000 62%, transparent 100%);
  opacity: 0;
  animation: boot-neon-gresille 1s 1.15s linear both;
}

.boot__lampe {
  opacity: 0;
  animation: boot-neon-gresille .7s 1.9s linear both;
}

.boot__lampe--g {
  -webkit-mask-image: radial-gradient(ellipse 6% 7% at 29.9% 13.5%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 6% 7% at 29.9% 13.5%, #000 55%, transparent 100%);
}

.boot__lampe--d {
  -webkit-mask-image: radial-gradient(ellipse 6% 7% at 71.2% 13.5%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 6% 7% at 71.2% 13.5%, #000 55%, transparent 100%);
  animation-delay: 2.05s;
}

@keyframes boot-neon-gresille {
  0%   { opacity: 0; }
  8%   { opacity: .9; }
  13%  { opacity: 0; }
  30%  { opacity: 0; }
  34%  { opacity: 1; }
  40%  { opacity: .25; }
  48%  { opacity: .95; }
  55%  { opacity: .5; }
  70%  { opacity: 1; }
  100% { opacity: 1; }
}

/* --- 5. Décor final ---------------------------------------- */
.scene-layer--light {
  z-index: 2;
  opacity: 0;
  animation: boot-final .8s 2.4s ease-in-out both;
}

@keyframes boot-final {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ============================================================
   4 BIS. AMBIANCE EN BOUCLE

   Démarre après l'allumage (3,4 s) et tourne tant que
   l'accueil est affiché :
   - impulsions qui courent dans les lignes bleues du sol
     (toutes les 5,5 s) ;
   - écrans : ligne de rafraîchissement + micro-scintillement ;
   - robot : yeux qui pulsent et clignent, voyant du torse.

   Couche décorative au-dessus de lumiere.png, sous les
   hologrammes et l'image de survol. Aucun clic capté.
============================================================ */

.scene-ambiance {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  animation: ambiance-apparait .8s 3.2s ease-out forwards;
}

.scene-ambiance > * {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
}

@keyframes ambiance-apparait {
  to { opacity: 1; }
}

/* --- Sol : impulsions dans les lignes entre les carreaux --- */
/* Chaque ligne est un tracé SVG posé exactement sur une ligne
   bleue de lumiere.png. Un petit trait lumineux (la « comète »)
   y circule grâce à stroke-dashoffset :
   - lignes de profondeur : du bureau vers nous (1,6 s) ;
   - rangées horizontales : du centre vers les côtés, chacune
     démarrant quand la comète de profondeur la croise (--d).
   Le cycle complet dure 5,5 s. */
.vie-sol-lignes {
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ligne-sol {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 16 200;
  stroke-dashoffset: 16;
}

.vie-sol-lignes__halo .ligne-sol {
  stroke: #4fdcff;
  stroke-width: 9;
}

.vie-sol-lignes__coeur .ligne-sol {
  stroke: #f2feff;
  stroke-width: 2.4;
}

.ligne-sol--profondeur {
  animation: comete-profondeur 5.5s calc(4s + var(--d, 0s)) linear infinite;
}

.ligne-sol--rangee {
  stroke-dasharray: 18 200;
  stroke-dashoffset: 18;
  animation: comete-rangee 5.5s calc(4s + var(--d, 0s)) cubic-bezier(.3, 0, .6, 1) infinite;
}

/* 29 % de 5,5 s = 1,6 s de trajet, puis repos */
@keyframes comete-profondeur {
  0%        { stroke-dashoffset: 16; }
  29%, 100% { stroke-dashoffset: -100; }
}

/* 22 % de 5,5 s = 1,2 s de trajet, puis repos */
@keyframes comete-rangee {
  0%        { stroke-dashoffset: 18; }
  22%, 100% { stroke-dashoffset: -100; }
}

/* --- Écrans ------------------------------------------------ */
/* Position de chaque écran : style en ligne dans index.html */
.vie-ecran {
  overflow: hidden;
  mix-blend-mode: screen;
}

/* Ligne de rafraîchissement qui descend */
.vie-ecran::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 35%;
  background: linear-gradient(180deg, transparent, rgba(120, 230, 255, .22) 50%, transparent);
  transform: translateY(-100%);
  animation: ecran-scan calc(2.6s + var(--n, 0) * .45s) calc(var(--n, 0) * -.6s) linear infinite;
}

/* Micro-scintillement, à un moment différent pour chaque écran */
.vie-ecran::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(150, 235, 255, .22);
  opacity: 0;
  animation: ecran-scintille calc(5s + var(--n, 0) * .9s) calc(var(--n, 0) * -1.3s) linear infinite;
}

@keyframes ecran-scan {
  from { transform: translateY(-100%); }
  to   { transform: translateY(290%); }
}

@keyframes ecran-scintille {
  0%, 90%, 100% { opacity: 0; }
  91% { opacity: .9; }
  92% { opacity: 0; }
  94% { opacity: .55; }
  95% { opacity: 0; }
}

/* --- Robot ------------------------------------------------- */
.vie-robot-oeil {
  width: .75%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #eafdff 0 22%, rgba(70, 215, 255, .95) 42%, rgba(0, 160, 255, .35) 68%, transparent 100%);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
  animation: robot-oeil 2.8s ease-in-out infinite alternate;
}

.vie-robot-oeil--g { left: 95.15%; top: 24.02%; }
.vie-robot-oeil--d { left: 96.14%; top: 23.80%; }

@keyframes robot-oeil {
  from { opacity: .45; }
  to   { opacity: 1; }
}

/* Paupière : couvre les deux yeux le temps d'un clignement */
.vie-robot-paupiere {
  left: 95.65%;
  top: 23.9%;
  width: 1.9%;
  height: 1.5%;
  border-radius: 45%;
  background: #08131e;
  transform: translate(-50%, -50%) scaleY(0);
  animation: robot-cligne 5.5s 4.2s linear infinite;
}

@keyframes robot-cligne {
  0%, 93%, 100% { transform: translate(-50%, -50%) scaleY(0); }
  94%   { transform: translate(-50%, -50%) scaleY(1); }
  95.5% { transform: translate(-50%, -50%) scaleY(0); }
  97%   { transform: translate(-50%, -50%) scaleY(1); }
  98.5% { transform: translate(-50%, -50%) scaleY(0); }
}

/* Voyant du torse */
.vie-robot-torse {
  left: 95.75%;
  top: 27.1%;
  width: 1.1%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 230, 255, .8), rgba(0, 160, 255, .25) 55%, transparent 75%);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
  animation: robot-oeil 1.9s ease-in-out infinite alternate;
}


/* ============================================================
   5. HOLOGRAMMES ANIMÉS

   Les hologrammes sont extraits de lumiere1.png
   (différence avec lumiere.png) et posés sur lumiere.png.
   Au repos, le résultat est identique à lumiere1.png.

   Chaque hologramme :
   1. son faisceau s'allume en grésillant ;
   2. le panneau monte depuis le socle ;
   3. le panneau flotte doucement en continu.

   Réglages :
   --holo-debut : début de la séquence (fin de l'allumage)
   --holo-pas   : écart entre deux hologrammes
   --ordre      : rang de l'hologramme (dans index.html)
============================================================ */

.landing__stage {
  --holo-debut: 3.2s;
  --holo-pas: .28s;
}

.scene-holos {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.holo {
  --depart: calc(var(--holo-debut) + var(--ordre, 0) * var(--holo-pas));
  position: absolute;
  pointer-events: none;
}

.holo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
}

.holo__faisceau {
  opacity: 0;
  animation:
    holo-faisceau-allumage .45s var(--depart) linear both,
    holo-faisceau-respire 3.2s calc(var(--depart) + .6s) ease-in-out infinite alternate;
}

.holo__panneau {
  opacity: 0;
  clip-path: inset(100% 0 0 0);
  will-change: transform;
  animation:
    holo-panneau-monte .6s calc(var(--depart) + .15s) cubic-bezier(.2, .7, .3, 1) both,
    holo-panneau-flotte calc(3.4s + var(--ordre, 0) * .37s) calc(var(--depart) + .75s) ease-in-out infinite alternate;
}

@keyframes holo-faisceau-allumage {
  0%   { opacity: 0; }
  20%  { opacity: .9; }
  32%  { opacity: .15; }
  52%  { opacity: 1; }
  64%  { opacity: .5; }
  100% { opacity: 1; }
}

@keyframes holo-faisceau-respire {
  from { opacity: 1; }
  to   { opacity: .78; }
}

@keyframes holo-panneau-monte {
  0% {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    filter: brightness(2.2);
  }
  35% {
    opacity: 1;
  }
  45% {
    opacity: .55;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    filter: brightness(1);
  }
}

@keyframes holo-panneau-flotte {
  from { transform: translateY(0); }
  to   { transform: translateY(-1.1%); }
}

/* Positions : mêmes coordonnées que le découpage des calques
   (en % du décor 1672 × 941). */
.holo--projets     { left: 8.971%;  top: 13.815%; width: 14.952%; height: 21.785%; }
.holo--veille      { left: 10.766%; top: 35.600%; width: 17.344%; height: 19.660%; }
.holo--formation   { left: 77.751%; top: 19.129%; width: 17.344%; height: 17.535%; }
.holo--competences { left: 74.761%; top: 36.663%; width: 18.541%; height: 18.597%; }
.holo--cv          { left: 84.330%; top: 2.125%;  width: 12.560%; height: 17.003%; }
.holo--ca          { left: 5.981%;  top: 62.699%; width: 31.100%; height: 34.538%; }
.holo--crf         { left: 65.789%; top: 62.699%; width: 29.904%; height: 34.538%; }

/* Chaque zone cliquable s'active quand son hologramme est affiché.
   (utilisé par l'animation des boutons dans index.html) */
.scene-hotspot--projets     { --pret: calc(3.2s + 0 * .28s + .5s); }
.scene-hotspot--formation   { --pret: calc(3.2s + 1 * .28s + .5s); }
.scene-hotspot--veille      { --pret: calc(3.2s + 2 * .28s + .5s); }
.scene-hotspot--competences { --pret: calc(3.2s + 3 * .28s + .5s); }
.scene-hotspot--ca          { --pret: calc(3.2s + 4 * .28s + .5s); }
.scene-hotspot--crf         { --pret: calc(3.2s + 5 * .28s + .5s); }
.scene-hotspot--cv          { --pret: calc(3.2s + 6 * .28s + .5s); }


/* ============================================================
   6. VIDÉO DU DÉCOR

   La vidéo se place au-dessus de lumiere.png et SOUS les
   hologrammes animés : elle doit donc montrer le décor
   sans hologrammes (sinon ils apparaîtraient en double).

   Elle devient visible uniquement lorsqu'elle
   est prête et que sa lecture a commencé.

   Ensuite, elle tourne en boucle.
============================================================ */

.scene-layer--video {
  z-index: 3;

  opacity: 0;
  visibility: hidden;

  background: #020b16;

  transition:
    opacity .18s linear;

  pointer-events: none;
  user-select: none;
}

.scene-layer--video.is-playing {
  opacity: 1;
  visibility: visible;
}

/* Ancienne quatrième image inutilisée */
.scene-layer--holograms {
  display: none !important;
}


/* ============================================================
   7. IMAGE DE SURVOL

   Chaque PNG de survol contient le décor complet,
   assombri sauf autour du bouton sélectionné.
============================================================ */

.scene-hover-image {
  z-index: 5;

  opacity: 0;
  visibility: hidden;

  background: rgba(0, 4, 14, .78);

  transition:
    opacity .28s ease-in-out;
}

.scene-hover-image.is-visible {
  opacity: 1;
  visibility: visible;
}


/* ============================================================
   8. PERSONNAGE

   Il remonte depuis le bas de l'écran.
   Il ne bloque pas les clics.
============================================================ */

.landing__portrait {
  position: absolute;

  z-index: 3;

  pointer-events: none !important;

  filter: brightness(1);

  transition:
    filter .28s ease-in-out;

  animation:
    personnage-remonte
    2s
    .2s
    cubic-bezier(.2, .75, .2, 1)
    both;
}

@keyframes personnage-remonte {
  from {
    transform: translate(-50%, 125%);
  }

  to {
    transform: translate(-50%, 0);
  }
}

.landing.is-scene-hovered .landing__portrait {
  filter: brightness(.16);
}


/* ============================================================
   9. ANCIENS BOUTONS MASQUÉS
============================================================ */

.landing__nav,
.landing__engagement,
.landing__affiliations,
.landing__identity,
.landing__title {
  display: none !important;
}


/* ============================================================
   10. ZONES CLIQUABLES

   Les boutons sont actifs après 3,2 s.

   Les positions ont été adaptées à ta vidéo.
============================================================ */

.scene-hitboxes {
  position: absolute;

  inset: 0;

  z-index: 10;

  pointer-events: none;
}

.scene-hotspot {
  position: absolute;

  display: block;

  margin: 0;
  padding: 0;

  border: 0;
  border-radius: 12px;

  background: transparent;
  color: transparent;

  font-size: 0;
  text-decoration: none;

  cursor: pointer;

  visibility: hidden;
  pointer-events: auto !important;

  animation:
    zones-actives
    1s
    3.2s
    steps(1, start)
    forwards;
}

@keyframes zones-actives {
  from {
    visibility: hidden;
  }

  to {
    visibility: visible;
  }
}

.scene-hotspot:focus-visible {
  outline: 3px solid #a7edff;
  outline-offset: 3px;
}


/* ============================================================
   11. POSITIONS DES HOLOGRAMMES

   Coordonnées en pourcentage de la vidéo complète.
============================================================ */

/* PROJETS : EN HAUT À GAUCHE */
.scene-hotspot--projets {
  left: 11.5%;
  top: 17%;
  width: 10%;
  height: 14%;
}

/* VEILLE TECHNOLOGIQUE */
.scene-hotspot--veille {
  left: 12.5%;
  top: 36.6%;
  width: 14%;
  height: 8.5%;
}

/* FORMATION */
.scene-hotspot--formation {
  left: 80.2%;
  top: 22.3%;
  width: 12.7%;
  height: 8.5%;
}

/* COMPÉTENCES */
.scene-hotspot--competences {
  left: 76.8%;
  top: 37.7%;
  width: 14.7%;
  height: 8.6%;
}

/* CV : EN HAUT À DROITE */
.scene-hotspot--cv {
  left: 86.4%;
  top: 4%;
  width: 9%;
  height: 9%;
}

/* CRÉDIT AGRICOLE : EN BAS À GAUCHE */
.scene-hotspot--ca {
  left: 8.2%;
  top: 64.5%;
  width: 26.5%;
  height: 18%;
}

/* CROIX-ROUGE : EN BAS À DROITE */
.scene-hotspot--crf {
  left: 67.4%;
  top: 64.7%;
  width: 26.6%;
  height: 17%;
}


/* ============================================================
   12. NAVIGATION MOBILE
============================================================ */

.landing__mobile-nav {
  display: none;
}

@media (max-width: 700px) {

  .scene-hitboxes {
    display: none;
  }

  .landing__mobile-nav {
    position: absolute;

    z-index: 20;

    top: 127px;
    left: 12px;
    right: 12px;

    display: grid;

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 9px;

    animation:
      menu-mobile-apparait
      .7s
      3.2s
      ease-out
      both;
  }

  .landing__mobile-nav button,
  .landing__mobile-nav a {
    display: grid;
    place-items: center;

    min-height: 43px;
    padding: 9px 7px;

    border: 1px solid rgba(103, 216, 255, .68);
    border-radius: 10px;

    background: rgba(2, 20, 37, .85);
    color: #e8faff;

    text-decoration: none;
    text-align: center;

    font:
      600 .65rem/1.3
      var(--font-display, sans-serif);

    backdrop-filter: blur(8px);

    cursor: pointer;
  }

  .landing__mobile-nav .landing__mobile-engagement {
    border-color: #ff88aa;
    background: rgba(79, 14, 43, .9);
  }
}

@keyframes menu-mobile-apparait {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}


/* ============================================================
   13. ACCESSIBILITÉ
============================================================ */

@media (prefers-reduced-motion: reduce) {

  .scene-layer--light,
  .holo img,
  .landing__portrait,
  .scene-hotspot,
  .landing__mobile-nav {
    animation: none !important;
  }

  .scene-layer--light {
    opacity: 1;
  }

  .scene-boot {
    display: none;
  }

  .scene-ambiance {
    display: none;
  }

  .holo img {
    opacity: 1;
    clip-path: none;
  }

  .scene-layer--video {
    display: none !important;
  }

  .landing__portrait {
    transform: translate(-50%, 0);
  }

  .scene-hotspot {
    visibility: visible;
    pointer-events: auto;
  }

  .landing__mobile-nav {
    opacity: 1;
  }
}
