/* ============================================================
   PROJETS.CSS — Grafitiks · Page "Tous les projets"
   Carousel horizontal plein écran :
   - desktop : molette → défilement horizontal (JS, lerp doux)
   - mobile  : scroll natif + scroll-snap
   Aucun faux-scroll vertical : la page fait un écran + footer.
   ============================================================ */

:root{
  --pink:   #ff2e8a;
  --violet: #7c3aed;
  --ease:   cubic-bezier(0.7, 0, 0.2, 1);
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.ap-main{ position: relative; }
.px-exp{
  position: relative;
  /* Taille des cartes — occupe toute la bande dispo entre le titre
     (une ligne) et les contrôles, avec ~25px de respiration mini */
  --card-h: clamp(360px, calc(100vh - 336px), 640px);
  --card-h: clamp(360px, calc(100svh - 336px), 640px);
  --card-w: calc(var(--card-h) * 0.8);
}
.px-scroll{ position: relative; width: 100%; }

.px-stage{
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: var(--bg);
  /* Isole le contexte de peinture → le navigateur ne repeint pas le reste de la page */
  contain: layout style;
}

/* ════════════════════════════════ FOND VIVANT ══
   Blobs statiques (animations retirées → grosse économie GPU :
   un blur(60px) animé est l'effet le plus lourd qui soit en CSS). */
.px-bg{
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.px-blob{
  position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: .45;
  mix-blend-mode: screen;
}
.px-blob.b1{
  width: 50vw; height: 50vw; left: -8vw; top: 8%;
  background: radial-gradient(circle at 40% 40%, rgba(124,58,237,.85), transparent 68%);
}
.px-blob.b2{
  width: 44vw; height: 44vw; right: -6vw; top: 30%;
  background: radial-gradient(circle at 60% 40%, rgba(255,46,138,.7), transparent 66%);
}
.px-blob.b3{
  width: 38vw; height: 38vw; left: 28%; bottom: -10%;
  background: radial-gradient(circle at 50% 50%, rgba(216,255,0,.45), transparent 64%);
}
.px-blob.b4{ display: none; }

.px-vignette{
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 80% at 50% 46%, transparent 42%, rgba(13,13,12,.55) 78%, rgba(13,13,12,.9) 100%),
    linear-gradient(180deg, rgba(13,13,12,.7) 0%, transparent 18%, transparent 82%, rgba(13,13,12,.85) 100%);
}

/* Nom du projet géant en outline derrière les cartes (desktop).
   Injecté en JS dans .px-bg, sous la vignette. Parallaxe via --gx. */
.px-ghost{
  position: absolute; left: 50%; top: 52%;
  transform: translate(calc(-50% + var(--gx, 0px)), -50%);
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(90px, 11vw, 210px); line-height: 1;
  text-transform: uppercase; white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255,255,255,.07);
  pointer-events: none; user-select: none;
  will-change: transform, opacity;   /* opacité + parallaxe pilotées par frame en JS */
}

