/* Novpira — feuille de style unique. Polices auto-hébergées, aucune ressource externe. */

@font-face {
  font-family: "Bricolage";
  src: url("/assets/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument";
  src: url("/assets/fonts/instrument.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --cobalt: #1c27d8;
  --cobalt-deep: #0f1670;
  --ink: #0c1033;
  --ink-soft: #4a4f73;
  --paper: #f4f5fb;
  --mist: #c9ceff;
  --signal: #ffc531;
  --ember: #ff7a45;
  --flare: #fff1b8;
  --rule: rgba(12, 16, 51, 0.18);

  --display: "Bricolage", "Helvetica Neue", Arial, sans-serif;
  --text: "Instrument", system-ui, -apple-system, "Segoe UI", sans-serif;

  --pad: clamp(1rem, 3vw, 2.5rem);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }
.on-cobalt :focus-visible { outline-color: var(--signal); }

.skip {
  position: absolute; left: var(--pad); top: -4rem; z-index: 10;
  background: var(--signal); color: var(--ink); padding: .6rem 1rem; text-decoration: none; font-weight: 600;
}
.skip:focus { top: .75rem; }

/* ---------- Barre commune ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .7rem;
  text-decoration: none; color: inherit;
  font: 800 1.6rem/1 var(--display); font-stretch: 80%; letter-spacing: -.02em;
}
.brand img { display: block; }
.bar-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: flex-end; }
.bar-nav a {
  text-decoration: none; font-weight: 500; font-size: 1rem;
  text-underline-offset: .3em; text-decoration-thickness: 2px;
}
.bar-nav a:hover { text-decoration-line: underline; }
.doc-head .bar { flex-wrap: wrap; row-gap: .75rem; }
.doc-head .bar-nav { justify-content: flex-start; gap: .25rem 1.25rem; }
@media (min-width: 40rem) { .doc-head .bar-nav { justify-content: flex-end; } }

/* ---------- Accueil : hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto;
  padding: clamp(1rem, 2.5vw, 2rem) var(--pad) 0;
  background: var(--cobalt); color: var(--paper);
}
.hero > *:not(canvas) { position: relative; z-index: 1; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }

.intro { align-self: start; margin-top: clamp(2.5rem, 9vh, 7rem); }
.lede {
  margin: 0; max-width: 18ch;
  font: 600 clamp(1.9rem, 4vw, 3.6rem)/1.02 var(--display);
  font-stretch: 82%;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.sub { margin: 1.1rem 0 0; max-width: 32ch; font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.4; color: var(--mist); }

/* Illustration technique, dessinée sur la même trame que la grille */
.art { align-self: center; justify-self: center; width: min(100%, 42rem); margin: 1.5rem 0; }
.art svg { display: block; width: 100%; height: auto; }
/* Étincelle qui parcourt le circuit : un cycle de 6 s */
.art .pulse { opacity: 0; offset-rotate: 0deg; animation: travel 6s ease-in-out infinite; }
.art .chip-core { animation: chip 6s ease-out infinite; }
.art .core { animation: lit 6s ease-out infinite; }
.art .p0 { offset-path: path("M222 185H200L170 155H90"); animation-delay: 2.16s; }
.art .n0 { animation-delay: 2.16s; }
.art .p1 { offset-path: path("M222 205H40"); animation-delay: 2.44s; }
.art .n1 { animation-delay: 2.44s; }
.art .p2 { offset-path: path("M222 225H190L160 255H110"); animation-delay: 1.32s; }
.art .n2 { animation-delay: 1.32s; }
.art .p3 { offset-path: path("M222 245H210L180 275V340"); animation-delay: 1.04s; }
.art .n3 { animation-delay: 1.04s; }
.art .p4 { offset-path: path("M338 185H360L390 155H470"); animation-delay: 2.3s; }
.art .n4 { animation-delay: 2.3s; }
.art .p5 { offset-path: path("M338 205H520"); animation-delay: 2.58s; }
.art .n5 { animation-delay: 2.58s; }
.art .p6 { offset-path: path("M338 225H370L400 255H450"); animation-delay: 1.46s; }
.art .n6 { animation-delay: 1.46s; }
.art .p7 { offset-path: path("M338 245H350L380 275V340"); animation-delay: 1.18s; }
.art .n7 { animation-delay: 1.18s; }
.art .p8 { offset-path: path("M250 157V120L220 90V40"); animation-delay: 1.74s; }
.art .n8 { animation-delay: 1.74s; }
.art .p9 { offset-path: path("M290 157V40"); animation-delay: 0.9s; }
.art .n9 { animation-delay: 0.9s; }
.art .p10 { offset-path: path("M310 157V110L340 80V40"); animation-delay: 1.88s; }
.art .n10 { animation-delay: 1.88s; }
.art .p11 { offset-path: path("M270 273V300L250 320V400"); animation-delay: 2.02s; }
.art .n11 { animation-delay: 2.02s; }
.art .p12 { offset-path: path("M290 273V400"); animation-delay: 1.6s; }
.art .n12 { animation-delay: 1.6s; }
@keyframes travel {
  0% { offset-distance: 0%; opacity: 0; }
  2% { opacity: 1; }
  26% { offset-distance: 100%; opacity: 1; }
  28%, 100% { offset-distance: 100%; opacity: 0; }
}
@keyframes lit {
  0%, 25% { fill: #f4f5fb; fill-opacity: .5; }
  28% { fill: #ffc531; fill-opacity: 1; }
  60% { fill: #ffc531; fill-opacity: .9; }
  100% { fill: #f4f5fb; fill-opacity: .5; }
}
@keyframes chip { 0% { stroke: #fff1b8; } 12% { stroke: #ffc531; } 100% { stroke: #ffc531; } }
@media (prefers-reduced-motion: reduce) { .art .pulse { display: none; } .art .chip-core, .art .core { animation: none; } }

.wordmark {
  font: 800 clamp(3.4rem, 26vw, 12rem)/.8 var(--display);
  font-stretch: 75%;
  letter-spacing: -.045em;
  margin: 0 0 0 -.045em;
  padding-bottom: .14em;
  color: var(--paper);
  user-select: none;
}

@media (min-width: 62rem) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: clamp(1.5rem, 4vw, 4rem); }
  .hero .bar { grid-column: 1 / -1; }
  .intro { grid-column: 1; grid-row: 2; }
  .art { grid-column: 2; grid-row: 2 / 4; margin: 0; justify-self: end; }
  .wordmark { grid-column: 1; grid-row: 3; font-size: clamp(5rem, min(16.5vw, 30svh), 22rem); }
}

/* Point du « i » : la tuile qui allume la grille */
.wordmark .i { position: relative; }
.spark {
  position: absolute; left: .047em; top: .174em;
  width: .153em; height: .153em;
  background: var(--signal);
  animation: spark-on .3s .55s both;
}
@keyframes spark-on { from { background: var(--paper); } to { background: var(--signal); } }
@media (prefers-reduced-motion: reduce) { .spark { animation: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Accueil : informations ---------- */
.info { padding: 0 0 clamp(3rem, 6vw, 5rem); }
.ribbon { height: clamp(96px, 11vw, 160px); margin-bottom: clamp(2.5rem, 6vw, 5rem); }
.ribbon canvas { display: block; width: 100%; height: 100%; }
.info-grid {
  display: grid; gap: clamp(3rem, 7vw, 6rem);
  grid-template-columns: 1fr; max-width: calc(80rem + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad);
}
@media (min-width: 62rem) {
  .info-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
}

.info h2 { font-size: 1.25rem; font-weight: 600; font-stretch: 90%; margin-bottom: 1.25rem; color: var(--ink-soft); }

.mail {
  display: inline-block;
  font: 700 clamp(1.25rem, 3vw, 2.25rem)/1.1 var(--display);
  font-stretch: 82%; letter-spacing: -.025em;
  color: var(--cobalt);
  text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .14em;
  overflow-wrap: anywhere;
  transition: text-decoration-thickness .15s ease;
}
.mail:hover { text-decoration-thickness: .16em; }

.contact-sub { margin: 1.25rem 0 0; max-width: 34ch; color: var(--ink-soft); }

.copy {
  margin-top: 1.5rem;
  font: 600 .9375rem/1 var(--text);
  color: var(--ink); background: transparent;
  border: 2px solid var(--ink); border-radius: 2px;
  padding: .8rem 1.1rem; cursor: pointer; min-height: 2.75rem;
}
.copy:hover { background: var(--ink); color: var(--paper); }
.copy[data-state="done"] { background: var(--signal); border-color: var(--signal); color: var(--ink); }

.legal ul { list-style: none; margin: 0; padding: 0; }
.legal li { border-top: 1px solid var(--rule); }
.legal li:last-child { border-bottom: 1px solid var(--rule); }
.legal a {
  position: relative; display: block; padding: 1.15rem 0 1.15rem 1.75rem; text-decoration: none;
}
.legal a::before {
  content: ""; position: absolute; left: 0; top: 1.62rem; width: .6rem; height: .6rem; background: var(--mist);
}
.legal a:hover::before { background: var(--signal); }
.legal .t {
  display: block; font: 600 1.375rem/1.2 var(--display); font-stretch: 88%;
  text-decoration: underline; text-decoration-color: transparent;
  text-decoration-thickness: 2px; text-underline-offset: .25em;
}
.legal a:hover .t { color: var(--cobalt); text-decoration-color: currentColor; }
.legal .d { display: block; margin-top: .2rem; color: var(--ink-soft); font-size: .9375rem; }

.foot {
  padding: 1.25rem var(--pad) 2rem; color: var(--ink-soft); font-size: .9375rem;
  display: flex; flex-wrap: wrap; gap: .25rem 2rem; justify-content: space-between;
  max-width: calc(80rem + 2 * var(--pad)); margin: 0 auto;
}
.foot p { margin: 0; }
.foot a { text-underline-offset: .2em; }

/* ---------- Pages légales ---------- */
.doc-head {
  background: var(--cobalt); color: var(--paper);
  padding: 1rem var(--pad);
}
.doc-intro { padding: clamp(3rem, 8vw, 6rem) var(--pad) clamp(2rem, 4vw, 3rem); max-width: 72rem; margin: 0 auto; }
.doc-intro h1 {
  font-size: clamp(2.5rem, 7vw, 5.5rem); line-height: .98; font-weight: 750;
  font-stretch: 80%; letter-spacing: -.035em; color: var(--cobalt);
}
.doc-meta { margin: 1.25rem 0 0; color: var(--ink-soft); font-size: .9375rem; }

.doc-body {
  display: grid; gap: 2.5rem 5rem; grid-template-columns: minmax(0, 1fr);
  max-width: 72rem; margin: 0 auto; padding: 0 var(--pad) clamp(3rem, 8vw, 6rem);
}
@media (min-width: 62rem) {
  .doc-body { grid-template-columns: 14rem minmax(0, 40rem); }
}

.toc { font-size: .9375rem; line-height: 1.4; }
.toc h2 { font-size: 1rem; font-weight: 600; font-stretch: 90%; margin-bottom: .75rem; color: var(--ink-soft); }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--rule); }
.toc li a {
  display: block; padding: .4rem 0 .4rem .9rem; text-decoration: none; color: var(--ink-soft);
}
.toc li a:hover { color: var(--cobalt); }
@media (min-width: 62rem) { .toc { position: sticky; top: 2rem; align-self: start; } }

.prose h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.75rem); line-height: 1.15; font-weight: 700; font-stretch: 88%;
  letter-spacing: -.015em; margin: 3rem 0 .9rem; scroll-margin-top: 1.5rem;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.125rem; font-weight: 650; font-stretch: 92%; margin: 2rem 0 .5rem; }
.prose a { color: var(--cobalt); text-underline-offset: .18em; text-decoration-thickness: 1.5px; }
.prose a:hover { text-decoration-thickness: 3px; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; padding-left: .2rem; }
.prose strong { font-weight: 650; }

.facts { margin: 0 0 1.5em; border-top: 1px solid var(--rule); }
.facts div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-soft); font-size: .9375rem; }
.facts dd { margin: 0; }
@media (max-width: 34rem) { .facts div { grid-template-columns: 1fr; gap: .1rem; } }

.callout {
  margin: 0 0 1.5em; padding: 1rem 1.25rem; background: #e8eaff; border-left: 4px solid var(--cobalt);
}
.callout p:last-child { margin-bottom: 0; }

mark.todo { background: #ffe39a; color: var(--ink); padding: 0 .3em; border-radius: 2px; }

/* ---------- 404 ---------- */
.lost { min-height: 100vh; min-height: 100svh; display: grid; place-content: center; padding: var(--pad); background: var(--cobalt); color: var(--paper); text-align: left; }
.lost h1 { font: 800 clamp(5rem, 22vw, 16rem)/.85 var(--display); font-stretch: 75%; letter-spacing: -.045em; }
.lost p { font: 500 1.5rem/1.2 var(--display); font-stretch: 88%; margin: 1.5rem 0 0; }
.lost a { color: var(--signal); text-underline-offset: .2em; }

/* ---------- Impression ---------- */
@media print {
  .doc-head, .toc, .foot, .skip { display: none; }
  body { background: #fff; font-size: 11pt; }
  .doc-body { display: block; }
  .prose a { color: inherit; }
}

@media (max-width: 30rem) {
  .bar { gap: .75rem; }
  .brand { font-size: 1.4rem; gap: .5rem; }
  .bar-nav { gap: .9rem; flex-wrap: nowrap; }
  .bar-nav a { font-size: .9rem; white-space: nowrap; }
}
