/* texte de lecture (pages projet) et tags */
@font-face {
  font-family: 'ServerMono';
  src: url('../font/ServerMono-Regular.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'noBG';
  src: url('../font/bianzhidai_nobg-ring.woff') format('woff');
}

:root {
  /* « noBG bold » : le noBG ring épaissi par un contour de sa couleur, même
     rendu que le gras, sans changer la largeur des lettres (pas de décalage) */
  --bold: 0.035em;
  --mono: 'ServerMono', ui-monospace, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #f0f0f0;
  font-family: 'noBG', sans-serif;
  height: 100%;

  /* motif points rouges en quinconce */
  /* 2 calques de gradients radiaux décalés de 15px */
  /* pour créer un effet de grille en quinconce */
  background-image: 
    radial-gradient(circle, red 1.5px, transparent 2px),
    radial-gradient(circle, red 1.5px, transparent 2px);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
}

body.page-scroll {
  overflow-y: auto;
}

/* canvas de l'explosion (explosion.js) */
/* z-index 2 pour être au-dessus du fond mais sous la nav (z-index 3) */
canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
}

/* container texte de fond */
/* centré avec flex, les 3 blocs sont répartis verticalement */
.content-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  width: 80%;
  height: 80vh;
  max-width: 1200px;
  color: #000;
  font-size: clamp(1.2rem, 2.5vw, 3.5rem);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* éléments spécifiques — reset marges pour distribution flex */
.construction-msg {
  margin: 0;
}

.intro {
  margin: 0;
}

.contact-info {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* hover : changement police uniquement sur éléments interactifs */
a:hover, .lang-btn:hover, .insta-btn:hover {
  -webkit-text-stroke: var(--bold) currentColor;
  text-decoration: none;
  background: transparent;
  color: inherit;
}

/* bouton instagram — style texte simple */
.insta-btn {
  display: inline-block;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

/* bouton langue — style texte simple */
.lang-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  font-size: clamp(1rem, 2vw, 2.5rem);
}

/* slider d'images */
.image-slider {
  width: 100%;
  max-width: 500px;
  height: auto;
  margin: 0 auto;
  overflow: hidden;
  display: block;
}

/* ============================
   navigation dans les coins
   ============================ */
.nav-home,
.nav-tools,
.nav-gallery,
.lang-btn {
  position: absolute;
  z-index: 3;
  font-size: clamp(1rem, 2vw, 2.5rem);
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.nav-home {
  top: 20px;
  left: 20px;
}

.lang-btn {
  top: 20px;
  right: 20px;
}

.nav-tools {
  bottom: 20px;
  left: 20px;
}

.nav-gallery {
  bottom: 20px;
  right: 20px;
}

.nav-home:hover,
.nav-tools:hover,
.nav-gallery:hover,
.lang-btn:hover,
.nav-home.active,
.nav-tools.active,
.nav-gallery.active {
  -webkit-text-stroke: var(--bold) currentColor;
}

/* ----- menu commun : "*" (accueil) qui déploie les liens au survol -----
   fixe dans le coin, sur toutes les pages : il ne défile ni ne disparaît jamais */
.site-menu {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 3;
  display: flex;
  align-items: center;
}

.site-menu .nav-home {
  position: static;
}

.site-menu-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  max-width: 0;
  margin-left: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, margin-left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) {
  .site-menu:hover .site-menu-links,
  .site-menu:focus-within .site-menu-links {
    max-width: 900px;
    margin-left: 1.2rem;
    opacity: 1;
  }
}

.site-menu-link {
  font-size: clamp(1rem, 1.6vw, 1.6rem);
}

/* la langue, un peu à l'écart des pages */
.site-menu-lang {
  margin-left: 0.6rem;
}

.site-menu-link:hover,
.site-menu-link.active {
  -webkit-text-stroke: var(--bold) currentColor;
}

.mobile-nav-lang {
  margin-top: 1rem;
}

/* menu mobile  */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  background-color: #f0f0f0;
  padding: 20px;
  box-sizing: border-box;
}

.mobile-nav.active {
  display: flex;
}

.mobile-nav-link {
  font-size: clamp(1.5rem, 5.5vw, 3rem);
  color: inherit;
  text-decoration: none;
  line-height: 1.2;
  text-align: center;
  display: block;
  width: 100%;
}

