/* ===========================================================
   Apoulit Créations
   Une page, une vue. L'impact vient de l'échelle typographique
   et du vide, pas de l'accumulation d'effets.
   =========================================================== */

:root {
  --bg:        #0d0f15;
  --bg-lift:   #161923;
  --bg-field:  #1c202b;
  --ink:       #f4f4f8;
  --ink-soft:  #b6b9c9;
  --ink-mute:  #767a8f;
  --accent:    #9184d9;
  --accent-hi: #b3a6ff;
  --line:      #232733;
  --line-hi:   #343949;
  --ok:        #6fc79a;
  --ko:        #dd6b76;

  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --pad-x: clamp(20px, 4.6vw, 74px);
  --pad-y: clamp(18px, 3vh, 38px);
  --gut:   clamp(14px, 1.6vw, 22px);   /* retrait du cadre */

  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: #0b0d12; }

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

/* ─────────────── Décors ─────────────── */

/* Lueur qui suit le curseur. Très diffuse : on la perçoit comme une
   présence, pas comme un effet. */
.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    46vw 46vw at var(--mx, 62%) var(--my, 32%),
    rgba(145, 132, 217, .13) 0%,
    rgba(145, 132, 217, .05) 38%,
    transparent 68%
  );
  transition: background .5s linear;
}

.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Passe-partout : un filet à quelques pixels du bord, ouvert aux angles.
   Cadre la composition comme une page imprimée. */
.frame {
  position: fixed;
  inset: var(--gut);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  animation: fade .9s var(--ease) .25s forwards;
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  inset: 0;
}
.frame::before {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-inline: 34px;
}
.frame::after {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  margin-block: 34px;
}

/* ─────────────── Entrées ─────────────── */

.ln { display: block; overflow: hidden; padding-bottom: .08em; }
.ln > span {
  display: block;
  transform: translateY(105%);
  animation: reveal 1.15s var(--ease) forwards;
}
.ln:nth-child(1) > span { animation-delay: .10s; }
.ln:nth-child(2) > span { animation-delay: .21s; }
.ln:nth-child(3) > span { animation-delay: .32s; }
@keyframes reveal { to { transform: translateY(0); } }

.fade {
  opacity: 0;
  transform: translateY(14px);
  animation: fade .95s var(--ease) forwards;
  animation-delay: var(--d, .5s);
}
@keyframes fade { to { opacity: 1; transform: none; } }

/* ─────────────── Ossature ─────────────── */

.page {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: calc(var(--pad-y) + var(--gut)) calc(var(--pad-x) + var(--gut));
  max-width: 1760px;
  margin-inline: auto;
}

/* ─────────────── Haut ─────────────── */

.top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.mark {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--accent);
  transition: color .3s var(--ease);
}
.mark:hover { color: var(--accent-hi); }
.mark svg { width: 25px; height: 25px; display: block; }
.mark span { font-family: var(--mono); font-size: 13.5px; color: var(--ink); }

.role {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ─────────────── Scène ─────────────── */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.58fr);
  gap: clamp(26px, 4.4vw, 76px);
  align-items: center;
  min-height: 0;
}

/* L'échelle fait tout le travail : le titre occupe la page.
   Le clamp est borné en vh autant qu'en vw pour qu'il tienne
   toujours dans la vue, sans ascenseur. */
.claim {
  margin: 0;
  font-weight: 500;
  font-size: clamp(40px, min(10.6vw, 20.5vh), 184px);
  line-height: .9;
  letter-spacing: -0.055em;
  text-wrap: nowrap;
}
.claim .hl { color: var(--accent); }

.aside {
  align-self: end;
  padding-bottom: clamp(2px, 2vh, 26px);
}

