/* police des titres, hébergée sur le site (licence OFL) : rien n'est envoyé à Google */
@font-face { font-family: "Instrument Serif"; src: url(fonts/instrument-serif.woff2) format("woff2"); font-display: swap; }

:root {
  /* Couleurs du thème courant : mat.js les remplace au défilement (liste THEMES).
     Valeurs ici = premier thème (« minuit »), affiché avant le chargement du script. */
  --c1: #2b2f45;
  --c2: #8a93b8;
  --c3: #05060a;

  --ink: #f4f8ff;
  --muted: rgba(244, 248, 255, .82);
  --line: #fff;
  --glass: color-mix(in srgb, var(--c3) 55%, transparent);
  --shade: color-mix(in srgb, var(--c3) 75%, transparent);
  --edge: rgba(255, 255, 255, .18);
  --serif: "Instrument Serif", Constantia, Cambria, Georgia, serif;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --r: 2px; /* arrondi des cartes, panneaux, boutons et étiquettes : presque carré */
  --dim: 0; /* 0 = fond pleinement visible, 1 = option « opacité » (piloté par mat.js) */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* fond de secours si WebGL est absent */
  background: var(--c3) radial-gradient(120% 90% at 30% 20%, var(--c1), transparent 60%) fixed;
}
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--c2); outline-offset: 3px; border-radius: var(--r); }

/* ---------- Fond animé ---------- */
#fluid { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
/* option « opacité » du fond d'écran (sections data-bg="dim") : flou 70 px + grain à 25 % ; l'assombrissement est dans le shader */
#fluid { filter: blur(calc(var(--dim) * 70px)); }
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: calc(var(--dim) * .25);
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 18px; left: 50%; translate: -50% 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
}
.nav a { padding: 12px 6px; text-decoration: none; font-size: 15px; font-weight: 600; white-space: nowrap; text-shadow: 0 1px 10px var(--shade); transition: color .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--c2); }

/* ---------- Mise en page ---------- */
section, .hero, footer { max-width: 1080px; margin: 0 auto; padding: 120px 32px; }
.label {
  margin: 0 0 14px; font: 12px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.label::before { content: ""; display: inline-block; width: 28px; height: 1px; margin-right: 10px; vertical-align: middle; background: currentColor; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; text-shadow: 0 2px 30px var(--shade); }
h2 { font-size: clamp(44px, 6vw, 76px); line-height: 1; margin: 0 0 44px; }

/* Hero */
.hero { position: relative; min-height: 100svh; text-align: center; }
/* le titre du haut, centré dans le premier écran */
.frame { position: absolute; inset: 0; display: grid; place-content: center; }
.frame > div { width: max-content; max-width: calc(100vw - 40px); }
.hero .label::before { display: none; }
.hero h1 { font-size: clamp(64px, 12vw, 150px); line-height: .95; margin: 0 0 22px; letter-spacing: -.01em; }
.lead { max-width: 36ch; margin: 0 auto 34px; font-size: clamp(17px, 2vw, 20px); text-shadow: 0 1px 14px var(--shade); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border-radius: var(--r);
  background: var(--ink); color: var(--c3); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: transform .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.ghost {
  background: var(--glass); color: var(--ink); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.note {
  position: absolute; right: 48px; bottom: 48px; max-width: 34ch; margin: 0; text-align: left;
  font-size: 12px; line-height: 1.5; color: var(--muted); text-shadow: 0 1px 10px var(--shade);
}

/* Cartes projets */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 22px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px;
  background: var(--glass); border: 1px solid var(--edge); border-radius: var(--r); text-decoration: none;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: border-color .2s, transform .2s;
}
a.card:hover { border-color: rgba(255, 255, 255, .55); transform: translateY(-3px); }
/* repères de coupe « + » aux coins haut gauche et bas droit (::after sert à la case qui grandit) */
.card::before {
  content: ""; position: absolute; inset: -6px; opacity: .8; pointer-events: none;
  --p: linear-gradient(var(--line), var(--line));
  background: var(--p) 5px 0 / 1px 11px no-repeat, var(--p) 0 5px / 11px 1px no-repeat,
              var(--p) right 5px bottom 0 / 1px 11px no-repeat, var(--p) right 0 bottom 5px / 11px 1px no-repeat;
}
.num { font: 12px var(--mono); color: var(--muted); }
.card h3 { display: flex; justify-content: space-between; align-items: baseline; margin: 0; font-size: 30px; line-height: 1.1; }
.card h3 span { font: 18px var(--sans); transition: translate .2s; }
a.card:hover h3 span { translate: 4px -4px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding: 10px 0 0; list-style: none; }
.tags li { padding: 2px 9px; border: 1px solid var(--edge); border-radius: var(--r); font: 11px var(--mono); }

/* Projet principal : toute la largeur, chiffres à droite */
.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px 48px; padding: 32px; }
.featured > div { display: flex; flex-direction: column; gap: 12px; }
.featured h3 { font-size: clamp(44px, 6vw, 68px); }
.featured p { font-size: 16px; max-width: 52ch; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-self: end; margin: 0; }
.stats div { padding-top: 10px; border-top: 1px solid var(--edge); }
.stats dt { font: 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 0; font: clamp(26px, 3vw, 36px)/1.2 var(--serif); }

/* À propos */
.about { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: start; }
.panel {
  padding: 28px; background: var(--glass); border: 1px solid var(--edge); border-radius: var(--r);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.panel p { margin: 0 0 16px; }
.panel p:last-child { margin: 0; }
.big { font: 26px/1.35 var(--serif); }
.stack { margin: 0; }
.stack div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--edge); }
.stack div:first-child { border-top: 0; padding-top: 0; }
.stack dt { font: 11px/2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stack dd { margin: 0; }

/* Contact */
.contact { text-align: center; }
.contact .label::before { display: none; }
.contact h2 { margin-bottom: 18px; }
.contact > p { max-width: 42ch; margin: 0 auto 28px; color: var(--muted); }
.mail { font: clamp(26px, 4vw, 40px) var(--serif); text-underline-offset: 6px; text-decoration-thickness: 1px; }
.contact > p, .mail, footer, .label { text-shadow: 0 1px 12px var(--shade); }
.contact .cta { margin-top: 30px; }

footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-top: 32px; padding-bottom: 72px; font: 12px var(--mono); color: var(--muted);
}