.mobile-nav-link.active {
  -webkit-text-stroke: var(--bold) currentColor;
}

.tool-name-short {
  display: none;
}

/* ============================
   page outils — desktop
   ============================ */
.tools-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(0.8rem, 2vh, 1.5rem);
  width: 90%;
}

.tool-item {
  font-size: clamp(1.2rem, 2.5vw, 3.5rem);
  cursor: pointer;
  transition: font-family 0.2s ease;
  line-height: 1.3;
}

.tool-item:hover {
  -webkit-text-stroke: var(--bold) currentColor;
  color: #fff;
}

/* lignes outils = zones de hover précises */
.tool-row {
  position: relative;
  z-index: 1;
  width: auto;
  padding: 0.6vh 2vw;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.tool-row .tool-item {
  position: relative;
  z-index: 1;
}

/* bouton « Essayer ↗ » à côté du nom de l'outil */
.tool-row {
  gap: 0.8rem;
}

.tool-try {
  position: relative;
  z-index: 1;
  align-self: center;
}

@media (max-width: 768px) {
  .tool-row .tool-try {
    margin-top: 0.35em;
  }

  .tool-row.open .tool-try {
    display: none;
  }
}

.tool-row:hover .tool-item {
  z-index: 10;
}

/* bande carousel horizontale */
/* invisible par défaut (opacity 0), elle s'active au survol d'un outil */
/* pointer-events none pour pas bloquer la souris quand inactive */
.tool-carousel-strip {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100vw;
  height: 50vh;
  z-index: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  padding: 10px 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  will-change: transform, opacity;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tool-carousel-strip.active {
  opacity: 1;
  pointer-events: none;
}

.tool-carousel-strip::-webkit-scrollbar {
  display: none;
}

.tool-carousel-track {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
}

.tool-track {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 30px;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
  will-change: opacity;
}

.tool-track.active {
  opacity: 1;
  pointer-events: auto;
}

.carousel-img-wrapper {
  height: 100%;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.35s ease;
}

.carousel-img-wrapper.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.carousel-img-wrapper img,
.carousel-img-wrapper video {
  height: 100%;
  width: auto;
  max-width: 85vw;
  display: block;
  transform: translateZ(0);
  filter: saturate(0.9);
  transition: transform 0.35s ease, filter 0.35s ease;
}

.carousel-img-wrapper:hover img,
.carousel-img-wrapper:hover video {
  transform: scale(1.04);
  filter: saturate(1.1) brightness(1.05);
}

/* overlay outils (plein écran) */
/* fond noir semi-transparent avec scroll interne */
/* padding top pour laisser de la place au bouton retour */
.tool-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background-color: rgba(0, 0, 0, 0.94);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow-y: auto;
  padding: 80px 20px 40px;
  box-sizing: border-box;
}

.tool-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-back {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 101;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: clamp(1rem, 2vw, 2rem);
  cursor: pointer;
  padding: 0;
}

.overlay-back:hover {
  -webkit-text-stroke: var(--bold) currentColor;
}

.overlay-title {
  font-size: clamp(1.8rem, 5vw, 4rem);
  margin-bottom: 40px;
  text-align: center;
  -webkit-text-stroke: var(--bold) currentColor;
}

.overlay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 1600px;
}

.overlay-img-wrapper {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.overlay-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================
   page galerie — desktop
   ============================ */
.gallery-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: clamp(64px, 10vh, 100px) 20px 40px;
  box-sizing: border-box;
  z-index: 1;
}

.gallery-intro {
  text-align: center;
  /* même taille que l'accroche de la page d'accueil */
  font-size: clamp(1.3rem, 2.95vw, 3.2rem);
  margin: 0 auto clamp(30px, 6vh, 60px);
  max-width: none;
  padding: 0 20px;
  line-height: 1.2;
}