/* ════════════════════════════════ CAROUSEL HORIZONTAL ══ */
.px-world{
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center;
  gap: clamp(28px, 4vw, 56px);
  /* Bande utile : sous le titre (une ligne) / au-dessus des contrôles.
     La carte se centre dedans → marge sous le titre = marge sous les
     encadrés, quelle que soit la hauteur d'écran. */
  padding-top: 190px;
  padding-bottom: 96px;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.px-world::-webkit-scrollbar{ display: none; }

/* Carte projet */
.px-card{
  position: relative; flex: 0 0 auto;
  width: var(--card-w); height: var(--card-h);
  text-decoration: none; color: var(--white);
  cursor: pointer;
}
/* Marges 50% (largeur intérieure du scroller) → première/dernière carte
   parfaitement centrables, indépendamment de la scrollbar de page */
.px-card:first-child{ margin-left:  calc(50% - var(--card-w) / 2); }
.px-card:last-child{  margin-right: calc(50% - var(--card-w) / 2); }

/* Conteneur 3D interne : reçoit les transforms JS (coverflow) sur desktop */
.px-card-3d{ position: absolute; inset: 0; }

/* Voile de profondeur : assombrit les cartes éloignées (opacité pilotée JS) */
.px-shade{
  position: absolute; inset: 0; z-index: 6;
  background: var(--bg); opacity: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
}

/* Snap natif sur écrans tactiles uniquement (desktop : molette + lerp JS) */
@media (hover: none){
  .px-world{ scroll-snap-type: x mandatory; }
  .px-card{ scroll-snap-align: center; }
}

/* ════ SCÈNE 3D — desktop uniquement ════
   Coverflow profond : rotation/recul JS par carte, reflet au sol,
   balayage lumineux à l'activation, entrée en cascade. */
@media (min-width: 769px){
  /* Carousel INFINI : positionnement 100% virtuel en JS (translateX +
     perspective par carte). Plus aucun scroll natif ici — overflow:clip
     empêche tout défilement parasite (focus clavier compris). */
  .px-world{
    overflow: clip;
    gap: clamp(18px, 2.2vw, 34px);
  }
  /* Desktop = positionnement virtuel : les marges de centrage ne servent
     pas (espacement piloté en JS via translateX) */
  .px-card:first-child{ margin-left: 0; }
  .px-card:last-child{ margin-right: 0; }

  .px-card-3d{ will-change: transform; }
  .px-shade{ will-change: opacity; }

  /* Balayage lumineux à l'activation — lent et très discret */
  .px-card-img::before{
    content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.045) 50%, transparent 70%);
    transform: translateX(-130%); opacity: 0;
  }
  .px-card.is-active .px-card-img::before{ animation: pxSweep 1.8s ease .1s; }

  /* Hover sur carte non active : cadre qui s'éclaire */
  .px-card:hover .px-frame{ border-color: rgba(255,255,255,.30); }

  /* Entrée : cartes montent du bas en cascade (stagger géré en JS,
     déclenché après le reveal de transitions.js) */
  .px-card{ transition: opacity .9s var(--ease), transform .9s var(--ease); }
  .px-card.px-enter{ opacity: 0; transform: translateY(90px); }
}
@keyframes pxSweep{
  0%  { opacity: 1; transform: translateX(-130%); }
  100%{ opacity: 1; transform: translateX(130%); }
}

.px-card-img{ position: absolute; inset: 0; border-radius: var(--radius-md); overflow: hidden; }
.px-card-img img{
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: var(--radius-md);
}

/* Cadre outline sur tout le thumbnail */
.px-frame{
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  border: 1.5px solid rgba(255,255,255,.10); border-radius: var(--radius-md);
  transition: border-color .5s ease, box-shadow .5s ease;
}
.px-card.is-active .px-frame{
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(216,255,0,.24), 0 50px 90px rgba(0,0,0,.65);
}

/* Reflet sol */
.px-card::after{
  content: ""; position: absolute; left: 6%; right: 6%; bottom: -8%;
  height: 14%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.5), transparent 70%);
  filter: blur(8px); opacity: .5;
}

/* ── INFO en overlay bas-gauche ──
   Titre en grand, catégorie en vert en dessous. */
