/* ═══════════════════════════════════════════════════════════
   Thomas Bengatta, Portfolio
   Trois ambiances : sobre sombre, sobre clair, retrowave.
   ═══════════════════════════════════════════════════════════ */

/* ─── 1. Tokens ─────────────────────────────────────────── */

:root {
  /* Sobre sombre : palette chaude, ambre et terre cuite. */
  --bg:          #14100e;
  --bg-alt:      #1b1613;
  --surface:     rgba(255, 238, 220, .04);
  --surface-2:   rgba(255, 238, 220, .075);
  --border:      rgba(255, 232, 210, .10);
  --border-str:  rgba(255, 232, 210, .19);
  --text:        #f6efe7;
  --text-soft:   #b8a89a;
  --text-mute:   #82736a;

  --acc:    #f2a13c;   /* ambre  */
  --acc-2:  #e8674c;   /* corail */
  --acc-3:  #d24f66;   /* rose brique */
  --acc-4:  #c9a227;   /* or     */

  --on-acc: #1a1108;   /* texte posé sur un aplat d'accent */

  --shadow: 0 20px 60px -22px rgba(0, 0, 0, .75);
  --glow:   0 0 45px -10px rgba(242, 161, 60, .4);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --container: 1160px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(5rem, 11vh, 8.5rem);
  --radius: 16px;
  --radius-sm: 10px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Texture de fond des cartes : semis de points en mode sobre. */
  --tex: radial-gradient(circle at 1px 1px, rgba(255, 232, 210, .11) 1px, transparent 0);
  --tex-size: 22px 22px;
}

[data-theme="light"] {
  --bg:          #fbf6f0;
  --bg-alt:      #f3ebe0;
  --surface:     rgba(60, 30, 10, .035);
  --surface-2:   rgba(60, 30, 10, .06);
  --border:      rgba(60, 30, 10, .12);
  --border-str:  rgba(60, 30, 10, .24);
  --text:        #1d1512;
  --text-soft:   #5d4f45;
  --text-mute:   #8a7a6e;

  --acc:    #c07211;
  --acc-2:  #c14a2c;
  --acc-3:  #ad3450;
  --acc-4:  #96751a;

  --on-acc: #fff8ef;

  --shadow: 0 20px 50px -24px rgba(90, 50, 20, .28);
  --glow:   0 0 40px -12px rgba(192, 114, 17, .3);

  --tex: radial-gradient(circle at 1px 1px, rgba(60, 30, 10, .13) 1px, transparent 0);
}

/* ── Retrowave : néon sur nuit violette ── */
[data-theme="retro"] {
  --bg:          #0c0521;
  --bg-alt:      #140a30;
  --surface:     rgba(180, 130, 255, .07);
  --surface-2:   rgba(180, 130, 255, .13);
  --border:      rgba(190, 140, 255, .2);
  --border-str:  rgba(255, 60, 160, .45);
  --text:        #f8ecff;
  --text-soft:   #bda4dd;
  --text-mute:   #806aa8;

  --acc:    #ff2d95;   /* magenta */
  --acc-2:  #ff9433;   /* orange  */
  --acc-3:  #00eaff;   /* cyan    */
  --acc-4:  #b14aed;   /* violet  */

  --on-acc: #12002a;

  --shadow: 0 20px 60px -20px rgba(255, 45, 149, .3);
  --glow:   0 0 40px -6px rgba(255, 45, 149, .6);

  --font-display: 'Orbitron', 'Space Grotesk', system-ui, sans-serif;

  /* En retrowave, du papier millimétré plutôt qu'un semis de points. */
  --tex: linear-gradient(rgba(190, 140, 255, .11) 1px, transparent 1px),
         linear-gradient(90deg, rgba(190, 140, 255, .11) 1px, transparent 1px);
  --tex-size: 26px 26px;
}

/* ─── 2. Base ───────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(.95rem, .9rem + .2vw, 1.0625rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.02em;
  margin: 0;
}
[data-theme="retro"] h1,
[data-theme="retro"] h2 { letter-spacing: .01em; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
strong { color: var(--text); font-weight: 600; }
canvas { display: block; }

::selection { background: var(--acc); color: var(--on-acc); }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: fixed;
  top: -100px; left: 1rem;
  z-index: 999;
  padding: .7rem 1.2rem;
  background: var(--acc);
  color: var(--on-acc);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top .25s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* Lignes de balayage : uniquement en retrowave. */
