/* =====================================================================
   Page d'accueil — styles
   ===================================================================== */

:root {
  --bg: #0a0a14;
  --text: #fff6e0;
  --muted: #9aa3c7;
  --neon-green: #39ff14;
  --neon-cyan: #00e5ff;
  --neon-pink: #ff2e97;
  --neon-yellow: #ffe600;
  --pad-x: clamp(1.25rem, 8vw, 8.75rem);
}

/* ---------- ÉCHELLE DU SITE ----------
   Toutes les tailles sont en rem : 1rem = 16px sur ordinateur.
   Tablettes et grands écrans (TV) affichent exactement la version ordinateur,
   réduite ou agrandie d'un seul bloc pour garder les mêmes proportions :
   - écran plus petit que 1280 × 800 (tablette, petit portable) : on réduit ;
   - entre les deux : taille normale (1rem = 16px) ;
   - écran plus grand que 1920 × 1080 (2K, 4K, TV) : on agrandit.
   Les téléphones gardent 16px et leur propre mise en page (voir les @media mobiles). */
html { font-size: 16px; }
@media (min-width: 700px) and (min-height: 501px) {
  html { font-size: max(min(16px, 1.25vw, 2vh), min(0.83333vw, 1.48148vh)); }
}
/* Tablette en portrait : référence 1024px de large pour rester lisible */
@media (min-width: 700px) and (min-height: 501px) and (orientation: portrait) {
  html { font-size: min(16px, 1.5625vw, 2vh); }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; color: var(--text); }
html { background: var(--bg); scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  font-family: 'VT323', monospace;
  overflow-x: hidden;
}

/* Scanlines CRT par-dessus toute la page */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 0.125rem, rgba(0, 0, 0, 0.18) 0.125rem 0.1875rem);
  z-index: 50;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6.875rem var(--pad-x) 5.625rem;
  overflow: hidden;
}
.hero > * { position: relative; z-index: 1; }

/* ---------- FOND COMMUN À TOUT LE SITE ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Photo de fond : floutée, assombrie, avec un lent zoom/panoramique */
.bg-photo {
  position: absolute;
  inset: -2.5rem;
  filter: blur(0.2188rem) brightness(0.5) saturate(1.1);
  transform: translate3d(var(--px, 0), var(--py, 0), 0) scale(1.08);
  transition: transform 0.6s ease-out;
  /* Calque GPU : le flou n'est pas recalculé à chaque image de l'animation */
  will-change: transform;
}
.bg-img {
  position: absolute;
  inset: 0;
  background: url('../arriereplan.webp') center / cover no-repeat;
  animation: kenburns 28s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes kenburns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.05) translate(-1%, -0.5%); }
}

/* Voile sombre, plus fort au centre pour la lisibilité */
.bg-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at center, rgba(10, 10, 20, 0.75) 0%, rgba(10, 10, 20, 0.45) 60%, rgba(10, 10, 20, 0.15) 100%);
}