.px-card-info{
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  text-align: left;
  padding: 80px 20px 18px;
  background: linear-gradient(to top,
    rgba(0,0,0,.82) 0%,
    rgba(0,0,0,.75) 28%,
    rgba(0,0,0,.55) 50%,
    rgba(0,0,0,.22) 72%,
    rgba(0,0,0,0)   100%);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Titre en premier, plus grand */
.px-name{
  display: block;
  font-family: var(--font-main); font-weight: 700;
  font-size: clamp(20px, 2vw, 28px); line-height: 1.02; letter-spacing: -.01em;
  text-transform: uppercase; margin-bottom: 5px;
}
/* Catégorie en dessous, en vert */
.px-cat{
  display: block; font-family: var(--font-display); font-weight: 900;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}

/* Bloc détaillé révélé sur la carte active */
.px-extra{
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .55s var(--ease), opacity .4s ease;
}
.px-extra > div{ overflow: hidden; min-height: 0; }
.px-card.is-active .px-extra{ grid-template-rows: 1fr; opacity: 1; }

.px-desc{ color: var(--gray); font-size: 13px; line-height: 1.5; margin: 10px 0 12px; max-width: 42ch; }
.px-tags{ display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.px-tag{
  font-size: 10.5px; letter-spacing: .02em; color: var(--white);
  padding: 5px 10px; border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.03);
}
.px-cta{
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 900; font-size: 10px; letter-spacing: .12em;
  color: var(--bg); background: var(--accent);
  padding: 9px 15px; border-radius: var(--radius-pill);
  transition: box-shadow var(--transition), transform var(--transition);
}
.px-card.is-active .px-cta:hover{ box-shadow: 0 0 16px rgba(216,255,0,.45); transform: translateY(-1px); }
.px-cta svg{ width: 12px; height: 12px; }

/* ════════════════════════════════ HUD ══ */
.px-hud{ position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.px-hud > *{ pointer-events: auto; }

.px-head{ position: absolute; top: 116px; left: var(--content-pad); }
.px-title{
  font-family: var(--font-main); font-weight: 700;
  font-size: clamp(34px, 5vw, 68px); line-height: .92; letter-spacing: -.02em;
  text-transform: uppercase; color: rgba(255,255,255,.96);
  /* Desktop : "ALL PROJECTS ✦" sur UNE ligne → plus de place verticale
     pour les cartes (mobile repasse en deux lignes, voir media query) */
  display: flex; align-items: baseline; flex-wrap: wrap; column-gap: .3em;
}
.px-title-line{ display: block; }
.px-title-with-spark{ display: inline-flex; align-items: center; gap: clamp(14px, 1.6vw, 26px); }
.px-title-word{ display: inline-block; }
.px-spark{
  display: inline-flex; align-items: center; justify-content: center;
  width: 0.38em; height: 0.38em;
  color: var(--accent);
  pointer-events: none;
  flex-shrink: 0;
  animation: sparkScale 3s ease-in-out infinite;
  animation-name: pxSparkScale;
}
.px-spark svg{ width: 100%; height: 100%; display: block; }
@keyframes pxSparkScale{
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px var(--accent));
  }
  50% {
    transform: scale(1.45);
    filter: drop-shadow(0 0 10px var(--accent)) drop-shadow(0 0 22px rgba(216,255,0,.35));
  }
}

.px-back{
  position: absolute; top: 124px; right: var(--content-pad);
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--gray);
  transition: color var(--transition);
}
.px-back svg{ width: 14px; height: 14px; transform: rotate(180deg); transition: transform var(--transition); }
.px-back:hover{ color: var(--accent); }
.px-back:hover svg{ transform: rotate(180deg) translate(3px,-3px); }

/* Rail de points/numéros à droite : retiré */
.px-rail{ display: none; }

/* Contrôles bas-gauche */
.px-controls{
  position: absolute; left: var(--content-pad); bottom: 40px;
  display: flex; align-items: center; gap: 14px;
}
.px-controls .proj-ctrl{
  width: 46px; height: 46px; border: 2.5px solid rgba(255,255,255,.55); border-radius: 50%;
  display: grid; place-items: center; color: var(--white);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.px-controls .proj-ctrl:hover{ border-color: rgba(255,255,255,.9); box-shadow: 0 0 12px rgba(255,255,255,.18); }
.px-controls .proj-ctrl svg{ width: 16px; height: 16px; }
/* Flèches : carousel horizontal → chevrons gauche/droite */
#pxPrev svg{ transform: rotate(-90deg); }
#pxNext svg{ transform: rotate(-90deg); }
.px-counter{
  display: inline-flex; align-items: baseline; gap: 5px; margin-left: 4px;
  font-family: var(--font-display); font-weight: 900; font-size: 13px; letter-spacing: .08em;
}
.px-counter i{ color: var(--gray-dark); font-style: normal; }
.px-counter #pxTotal{ color: var(--gray); }

/* Barre de progression bas */
.px-bar{
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(255,255,255,.08); cursor: pointer;
}
.px-bar i{
  position: absolute; left: 0; top: 0; height: 100%; width: 0%;
  background: var(--accent); box-shadow: 0 0 10px rgba(216,255,0,.5);
}

/* Indice scroll — souris animée (même style que la homepage) */
.px-hint{
  position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 900; font-size: 10px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gray);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
}
.px-hint .mouse{
  width: 20px; height: 32px; border: 1px solid var(--gray); border-radius: 12px;
  position: relative; flex-shrink: 0;
}
.px-hint .mouse::after{
  content:""; position: absolute; left: 50%; top: 6px;
  width: 3px; height: 6px; border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  animation: scrolly 1.6s var(--ease) infinite;
}
@keyframes scrolly{
  0%   { opacity: 0; transform: translate(-50%, 0); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 10px); }
}
.px-stage.is-scrolled .px-hint{ opacity: 0; transform: translateX(-50%) translateY(10px); }