.scanlines {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, .16) 0px,
    rgba(0, 0, 0, .16) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}
[data-theme="retro"] .scanlines { display: block; }

/* ─── 3. Navigation ─────────────────────────────────────── */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background .35s var(--ease), border-color .35s var(--ease);
}

.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom-color: var(--border);
}

.nav__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: .9rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav__logo { display: flex; align-items: center; gap: .65rem; margin-right: auto; }

.nav__logo-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  color: var(--on-acc);
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  box-shadow: var(--glow);
  transition: transform .4s var(--ease);
}
.nav__logo:hover .nav__logo-mark { transform: rotate(-8deg) scale(1.08); }

.nav__logo-text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: -.01em;
}

.nav__links { display: flex; gap: .35rem; }

.nav__links a {
  position: relative;
  padding: .45rem .8rem;
  font-size: .875rem;
  color: var(--text-soft);
  border-radius: 8px;
  transition: color .25s;
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: .8rem; right: .8rem; bottom: .18rem;
  height: 1.5px;
  background: var(--acc);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav__links a:hover,
.nav__links a.is-current { color: var(--text); }
.nav__links a.is-current::after { transform: scaleX(1); }

.nav__actions { display: flex; align-items: center; gap: .4rem; }

.btn-icon {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font: 600 .72rem/1 var(--font-mono);
  cursor: pointer;
  transition: color .25s, border-color .25s, background .25s, transform .25s var(--ease);
}
.btn-icon:hover {
  color: var(--text);
  border-color: var(--border-str);
  background: var(--surface-2);
  transform: translateY(-2px);
}

/* Sélecteur d'ambiance : les trois options visibles en permanence. */
.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
}

.theme-switch__opt {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  padding: 0;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  transition: color .25s, background .25s, box-shadow .3s;
}
.theme-switch__opt:hover { color: var(--text); background: var(--surface-2); }

.theme-switch__opt[aria-pressed="true"] {
  color: var(--on-acc);
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
}
[data-theme="retro"] .theme-switch__opt[aria-pressed="true"] {
  box-shadow: 0 0 14px -2px var(--acc);
}

.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}
.nav__burger span {
  display: block;
  height: 1.7px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .35s var(--ease), opacity .2s;
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.7px) rotate(-45deg); }

.nav__progress {
  height: 1.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--acc), var(--acc-2), var(--acc-3));
  transition: width .1s linear;
}

/* ─── 3 bis. Habillage des cartes ───────────────────────── */

/* Deux couches posées derrière le contenu, jamais devant :
   une texture fixe très pâle, et un halo qui suit le curseur.
   `isolation` fait que les z-index négatifs restent au-dessus
   du fond de la carte mais sous le texte. */
.surface { position: relative; isolation: isolate; overflow: hidden; }