/* Apparitions au défilement : .in est posée par mat.js, l'une après l'autre (--d) ; sans JavaScript, tout reste visible */
.js .reveal {
  opacity: 0; translate: 0 28px;
  transition: opacity .7s ease var(--d, 0s), translate .7s cubic-bezier(.2, .8, .2, 1) var(--d, 0s), transform .2s, border-color .2s;
}
.js .reveal.in { opacity: 1; translate: 0 0; }
.js .reveal .shot { scale: 1.06; transition: scale 1.2s cubic-bezier(.2, .8, .2, 1) var(--d, 0s); } /* les captures se posent */
.js .reveal.in .shot { scale: 1; }
/* entrée du haut de page au chargement, ligne par ligne */
.js .frame > div > * { animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
.js .frame > div > :nth-child(2) { animation-delay: .1s; }
.js .frame > div > :nth-child(3) { animation-delay: .2s; }
.js .frame > div > :nth-child(4) { animation-delay: .3s; }
.js .frame > div > :nth-child(5) { animation-delay: .4s; }
@keyframes rise { from { opacity: 0; translate: 0 24px; } }
/* Cartes projets : une petite case apparaît en haut à gauche puis grandit jusqu'à la carte.
   La carte est découpée (clip-path) au même rythme que le cadre ::after trace ses bords droit et bas. */
.js .card.reveal { translate: none; transition: transform .2s, border-color .2s; }
.js .card.reveal.in { animation: case-cut 1.2s cubic-bezier(.7, 0, .2, 1) var(--d, 0s) backwards; }
.js .card.reveal::after {
  content: ""; position: absolute; top: -1px; left: -1px; width: calc(100% + 2px); height: calc(100% + 2px);
  border: 1px solid var(--line); border-radius: var(--r); opacity: 0; pointer-events: none;
}
.js .card.reveal.in::after { animation: case-line 1.2s cubic-bezier(.7, 0, .2, 1) var(--d, 0s); }
@keyframes case-cut {
  0% { opacity: 0; clip-path: inset(-7px calc(100% - 16px) calc(100% - 16px) -7px); }
  18% { opacity: 1; clip-path: inset(-7px calc(100% - 16px) calc(100% - 16px) -7px); }
  100% { opacity: 1; clip-path: inset(-7px 0 0 -7px); }
}
@keyframes case-line {
  0% { width: 16px; height: 16px; opacity: 0; }
  18% { width: 16px; height: 16px; opacity: 1; }
  80% { opacity: 1; }
  100% { width: calc(100% + 2px); height: calc(100% + 2px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal .shot { opacity: 1; translate: none; scale: none; transition: none; }
  .js .frame > div > * { animation: none; }
  .js .card.reveal.in, .js .card.reveal.in::after { animation: none; }
}

@media (max-width: 760px) {
  section, .hero, footer { padding-left: 24px; padding-right: 24px; }
  section { padding-top: 88px; padding-bottom: 88px; }
  .about, .featured { grid-template-columns: 1fr; }
  .stats dd { font-size: 22px; }
  .note { display: none; }
  .nav { gap: 20px; }
  .nav a { font-size: 14px; }
  .stack div { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Idées reprises de mashoqapik.fr ---------- */

/* statut « disponible » sous les boutons du haut de page */
.status { margin: 26px 0 0; font: 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); text-shadow: 0 1px 10px var(--shade); }

/* titre de section + lien « All projects » */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 44px; }
.head h2 { margin: 0; }
.more {
  padding: 8px 14px; border: 1px solid var(--edge); border-radius: var(--r); background: var(--glass);
  font: 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.more:hover { border-color: rgba(255, 255, 255, .55); }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }

/* cote au survol (taille en « cm »), comme une sélection dans un logiciel de design ; ajoutée par mat.js */
.size {
  position: absolute; left: 50%; top: calc(100% + 4px); translate: -50% 0; z-index: 2;
  padding: 1px 7px; border-radius: var(--r); background: var(--ink); color: var(--c3);
  font: 10px/16px var(--mono); white-space: nowrap; opacity: 0; transition: opacity .2s; pointer-events: none;
}
a.card:hover .size, .cover:hover .size, .cover[aria-current="true"] .size { opacity: 1; }

/* ---------- Page projets : vignettes + description du projet choisi ---------- */
.work { padding-top: 110px; }
.page-title { font-size: clamp(52px, 8vw, 96px); line-height: 1; margin: 0 0 36px; }
.covers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 40px; }
.cover {
  position: relative; display: grid; align-content: space-between; aspect-ratio: 4 / 3; padding: 14px 16px;
  border: 1px solid var(--edge); border-radius: var(--r); background: var(--glass); text-decoration: none;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: border-color .2s, transform .2s, background-color .2s;
}
.cover strong { font: 400 clamp(24px, 2.6vw, 34px)/1 var(--serif); }
.cover .kind { font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cover:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .5); }
.cover[aria-current="true"] { border-color: var(--ink); background-color: color-mix(in srgb, var(--c1) 40%, transparent); }
.detail { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px 48px; margin-bottom: 24px; }
.detail[hidden] { display: none; }
.detail h2 { margin: 0 0 18px; }
.points { margin: 0 0 22px; padding-left: 18px; color: var(--muted); }
.points li { margin-bottom: 6px; }

@media (max-width: 760px) {
  .work { padding-top: 88px; }
  .covers { grid-template-columns: 1fr 1fr; }
  .cover:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; } /* 5 vignettes : Liner en large, puis 2 × 2 */
  .detail { grid-template-columns: 1fr; padding: 22px; }
}

