:root {
  --bg: #050608;
  --ink: #e8eaed;
  --muted: #8a8f97;
  --faint: #2a2d33;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-open: cubic-bezier(0.32, 0.72, 0, 1);   /* a screen opening: moves at once, settles slowly */
  --col: min(100% - 32px, 760px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: var(--mono); -webkit-font-smoothing: antialiased; }
html.is-loading body { overflow: hidden; }
button { font: inherit; color: inherit; }

/* the name, used by the intro and the home */
.kicker { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.name { margin: 0; font-size: clamp(36px, 8vw, 88px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }

/* ---------- 1. intro ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
  text-align: center;
}
.intro__inner { opacity: 0; transform: translateY(8px); }
.intro.is-in .intro__inner {
  opacity: 1;
  transform: none;
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.intro.is-out { opacity: 0; transition: opacity 450ms ease; pointer-events: none; }

/* ---------- 2. build ---------- */
.build {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: var(--bg);
}
.build.is-out { opacity: 0; transition: opacity 600ms ease; pointer-events: none; }
.build__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the edge of the picture: everything inside moves with it (translateY set by the script) */
.build__edge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  will-change: transform;
}
.build__above {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: var(--col);
  transform: translateX(-50%);
}
.build__code {
  height: min(40vh, 340px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  -webkit-mask: linear-gradient(180deg, transparent 0, #000 60%);
          mask: linear-gradient(180deg, transparent 0, #000 60%);
}
.build__src {
  margin: 0 0 18px;
  font: 12px/1.75 var(--mono);
  white-space: pre;
  color: #4b5058;
}
.build__src .kw { color: #9a9fa8; }
.build__src .fn, .build__src .type, .build__src .file { color: #7d828b; }
.build__src .str, .build__src .num { color: #5f646c; }
.build__src .com { color: #3a3e45; }
.build__src .ok { color: var(--ink); }
.build__src .caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  vertical-align: -0.2em;
  background: var(--ink);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.build__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}
.build__label { color: var(--ink); letter-spacing: 0.02em; }
.build__pct { color: var(--muted); font-variant-numeric: tabular-nums; }

/* the bar is the edge itself: a hairline across the screen, filled from the left */
.build__bar {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  transform-origin: 50% 50%;
}
.build__fill {
  height: 100%;
  background: var(--ink);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.55);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
/* once the picture is whole: the code fades, the bar closes on its centre */
.build__edge.is-gone .build__above { opacity: 0; transition: opacity 300ms ease; }
.build__edge.is-gone .build__bar { transform: scaleX(0); transition: transform 600ms var(--ease-out) 120ms; }

/* end screen */
.build__done {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(ellipse 46% 40% at 50% 50%, rgba(5, 6, 8, 0.9) 0, rgba(5, 6, 8, 0.72) 45%, rgba(5, 6, 8, 0) 100%);
  opacity: 0;
}
.build__done > * { opacity: 0; transform: translateY(8px); }
.build__done.is-in { opacity: 1; pointer-events: auto; transition: opacity 600ms ease; }
.build__done.is-in > * {
  opacity: 1;
  transform: none;
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}
.build__done.is-in > :nth-child(2) { transition-delay: 80ms; }
.build__done.is-in > :nth-child(3) { transition-delay: 160ms; }

.build__msg { margin: 0; font-size: clamp(14px, 1.6vw, 18px); color: var(--ink); }
.build__msg::before { content: "✔ "; }
.build__enter {
  min-width: 220px;
  min-height: 60px;
  padding: 0 32px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.build__enter:active { transform: scale(0.97); }
.build__enter:focus-visible { outline: 1px solid var(--ink); outline-offset: 5px; }
@media (hover: hover) and (pointer: fine) {
  .build__enter:hover { background: #ffffff; }
}
.build__hint { margin: 0; font-size: 12px; color: var(--muted); }
@media (hover: none) { .build__hint { display: none; } }   /* no keyboard on a phone */

/* credits: one discreet line, bottom left */
.build__credits {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 40px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(5, 6, 8, 0) 0, rgba(5, 6, 8, 0.88) 55%);
  font-size: 10px;
  line-height: 1.6;
  color: rgba(232, 234, 237, 0.7);
  opacity: 0;
  pointer-events: none;
}
.build__credits.is-in { opacity: 1; pointer-events: auto; transition: opacity 600ms ease 300ms; }
.build__link {
  padding: 6px 2px;
  border: 0;
  background: none;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.build__link:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

.build__skip {
  position: absolute;
  right: max(16px, env(safe-area-inset-right, 0px));
  top: calc(12px + env(safe-area-inset-top, 0px));
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms ease, opacity 300ms ease;
}
.build__skip.is-hidden { opacity: 0; pointer-events: none; }
.build__skip:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .build__skip:hover { color: var(--ink); }
  .build__link:hover { color: var(--ink); }
}

/* ---------- credits panel ---------- */
.credits {
  width: min(100% - 32px, 760px);
  max-height: min(80vh, 720px);
  padding: 0;
  border: 1px solid var(--faint);
  background: var(--bg);
  color: var(--ink);
  font: 12px/1.6 var(--mono);
}
.credits::backdrop { background: rgba(0, 0, 0, 0.7); }
.credits[open] { display: flex; flex-direction: column; }
.credits__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--faint);
}
.credits__title { margin: 0; font-size: 14px; font-weight: 500; }
.credits__close {
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.credits__close:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.credits__note { margin: 0; padding: 14px 20px 0; color: var(--muted); }
.credits__list {
  margin: 0;
  padding: 14px 20px 20px 48px;
  overflow-y: auto;
  min-height: 0;
}
.credits__list li { margin-bottom: 8px; padding-left: 4px; color: var(--muted); }
.credits__list strong { color: var(--ink); font-weight: 500; }
.credits__list a { color: var(--muted); text-underline-offset: 2px; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) {
  .credits__close:hover, .credits__list a:hover { color: var(--ink); }
}

/* ---------- 3. home (black, content to come) ----------
   not ".home": WordPress puts that class on <body> of the front page */
.accueil { position: relative; height: 100svh; min-height: 420px; overflow: hidden; background: #000; }
html.is-home, html.is-home body { overflow: hidden; }      /* the home is one screen, nothing below */

/* the scene fills the screen like a photograph; the man and the neon stay in frame when cropped */
.scene { position: absolute; inset: 0; will-change: transform; }

/* a section: its own page, black for now */
.page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 96px 16px 48px;
  background: var(--bg);
}
.page__title {
  margin: 0;
  font-size: clamp(22px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

/* the dive: the laptop screen comes to the viewer. It is a real page of code, laid out at the size
   of the whole screen and first shown scaled down onto the laptop: as it grows its text is never
   enlarged, so it stays sharp from the first frame to the last. */
.dive {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  color: #c9d1d9;
  font: 500 clamp(11px, 1.6vw, 24px)/1.7 var(--mono);
  opacity: 0;
  pointer-events: none;
  transform-origin: 0 0;
  overflow: hidden;
}
.dive__tab {
  margin: 0;
  padding: 0 4vw;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  font-size: 0.72em;
  line-height: 3;
  color: #8b949e;
}
.dive__tab span { display: inline-block; padding: 0 1.2em; background: #0d1117; color: #c9d1d9; border-top: 2px solid #f0f6fc; }
.dive__code { flex: 1; min-height: 0; margin: 0; padding: 2.4vh 4vw; overflow: hidden; counter-reset: line; }
.dive__code .l { display: block; white-space: pre; counter-increment: line; }
.dive__code .l::before { content: counter(line); display: inline-block; width: 2.2em; margin-right: 1.4em; text-align: right; color: #484f58; }
.dive__code .kw { color: #ff7b72; }
.dive__code .fn { color: #d2a8ff; }
.dive__code .ty { color: #79c0ff; }
.dive__code .str { color: #a5d6ff; }
.dive__cmd {
  margin: 0;
  padding: 1.4vh 4vw calc(1.4vh + env(safe-area-inset-bottom, 0px));
  min-height: calc(1.7em + 2.8vh);
  background: #010409;
  border-top: 1px solid #21262d;
  color: #f0f6fc;
  white-space: pre;
}
.dive__cmd::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: #f0f6fc;
  animation: blink 1s steps(1) infinite;
}

/* leaving the home: the screen grows from the laptop (start position set by the script), the
   scene pushes in a little and fades behind it */
html.is-diving .dive {
  opacity: 1;
  pointer-events: auto;
  transition: transform 600ms var(--ease-open), opacity 100ms ease;
}
html.is-diving .scene {
  opacity: 0;
  transition: transform 600ms var(--ease-open), opacity 300ms ease 100ms;
}
html.is-diving .bandeau { opacity: 0; transition: opacity 140ms ease; }
/* leaving a section: the screen simply closes over the page */
html.is-leaving .dive { opacity: 1; pointer-events: auto; transition: opacity 200ms ease; }
/* arriving on a section: the screen is there from the first frame, then opens on the page */
html.is-arriving .dive { opacity: 1; }
html.is-arrived .dive { opacity: 0; transition: opacity 380ms ease; }
/* back on the home: the screen is there from the first frame, then shrinks back onto the laptop */
html.is-surfacing .dive { opacity: 1; }
html.is-surfacing .dive__cmd::before { content: "> cd ~"; }
html.is-surfacing .scene { opacity: 0; }
html.is-surfaced .dive { transition: transform 600ms var(--ease-open), opacity 180ms ease 420ms; }
html.is-surfaced .dive__cmd::before { content: "> cd ~"; }
html.is-surfaced .scene { transition: transform 600ms var(--ease-open), opacity 360ms ease; }
/* should the script never run, the screen does not stay closed */
html.is-arriving .dive, html.is-surfacing .dive { animation: dive-failsafe 400ms ease 3s forwards; }
@keyframes dive-failsafe { to { opacity: 0; visibility: hidden; } }

/* both pages show the same screen at the moment of the page change: the browser cross-fades them */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
.scene__still, .scene__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 50%;
  display: block;
}
.scene__video { opacity: 0; }
.scene__video--loop { transition: opacity 400ms ease; }
html.is-tall .scene__still, html.is-tall .scene__video { object-position: 50% 50%; }
.scene__video.is-on { opacity: 1; }
/* soft dark edges so the name and the menu stay readable over the picture */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 6, 8, 0.72) 0, rgba(5, 6, 8, 0) 26%),
    linear-gradient(0deg, rgba(5, 6, 8, 0.6) 0, rgba(5, 6, 8, 0) 22%);
  pointer-events: none;
}

/* the bar has no background of its own: the pseudonym alone on the left, the sections on the right */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.bandeau {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(24px, env(safe-area-inset-left, 0px));
}
.bandeau__brand {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-6px);
}
.bandeau__brand:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.scene__skip { position: absolute; z-index: 2; }
html.is-loading .bandeau { visibility: hidden; }

.menu { display: flex; gap: 2px; }
.menu__link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-6px);
  background: linear-gradient(currentColor, currentColor) no-repeat 14px calc(100% - 12px) / 0 1px;
}
.menu__link:focus-visible { outline: 1px solid var(--ink); outline-offset: -4px; }
@media (hover: hover) and (pointer: fine) {
  .menu__link:hover { background-size: calc(100% - 28px - 0.16em) 1px; }
}

/* the pseudonym comes with the scene, the sections once the scene has settled */
html.is-ready .bandeau__brand,
html.is-menu .menu__link {
  opacity: 1;
  transform: none;
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out),
              background-size 220ms var(--ease-out);
}
html.is-menu .menu__link:nth-child(2) { transition-delay: 60ms, 60ms, 0ms; }
html.is-menu .menu__link:nth-child(3) { transition-delay: 120ms, 120ms, 0ms; }
html.is-menu .menu__link:nth-child(4) { transition-delay: 180ms, 180ms, 0ms; }
html.is-menu .menu__link:active { opacity: 0.7; transition-duration: 100ms; transition-delay: 0ms; }
.scene__skip {
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: rgba(232, 234, 237, 0.7);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, color 150ms ease;
}
html.is-playing .scene__skip { opacity: 1; pointer-events: auto; }
.scene__skip:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .scene__skip:hover { color: var(--ink); }
}

/* the neon sign in miniature: the menu button of narrow screens */
.neon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 14px rgba(190, 160, 255, 0.55));
  transition: transform 160ms var(--ease-out), opacity 600ms var(--ease-out);
}
.neon-btn:active { transform: scale(0.94); }
.neon-btn:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
html.is-ready .neon-btn { opacity: 1; }
.neon-btn svg { display: block; overflow: visible; }
.neon-btn__l, .neon-btn__r, .neon-btn__a, .neon-btn__b {
  transition: transform 240ms var(--ease-out), opacity 200ms ease;
}
.neon-btn__b { opacity: 0; }
/* open: the brackets slide away and the slash is joined by its mirror, making a cross */
html.is-nav .neon-btn__l { opacity: 0; transform: translateX(-8px); }
html.is-nav .neon-btn__r { opacity: 0; transform: translateX(8px); }
html.is-nav .neon-btn__b { opacity: 1; }

/* narrow screens: the sections open as a full panel from the neon button */
@media (max-width: 899px) {
  .bandeau { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .neon-btn { display: inline-flex; position: relative; z-index: 4; }
  .bandeau__brand { position: relative; z-index: 4; }
  .menu {
    position: fixed;
    inset: 0;
    z-index: 3;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 88px 16px calc(32px + env(safe-area-inset-bottom, 0px));
    background: rgba(5, 6, 8, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 0s linear 220ms;
  }
  html.is-nav .menu { opacity: 1; visibility: visible; transition: opacity 220ms ease; }
  .menu__link,
  html.is-menu .menu__link {
    justify-content: center;
    min-width: 240px;
    min-height: 60px;
    padding: 0 16px;
    font-size: 18px;
    letter-spacing: 0.2em;
    opacity: 0;
    transform: translateY(10px);
    background: none;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
    transition: none;
  }
  html.is-nav .menu__link {
    opacity: 1;
    transform: none;
    transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
  }
  html.is-nav .menu__link:nth-child(2) { transition-delay: 50ms; }
  html.is-nav .menu__link:nth-child(3) { transition-delay: 100ms; }
  html.is-nav .menu__link:nth-child(4) { transition-delay: 150ms; }
  html.is-nav .menu__link:active { opacity: 0.6; transition-duration: 100ms; transition-delay: 0ms; }
  .scene__skip { min-height: 48px; }
  .scene::after {
    background:
      linear-gradient(180deg, rgba(5, 6, 8, 0.75) 0, rgba(5, 6, 8, 0) 22%),
      linear-gradient(0deg, rgba(5, 6, 8, 0.6) 0, rgba(5, 6, 8, 0) 20%);
  }
}
@media (max-width: 639px) {
  .build__src { font-size: 11px; }
  .build__code { height: min(32vh, 260px); }
  .build__enter { min-width: 200px; min-height: 56px; font-size: 18px; }
  .build__done {
    background: radial-gradient(ellipse 95% 30% at 50% 50%, rgba(5, 6, 8, 0.92) 0, rgba(5, 6, 8, 0.78) 50%, rgba(5, 6, 8, 0) 100%);
  }
  .build__msg { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .build__src .caret { animation: none; }
  .intro__inner, .bandeau__brand, .menu__link, .build__done > * { transform: none !important; }
  .neon-btn__l, .neon-btn__r { transform: none !important; }
  .dive__cmd::after { animation: none; }
}