.surface::before,
.surface::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Texture : elle s'efface en diagonale pour ne pas courir sous le texte. */
.surface::before {
  background-image: var(--tex);
  background-size: var(--tex-size);
  -webkit-mask-image: linear-gradient(145deg, #000 0%, rgba(0, 0, 0, .35) 45%, transparent 80%);
  mask-image: linear-gradient(145deg, #000 0%, rgba(0, 0, 0, .35) 45%, transparent 80%);
}

/* Halo : position pilotée par main.js via --mx / --my. */
.surface::after {
  background: radial-gradient(
    circle 220px at var(--mx, 50%) var(--my, -20%),
    color-mix(in srgb, var(--acc) 16%, transparent),
    transparent 70%
  );
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.surface:hover::after { opacity: 1; }

@media (hover: none) {
  .surface::after { display: none; }
}

/* ─── 4. Boutons ────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .8rem 1.5rem;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease),
              background .3s, border-color .3s, color .3s;
}
.btn:hover { transform: translateY(-2.5px); }
.btn svg { flex: none; }

.btn--primary {
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: var(--on-acc);
  font-weight: 600;
  box-shadow: 0 8px 26px -12px var(--acc);
}
.btn--primary:hover { box-shadow: 0 14px 34px -12px var(--acc); }

.btn--ghost {
  border-color: var(--border-str);
  color: var(--text);
  background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--acc); }

[data-theme="retro"] .btn--primary { box-shadow: 0 0 24px -4px var(--acc); }
[data-theme="retro"] .btn--primary:hover { box-shadow: 0 0 36px -2px var(--acc); }
[data-theme="retro"] .btn--ghost:hover { box-shadow: 0 0 20px -6px var(--acc-3); }

/* ─── 5. Hero ───────────────────────────────────────────── */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 7rem var(--gutter) 5rem;
  overflow: hidden;
  isolation: isolate;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: -2;
}

.hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 62% 55% at 50% 46%,
      color-mix(in srgb, var(--bg) 80%, transparent) 0%,
      color-mix(in srgb, var(--bg) 38%, transparent) 45%,
      transparent 78%),
    linear-gradient(to bottom, transparent 58%, var(--bg) 97%);
}
/* En retrowave, le soleil et la grille passent derrière tout le bloc de
   texte. Le voile couvre donc large : du nom jusque sous les boutons. */
[data-theme="retro"] .hero__veil {
  background:
    radial-gradient(ellipse 58% 46% at 50% 46%,
      color-mix(in srgb, var(--bg) 88%, transparent) 0%,
      color-mix(in srgb, var(--bg) 66%, transparent) 45%,
      color-mix(in srgb, var(--bg) 24%, transparent) 72%,
      transparent 88%),
    linear-gradient(to bottom, transparent 76%, var(--bg) 99%);
}

.hero__content {
  position: relative;
  max-width: 800px;
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.6rem;
  padding: .4rem .95rem .4rem .8rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface-2);
  backdrop-filter: blur(10px);
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-soft);
}

.dot-pulse {
  position: relative;
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--acc);
}
.dot-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--acc);
  animation: ping 2.2s var(--ease-out) infinite;
}
@keyframes ping {
  0%   { transform: scale(1);   opacity: .8; }
  70%, 100% { transform: scale(3.2); opacity: 0; }
}

.hero__name {
  font-size: clamp(3rem, 11.5vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1;
  margin-bottom: 1.35rem;
}
[data-theme="retro"] .hero__name { letter-spacing: -.005em; font-size: clamp(2.4rem, 9.2vw, 6.2rem); }

.hero__name-line { display: block; }

/* Le dégradé est découpé sur le texte. Sans cette réserve basse,
   la boîte s'arrête à la ligne de base et mange la jambe du « g ». */
.hero__name-line--accent {
  padding-bottom: .16em;
  margin-bottom: -.16em;
  background: linear-gradient(100deg, var(--acc) 5%, var(--acc-2) 50%, var(--acc-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* `background-image` et non `background` : la propriété raccourcie
   réinitialiserait background-clip à border-box, et le dégradé se
   repeindrait en bloc plein par-dessus le texte devenu invisible. */
[data-theme="retro"] .hero__name-line--accent {
  background-image: linear-gradient(to bottom, #fff3a8 2%, var(--acc-2) 44%, var(--acc) 88%);
  text-shadow: 0 0 26px rgba(255, 45, 149, .6), 0 0 60px rgba(255, 45, 149, .3);
}
[data-theme="retro"] .hero__name-line:not(.hero__name-line--accent) {
  color: var(--text);
  text-shadow: 0 0 18px rgba(0, 234, 255, .5), 0 0 44px rgba(0, 234, 255, .25);
}

.hero__role {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: clamp(.82rem, .75rem + .45vw, 1.02rem);
  font-weight: 500;
  color: var(--text);
}
.hero__sep { color: var(--acc); }
.hero__typed { color: var(--text-soft); }
.hero__typed::after {
  content: '';
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--acc);
  animation: caret .95s steps(2) infinite;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.hero__pitch {
  max-width: 60ch;
  margin: 0 auto 2.4rem;
  font-size: clamp(.97rem, .93rem + .2vw, 1.1rem);
  color: var(--text-soft);
  font-weight: 300;
  line-height: 1.75;
}

.hero__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: .85rem; }

.hero__scroll {
  position: absolute;
  bottom: 2.2rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  font-size: .68rem;
  font-family: var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-mute);
  transition: color .3s;
}
.hero__scroll:hover { color: var(--text); }
.hero__scroll-line {
  width: 1px; height: 42px;
  background: linear-gradient(to bottom, transparent, var(--acc));
  animation: drift 2.4s var(--ease-out) infinite;
}
@keyframes drift {
  0%, 100% { transform: scaleY(.4); transform-origin: top; opacity: .4; }
  50%      { transform: scaleY(1);  transform-origin: top; opacity: 1; }
}

/* ─── 6. Sections ───────────────────────────────────────── */

.section { padding-block: var(--section-y); position: relative; }
.section--alt { background: var(--bg-alt); }
.section--alt::before,
.section--alt::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-str) 25%, var(--border-str) 75%, transparent);
}
.section--alt::before { top: 0; }
.section--alt::after  { bottom: 0; }