/* ---------- Captures des projets (dossier img/) ---------- */
.shot {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top;
  border: 1px solid var(--edge); border-radius: var(--r); background: rgba(0, 0, 0, .3);
}
.side { display: flex; flex-direction: column; gap: 18px; }
/* vignettes de la page projets : capture en fond, assombrie en bas pour garder le nom lisible */
.cover { isolation: isolate; }
.cover img { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: inherit; opacity: .6; transition: opacity .2s; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: linear-gradient(to top, color-mix(in srgb, var(--c3) 92%, transparent) 15%, transparent 85%); }
.cover:hover img, .cover[aria-current="true"] img { opacity: .9; }


/* ---------- Corrections de l'audit (28/11) ---------- */
/* lien d'évitement, visible seulement au clavier */
.skip { position: fixed; left: 16px; top: -60px; z-index: 20; padding: 10px 14px; background: var(--ink); color: var(--c3); font-weight: 600; text-decoration: none; }
.skip:focus { top: 16px; }
/* bande sombre derrière la barre du haut dès qu'on défile (classe posée par mat.js) */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 72px; z-index: 9; pointer-events: none;
  background: linear-gradient(var(--shade), transparent); opacity: 0; transition: opacity .3s;
}
html.scrolled body::before { opacity: 1; }
/* flèche de Liner collée à son titre */
.featured h3 { justify-content: flex-start; gap: 14px; }
/* boutons alignés à gauche dans une description de projet */
.detail .cta { justify-content: flex-start; margin-top: 4px; }
/* numéro des vignettes lisible sur la capture */
.cover .num { justify-self: start; padding: 1px 6px; background: color-mix(in srgb, var(--c3) 75%, transparent); }
/* la cote au survol n'a pas de sens au doigt */
@media (hover: none) { .size { display: none; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 760px) {
  .head { flex-direction: column; align-items: flex-start; }
  footer { flex-direction: column; gap: 6px; }
}
/* page Legal notice : petits intertitres dans le panneau */
.legal h2 { font-size: 28px; margin: 28px 0 8px; }
.legal h2:first-child { margin-top: 0; }
.legal .panel a { text-underline-offset: 3px; }

/* pseudo en haut à droite : ramène au début de l'accueil */
.brand {
  position: fixed; top: 30px; right: 40px; z-index: 10;
  font: 24px/1 var(--serif); text-decoration: none; text-shadow: 0 1px 10px var(--shade); transition: color .2s;
}
.brand:hover { color: var(--c2); }
@media (max-width: 760px) {
  .brand { right: 24px; font-size: 22px; }
  .nav { left: 24px; translate: none; gap: 14px; } /* barre à gauche pour laisser la place au pseudo */
  .nav a:first-child { display: none; }           /* « Home » : le pseudo fait le même travail */
}

/* barre de défilement cachée : la règle de progression à droite (mat.js) sert d'indicateur */
html { scrollbar-width: none; }
::-webkit-scrollbar { display: none; }

/* réglet : la ligne de mesure (mat.js), puis s'efface */
.rule { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; opacity: 0; transition: opacity .4s; }
.rule.on { opacity: 1; transition: none; }
.rule line { stroke: var(--ink); stroke-width: 1.5; }
.rule line.end { stroke-width: 1; } /* grand trait du bout, comme celui du départ */
.rule .t { stroke-width: 1; transform-box: fill-box; transform-origin: 50% 100%; animation: tick-grow .35s cubic-bezier(.2, .8, .2, 1) both; }
.rule g text { font-size: 9px; animation: tick-num .4s .15s both; }
@keyframes tick-grow { from { transform: scaleY(0); } }
@keyframes tick-num { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rule .t, .rule g text { animation: none; } }
.rule text { fill: var(--ink); stroke: none; font: 12px var(--mono); text-anchor: middle; }
.rule.ghost .t, .rule.ghost g text { animation: none; } /* copie qui s'estompe : ses traits ne repoussent pas */
/* curseur en croix sur le fond, normal sur le texte, main sur les liens */
@media (hover: hover) and (pointer: fine) {
  html { cursor: crosshair; }
  :where(p, h1, h2, h3, li, dl, .panel, .detail, .note, .status, footer) { cursor: auto; }
  a, a * { cursor: pointer; }
}
/* indication du réglet, seulement avec une souris */
.hint { opacity: .75; }
@media (hover: none) { .hint { display: none; } }

/* ---------- Graduations qui poussent au défilement (traits créés par mat.js) ---------- */
.ruler { position: relative; height: 34px; width: min(1041px, calc(100% - 64px)); margin: 0 auto; pointer-events: none; } /* 1041 px = 40 cm pile */
.ruler::after { /* la ligne de base se déroule de gauche à droite */
  content: ""; position: absolute; left: 0; width: var(--len, 100%); bottom: 0; height: 1px; background: var(--edge);
  transform: scaleX(0); transform-origin: left; transition: transform .8s cubic-bezier(.2, .8, .2, 1);
}
.ruler.on::after { transform: scaleX(1); }
.ruler i {
  position: absolute; bottom: 0; width: 1px; background: var(--ink); opacity: .7;
  transform: scaleY(0); transform-origin: bottom; transition: transform .35s cubic-bezier(.2, .8, .2, 1) calc(var(--i) * 10ms);
}
.ruler.on i { transform: scaleY(1); }
.ruler b {
  position: absolute; bottom: 18px; translate: -50% 0; font: 400 9px var(--mono); color: var(--muted);
  opacity: 0; transition: opacity .4s calc(var(--i) * 10ms + .2s);
}
.ruler.on b { opacity: 1; }
/* petite règle sous un grand titre, sans chiffres */
.ruler.short { width: min(260px, 100%); height: 16px; margin: -26px 0 40px; }
.ruler.short b { display: none; }
.contact .ruler.short { margin: 0 auto 24px; }
/* règle de progression le long du bord droit */
.progress { position: fixed; top: 84px; bottom: 40px; right: 6px; width: 14px; z-index: 5; pointer-events: none; }
.progress i {
  position: absolute; right: 0; height: 1px; background: var(--ink); opacity: .25;
  transform: scaleX(.35); transform-origin: right; transition: transform .3s, opacity .3s;
}
.progress i.on { opacity: .8; transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .ruler::after, .ruler i, .ruler b, .progress i { transition: none; } }
@media (max-width: 760px) {
  .ruler:not(.short) { width: auto; margin: 0 24px; }
  .progress { right: 2px; width: 10px; }
}

/* texte non sélectionnable, sauf l'adresse mail (pour pouvoir la copier) */
body { -webkit-user-select: none; user-select: none; }
.mail { -webkit-user-select: text; user-select: text; }