.gallery-intro p {
  margin: 0;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.filter-btn {
  background: transparent;
  border: 1.5px solid #000;
  color: #000;
  font-family: inherit;
  font-size: clamp(0.9rem, 1.5vw, 1.3rem);
  padding: 6px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: #000;
  color: #f0f0f0;
  -webkit-text-stroke: var(--bold) currentColor;
}

.gallery-grid {
  column-count: 4;
  column-gap: 8px;
  max-width: 1600px;
  margin: 0 auto;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 8px;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.gallery-item.hidden {
  display: none;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================
   mobile (<= 768px)
   ============================ */
@media (max-width: 768px) {
  /* cache lien outils sur accueil (mobile uniquement) */
  .home-page .nav-tools {
    display: none;
  }

  /* cache liens outils & galerie sur pages correspondantes (mobile, ils sont dans le menu) */
  .tools-page .nav-tools,
  .tools-page .nav-gallery,
  .gallery-page .nav-tools,
  .gallery-page .nav-gallery {
    display: none;
  }

  .tool-name-full {
    display: none;
  }

  .tool-name-short {
    display: inline;
  }

  /* empêche titres outils de devenir blancs au clic sur mobile */
  .tool-item:hover {
    color: inherit;
  }

  .content-container {
    width: 90%;
    height: 85vh;
    padding: 20px 0;
    font-size: clamp(1.5rem, 5.5vw, 3rem);
  }

  .lang-btn {
    font-size: clamp(1.2rem, 5vw, 2.5rem);
  }

  .nav-home,
  .nav-tools,
  .nav-gallery,
  .lang-btn {
    font-size: clamp(1.2rem, 5vw, 2.5rem);
  }

  .construction-msg {
    margin: 0;
  }

  .intro {
    margin: 0;
  }

  .contact-info {
    margin-top: 0;
    gap: 15px;
  }

  .image-slider {
    max-width: 90%;
  }

  /* outils mobile */
  .tools-container {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    padding-top: 140px;
    padding-bottom: 20px;
    gap: 0.6rem;
    width: 95%;
    margin: 0 auto;
    align-items: stretch;
  }

  .tool-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
    padding: 1vh 0;
  }

  .tool-row .tool-item {
    font-size: clamp(1.5rem, 5.5vw, 3rem);
    transition: all 0.35s ease;
    flex-shrink: 0;
  }

  .tool-row.open .tool-item {
    writing-mode: vertical-rl;
    text-orientation: sideways;
    padding-right: 8px;
  }

  .tool-mobile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    flex: 1;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.35s ease;
    pointer-events: none;
  }

  .tool-row.open .tool-mobile-grid {
    max-height: var(--grid-height, 2000px);
    opacity: 1;
    pointer-events: auto;
  }

  /* fermeture séquentielle : grille se replie d'abord, puis le texte revient */
  /* la classe .closing réduit max-height et opacity de la grille */
  /* la transition du texte (writing-mode) est gérée par css séparément */
  .tool-row.closing .tool-mobile-grid {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.3s ease;
  }

  .tool-mobile-img {
    aspect-ratio: 1;
    overflow: hidden;
  }

  .tool-mobile-img img,
  .tool-mobile-img video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* overlay mobile */
  .overlay-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .tool-overlay {
    padding-top: 80px;
  }

  /* galerie mobile */
  .gallery-grid {
    column-count: 3;
    column-gap: 6px;
  }

  .gallery-item {
    break-inside: avoid;
    margin-bottom: 6px;
  }

  .gallery-item img,
  .gallery-item video {
    width: 100%;
    height: auto;
    display: block;
  }

  .gallery-page {
    padding-top: 76px;
  }

  .gallery-intro {
    font-size: clamp(1.25rem, 5.5vw, 2rem);
    margin-bottom: 24px;
  }

}

/* ============================
   visionneuse mobile
   ============================ */
/* affichage plein écran au-dessus de tout (z-index 200) */
/* les zones gauche/droite sont invisibles mais cliquables pour naviguer */
/* ============================ */
.mobile-viewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  background-color: rgba(0, 0, 0, 0.96);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  touch-action: pan-y;
}

.mobile-viewer.active {
  display: flex;
}

.mobile-viewer-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-viewer-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  font-family: inherit;
  padding: 0;
}

.mobile-viewer-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(0.8rem, 3vw, 1rem);
  opacity: 0.7;
}