.section__head { margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.section__head--center { text-align: center; }

.section__num {
  display: block;
  margin-bottom: .5rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .22em;
  color: var(--acc);
}

.section__title {
  font-size: clamp(1.85rem, 1.3rem + 2.4vw, 3.1rem);
  font-weight: 600;
}
[data-theme="retro"] .section__title {
  text-shadow: 0 0 22px color-mix(in srgb, var(--acc) 45%, transparent);
}

.section__sub {
  margin-top: .85rem;
  max-width: 56ch;
  color: var(--text-soft);
  font-size: .96rem;
  font-weight: 300;
}
.section__head--center .section__sub { margin-inline: auto; }

/* ─── 7. À propos ───────────────────────────────────────── */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.about__text { color: var(--text-soft); font-weight: 300; }
.about__text .lead {
  font-size: clamp(1.05rem, 1rem + .35vw, 1.3rem);
  line-height: 1.6;
  color: var(--text);
  font-weight: 400;
  margin-bottom: 1.4rem;
}

.about__facts {
  display: grid;
  gap: .3rem;
  padding: 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.fact { padding: .85rem .25rem; border-bottom: 1px solid var(--border); }
.fact:last-child { border-bottom: 0; }

.fact__label {
  display: block;
  margin-bottom: .3rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.fact__value { display: flex; flex-wrap: wrap; gap: .45rem; font-size: .93rem; font-weight: 500; }

.lang-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  padding: .18rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: .76rem;
}
.lang-chip em { font-style: normal; color: var(--acc); font-size: .7rem; }

/* ─── 8. Compétences ────────────────────────────────────── */

.skills {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: center;
}

.skills__canvas-wrap {
  position: relative;
  aspect-ratio: 1 / .88;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--acc-4) 10%, transparent), transparent 60%),
    var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.skills__canvas-wrap canvas { width: 100%; height: 100%; touch-action: none; }

.skills__legend { display: grid; gap: .35rem; }

.skill-group {
  padding: .85rem .9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background .3s, border-color .3s;
}
.skill-group:hover { background: var(--surface); border-color: var(--border); }

.skill-group__title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .7rem;
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.swatch {
  width: 9px; height: 9px;
  flex: none;
  border-radius: 3px;
  background: var(--c);
  box-shadow: 0 0 12px -2px var(--c);
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  padding: .34rem .72rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: .82rem;
  color: var(--text-soft);
  transition: color .25s, border-color .25s, transform .25s var(--ease), background .25s;
}
.chips li:hover {
  color: var(--text);
  border-color: var(--border-str);
  background: var(--surface-2);
  transform: translateY(-2px);
}

/* ─── 8 bis. Le labo ────────────────────────────────────── */

.lab__stage {
  position: relative;
  aspect-ratio: 21 / 8;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse 70% 90% at 50% 50%, color-mix(in srgb, var(--acc) 7%, transparent), transparent 70%),
    var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lab__stage canvas {
  width: 100%; height: 100%;
  touch-action: none;              /* le balayage pilote le nuage, pas le scroll */
  cursor: crosshair;
}

.lab__stage:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }

/* Battement de coeur au changement de démo : le canvas repart de zéro,
   sans cette respiration la transition passerait inaperçue. */