/* Carrés « nourriture » qui flottent */
.food {
  position: absolute;
  width: var(--s, 0.625rem);
  height: var(--s, 0.625rem);
  border-radius: 25%;
  background: var(--c, var(--neon-pink));
  box-shadow: 0 0 0.75rem var(--c, var(--neon-pink));
  opacity: 0.55;
  animation: float var(--t, 9s) ease-in-out var(--delay, 0s) infinite alternate;
}
@keyframes float {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(var(--dx, 1.25rem), calc(var(--dy, -1.875rem) * 0.5)) rotate(20deg); opacity: 0.8; }
  100% { transform: translate(calc(var(--dx, 1.25rem) * -0.5), var(--dy, -1.875rem)) rotate(-10deg); }
}/* Position, taille, couleur et trajectoire de chaque carré */
.food-1 { top: 14%; left: 12%; --s: 0.75rem; --c: #ff4fd8; --t: 8s; --dx: 1.875rem; --dy: -2.5rem; }
.food-2 { top: 22%; left: 78%; --s: 1rem; --c: #ff2e97; --t: 11s; --dx: -1.5625rem; --dy: 2.1875rem; --delay: -3s; }
.food-3 { top: 68%; left: 8%; --s: 0.625rem; --c: #7873f5; --t: 9s; --dx: 2.5rem; --dy: -1.5625rem; --delay: -5s; }
.food-4 { top: 78%; left: 70%; --s: 0.875rem; --c: #ff6ec7; --t: 10s; --dx: -2.1875rem; --dy: -1.875rem; --delay: -2s; }
.food-5 { top: 40%; left: 90%; --s: 0.5rem; --c: #4f7cff; --t: 7s; --dx: -1.25rem; --dy: 2.5rem; --delay: -4s; }
.food-6 { top: 55%; left: 22%; --s: 0.5rem; --c: #b44bff; --t: 12s; --dx: 1.5625rem; --dy: 1.875rem; --delay: -6s; }
.food-7 { top: 10%; left: 52%; --s: 0.5625rem; --c: #7873f5; --t: 9.5s; --dx: -1.875rem; --dy: 1.5625rem; --delay: -1s; }
.food-8 { top: 86%; left: 40%; --s: 0.6875rem; --c: #ff2e97; --t: 8.5s; --dx: 1.875rem; --dy: -2.1875rem; --delay: -7s; }

/* ---------- MENU ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  /* Logo à gauche, liens au centre, FR/EN à droite */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
  padding: 0.625rem var(--pad-x);
  background: linear-gradient(to bottom, rgba(10, 10, 20, 0.85), rgba(10, 10, 20, 0));
  transition: background 0.3s, box-shadow 0.3s;
}
.nav.is-scrolled {
  background: rgba(10, 10, 20, 0.9);
  -webkit-backdrop-filter: blur(0.625rem);
  backdrop-filter: blur(0.625rem);
  box-shadow: 0 0.125rem 0 rgba(255, 46, 151, 0.35);
}
.logo { display: flex; justify-self: start; }
.logo img {
  height: 4.125rem;
  width: auto;
  transition: filter 0.2s;
}
.logo:hover img, .logo:focus-visible img {
  filter: drop-shadow(0 0 0.375rem var(--neon-pink)) drop-shadow(0 0 0.875rem rgba(255, 46, 151, 0.6));
}

/* Ordinateur : la liste et FR/EN sont des colonnes de la grille */
.menu { display: contents; }
/* Police pixel ; l'ombre décalée donne l'épaisseur */
.nav-list {
  display: flex;
  gap: clamp(1.2rem, 2.6vw, 2.6rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-link, .lang {
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s, transform 0.2s;
}
.nav-link {
  position: relative;
  display: block;
  padding: 0.5rem 0;
  font-size: clamp(0.5625rem, 1.2vw, 0.8125rem); /* même taille que « Développeuse web » */
  white-space: nowrap;
  text-shadow: 0.08em 0.08em 0 rgba(255, 46, 151, 0.35);
}
/* Trait néon qui se déploie sous le lien */
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.1875rem;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan));
  box-shadow: 0 0 0.625rem rgba(255, 46, 151, 0.6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nav-link:hover, .nav-link:focus-visible, .nav-link.is-active {
  color: var(--text);
  text-shadow: 0.1em 0.1em 0 var(--neon-pink), -0.06em -0.06em 0 var(--neon-cyan);
  transform: translateY(-0.125rem);
}
.nav-link:hover::after, .nav-link:focus-visible::after, .nav-link.is-active::after { transform: scaleX(1); }

.lang {
  justify-self: end;
  display: inline-flex;
  gap: 0.8em;
  padding: 0.5rem 0;
  background: none;
  border: 0;
  font-size: clamp(0.5625rem, 1.2vw, 0.8125rem);
  cursor: pointer;
}
.lang span { transition: color 0.2s, text-shadow 0.2s; }
.lang:hover span:not(.is-on):not(.sep) { color: var(--text); }
.sep { opacity: 0.5; }
.lang .is-on { color: var(--text); text-shadow: 0.1em 0.1em 0 var(--neon-cyan); }

.nav a:focus-visible, .nav button:focus-visible { outline: 0.125rem dashed var(--neon-cyan); outline-offset: 0.375rem; }

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.3125rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.375rem;
  background: none;
  border: 0;
  cursor: pointer;
  z-index: 2;
}
.burger span {
  display: block;
  height: 0.1875rem;
  background: var(--text);
  transition: transform 0.25s, opacity 0.2s;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(0.5rem) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-0.5rem) rotate(-45deg); }

@media (max-width: 699px), (max-height: 500px) {
  .logo img { height: 3.125rem; }
  .burger { display: flex; position: relative; }
  /* backdrop-filter piégerait le menu plein écran (position: fixed) dans la barre */
  .nav.is-scrolled { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav { grid-template-columns: 1fr auto; }
  .menu {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    background: rgba(10, 10, 20, 0.97);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s, visibility 0.25s;
  }
  .menu.is-open { visibility: visible; opacity: 1; }
  .nav-list { flex-direction: column; align-items: center; gap: 1.6rem; }
  .nav-link { font-size: clamp(1rem, 5vw, 1.375rem); }
  .lang { justify-self: auto; font-size: 0.8125rem; }
}

.hud {
  position: absolute;
  bottom: 1.25rem;
  left: var(--pad-x);
  right: var(--pad-x);
  display: flex;
  justify-content: space-between;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5rem, 1.2vw, 0.75rem);
  letter-spacing: 0.08em;
  color: var(--muted);
  z-index: 3;
}
.hud strong { color: var(--text); font-weight: 400; margin-left: 0.8em; }

.hero-title {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  font-size: clamp(1.7rem, 6.5vw, 5.2rem);
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: var(--text);
  text-align: center;
}
.line { display: block; white-space: nowrap; }
/* Téléphone en portrait : le nom occupe toute la largeur (« Seghilani » ≈ 9,2em) */
@media (max-width: 699px) {
  .hero-title { font-size: clamp(1.7rem, 8.6vw, 2.6rem); }
}

/* Lettres découpées par le JS : cachées jusqu'au passage du snake */
.char {
  display: inline-block;
  opacity: 0;
  transform: scale(0.3) translateY(0.2em);
}
.char.is-on {
  opacity: 1;
  transform: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.8, 0.64, 1), opacity 0.12s linear;
  text-shadow: 0.06em 0.06em 0 var(--neon-pink), -0.04em -0.04em 0 var(--neon-cyan);
}
.outline .char.is-on {
  color: transparent;
  -webkit-text-stroke: 0.125rem var(--text);
  text-shadow: 0.06em 0.06em 0 rgba(0, 229, 255, 0.55);
}

.hero-meta {
  margin-top: clamp(1.2rem, 3vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5625rem, 1.2vw, 0.8125rem);
  color: var(--neon-green);
}
.hero-meta span:last-child { color: var(--neon-cyan); }

/* Le reste du hero n'apparaît qu'une fois le nom écrit */
.js .reveal {
  opacity: 0;
  visibility: hidden; /* pas cliquable tant qu'il est caché */
  transform: translateY(0.75rem);
}
.js .hero.is-ready .reveal {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: calc(var(--d, 0) * 120ms);
}

/* Globe fil de fer : lien vers la scène suivante (on plonge dedans) */
.globe {
  display: block;
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 50%;
  z-index: 3;
  transition: filter 0.2s;
}
.globe canvas { display: block; width: 100%; height: 100%; }
.globe:hover, .globe:focus-visible {
  filter: drop-shadow(0 0 0.625rem rgba(255, 46, 151, 0.6));
}
.globe:focus-visible { outline: 0.125rem dashed var(--neon-cyan); outline-offset: 0.375rem; }

/* Sur l'accueil : sous le sous-titre */
.hero-globe {
  --d: 1;   /* apparaît juste après le sous-titre */
  align-self: center;
  margin-top: clamp(1.8rem, 4vw, 2.8rem);
}

/* Le globe rétrécit dans la bouche du snake */
.globe.is-eaten {
  transform: scale(0) rotate(180deg) !important;
  transition: transform 0.18s ease-in !important;
}

/* ---------- SCÈNES : une seule visible à la fois ---------- */
.scene:not(.is-active) { display: none !important; }
.scene { transform-origin: var(--ox, 50%) var(--oy, 50%); }

/* On plonge dans le globe : la scène grossit vers lui et disparaît */
.scene.is-diving-out {
  animation: diveOut 0.7s cubic-bezier(0.55, 0, 0.85, 0.35) forwards;
  pointer-events: none;
}
@keyframes diveOut {
  to { transform: scale(3.5); opacity: 0; filter: blur(0.625rem); }
}

/* La nouvelle scène se matérialise, comme si on venait d'y arriver */
.scene.is-arriving { animation: arrive 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes arrive {
  from { opacity: 0; transform: scale(1.15); filter: blur(0.5rem); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* Retour à l'accueil : on recule hors de la scène… */
.scene.is-pulling-back { animation: pullBack 0.5s ease-in forwards; pointer-events: none; }
@keyframes pullBack {
  to { transform: scale(0.85); opacity: 0; filter: blur(0.375rem); }
}
/* …et on ressort du globe */
.scene.is-emerging { animation: emerge 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes emerge {
  from { transform: scale(3.5); opacity: 0; filter: blur(0.625rem); }
  to   { transform: none; opacity: 1; filter: none; }
}

/* Le décor avance aussi pendant la plongée, puis revient doucement */
.bg.is-diving {
  transform: scale(1.35);
  transition: transform 0.7s cubic-bezier(0.55, 0, 0.85, 0.35);
}

.hero-title:focus { outline: none; }

/* ---------- QUI SUIS-JE ---------- */
/* Tient dans la fenêtre : texte à gauche, photo au centre, mini-chat à droite.
   --fit (réglé par le JS) réduit texte et photo si la fenêtre est trop basse. */
.about {
  --fit: 1;
  --globe-size: 4.75rem;
  --globe-gap: clamp(0.625rem, 2.5vh, 1.5rem);
  position: relative;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: clamp(5rem, 12vh, 6.875rem) var(--pad-x) calc(var(--globe-size) + 2 * var(--globe-gap));
  overflow: hidden;
}
.about-inner {
  display: grid;
  /* Texte | photo | mini-chat */
  grid-template-columns: minmax(0, 1.35fr) auto minmax(11.875rem, 0.75fr);
  column-gap: clamp(1.2rem, 3vw, 3rem);
  align-items: stretch;
  width: 100%;
  max-width: 81.25rem;
  margin: 0 auto;
}
/* Titre au-dessus de l'écran ; écran et photo sur la même ligne */
.about-text { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; min-height: 0; }

/* Fenêtre vraiment trop basse : seul le texte de la carte défile */
.about.is-cramped { align-items: stretch; }
.about.is-cramped .about-inner { height: 100%; grid-template-rows: auto minmax(0, 1fr); }
.about.is-cramped .about-text { max-height: 100%; }
.about.is-cramped .card-body { overflow-y: auto; }

.about-title {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  margin: 0 0 clamp(0.6rem, 2vh, 1.2rem);
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  font-size: calc(clamp(1.1rem, min(3vw, 5vh), 2.2rem) * var(--fit));
  line-height: 1.4;
  color: var(--text);
  text-shadow: 0.08em 0.08em 0 var(--neon-pink);
}
.about-title:focus { outline: none; }

/* Fenêtre vitrée avec une carte mère en fond (Qui suis-je, Compétences) */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 0.0625rem solid rgba(255, 246, 224, 0.14);
  border-radius: 1.125rem;
  background: rgba(8, 9, 18, 0.72);
  box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(0.625rem);
  backdrop-filter: blur(0.625rem);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.card-bg { position: absolute; inset: 0; pointer-events: none; }
.card-board { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Vitre teintée : plus sombre côté texte, reflet et vignettage */
.card-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 7, 14, 0) 40%, rgba(6, 7, 14, 0.6) 100%),
    linear-gradient(to right, rgba(8, 9, 18, 0.9) 0%, rgba(8, 9, 18, 0.78) 55%, rgba(8, 9, 18, 0.55) 100%);
}
.card-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1rem;
  border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.07);
}
.card-dots { display: flex; gap: 0.375rem; }
.card-dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.card-name { font-family: 'Press Start 2P', monospace; font-size: 0.5rem; color: var(--muted); }
.card-body {
  position: relative;
  z-index: 1;
  min-height: 0;
  padding: clamp(1rem, 3vh, 1.8rem) clamp(1.2rem, 2.4vw, 2.2rem);
}
.about .card p {
  margin: 0 0 clamp(0.6rem, 1.6vh, 1rem);
  font-size: calc(clamp(0.9rem, min(1.1vw, 2vh), 1.05rem) * var(--fit));
  line-height: 1.65;
  color: #d4d8ee;
}
.about .card p:first-child { color: var(--text); font-weight: 500; }
.about .card p:last-child { margin-bottom: 0; }
.card a { color: var(--neon-pink); text-underline-offset: 0.1875rem; }
.card a:hover { color: var(--text); }

/* Photo centrée à la hauteur de la carte */
.photo {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  margin: 0;
  justify-self: start;
  align-self: center;
  /* Image 2:3 : largeur limitée pour que la hauteur tienne dans la fenêtre */
  width: calc(min(17.5rem, 36vh) * var(--fit));
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  border: 0.1875rem solid var(--text);
  box-shadow: 0.625rem 0.625rem 0 var(--neon-pink), 1.25rem 1.25rem 0 rgba(0, 229, 255, 0.5);
}

/* ---------- COMPÉTENCES ---------- */
/* Tient dans la fenêtre */
.skills {
  --globe-size: 4.75rem;
  --globe-gap: clamp(0.625rem, 2.5vh, 1.5rem);
  position: relative;
  height: 100vh;
  height: 100svh;
  display: flex;
  padding: clamp(5rem, 12vh, 6.875rem) var(--pad-x) calc(var(--globe-size) + 2 * var(--globe-gap));
  overflow: hidden;
}
/* Globe centré en bas de chaque section */
.next-globe, .next-globe {
  position: absolute;
  bottom: var(--globe-gap);
  left: calc(50% - var(--globe-size) / 2);
  width: var(--globe-size);
  height: var(--globe-size);
}
.skills-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 81.25rem;
  min-height: 0;
  margin: auto;
}
.skills-title {
  margin: 0 0 clamp(0.8rem, 3vh, 1.8rem);
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  font-size: clamp(1.1rem, min(3vw, 5vh), 2.2rem);
  line-height: 1.4;
  color: var(--text);
  text-shadow: 0.08em 0.08em 0 var(--neon-pink);
}
.skills-title:focus { outline: none; }
/* ---------- RUBIK'S CUBE 3D ---------- */
/* --s = taille d'un petit cube ; tout le reste du cube en découle */
.cube {
  --s: clamp(2.75rem, min(9.6vh, 7.2vw), 6.25rem);
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(1.2rem, 3vw, 3rem);
  align-items: center;
}
.cube-stage { grid-column: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cube-scene {
  position: relative;
  width: 100%;
  max-width: calc(var(--s) * 5.4);
  height: calc(var(--s) * 5.4);
  perspective: 75rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.grabbing { cursor: grabbing; }
.cube-scene:focus-visible { outline: 0.125rem dashed var(--neon-cyan); outline-offset: 0.25rem; border-radius: 1rem; }
.cube-body { position: absolute; top: 50%; left: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.cubie {
  position: absolute;
  left: calc(var(--s) / -2);
  top: calc(var(--s) / -2);
  width: var(--s);
  height: var(--s);
  transform-style: preserve-3d;
}
.face {
  position: absolute;
  inset: 0;
  display: flex;
  padding: calc(var(--s) * 0.06);
  background: #07070f;
  border-radius: calc(var(--s) * 0.14);
  backface-visibility: hidden;
}
.face-inner { background: #11121d; }
/* Les 6 couleurs du cube, version néon */
.face-green  { --c: var(--neon-green); }
.face-blue   { --c: var(--neon-cyan); }
.face-red    { --c: var(--neon-pink); }
.face-orange { --c: #ff7a1a; }
.face-white  { --c: #b44bff; --ink: #fff6e0; }
.face-yellow { --c: var(--neon-yellow); }
.sticker {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--s) * 0.04);
  border-radius: calc(var(--s) * 0.1);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 50%), var(--c);
  box-shadow: inset 0 -0.1875rem 0.375rem rgba(0, 0, 0, 0.22), inset 0 0.0625rem 0 rgba(255, 255, 255, 0.5);
  color: var(--ink, #0a0a14);
  transition: filter 0.2s;
}
.cube .sticker i { font-size: calc(var(--s) * 0.42); line-height: 1; color: var(--ink, #0a0a14); }
.abbr {
  font-family: 'Press Start 2P', monospace;
  font-size: calc(var(--s) * 0.24);
  line-height: 1;
}
.sticker small {
  font-family: 'VT323', monospace;
  font-size: calc(var(--s) * 0.2);
  line-height: 1;
  text-transform: uppercase;
}
.cube-logo { font-family: 'Press Start 2P', monospace; font-size: calc(var(--s) * 0.2); opacity: 0.35; }
.face-skill { cursor: pointer; }
.face-skill:hover .sticker { filter: brightness(1.15); }
.selected .sticker {
  box-shadow: inset 0 0 0 0.125rem #fff6e0, 0 0 calc(var(--s) * 0.45) var(--c);
  animation: glow 1.4s ease-in-out infinite;
}
@keyframes glow { 50% { filter: brightness(1.3); } }
.cube-shadow {
  width: calc(var(--s) * 3.4);
  height: calc(var(--s) * 0.4);
  margin-top: calc(var(--s) * -0.5);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 229, 255, 0.35), rgba(0, 229, 255, 0));
  pointer-events: none;
}
.cube-controls { display: flex; gap: 0.75rem; margin-top: clamp(0.6rem, 2vh, 1.2rem); }
.cube-btn {
  --accent: var(--neon-green);
  padding: 0.7rem 1rem;
  border: 0.125rem solid var(--accent);
  border-radius: 0.5rem;
  background: rgba(10, 10, 20, 0.7);
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.625rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.ghost { --accent: var(--neon-pink); }
.cube-btn:hover:not(:disabled), .cube-btn:focus-visible {
  background: var(--accent);
  color: #0a0a14;
  box-shadow: 0 0 1rem var(--accent);
  outline: none;
}
.cube-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Panneau d'explication, même esprit que les cartes du site */
.cube-side { grid-column: 2; display: flex; flex-direction: column; gap: clamp(0.8rem, 2.5vh, 1.5rem); min-width: 0; }
.panel {
  --accent: var(--neon-cyan);
  position: relative;
  padding: clamp(1rem, 3vh, 1.6rem) clamp(1rem, 2vw, 1.6rem);
  border-radius: 0.75rem;
  background: #0f1019;
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0.25rem 0 0 var(--accent), 0 0 2.5rem rgba(0, 0, 0, 0.4);
}
/* Fond « carte mère » comme dans Qui suis-je : le contenu passe au-dessus de la vitre */
.panel.card {
  display: block;
  border-left: 0.1875rem solid var(--accent);
  box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.45);
}
.panel > :not(.card-bg) { position: relative; z-index: 1; }
.panel[data-cat="design"] { --accent: var(--neon-pink); }
.panel[data-cat="other"] { --accent: var(--neon-green); }
.anim > :not(.card-bg) { animation: panelIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.anim > :nth-child(3) { animation-delay: 0.05s; }
.anim > :nth-child(4) { animation-delay: 0.1s; }
.anim > :nth-child(5) { animation-delay: 0.15s; }
.anim > :nth-child(6) { animation-delay: 0.2s; }
@keyframes panelIn { from { opacity: 0; transform: translateY(0.625rem); } }
.panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.9rem;
  border-radius: 0.625rem;
  border: 0.125rem solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0.875rem rgba(0, 0, 0, 0.4), inset 0 0 0.75rem rgba(255, 255, 255, 0.04);
}
.panel-icon i { font-size: 1.9rem; }
.panel-abbr { font-family: 'Press Start 2P', monospace; font-size: 0.9rem; }
.panel-cat {
  display: block;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5625rem;
  color: var(--accent);
  text-transform: uppercase;
}
.panel-cat:empty { display: none; }
.panel-title {
  margin: 0.6rem 0 0.5rem;
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  font-size: clamp(0.85rem, min(1.6vw, 2.6vh), 1.2rem);
  line-height: 1.5;
  color: var(--text);
  text-shadow: 0.1em 0.1em 0 var(--accent);
}
/* Petite définition de la compétence, sous son nom */
.panel-def {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.75rem;
  border-left: 0.125rem solid var(--accent);
  border-radius: 0 0.5rem 0.5rem 0;
  background: rgba(255, 255, 255, 0.04);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(0.82rem, min(1vw, 1.9vh), 0.92rem);
  font-style: italic;
  line-height: 1.5;
  color: var(--muted);
}
.panel-def:empty { display: none; }
.panel-desc { margin: 0; font-size: clamp(1.1rem, min(1.5vw, 2.6vh), 1.35rem); line-height: 1.25; color: #c4c9e0; }
.mini-cube { display: grid; grid-template-columns: repeat(3, 0.5625rem); gap: 0.1875rem; transform: rotate(-12deg); }
.mini-cell { display: block; width: 0.5625rem; height: 0.5625rem; border-radius: 0.125rem; background: var(--c); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.chip {
  --accent: var(--neon-cyan);
  padding: 0.25rem 0.7rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
  background: #0f1019;
  box-shadow: inset 0.1875rem 0 0 var(--accent);
  color: #c4c9e0;
  font-family: 'VT323', monospace;
  font-size: clamp(1rem, 2.2vh, 1.2rem);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, color 0.15s;
}
.chip[data-cat="design"] { --accent: var(--neon-pink); }
.chip[data-cat="other"] { --accent: var(--neon-green); }
.chip:hover, .chip:focus-visible { transform: translateY(-0.125rem); border-color: var(--accent); color: var(--text); outline: none; }
.chip[aria-pressed="true"] { background: var(--accent); color: #0a0a14; border-color: var(--accent); }

/* ---------- CRÉATIONS & CONTACT ---------- */
/* Même cadre que « Qui suis-je » */
.creations, .contact {
  --globe-size: 4.75rem;
  --globe-gap: clamp(0.625rem, 2.5vh, 1.5rem);
  position: relative;
  height: 100vh;
  height: 100svh;
  display: flex;
  padding: clamp(5rem, 12vh, 6.875rem) var(--pad-x) calc(var(--globe-size) + 2 * var(--globe-gap));
  overflow: hidden;
}
.creations-inner, .contact-inner {
  width: 100%;
  max-width: 81.25rem;
  height: 100%;
  margin: 0 auto;
}
.creations-title, .contact-title {
  grid-column: 1 / -1;
  margin: 0 0 clamp(0.6rem, 2vh, 1.2rem);
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  font-size: clamp(1.1rem, min(3vw, 5vh), 2.2rem);
  line-height: 1.4;
  color: var(--text);
  text-shadow: 0.08em 0.08em 0 var(--neon-pink);
}
.creations-title:focus, .contact-title:focus { outline: none; }

/* Titre puis grille de projets 4 × 2 */
.creations-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
.projects {
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(0.6rem, 1.6vw, 1.2rem);
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.project {
  --accent: var(--neon-cyan);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 0.0625rem solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  background: #0f1019;
  box-shadow: 0 0.875rem 1.875rem rgba(0, 0, 0, 0.45);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.projects li:nth-child(4n + 2) .project { --accent: var(--neon-pink); }
.projects li:nth-child(4n + 3) .project { --accent: var(--neon-green); }
.projects li:nth-child(4n + 4) .project { --accent: var(--neon-yellow); }
.project:hover, .project:focus-visible {
  transform: translateY(-0.25rem);
  border-color: var(--accent);
  box-shadow: 0 0 1.375rem color-mix(in srgb, var(--accent) 35%, transparent), 0 0.875rem 1.875rem rgba(0, 0, 0, 0.45);
  outline: none;
}
.preview {
  position: relative;
  flex: 1;
  min-height: 3.125rem;
  overflow: hidden;
  background: #000;
}
.project-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.project:hover .project-img, .project:focus-visible .project-img { transform: scale(1.06); }
/* Effet écran CRT sur l'aperçu */
.preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 0.125rem, rgba(0, 0, 0, 0.22) 0.125rem 0.1875rem),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}
/* Carte « Réalisés en entreprise » : 4 vignettes, un clic ouvre la liste des sites */
.project-toggle {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.project-toggle:focus-visible { outline: 0.125rem solid var(--accent); outline-offset: -0.125rem; }
.project-toggle .project-name { display: block; }
.tiles-preview {
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    #0a0b14;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.45rem;
  width: min(70%, 10.625rem);
  height: min(72%, 6.875rem);
  transition: transform 0.4s;
}
.project:hover .tiles { transform: scale(1.05); }
.tiles span {
  display: grid;
  place-items: center;
  border: 0.0625rem solid var(--neon-cyan);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5625rem;
}
.tiles span:nth-child(2) { border-color: var(--neon-pink); }
.tiles span:nth-child(3) { border-color: var(--neon-green); }
.tiles span:nth-child(4) { border-color: var(--neon-yellow); }

/* Liste des sites, par-dessus la carte */
.project-menu {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: rgba(10, 11, 20, 0.96);
  animation: projectMenuIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.project-menu[hidden] { display: none; }
@keyframes projectMenuIn { from { opacity: 0; transform: translateY(0.5rem); } }
.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem 0.2rem 0.9rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  color: var(--accent);
  text-transform: uppercase;
}
.menu-close {
  width: 1.625rem;
  height: 1.625rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.menu-close:hover, .menu-close:focus-visible { background: rgba(255, 255, 255, 0.2); outline: none; }
.project-links {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.4rem 0.8rem 0.8rem;
  overflow-y: auto;
  scrollbar-width: none;
  list-style: none;
}
.project-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: clamp(0.35rem, 1vh, 0.55rem) 0.75rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(0.82rem, min(1vw, 1.8vh), 0.95rem);
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.project-links a::after { content: '↗'; color: var(--accent); }
.project-links a:hover, .project-links a:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); transform: translateX(0.1875rem); outline: none; }
/* « Voir → » apparaît au survol */
.play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.55);
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6875rem;
  text-shadow: 0 0 0.625rem var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}
.project:hover .play, .project:focus-visible .play { opacity: 1; }
.project-info {
  flex-shrink: 0;
  padding: clamp(0.5rem, 1.4vh, 0.8rem) clamp(0.6rem, 1vw, 0.9rem);
  box-shadow: inset 0 0.1875rem 0 var(--accent);
}
.project-cat {
  display: block;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  color: var(--accent);
  text-transform: uppercase;
}
.project-name {
  margin: 0.4rem 0 0.3rem;
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  font-size: clamp(0.7rem, min(1.05vw, 2vh), 0.9rem);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.project-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 0.3rem;
  font-size: clamp(1rem, min(1.2vw, 2.1vh), 1.15rem);
  line-height: 1.15;
  color: #c4c9e0;
}
.tags { display: block; font-size: 1rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Fenêtre basse : on garde l'aperçu, la description passe à la trappe */
@media (max-height: 720px) and (min-width: 700px) and (min-height: 501px) {
  .project-desc { display: none; }
}

/* ---------- CONTACT : moderne et minimaliste ---------- */
.contact {
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --line: rgba(255, 246, 224, 0.14);
}
/* Une colonne centrée : titre, formulaire, liens */
.contact-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: clamp(0.8rem, 2.4vh, 1.4rem);
  /* Si la fenêtre est très basse, la colonne défile, sans barre visible */
  overflow-y: auto;
  scrollbar-width: none;
}
.contact-inner::-webkit-scrollbar { display: none; }
.contact-title { align-self: center; margin: 0; flex-shrink: 0; }

/* Liens et mentions légales sur une même ligne (elle passe à la ligne si besoin) */
.contact-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem 1.4rem;
  font-family: var(--sans);
}
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border: 0.0625rem solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.contact-link i { font-size: 1rem; }
.contact-link:hover, .contact-link:focus-visible { background: var(--text); border-color: var(--text); color: #0a0a14; outline: none; }
.copy { margin: 0; font-size: 0.8rem; color: var(--muted); }
.copy a { color: var(--text); text-underline-offset: 0.1875rem; }
.copy a:hover { color: var(--neon-pink); }

/* Formulaire : une carte vitrée, des champs soulignés, un seul bouton */
.form {
  width: 100%;
  max-width: 40rem;
  min-height: 0;
  font-family: var(--sans);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 2vh, 1.2rem);
  padding: clamp(1rem, 2.8vh, 1.8rem) clamp(1.2rem, 2.4vw, 2.2rem);
  border: 0.0625rem solid var(--line);
  border-radius: 1.25rem;
  background: rgba(12, 12, 22, 0.55);
  backdrop-filter: blur(0.875rem);
  -webkit-backdrop-filter: blur(0.875rem);
}
.hp { position: absolute; left: -9999px; width: 0.0625rem; height: 0.0625rem; overflow: hidden; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.form input, .form textarea {
  width: 100%;
  padding: 0.45rem 0;
  border: 0;
  border-bottom: 0.0625rem solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.form input::placeholder, .form textarea::placeholder { color: rgba(154, 163, 199, 0.5); }
.form textarea { resize: none; min-height: 3.2em; max-height: 20vh; line-height: 1.5; }
.form input:focus, .form textarea:focus { outline: none; border-bottom-color: var(--text); }
.form [aria-invalid="true"] { border-bottom-color: var(--neon-pink); }
.form-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.form-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: #0a0a14;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.form-btn::after { content: '→'; transition: transform 0.2s; }
.form-btn:hover, .form-btn:focus-visible { background: var(--neon-pink); outline: none; }
.form-btn:hover::after, .form-btn:focus-visible::after { transform: translateX(0.1875rem); }
.form-btn:focus-visible { box-shadow: 0 0 0 0.1875rem rgba(255, 46, 151, 0.35); }
.form-btn:disabled { opacity: 0.5; cursor: wait; }
.form-status { margin: 0; font-size: 0.85rem; color: var(--muted); }
.form-status.is-error { color: var(--neon-pink); }
.form-status.is-ok { color: var(--neon-green); }

/* Texte réservé aux lecteurs d'écran */
.sr-only { position: absolute; width: 0.0625rem; height: 0.0625rem; padding: 0; margin: -0.0625rem; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- MINI-CHAT (Qui suis-je) ---------- */
/* Carte à droite de la photo ; un clic ouvre la discussion */
.teaser {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
  width: 100%;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.teaser:hover, .teaser:focus-visible { transform: translateY(-0.1875rem); border-color: rgba(255, 246, 224, 0.35); outline: none; }
.teaser:focus-visible { box-shadow: 0 0 0 0.125rem var(--neon-cyan), 0 1.25rem 2.5rem rgba(0, 0, 0, 0.45); }
.online { width: 0.4375rem; height: 0.4375rem; margin-left: auto; border-radius: 50%; background: var(--neon-green); box-shadow: 0 0 0.5rem var(--neon-green); }
.teaser-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: clamp(0.9rem, 2.4vh, 1.3rem) 1.1rem;
}
.teaser-hello { font-size: calc(clamp(0.95rem, min(1.2vw, 2.2vh), 1.1rem) * var(--fit)); font-weight: 600; line-height: 1.35; color: var(--text); }
.teaser-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.55rem 0.55rem 0.9rem;
  border: 0.0625rem solid rgba(255, 246, 224, 0.14);
  border-radius: 999px;
  background: rgba(8, 9, 18, 0.6);
  font-size: 0.82rem;
  color: rgba(154, 163, 199, 0.8);
}
.teaser-field b {
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: var(--text);
  color: #0a0a14;
  font-weight: 600;
  flex-shrink: 0;
}

/* Fenêtre de discussion */
.chat {
  position: fixed;
  z-index: 35;
  top: 50%;
  right: var(--pad-x);
  width: min(25rem, calc(100vw - 2rem));
  height: min(35rem, calc(100svh - 8.75rem));
  transform: translateY(-50%);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.chat[hidden] { display: none; }
.chat.is-opening { animation: chatIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes chatIn { from { opacity: 0; transform: translateY(calc(-50% + 1rem)) scale(0.96); } }
.chat-window { height: 100%; }
.chat-close {
  margin-left: auto;
  width: 1.625rem;
  height: 1.625rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-close:hover, .chat-close:focus-visible { background: rgba(255, 255, 255, 0.2); outline: none; }
.chat-log {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 246, 224, 0.2) transparent;
}
.msg {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 0.875rem;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: chatMsg 0.25s ease-out;
}
@keyframes chatMsg { from { opacity: 0; transform: translateY(0.375rem); } }
.msg-bot {
  align-self: flex-start;
  border: 0.0625rem solid rgba(255, 246, 224, 0.12);
  border-bottom-left-radius: 0.25rem;
  background: rgba(18, 19, 30, 0.88);
  color: #d4d8ee;
}
.msg-user {
  align-self: flex-end;
  border-bottom-right-radius: 0.25rem;
  background: var(--text);
  color: #0a0a14;
}
.chat-action {
  display: inline-flex;
  margin-top: 0.55rem;
  padding: 0.4rem 0.85rem;
  border: 0.0625rem solid var(--neon-pink);
  border-radius: 999px;
  background: none;
  color: var(--neon-pink);
  font: 600 0.8rem/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.chat-action:hover, .chat-action:focus-visible { background: var(--neon-pink); color: #0a0a14; outline: none; }
/* « … » pendant que la réponse s'écrit */
.typing { display: inline-flex; gap: 0.25rem; padding: 0.2rem 0; }
.typing i { width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--muted); animation: chatDot 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 40% { transform: translateY(-0.25rem); opacity: 1; } 0%, 80%, 100% { opacity: 0.4; } }
.chat-chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.7rem; }
.chat-chips:empty { display: none; }
.chat-chip {
  padding: 0.35rem 0.75rem;
  border: 0.0625rem solid rgba(255, 246, 224, 0.16);
  border-radius: 999px;
  background: rgba(18, 19, 30, 0.75);
  color: var(--text);
  font: 500 0.78rem/1.2 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.chat-chip:hover, .chat-chip:focus-visible { border-color: var(--text); background: rgba(255, 246, 224, 0.08); outline: none; }
.chat-form {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.07);
  background: rgba(8, 9, 18, 0.7);
}
.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.95rem;
  border: 0.0625rem solid rgba(255, 246, 224, 0.14);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 0.9rem 'Inter', system-ui, sans-serif;
  transition: border-color 0.2s;
}
.chat-input::placeholder { color: rgba(154, 163, 199, 0.6); }
.chat-input:focus { outline: none; border-color: rgba(255, 246, 224, 0.5); }
.chat-send {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: #0a0a14;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-send:hover, .chat-send:focus-visible { background: var(--neon-pink); outline: none; }
.chat-send:disabled { opacity: 0.4; cursor: default; }

/* ---------- TABLETTE EN PORTRAIT ----------
   Même mise en page que l'ordinateur ; l'écran étant plus haut que large,
   les cartes de projets gardent les proportions de l'ordinateur au lieu de s'étirer. */
@media (min-width: 700px) and (min-height: 501px) and (orientation: portrait) {
  .creations-inner { height: auto; max-height: 100%; margin: auto; }
  .projects { grid-auto-rows: auto; }
  .preview { flex: none; aspect-ratio: 4 / 3; }
}

/* ---------- MOBILE (téléphone, portrait ou paysage) ----------
   Exactement les mêmes éléments que sur ordinateur, empilés dans l'ordre de
   lecture (titre → contenu principal → éléments secondaires → globe).
   Chaque section prend la hauteur de son contenu et la page défile au doigt :
   rien n'est masqué ni compressé dans la hauteur de l'écran. */
@media (max-width: 699px), (max-height: 500px) {
  /* Pas de snake sur mobile : ni son canvas, ni le compteur de score */
  #snake-canvas, .hud { display: none; }

  .about, .skills, .creations, .contact {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    overflow: visible;
    padding-top: 6rem;
  }
  .about-title, .skills-title, .creations-title, .contact-title {
    margin: 0 0 1.4rem;
    font-size: clamp(1.3rem, 6.5vw, 1.8rem);
  }

  /* Qui suis-je : titre → texte → photo → mini-chat */
  .about-inner { display: flex; flex-direction: column; gap: 1.8rem; }
  .about-title { margin: 0; align-self: flex-start; }
  .about .card p { font-size: 1rem; }
  .photo { align-self: center; width: min(15rem, 62vw); margin-right: 1.25rem; }
  .teaser { align-self: stretch; }

  /* Compétences : titre → cube (ombre, boutons) → explication → puces */
  .skills-inner { display: block; margin: 0; }
  .cube {
    --s: min(15vw, 4.5rem);
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
  }

  /* Créations : mêmes cartes complètes, sur 2 colonnes, proportions de l'ordinateur */
  .creations-inner { display: block; height: auto; }
  .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 0.8rem;
  }
  .preview { flex: none; aspect-ratio: 4 / 3; }

  /* Contact : la colonne s'allonge au lieu de défiler à l'intérieur */
  .contact-inner { height: auto; overflow: visible; justify-content: flex-start; gap: 1.4rem; }
  .contact-title { margin: 0; }
  .form { padding: 1.2rem; }

  /* Fenêtre de discussion : en bas de l'écran, toute la largeur */
  .chat { top: auto; right: 1rem; bottom: 1rem; left: 1rem; width: auto; height: min(32.5rem, calc(100svh - 6rem)); transform: none; }
  @keyframes chatIn { from { opacity: 0; transform: translateY(1rem); } }
}

/* Téléphone en paysage : menu et accueil compacts, projets sur 4 colonnes */
@media (max-height: 500px) and (orientation: landscape) {
  .nav { padding-top: 0.25rem; padding-bottom: 0.25rem; }
  .logo img { height: 2.5rem; }
  .menu { gap: 1.2rem; }
  .nav-list { gap: 0.9rem; }
  .nav-link { font-size: 1rem; }
  .about, .skills, .creations, .contact { padding-top: 4rem; }
  .hero { padding-top: 3.4rem; padding-bottom: 2.4rem; }
  .hero-title { font-size: min(6.5vw, 10.5vh); line-height: 1.3; }
  .hero-meta { margin-top: 0.6rem; }
  .hero-globe { margin-top: 0.8rem; }
  .hud { bottom: 0.5rem; }
  .photo { width: min(13rem, 30vw); }
  .cube { --s: min(8vw, 4.5rem); }
  .projects { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

#snake-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .char, .char.is-on, .js .reveal { transition: none !important; transform: none !important; }
  .bg-img, .food { animation: none; }
  .bg-photo { transition: none; }
  html { scroll-behavior: auto; }
  .scene { animation: none !important; }
  .bg { transition: none; }
}