/* ════════════════════════════════ TRANSITION PAGE ══ */
.px-transition-overlay{
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity .55s cubic-bezier(0.4, 0, 0.2, 1);
}
.px-transition-overlay.is-visible{
  opacity: 1; pointer-events: auto;
}
.px-stage.is-leaving{
  filter: blur(22px) brightness(0.7);
  transition: filter .5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fallback no-JS */
.px-fallback{ position: relative; z-index: 6; display: flex; flex-direction: column; gap: 12px; padding: 160px var(--content-pad); }
.px-fallback a{ color: var(--accent); font-weight: 700; }

/* ════════════════════════════════ RESPONSIVE ══ */
@media (max-width: 1024px){
  .px-head{ top: 108px; }
  .px-back{ top: 116px; }
}
@media (max-width: 768px){
  /* Cartes plus HAUTES qu'avant (ratio 3/4 au lieu de 4/5) :
     l'image reste bien visible malgré les infos en overlay */
  .px-exp{
    --card-w: min(80vw, 330px);
    --card-h: min(calc(var(--card-w) * 4 / 3), 56vh);
    --card-h: min(calc(var(--card-w) * 4 / 3), 56svh);
  }
  .px-world{ gap: 18px; padding-top: 0; padding-bottom: 0; }
  /* Décale les cartes sous le titre (marge visible ≈ moitié)
     + atténuation des cartes non actives par classes (pas de 3D JS) */
  .px-card{
    margin-top: 90px;
    opacity: .45; transform: scale(.94);
    transition: opacity .45s ease, transform .45s var(--ease);
  }
  .px-card.is-active{ opacity: 1; transform: none; }
  .px-ghost{ display: none; }
  /* Overlay info plus compact → moins d'image mangée */
  .px-card-info{ padding: 56px 16px 14px; }
  .px-head{ top: 84px; left: var(--content-pad); right: var(--content-pad); }
  /* Mobile : titre sur deux lignes comme avant */
  .px-title{ display: block; font-size: clamp(36px, 11vw, 52px); }
  .px-title-with-spark{ gap: 10px; }
  .px-spark{ width: 0.42em; height: 0.42em; }
  .px-back{ display: none; }
  .px-controls{
    bottom: 28px; left: var(--content-pad);
    gap: 10px;
  }
  .px-controls .proj-ctrl{ width: 38px; height: 38px; }
  .px-controls .proj-ctrl svg{ width: 12px; height: 12px; }
  .px-counter{ font-size: 11px; }
  .px-hint{ bottom: 90px; font-size: 9px; letter-spacing: 0.2em; }
  .px-hint .mouse{ width: 16px; height: 26px; }
  .px-desc{ display: none; }
}

@media (max-width: 480px){
  .px-head{ top: 76px; }
  .px-title{ font-size: clamp(32px, 12vw, 44px); }
  .px-exp{ --card-w: min(84vw, 310px); }
  .px-controls{ bottom: 22px; }
  .px-hint{ display: none; }
}

@media (prefers-reduced-motion: reduce){
  .px-blob{ animation: none; }
  .px-card{ transition: opacity .3s ease; }
  .px-world{ scroll-behavior: auto; }
}