@keyframes lab-swap {
  from { opacity: .25; transform: scale(.985); }
  to   { opacity: 1;   transform: none; }
}
.lab__stage.is-swap canvas { animation: lab-swap .5s var(--ease-out); }

/* ── Flèches, posées sur les bords du cadre ── */
.lab__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-soft);
  cursor: pointer;
  transition: color .25s, border-color .25s, background .25s, transform .3s var(--ease);
}
.lab__arrow--prev { left: .7rem; }
.lab__arrow--next { right: .7rem; }
.lab__arrow:hover {
  color: var(--on-acc);
  border-color: transparent;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
}
.lab__arrow--prev:hover { transform: translateY(-50%) translateX(-2px); }
.lab__arrow--next:hover { transform: translateY(-50%) translateX(2px); }

/* ── Barre : compteur, nom, pastilles ── */
.lab__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1rem;
  margin-top: .95rem;
}

.lab__meta { display: flex; align-items: baseline; gap: .7rem; }

.lab__counter {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--acc);
}

.lab__name {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.lab__dots { display: flex; gap: .4rem; }

.lab__dot {
  width: 26px; height: 5px;
  padding: 0;
  border: 0;
  border-radius: 100px;
  background: var(--border-str);
  cursor: pointer;
  transition: background .3s, width .3s var(--ease);
}
.lab__dot:hover { background: var(--text-mute); }
.lab__dot[aria-current="true"] {
  width: 34px;
  background: linear-gradient(90deg, var(--acc), var(--acc-2));
}

.lab__hint {
  margin: .55rem 0 0;
  font-size: .82rem;
  font-weight: 300;
  color: var(--text-mute);
  max-width: 62ch;
}

/* ─── 8 ter. Chiffres clés ──────────────────────────────── */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.75rem;
  margin: 0 0 1rem;
  padding-top: .35rem;
}
.stats li { display: flex; flex-direction: column; gap: .1rem; }
.stats b {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--acc);
}
.stats span {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* ─── 9. Parcours ───────────────────────────────────────── */

.tabs {
  display: inline-flex;
  gap: .25rem;
  margin-bottom: 2.75rem;
  padding: .28rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
}

.tab {
  padding: .5rem 1.25rem;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--text-mute);
  font-family: var(--font-body);
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .3s, background .3s;
}
.tab:hover { color: var(--text-soft); }
.tab.is-active {
  color: var(--on-acc);
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
}

/* Bridé sur la largeur du texte : au-delà, les cartes sonnent creux. */
.timeline { display: none; position: relative; padding-left: 1.9rem; max-width: 880px; }
.timeline.is-active { display: block; }
.timeline::before {
  content: '';
  position: absolute;
  top: .55rem; bottom: .55rem; left: 5px;
  width: 1.5px;
  background: linear-gradient(to bottom, var(--acc), var(--acc-3) 55%, transparent);
}

.tl { position: relative; padding-bottom: 1.15rem; }
.tl:last-child { padding-bottom: 0; }

/* Chaque entrée devient une carte : c'est elle qui porte l'habillage. */
.tl__body {
  padding: 1.3rem 1.5rem 1.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .4s var(--ease), transform .4s var(--ease);
}
.tl:hover .tl__body { border-color: var(--border-str); transform: translateY(-2px); }

/* Aligné sur la première ligne de texte à l'intérieur de la carte. */
.tl__marker {
  position: absolute;
  top: 1.55rem; left: calc(-1.9rem + 1px);
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--acc);
  transition: box-shadow .4s var(--ease), transform .4s var(--ease);
}
.section--alt .tl__marker { background: var(--bg-alt); }
.tl:hover .tl__marker {
  transform: scale(1.35);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--acc) 18%, transparent);
}

.tl__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-bottom: .5rem; }

.tl__date {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--text-mute);
}
.tl__date em { font-style: normal; color: var(--acc-3); }