.intro {
  margin: 0 0 clamp(18px, 2.8vh, 32px);
  font-size: clamp(13px, .93vw, 15px);
  line-height: 1.7;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.work { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.work li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  padding: clamp(10px, 1.5vh, 16px) 0;
  border-bottom: 1px solid var(--line);
  transition: border-color .35s var(--ease);
}
.work li:hover { border-bottom-color: var(--accent); }
.work li:hover .idx { color: var(--accent); }
.work li:hover h2 { color: var(--ink); }

.idx {
  font-family: var(--mono); font-size: 10.5px; padding-top: 2px;
  color: var(--ink-mute); transition: color .35s var(--ease);
}
.work h2 {
  margin: 0 0 2px;
  font-family: var(--mono); font-weight: 500; font-size: 12.5px;
  color: var(--ink-soft); transition: color .35s var(--ease);
}
/* Sur la page 404, les intitulés sont des liens : ils doivent se voir
   comme tels sans casser l'alignement de la liste. */
.work h2 a {
  border-bottom: 1px solid transparent;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.work h2 a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.work p { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-mute); }

.stack {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: clamp(16px, 2.2vh, 24px) 0 0; padding: 0; list-style: none;
}
.stack li {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  color: var(--ink-mute);
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.stack li:hover { color: var(--ink-soft); border-color: var(--line-hi); }

/* ─────────────── Bas ─────────────── */

.bottom {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 14px 30px;
}
.reach { display: flex; align-items: center; gap: clamp(12px, 1.8vw, 24px); flex-wrap: wrap; }

.cta {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-size: 14.5px; font-weight: 500;
  color: var(--ink); background: none;
  border: 1px solid var(--line-hi); border-radius: 999px;
  padding: 11px 22px; cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease), background .3s var(--ease);
}
.cta svg { width: 16px; height: 16px; transition: transform .35s var(--ease); }
.cta:hover { color: var(--accent-hi); border-color: var(--accent); background: rgba(145,132,217,.08); }
.cta:hover svg { transform: translateX(4px); }

.mail {
  font-family: var(--mono); font-size: 12px; color: var(--ink-mute);
  border-bottom: 1px solid transparent;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.mail:hover { color: var(--ink-soft); border-bottom-color: var(--line-hi); }

.legal {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-mute);
}
.legal .dot { opacity: .5; }
.legal a { transition: color .3s var(--ease); }
.legal a:hover { color: var(--accent); }

/* ═══════════════ Formulaire ═══════════════ */

.sheet {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  padding: clamp(14px, 3.5vh, 40px) clamp(14px, 4vw, 40px);
  background: rgba(6, 7, 11, .8);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  animation: veil .3s ease both;
}
@keyframes veil { from { opacity: 0; } to { opacity: 1; } }

.sheet-panel {
  position: relative; width: min(780px, 100%);
  background: var(--bg-lift);
  border: 1px solid var(--line-hi); border-radius: 8px;
  padding: clamp(28px, 4.2vw, 58px);
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  animation: lift .42s var(--ease) both;
}
@keyframes lift { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.sheet-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; display: grid; place-items: center;
  color: var(--ink-mute); background: none;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.sheet-close svg { width: 19px; height: 19px; }
.sheet-close:hover { color: var(--ink); border-color: var(--line-hi); }

.sheet-head { margin-bottom: clamp(24px, 3.2vw, 36px); }
.sheet-kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent);
}
.sheet-kicker i { width: 18px; height: 1px; background: var(--accent); }
.sheet-head h2 {
  margin: 0 0 10px; font-weight: 500;
  font-size: clamp(24px, 3.1vw, 34px); line-height: 1.12; letter-spacing: -0.035em;
}
.sheet-sub { margin: 0; font-size: 14.5px; color: var(--ink-soft); }

.form { display: grid; gap: clamp(16px, 2vw, 22px); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 2vw, 22px); }
.field { display: grid; gap: 8px; position: relative; }

.field label {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft);
}
.field label b { color: var(--accent); font-weight: 400; }
.field label small { font-size: 10px; letter-spacing: .04em; text-transform: none; color: var(--ink-mute); }

.field input, .field textarea {
  width: 100%;
  font-family: var(--sans); font-size: 15.5px; line-height: 1.5; color: var(--ink);
  background: var(--bg-field);
  border: 1px solid var(--line-hi); border-radius: 6px;
  padding: 13px 15px;
  transition: border-color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.field textarea { resize: vertical; min-height: 132px; }
.field input::placeholder, .field textarea::placeholder { color: #676c80; }
.field input:hover, .field textarea:hover { border-color: #454b60; }
.field input:focus, .field textarea:focus {
  outline: none; background: #20242f; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(145,132,217,.17);
}
.field[data-invalid] input, .field[data-invalid] textarea { border-color: var(--ko); }
.field[data-invalid] input:focus, .field[data-invalid] textarea:focus { box-shadow: 0 0 0 3px rgba(221,107,118,.17); }
.field .err { font-family: var(--mono); font-size: 11px; color: var(--ko); }

.count {
  position: absolute; right: 2px; bottom: -18px;
  font-family: var(--mono); font-size: 10px; color: var(--ink-mute);
  opacity: 0; transition: opacity .25s var(--ease);
}
.field:focus-within .count { opacity: 1; }

.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 18px; margin-top: 8px;
}
.submit {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-weight: 500; font-size: 15px;
  color: #0f1117; background: var(--accent);
  border: 1px solid var(--accent); border-radius: 6px;
  padding: 14px 28px; cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease), opacity .25s var(--ease);
}
.submit svg { width: 17px; height: 17px; transition: transform .35s var(--ease); }
.submit:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.submit:hover:not(:disabled) svg { transform: translateX(4px); }
.submit:disabled { opacity: .55; cursor: default; }

.note { margin: 0; flex: 1 1 250px; font-size: 12.5px; line-height: 1.55; color: var(--ink-mute); }
.note a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.note[data-state="error"] { color: var(--ko); }
.note[data-state="ok"] { color: var(--ok); }

.done { display: grid; gap: 14px; padding: clamp(12px, 2vw, 24px) 0; animation: fade .6s var(--ease) both; }
.done h3 { margin: 0; font-weight: 500; font-size: clamp(21px, 2.6vw, 28px); letter-spacing: -0.03em; }
.done p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }

/* ═══════════════ Page de texte ═══════════════
   En-tête, corps et pied partagent la MÊME grille : c'est le
   désalignement entre un en-tête large et un corps centré qui
   donnait l'impression d'un contenu qui flotte. */

body.doc { overflow: auto; }
body.doc .frame { display: none; }

.doc-top,
.doc-body,
.doc-bottom {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--pad-x);
  position: relative;
  z-index: 1;
}

.doc-top {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-block: var(--pad-y);
}
.back { font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute); transition: color .3s var(--ease); }
.back:hover { color: var(--accent); }

.doc-body { padding-block: clamp(24px, 5vh, 56px) clamp(48px, 9vh, 92px); }
/* Le texte reste lisible (68 caractères) mais aligné à gauche
   sur la même colonne que le logo. */
.doc-body > * { max-width: 70ch; }

.doc-body h1 {
  margin: 0 0 8px; font-weight: 500;
  font-size: clamp(30px, 4.6vw, 52px); line-height: 1.04; letter-spacing: -0.042em;
}
.date { margin: 0 0 clamp(26px, 4vh, 42px); font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute); }

.toc {
  display: flex; flex-wrap: wrap; gap: 22px; padding: 15px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: clamp(30px, 5vh, 54px);
  font-family: var(--mono); font-size: 11.5px;
}
.toc a { color: var(--ink-soft); transition: color .3s var(--ease); }
.toc a:hover { color: var(--accent); }

.doc-body section { margin-bottom: clamp(40px, 7vh, 72px); }
.doc-body h2 { margin: 0 0 clamp(16px, 2.4vh, 24px); font-weight: 500; font-size: clamp(21px, 2.6vw, 27px); letter-spacing: -0.03em; }
.doc-body h3 { margin: clamp(22px, 3.2vh, 34px) 0 10px; font-family: var(--mono); font-weight: 500; font-size: 12.5px; color: var(--accent); }
.doc-body p { margin: 0 0 13px; font-size: 15px; line-height: 1.72; color: var(--ink-soft); text-wrap: pretty; }
.doc-body strong { color: var(--ink); font-weight: 500; }
.doc-body a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.doc-body a:hover { color: var(--accent); }

.specs { display: grid; grid-template-columns: minmax(118px, max-content) 1fr; margin: 0; border-top: 1px solid var(--line); }
.specs dt, .specs dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.6; }
.specs dt { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); padding-right: 22px; align-self: start; padding-top: 14px; }
.specs dd { color: var(--ink-soft); }

.grid { width: 100%; border-collapse: collapse; margin: 6px 0 16px; font-size: 13.5px; }
.grid th {
  text-align: left; padding: 10px 14px 10px 0;
  font-family: var(--mono); font-weight: 500; font-size: 10.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute);
  border-bottom: 1px solid var(--line);
}
.grid td { padding: 12px 14px 12px 0; vertical-align: top; line-height: 1.6; color: var(--ink-soft); border-bottom: 1px solid var(--line); }

.doc-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-block: 20px 38px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-mute);
}
.doc-bottom a { transition: color .3s var(--ease); }
.doc-bottom a:hover { color: var(--accent); }

/* ═══════════════ Adaptations ═══════════════ */

/* En dessous, le titre ne peut plus rester sur une seule ligne
   par ligne : on relâche la contrainte de non-retour. */
@media (max-width: 1100px) {
  .claim { text-wrap: balance; }
}

@media (max-width: 900px), (max-height: 620px) {
  body { overflow: auto; }
  .page { height: auto; min-height: 100dvh; }
  .frame { display: none; }
  .stage {
    grid-template-columns: 1fr;
    gap: clamp(26px, 6vh, 44px);
    align-items: start;
    padding: clamp(26px, 6vh, 52px) 0;
  }
  .aside { align-self: auto; padding-bottom: 0; }
  .claim { font-size: clamp(38px, 12vw, 68px); }
  .intro, .work p { font-size: 13px; }
  .work h2 { font-size: 13.5px; }
  .row { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .role { display: none; }
  .bottom { flex-direction: column; align-items: flex-start; }
  .specs { grid-template-columns: 1fr; }
  .specs dt { border-bottom: 0; padding-bottom: 0; }
  .specs dd { padding-top: 4px; }
  .grid, .grid thead, .grid tbody, .grid tr, .grid th, .grid td { display: block; }
  .grid thead { display: none; }
  .grid tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .grid td { border: 0; padding: 3px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .ln > span { transform: none; }
  .fade, .frame { opacity: 1; transform: none; }
  .glow { display: none; }
}