.mobile-viewer-zone {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  z-index: 5;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-viewer-zone-left {
  left: 0;
}

.mobile-viewer-zone-right {
  right: 0;
}

/* ============================
   optimisation chargement images (blur-up)
   ============================ */
/* les images commencent avec un flou de 10px (thumb basse qualité) */
/* quand la classe .img-loaded est ajoutée, le flou disparaît en 0.5s */
/* ============================ */
.carousel-img-wrapper img.img-blur,
.gallery-item img.img-blur,
.tool-mobile-img img.img-blur,
.overlay-img-wrapper img.img-blur,
.mobile-viewer-img.img-blur {
  filter: blur(10px);
  transition: filter 0.5s ease;
}

.carousel-img-wrapper img.img-loaded,
.gallery-item img.img-loaded,
.tool-mobile-img img.img-loaded,
.overlay-img-wrapper img.img-loaded,
.mobile-viewer-img.img-loaded {
  filter: blur(0);
  transition: filter 0.5s ease;
}

/* conservation filtres existants une fois chargé */
.carousel-img-wrapper img.img-loaded {
  filter: saturate(0.9);
}

.carousel-img-wrapper:hover img.img-loaded {
  filter: saturate(1.1) brightness(1.05);
}

/* fond placeholder pendant chargement */
.carousel-img-wrapper,
.gallery-item,
.tool-mobile-img,
.overlay-img-wrapper {
  background-color: #e0e0e0;
}

/* ============================
   page d'accueil
   ============================
   - un carrousel fixe au centre de l'écran (.home-carousel-strip) ;
   - les titres des projets (.home-titles, fixe) sont placés par home.js
     selon le scroll : la page défile sur une piste invisible (.home-snaps)
     crantée sur chaque projet (scroll-snap) ;
   - arrivé au centre, un titre s'arrête et passe en exergue : une copie en
     négatif (.home-exergue) apparaît devant les images, puis se fond à
     nouveau derrière elles quand on continue de scroller ;
   - entre deux crans, aucun titre en exergue : seulement le carrousel.
   l'intro est une surcouche transparente : la homepage est déjà là dessous.
   ============================ */
.home-page {
  --pad: 20px;
  --strip-h: 50vh;
  --title-max: 6rem;
  /* estimation avant mesure (home.js pose --title-fit, la taille exacte) */
  --title-size: var(--title-fit, min(var(--title-max), calc((100vw - 2 * var(--pad) - 4vw) / var(--title-em, 30))));
  /* phrase d'accroche : toujours sur une seule ligne */
  --phrase-size: min(3.2rem, calc((100vw - 2 * var(--pad)) / var(--phrase-em, 34)));
  /* distance de scroll entre deux projets */
  --snap-step: clamp(240px, 42vh, 460px);
  /* scroll vertical natif ; les glissements horizontaux pilotent le carrousel */
  touch-action: pan-y pinch-zoom;
}

/* sur l'accueil, c'est la page elle-même (html) qui défile, pas le body :
   la molette et le doigt fonctionnent aussi au-dessus des calques fixes
   (titres, carrousel). le fond de points reste immobile (fixed). */
html.home-root {
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  /* le scroll cranté (un projet par cran) est géré par home.js */
  scrollbar-width: none;
  background-attachment: fixed;
}

html.home-root::-webkit-scrollbar {
  display: none;
}

html.home-root body.home-page {
  height: auto;
  overflow: visible;
  background: transparent;
}

/* ----- carrousel, devant les titres ; cliquable : mène au projet actif ----- */
.home-carousel-strip {
  position: fixed;
  top: 50%;
  left: 0;
  width: 100%;
  height: var(--strip-h);
  transform: translateY(-50%);
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.home-carousel-strip.active {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.home-carousel-track {
  position: relative;
  height: 100%;
}

/* une piste par projet, superposées : fondu enchaîné lent d'un projet à l'autre */
.home-track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 30px;
  opacity: 0;
  /* l'ancienne piste s'efface d'abord… */
  transition: opacity 0.35s ease;
}

.home-track.active {
  opacity: 1;
  will-change: transform, opacity;
  /* …puis la nouvelle apparaît : les deux ne se superposent jamais */
  transition: opacity 0.6s ease 0.35s;
}

.home-carousel-img-wrapper {
  height: 100%;
  flex-shrink: 0;
  background-color: #e0e0e0;
}

.home-carousel-img-wrapper img,
.home-carousel-img-wrapper video {
  display: block;
  height: 100%;
  width: auto;
  max-width: 85vw;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.home-carousel-img-wrapper img.img-blur {
  filter: blur(10px);
  transition: filter 0.6s ease;
}

.home-carousel-img-wrapper img.img-loaded {
  filter: saturate(0.9);
  transition: filter 0.6s ease;
}

/* ----- piste de scroll et accroche ----- */
.home-main {
  position: relative;
}

/* accroche en haut de page, défile avec la page */
.home-header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(64px, 10vh, 100px) var(--pad) 0;
  text-align: center;
}

.home-phrase {
  margin: 0;
  font-size: var(--phrase-size);
  font-weight: normal;
  line-height: 1.2;
  white-space: nowrap;
}

/* hauteur = un cran par projet ; les crans (.home-snap) servent de repères */
.home-snaps {
  position: relative;
  height: calc((var(--snap-count, 1) - 1) * var(--snap-step) + 100vh);
}

.home-snap {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  top: calc(var(--i) * var(--snap-step));
  pointer-events: none;
}

/* ----- titres (derrière les images) ----- */
.home-titles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.home-titles-inner {
  position: absolute;
  inset: 0;
}

/* chaque titre est placé par home.js : le précédent au-dessus du carrousel,
   celui en exergue au centre, le suivant en dessous */
.home-titles-list {
  position: absolute;
  inset: 0;
}

.home-titles-list .home-project-row {
  position: absolute;
  top: 0;
  left: 50%;
  max-width: calc(100% - 2 * var(--pad));
  visibility: hidden;
  will-change: transform, opacity;
}

.home-project-row,
.home-project-row:hover,
.home-exergue,
.home-exergue:hover {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  padding: clamp(6px, 1.6vh, 18px) 2vw;
  font-family: 'noBG', sans-serif;
  font-size: var(--title-size);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.home-project-row {
  color: #000;
  pointer-events: auto;
  cursor: pointer;
}

.home-project-row:focus-visible {
  outline: none;
  -webkit-text-stroke: var(--bold) currentColor;
}

/* écrans tactiles : pas de gras « collé » après un tap */
@media (hover: none) {
  .home-project-row:hover {
    -webkit-text-stroke: 0;
  }
}

/* ----- titre en exergue : copie en négatif, devant les images ----- */
/* blanc + difference = noir sur le fond clair, inversé sur les images */
.home-exergue,
.home-exergue:hover {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: calc(100% - 2 * var(--pad));
  transform: translate(-50%, -50%);
  color: #fff;
  mix-blend-mode: difference;
  -webkit-text-stroke: 0;
  opacity: 0;
  pointer-events: none;
}

.home-exergue.is-clickable {
  pointer-events: auto;
}

/* apparition douce du premier titre après l'intro ou un redimensionnement */
.home-exergue.is-settling {
  transition: opacity 0.7s ease;
}

/* ----- infos du projet actif : en bas à droite ----- */
.home-info {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.4rem 1.2rem;
  max-width: calc(100% - 40px);
  font-size: clamp(0.95rem, 1.3vw, 1.3rem);
  line-height: 1.3;
  text-align: right;
  transition: opacity 0.25s ease;
}

.home-info.is-changing {
  opacity: 0;
}

.home-info-tag {
  font-size: 0.72em;
}

.home-info-tags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem 0.5rem;
}

/* ----- intro plein écran ----- */
.home-intro {
  display: none; /* sans JS : pas d'intro bloquante */
}

/* phrase + gif forment un groupe centré en hauteur sur l'écran */
.show-intro .home-intro {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vh, 44px);
  cursor: pointer;
  touch-action: none;
}

.home-intro-text {
  padding: 0 var(--pad);
  text-align: center;
}

/* sortie : glissement lent et amorti, jusqu'à la place de la phrase en haut */
.home-intro-text.animating {
  transition: transform 1.6s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}

/* le gif ne bouge jamais : il s'estompe sur place */
.home-intro-gif {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: min(36vh, 340px);
  transition: opacity 1.1s ease;
}

.home-intro-gif.fading {
  opacity: 0;
}

/* pendant l'intro : pas de scroll, titres masqués par un clip (pas un fondu) */
html.show-intro.home-root {
  overflow: hidden;
}

.show-intro .home-titles-inner {
  clip-path: inset(100% 0 0 0);
  transform: translateY(12vh);
}

.show-intro .home-header-text {
  opacity: 0;
}

.show-intro .home-chrome,
.show-intro .home-carousel-strip,
.show-intro .home-exergue {
  opacity: 0 !important;
  pointer-events: none;
}

.home-chrome {
  transition: opacity 0.8s ease;
}

/* sortie : le clip se lève de bas en haut pendant que la phrase remonte, les
   titres montent doucement à leur place ; le carrousel apparaît ensuite */
.show-intro.intro-exiting .home-titles-inner {
  clip-path: inset(0 0 0 0);
  transform: none;
  transition: clip-path 1.6s cubic-bezier(0.65, 0, 0.35, 1), transform 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.show-intro.intro-exiting .home-chrome {
  opacity: 1 !important;
  transition-delay: 0.8s;
}

/* ----- mobile ----- */
@media (max-width: 768px) {
  .home-page {
    --strip-h: 42vh;
    --title-max: 2.6rem;
    --snap-step: clamp(200px, 36vh, 360px);
    /* estimation sur deux lignes avant mesure */
    --title-size: var(--title-fit, min(var(--title-max), calc((100vw - 56px) * 1.8 / var(--title-em, 30))));
  }

  /* sur téléphone, un titre peut passer sur deux lignes (jamais plus) */
  .home-project-row,
  .home-project-row:hover,
  .home-exergue,
  .home-exergue:hover {
    white-space: normal;
    text-wrap: balance;
    line-height: 1.15;
  }

  .home-header {
    padding-top: 76px;
  }

  .home-track {
    padding: 0 16px;
    gap: 10px;
  }

  .home-info {
    font-size: 1.05rem;
  }

  .home-intro-gif {
    height: min(30vh, 260px);
  }
}

/* téléphone à l'horizontale */
@media (max-height: 520px) and (orientation: landscape) {
  .home-page {
    --title-max: 3rem;
  }

  .home-header {
    padding-top: 56px;
  }

  .home-intro-gif {
    height: 38vh;
  }
}

/* ============================
   page projet — grille horizontale
   ============================ */
.project-page {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}

.project-header {
  flex: 0 0 auto;
  padding: 90px 40px 16px;
  box-sizing: border-box;
}

.project-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.project-id {
  font-family: var(--mono);
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  opacity: 0.6;
  white-space: nowrap;
}

.project-title {
  font-size: clamp(1.4rem, 2.6vw, 2.6rem);
  margin: 0;
  line-height: 1.2;
}

.project-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* pastilles de tags : même dessin partout sur le site (page projet, accueil,
   liste des projets, filtres) */
.project-tag,
.home-info-tag,
.projects-tag,
.projects-filter {
  display: inline-block;
  font-family: var(--mono);
  line-height: 1.3;
  white-space: nowrap;
  border: 1.5px solid #000;
  padding: 2px 12px;
  border-radius: 20px;
}

.project-tag {
  font-size: clamp(0.7rem, 0.95vw, 0.85rem);
}

.project-credits {
  font-family: var(--mono);
  font-size: clamp(0.75rem, 0.95vw, 0.9rem);
  opacity: 0.6;
  margin-left: auto;
  white-space: nowrap;
}

.project-line-description {
  margin-top: 0.8rem;
}

.project-text {
  width: 66%;
  font-family: var(--mono);
  font-size: clamp(0.85rem, 1.1vw, 1.05rem);
  line-height: 1.6;
}

/* description longue : coupée à 335 caractères, une flèche déplie la suite */
.project-text-rest {
  animation: project-text-in 0.5s ease;
}

@keyframes project-text-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.project-text-toggle {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0 0.2em;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.project-text-toggle:hover {
  -webkit-text-stroke: var(--bold) currentColor;
}

.project-text-toggle[aria-expanded="true"] {
  transform: rotate(180deg);
}

/* texte déplié : la page défile, le carrousel garde une hauteur confortable */
.project-page.text-open {
  overflow-y: auto;
}

.project-page.text-open .project-carousel {
  flex: 0 0 auto;
  height: 62vh;
}

/* carrousel central : scroll natif (molette convertie en JS) + glisser-déposer */
.project-carousel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.project-carousel::-webkit-scrollbar {
  display: none;
}

.project-carousel.grabbing {
  cursor: grabbing;
}

.project-carousel-track {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 0 40px;
  width: max-content;
}

.project-carousel-item {
  flex-shrink: 0;
  height: 100%;
}

.project-carousel-item img {
  height: 100%;
  width: auto;
  max-width: 85vw;
  display: block;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.project-footer {
  flex: 0 0 auto;
  text-align: right;
  padding: 16px 40px;
  box-sizing: border-box;
  font-size: clamp(0.95rem, 1.6vw, 1.3rem);
}

.project-next {
  color: inherit;
  text-decoration: none;
}

.project-next:hover {
  -webkit-text-stroke: var(--bold) currentColor;
}

/* page projet sur téléphone : la page défile, texte pleine largeur,
   carrousel à hauteur confortable */
@media (max-width: 768px) {
  .project-page,
  .project-page.text-open {
    display: block;
    height: 100%;
    overflow-y: auto;
  }

  .project-header {
    padding: 76px 20px 16px;
  }

  .project-line {
    gap: 0.6rem;
  }

  .project-credits {
    margin-left: 0;
  }

  .project-text {
    width: 100%;
  }

  .project-carousel,
  .project-page.text-open .project-carousel {
    height: 58vh;
  }

  .project-carousel-track {
    padding: 0 20px;
  }

  .project-carousel-item img {
    max-width: 88vw;
  }

  .project-footer {
    text-align: left;
    padding: 16px 20px 28px;
  }
}

/* ============================
   essayer en ligne : bouton et expérience intégrée
   ============================ */
/* bouton : pastille pleine, qui s'inverse au survol (effet négatif) */
.try-btn,
a.try-btn:hover {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  box-sizing: border-box;
  border: 1.5px solid #000;
  border-radius: 20px;
  padding: 3px 14px;
  background: #000;
  color: #f0f0f0;
  font-family: 'noBG', sans-serif;
  font-size: clamp(0.85rem, 1.05vw, 1.05rem);
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  -webkit-text-stroke: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.try-btn:hover,
a.try-btn:hover,
.try-btn:focus-visible {
  background: transparent;
  color: #000;
  outline: none;
}

/* expérience dans le carrousel : même hauteur que les images, à son format */
.project-embed {
  position: relative;
  height: 100%;
  aspect-ratio: var(--embed-ratio, 4 / 3);
  max-width: 85vw;
  overflow: hidden;
  background-color: #e0e0e0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  cursor: default;
}

.project-embed-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.project-embed-viewport {
  position: absolute;
  overflow: hidden;
}

.project-embed-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  transform-origin: 0 0;
}

.project-embed.is-running {
  background-image: none !important;
}

.project-embed-start {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.project-embed.is-running .project-embed-start {
  display: none;
}

.project-embed-full {
  position: absolute;
  top: 12px;
  right: 12px;
}

.project-embed-close {
  display: none;
}

/* plein écran : le cadre couvre toute la fenêtre, sur le fond à points */
.project-embed.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 400;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  background-color: #f0f0f0;
  background-image:
    radial-gradient(circle, red 1.5px, transparent 2px),
    radial-gradient(circle, red 1.5px, transparent 2px) !important;
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  background-repeat: repeat;
}

.project-embed.is-fullscreen .project-embed-frame {
  inset: 64px 16px 16px;
}

.project-embed.is-fullscreen .project-embed-full {
  display: none;
}

.project-embed.is-fullscreen .project-embed-close {
  display: inline-flex;
  position: absolute;
  top: 16px;
  right: 16px;
}

html.embed-fullscreen body {
  overflow: hidden;
}

@media (max-width: 768px) {
  /* téléphone : pleine largeur, hauteur selon le format de l'expérience */
  .project-embed {
    width: 88vw;
    height: auto;
    max-width: 88vw;
    max-height: 100%;
    align-self: center;
  }

  .project-embed.is-fullscreen .project-embed-frame {
    inset: 60px 8px 8px;
  }
}

/* ============================
   page projets — liste / grille, filtre par tag
   ============================ */
.projects-main {
  box-sizing: border-box;
  padding: 100px 40px 60px;
}

.projects-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(28px, 5vh, 56px);
}

.projects-filters {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
}

/* filtre actif : pastille pleine */
.projects-filter.active {
  background: #000;
  color: #f0f0f0;
}

/* deux icônes : liste / carrés */
.projects-views {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
}

.projects-view-btn {
  display: block;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.projects-view-btn:hover,
.projects-view-btn.active {
  opacity: 1;
}

.projects-view-btn svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.projects-empty {
  font-size: clamp(1rem, 1.6vw, 1.5rem);
}

/* mode liste : titre, tags, date */
.projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.projects-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 4.5em;
  align-items: baseline;
  gap: 0.4rem 2rem;
  padding: clamp(6px, 1.2vh, 12px) 0;
}

.projects-row-title {
  font-size: clamp(1.4rem, 2.6vw, 2.6rem);
  line-height: 1.2;
}

.projects-row:hover .projects-row-title {
  -webkit-text-stroke: var(--bold) currentColor;
}

.projects-row-tags,
.projects-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: clamp(0.72rem, 0.9vw, 0.88rem);
}

.projects-row-year {
  font-size: clamp(0.85rem, 1.1vw, 1.1rem);
  text-align: right;
}

/* mode grille : lignes et colonnes d'images */
.projects-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 18vw, 280px), 1fr));
  gap: 28px 16px;
}