.badge {
  padding: .16rem .55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.badge--live {
  border-color: color-mix(in srgb, var(--acc-3) 45%, transparent);
  background: color-mix(in srgb, var(--acc-3) 13%, transparent);
  color: var(--acc-3);
}

.tl__role { font-size: clamp(1.08rem, 1rem + .35vw, 1.32rem); margin-bottom: .25rem; }

.tl__org { margin-bottom: .7rem; font-size: .9rem; font-weight: 500; color: var(--acc); }
.tl__loc { color: var(--text-mute); font-weight: 400; }
.tl__loc::before { content: ' · '; }

.tl__desc {
  max-width: 68ch;
  color: var(--text-soft);
  font-size: .94rem;
  font-weight: 300;
  margin-bottom: .9rem;
}

.tl__tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tl__tags li {
  padding: .2rem .6rem;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: .71rem;
  color: var(--text-mute);
}

/* ─── 10. Projets ───────────────────────────────────────── */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .4s var(--ease);
}
.feature:hover { border-color: var(--border-str); }

.feature__visual {
  position: relative;
  aspect-ratio: 4 / 3.1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a0714;
}
.feature__visual canvas { width: 100%; height: 100%; }

.feature__badge {
  position: absolute;
  top: .9rem; left: .9rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .7rem;
  border-radius: 100px;
  background: rgba(8, 5, 18, .72);
  backdrop-filter: blur(8px);
  font-size: .7rem;
  font-weight: 500;
  color: #f0eaf6;
}

.feature__kicker {
  margin-bottom: .5rem;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--acc-3);
}

.feature__title {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: .4rem;
}

.feature__tagline {
  margin-bottom: 1rem;
  font-size: .93rem;
  font-style: italic;
  color: var(--acc);
}

.feature__desc {
  max-width: 60ch;
  margin-bottom: 1.2rem;
  color: var(--text-soft);
  font-size: .94rem;
  font-weight: 300;
}

.feature__links { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.3rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
  gap: 1.15rem;
}

/* Pas de ::before ici : il est déjà pris par la texture de `.surface`. */
.card {
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform .45s var(--ease), border-color .45s, background .45s;
}
.card:hover { transform: translateY(-5px); border-color: var(--border-str); background: var(--surface-2); }

.card__icon {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  margin-bottom: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--acc);
}
.card__icon svg { width: 20px; height: 20px; }

.card__title { font-size: 1.08rem; margin-bottom: .6rem; }
.card__desc {
  margin-bottom: 1rem;
  color: var(--text-soft);
  font-size: .89rem;
  font-weight: 300;
  line-height: 1.65;
}

/* ─── 11. Contact ───────────────────────────────────────── */

.contact { text-align: center; }

.mail-cta {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.1rem 1.4rem 1.1rem 1.9rem;
  border: 1px solid var(--border-str);
  border-radius: 100px;
  background: var(--surface);
  font-family: var(--font-display);
  font-size: clamp(.95rem, .85rem + .8vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -.02em;
  word-break: break-all;
  transition: transform .4s var(--ease), border-color .4s, box-shadow .4s;
}
.mail-cta:hover {
  transform: translateY(-3px);
  border-color: var(--acc);
  box-shadow: var(--glow);
}

.mail-cta__icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: var(--on-acc);
  transition: transform .4s var(--ease);
}
.mail-cta:hover .mail-cta__icon { transform: translateX(4px); }

.contact__row { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }

.contact__item {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  font-size: .87rem;
  color: var(--text-soft);
  transition: color .3s, border-color .3s, transform .3s var(--ease);
}
.contact__item:not(.contact__item--static):hover {
  color: var(--text);
  border-color: var(--acc);
  transform: translateY(-2px);
}
.contact__item svg { flex: none; opacity: .75; }

/* ─── 11 bis. Bandeau éphémère (easter egg) ─────────────── */

.toast {
  position: fixed;
  left: 50%; bottom: 2rem;
  z-index: 200;
  transform: translate(-50%, 1.5rem);
  padding: .7rem 1.3rem;
  border: 1px solid var(--border-str);
  border-radius: 100px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--glow);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--acc);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ─── 12. Footer ────────────────────────────────────────── */

.footer {
  padding-block: 2.25rem;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-mute);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .6rem;
}
.footer p { margin: 0; }
.footer__note { font-family: var(--font-mono); font-size: .74rem; }

/* ─── 13. Reveal au scroll ──────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .85s var(--ease-out), transform .85s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 105ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ─── 13 bis. Retrowave : toute la scène s'anime ────────────
   Ce bloc n'existe qu'en ambiance retro. Les deux ambiances
   sobres restent volontairement calmes : ici, on assume le
   grésillement des néons et la VHS qui a trop servi.
   prefers-reduced-motion coupe tout via la section 15. */

/* Bande de tracking VHS qui balaie l'écran de haut en bas. */
[data-theme="retro"] .scanlines::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -30%;
  height: 26%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, .03) 30%,
    rgba(0, 234, 255, .05) 55%,
    rgba(255, 45, 149, .04) 70%,
    transparent
  );
  animation: vhs-roll 9s linear infinite;
}
@keyframes vhs-roll {
  0%   { top: -30%; }
  100% { top: 110%; }
}

/* Papillotement CRT d'ensemble, par à-coups irréguliers. */
[data-theme="retro"] .scanlines {
  animation: crt-flicker 5s steps(1, end) infinite;
}
@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  7%   { opacity: .8; }
  8%   { opacity: 1; }
  38%  { opacity: .88; }
  39%  { opacity: 1; }
  61%  { opacity: .82; }
  62%  { opacity: 1; }
  84%  { opacity: .9; }
  85%  { opacity: 1; }
}

/* Le nom glitche par rafales : aberration chromatique fugace.
   drop-shadow suit l'alpha du texte découpé, contrairement à
   text-shadow qui serait invisible sur un texte transparent. */
[data-theme="retro"] .hero__name-line--accent {
  animation: rgb-glitch 7s infinite;
}
@keyframes rgb-glitch {
  0%, 88.8%, 92.4%, 100% { transform: none; filter: none; }
  89.2% {
    transform: translateX(-4px) skewX(-3deg);
    filter: drop-shadow(3px 0 rgba(0, 234, 255, .85)) drop-shadow(-3px 0 rgba(255, 45, 149, .85));
  }
  90.4% {
    transform: translateX(3px) skewX(2deg);
    filter: drop-shadow(-3px 0 rgba(0, 234, 255, .85)) drop-shadow(3px 0 rgba(255, 45, 149, .85));
  }
  91.4% {
    transform: translateX(-1px);
    filter: drop-shadow(2px 0 rgba(0, 234, 255, .6));
  }
}

/* Les titres respirent comme des tubes au néon. */
[data-theme="retro"] .section__title {
  animation: neon-breathe 3.8s ease-in-out infinite;
}
@keyframes neon-breathe {
  0%, 100% { text-shadow: 0 0 18px rgba(255, 45, 149, .35); }
  50%      { text-shadow: 0 0 30px rgba(255, 45, 149, .65), 0 0 60px rgba(255, 45, 149, .25); }
}

/* Le numéro de section grésille comme une enseigne fatiguée. */
[data-theme="retro"] .section__num {
  text-shadow: 0 0 12px currentColor;
  animation: neon-buzz 4.6s infinite;
}
@keyframes neon-buzz {
  0%, 100% { opacity: 1; }
  3%   { opacity: .35; }
  4%   { opacity: 1; }
  5.5% { opacity: .5; }
  6%   { opacity: 1; }
  52%  { opacity: .6; }
  53%  { opacity: 1; }
}

/* Monogramme et barre de progression rayonnent en cadence. */
[data-theme="retro"] .nav__logo-mark {
  animation: logo-pulse 2.8s ease-in-out infinite;
}
@keyframes logo-pulse {
  0%, 100% { box-shadow: 0 0 16px -4px var(--acc); }
  50%      { box-shadow: 0 0 30px -2px var(--acc), 0 0 56px -10px var(--acc-3); }
}
[data-theme="retro"] .nav__progress { box-shadow: 0 0 12px 0 var(--acc); }

/* Liens de navigation façon borne d'arcade. */
[data-theme="retro"] .nav__links a {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}
[data-theme="retro"] .nav__links a.is-current { text-shadow: 0 0 10px var(--acc-3); }

/* Pastille de statut et curseur de saisie passent au cyan. */
[data-theme="retro"] .dot-pulse,
[data-theme="retro"] .dot-pulse::after { background: var(--acc-3); }
[data-theme="retro"] .hero__typed::after {
  background: var(--acc-3);
  box-shadow: 0 0 10px var(--acc-3);
}