.projects-view-grid .projects-list {
  display: none;
}

.projects-view-grid .projects-grid {
  display: grid;
}

.projects-card-link {
  display: block;
}

.projects-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background-color: #e0e0e0;
}

.projects-card-image-empty {
  aspect-ratio: 1;
}

.projects-card-title {
  display: block;
  margin-top: 8px;
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  line-height: 1.2;
}

.projects-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.5rem;
  margin-top: 6px;
  font-size: clamp(0.8rem, 1vw, 1rem);
}

.projects-card-meta .projects-tag {
  font-size: 0.8em;
}

.projects-card-year {
  margin-right: 0.3rem;
}

/* ============================
   page à propos
   ============================ */
.about-main {
  box-sizing: border-box;
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(110px, 18vh, 180px) 20px 80px;
  text-align: center;
  font-size: clamp(1rem, 1.5vw, 1.5rem);
  line-height: 1.5;
}

.about-name {
  margin: 0 0 1.2em;
  font-size: clamp(1.6rem, 3vw, 3rem);
  font-weight: normal;
  line-height: 1.2;
}

.about-text {
  margin: 0 0 1.2em;
}

.about-degree {
  margin: 0 0 1.2em;
}

.about-born {
  margin: 0;
}

/* le compteur ne se coupe jamais entre un nombre et son unité */
.about-counter-part {
  white-space: nowrap;
}