/* Le bouton principal palpite ; le survol fige et intensifie. */
[data-theme="retro"] .btn--primary { animation: btn-pulse 2.4s ease-in-out infinite; }
[data-theme="retro"] .btn--primary:hover { animation: none; }
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 18px -6px var(--acc); }
  50%      { box-shadow: 0 0 32px -2px var(--acc); }
}

/* Les cartes s'ourlent de néon au survol. */
[data-theme="retro"] .card:hover,
[data-theme="retro"] .feature:hover,
[data-theme="retro"] .tl:hover .tl__body {
  border-color: color-mix(in srgb, var(--acc) 55%, transparent);
  box-shadow: 0 0 26px -8px var(--acc), 0 0 60px -18px var(--acc-4);
}

/* Sections alternées : la grille au sol défile vers le bas,
   comme si l'on roulait dessus. Seules les lignes horizontales
   bougent, les verticales restent en place. */
[data-theme="retro"] .section--alt {
  background-color: var(--bg-alt);
  background-image:
    linear-gradient(rgba(190, 140, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(190, 140, 255, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: grid-drift 2.6s linear infinite;
}
@keyframes grid-drift {
  to { background-position: 0 44px, 0 0; }
}

/* Les cadres du labo et de la carte des compétences en vitrine néon. */
[data-theme="retro"] .lab__stage,
[data-theme="retro"] .skills__canvas-wrap {
  border-color: color-mix(in srgb, var(--acc) 40%, transparent);
  box-shadow: 0 0 34px -12px var(--acc), inset 0 0 40px -30px var(--acc-3);
}

/* ─── 14. Responsive ────────────────────────────────────── */

@media (max-width: 940px) {
  .about, .skills, .feature { grid-template-columns: 1fr; }
  .skills__canvas-wrap { aspect-ratio: 1 / .72; }
  .feature__visual { aspect-ratio: 16 / 9; }
  .skills__legend { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
}

@media (max-width: 780px) {
  .nav__logo-text { display: none; }
  .nav__burger { display: flex; }

  .nav__links {
    position: fixed;
    inset: 60px 0 auto 0;
    flex-direction: column;
    gap: 0;
    padding: 1rem var(--gutter) 1.6rem;
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-115%);
    opacity: 0;
    visibility: hidden;
    transition: transform .45s var(--ease), opacity .3s, visibility .3s;
  }
  .nav__links.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav__links a { padding: .85rem .3rem; font-size: 1rem; border-bottom: 1px solid var(--border); }
  .nav__links a::after { display: none; }

  .hero { min-height: 92svh; }
  .hero__scroll { display: none; }
  /* Un cadre trop haut noie le mot : on garde un bandeau bien large. */
  .lab__stage { aspect-ratio: 2 / 1; }
  .lab__arrow { width: 34px; height: 34px; }
  .lab__arrow--prev { left: .45rem; }
  .lab__arrow--next { right: .45rem; }
  .lab__bar { justify-content: flex-start; }
  .stats { gap: .5rem 1.25rem; }

  /* En portrait le texte est plus haut et retombe sur le soleil :
     on assombrit davantage, et sur une zone plus large. */
  [data-theme="retro"] .hero__veil {
    background:
      radial-gradient(ellipse 80% 34% at 50% 44%,
        color-mix(in srgb, var(--bg) 62%, transparent) 0%,
        color-mix(in srgb, var(--bg) 30%, transparent) 62%,
        transparent 86%),
      linear-gradient(to bottom, transparent 82%, var(--bg) 99%);
  }
  .timeline { padding-left: 1.5rem; }
  .tl__marker { left: calc(-1.5rem + 1px); }
  .footer__inner { flex-direction: column; }
}

/* ─── 15. Mouvement réduit ──────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ─── 16. Impression ────────────────────────────────────── */

@media print {
  .nav, .hero__canvas, .hero__veil, .hero__scroll, .scanlines,
  .skills__canvas-wrap, .feature__visual, .tabs { display: none !important; }
  body { background: #fff; color: #000; }
  .timeline { display: block !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