.about-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4em 2em;
  margin: 1.8em 0 0;
}

/* chiffres à largeur fixe : le compteur ne tremble pas à chaque seconde */
.about-counter-num {
  display: inline-block;
  text-align: right;
}

@media (max-width: 768px) {
  .projects-main {
    padding: 90px 20px 40px;
  }

  .projects-filters {
    font-size: 0.95rem;
  }

  .projects-row-title {
    font-size: clamp(1.5rem, 6.5vw, 2.2rem);
  }

  .projects-row-tags,
  .projects-row-year,
  .projects-card-meta {
    font-size: 0.95rem;
  }

  .projects-card-title {
    font-size: 1.15rem;
  }

  .about-main {
    font-size: 1.15rem;
  }

  .about-name {
    font-size: 2rem;
  }

  .project-text {
    font-size: 0.95rem;
  }

  .project-title {
    font-size: clamp(1.7rem, 7vw, 2.4rem);
  }

  .project-tag,
  .projects-tag,
  .projects-filter {
    font-size: 0.85rem;
  }

  .home-info-tag {
    font-size: 0.8em;
  }

  .site-menu-link {
    font-size: 1.1rem;
  }

  .projects-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .projects-row-tags {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* ============================
   transitions entre pages (page-transition.js)
   ============================
   au clic sur un lien : tous les éléments de la page s'effacent ; la page
   suivante s'ouvre sur le fond seul, dont les points ondulent en hauteur puis
   reprennent leur place ; ses éléments apparaissent ensuite en fondu.
   ============================ */
/* sortie */
html.pt-leave body > *:not(.pt-canvas):not(.site-menu) {
  opacity: 0 !important;
  transition: opacity 0.4s ease !important;
}

/* entrée : éléments masqués dès le premier rendu (classe posée dans le <head>) */
html.pt-enter body > *:not(.pt-canvas):not(.site-menu) {
  opacity: 0 !important;
}

/* apparition fluide des éléments une fois les points revenus en place */
html.pt-reveal body > *:not(.pt-canvas):not(.site-menu) {
  transition: opacity 0.7s ease !important;
}

/* pendant l'ondulation, le fond du body s'efface : le canvas des points
   (juste au-dessus du fond de la page) le remplace à l'identique */
html.pt-waving body {
  background: transparent;
}

.pt-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
