/*
 * vestarka.fr v3 — fondations : jetons, typographie, en-tête, système de mouvement.
 * Une seule tenue, sombre (ADR-207) : charbon chaud, ivoire, or, terre.
 * Une action est un aplat d'or, un état est un lavis d'or (ADR-211).
 * Aucune ressource externe : la CSP du site n'autorise que 'self'.
 */

@font-face { font-family: "Space Grotesk"; src: url("/assets/fonts/space-grotesk-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/assets/fonts/space-grotesk-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #171716;
  --deep: #121211;
  --card: #201F1C;
  --raised: #24231F;
  --rail: #3A3832;
  --outline: #6A665C;
  /* Textes secondaires éclaircis pour la lecture sur fond sombre.
     --outline reste réservé aux filets et aux formes, jamais au texte. */
  --faint: #C0BAAE;
  --muted: #E8E4D9;
  --ivory: #F1EDE3;
  --gold: #B49A62;
  --gold-hi: #C5AB70;
  --gold-wash: #2A2519;
  --terre: #9F765E;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 12px;
  --radius-lg: 18px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(72px, 8.5vw, 128px);

  /*
   * Jetons de mouvement. Trois durées, deux courbes, trois ressorts, trois
   * distances : une animation qui n'entre dans aucun n'a probablement pas de
   * raison d'être. La réactivité passe avant la fluidité.
   */
  --dur-fast: 0.18s;
  --dur-normal: 0.35s;
  --dur-slow: 0.6s;
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-sharp: cubic-bezier(0.4, 0, 0.2, 1);
  --ease: var(--ease-smooth);
  --dist-sm: 8px;
  --dist-md: 16px;
  --dist-lg: 24px;
  /* Les ressorts, sans moteur : la courbe d'un ressort amorti échantillonnée
     en linear(). Sans linear(), une courbe de Bézier qui dépasse un peu. */
  --spring-gentle: var(--ease-smooth);
  --spring-snappy: cubic-bezier(0.3, 1.25, 0.6, 1);
  --spring-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-gentle: 0.65s;
  --dur-snappy: 0.54s;
  --dur-pop: 0.68s;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    /* Ressort k=140, c=22 : aucun dépassement. */
    --spring-gentle: linear(0, 0.031, 0.094, 0.176, 0.274, 0.365, 0.452, 0.533, 0.612, 0.676, 0.731, 0.779, 0.82, 0.857, 0.885, 0.908, 0.928, 0.944, 0.956, 0.966, 0.974, 0.98, 0.985, 0.989, 0.992, 0.994, 0.996, 0.997, 0.998, 0.999, 0.999, 1, 1);
    /* Ressort k=320, c=26 : 3 % de dépassement. */
    --spring-snappy: linear(0, 0.05, 0.152, 0.278, 0.412, 0.541, 0.657, 0.757, 0.838, 0.908, 0.955, 0.988, 1.011, 1.024, 1.031, 1.033, 1.032, 1.029, 1.025, 1.02, 1.016, 1.012, 1.009, 1.006, 1.003, 1.002, 1.001, 1, 0.999, 0.999, 0.999, 0.999, 1);
    /* Ressort k=420, c=20 : 17 % de dépassement, pour ce qui apparaît. */
    --spring-pop: linear(0, 0.092, 0.295, 0.539, 0.753, 0.942, 1.073, 1.142, 1.169, 1.159, 1.13, 1.09, 1.05, 1.018, 0.993, 0.978, 0.972, 0.972, 0.977, 0.983, 0.99, 0.996, 1, 1.003, 1.005, 1.005, 1.004, 1.003, 1.002, 1.001, 1, 1, 1);
  }
}

/* Appareil modeste : des mouvements plus courts, et pas de calque de grain. */
.is-low-end {
  --dur-normal: 0.2s;
  --dur-slow: 0.35s;
  --dur-gentle: 0.4s;
}
.is-low-end body::before { display: none; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ivory);
  font: 400 1.0625rem/1.65 var(--font-body);
  /* « clip » ne crée pas de conteneur de défilement ; « hidden » le remplace là où il manque. */
  overflow-x: hidden;
  overflow-x: clip;
}

/* Le grain : la même matière que le film, posée sur toute la page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: url("/assets/img/grain.png");
  opacity: 0.045;
  mix-blend-mode: overlay;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--gold-hi); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--ivory); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--gold); color: var(--bg); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 16px; }

.wrap { width: min(100% - 2 * var(--gutter), 1160px); margin-inline: auto; }
.wrap--wide { width: min(100% - 2 * var(--gutter), 1400px); }

.overline {
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  font: 500 0.75rem/1.2 var(--font-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.overline::before { content: ""; width: 28px; height: 1px; background: currentColor; flex: none; transform-origin: left center; }

.accent { color: var(--gold-hi); }
.mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.02em; }
.note { max-width: 40rem; color: var(--muted); font-size: 0.9375rem; border-left: 2px solid var(--rail); padding-left: 14px; }

/* --- boutons -------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: var(--radius);
  font: 600 1rem/1 var(--font-display);
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-sharp), background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.button:active { transform: scale(0.97); }
.button--gold { background: var(--gold); color: var(--bg); }
.button--gold:hover { background: var(--gold-hi); color: var(--bg); }
.button--ghost { border: 1px solid var(--rail); color: var(--ivory); }
.button--ghost:hover { border-color: var(--gold); color: var(--ivory); }

/* --- en-tête -------------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-normal), border-color var(--dur-normal);
}
.top[data-scrolled="true"] {
  background: rgb(23 23 22 / 0.86);
  border-bottom-color: var(--rail);
  backdrop-filter: blur(14px) saturate(1.1);
}
.is-low-end .top[data-scrolled="true"] { backdrop-filter: none; background: rgb(23 23 22 / 0.97); }
@media (prefers-reduced-transparency: reduce) {
  .top[data-scrolled="true"] { background: var(--bg); backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --rail: var(--outline); }
}
.top__inner {
  width: min(100% - 2 * var(--gutter), 1400px);
  margin-inline: auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 32px;
}
/* La lecture de la page, en un fil d'or : un transform, jamais une largeur. */
.top__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-hi));
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ivory); text-decoration: none; }
.brand__seal { width: 40px; height: auto; }
.brand__name { font: 600 1.05rem/1 var(--font-display); letter-spacing: 0.24em; }
.nav { position: relative; display: flex; gap: 28px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.9375rem; padding-block: 10px; transition: color var(--dur-fast); }
.nav a:hover, .nav a[aria-current="true"] { color: var(--ivory); }
/* Le repère de la section lue glisse d'un lien à l'autre. */
.nav__ink {
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100px;
  height: 1px;
  background: var(--gold);
  transform-origin: left center;
  transform: translateX(var(--ink-x, 0)) scaleX(var(--ink-w, 0));
  opacity: var(--ink-o, 0);
  transition: transform var(--dur-normal) var(--spring-gentle), opacity var(--dur-fast);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--gold-wash);
  border: 1px solid rgb(180 154 98 / 0.35);
  color: var(--gold-hi);
  font: 500 0.8125rem/1 var(--font-body);
  white-space: nowrap;
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

@media (max-width: 920px) {
  .nav { display: none; }
  .badge { margin-left: auto; }
}
@media (max-width: 420px) {
  .brand__name { letter-spacing: 0.16em; }
  .badge { font-size: 0.75rem; padding: 6px 10px; }
}

/* --- sections ------------------------------------------------------------- */

.section { padding-block: var(--section) 0; }
main > .section:last-child { padding-bottom: var(--section); }
@media (max-width: 760px) {
  :root { --section: clamp(56px, 8vw, 64px); }
}
/*
 * Une section loin de l'écran n'est ni mise en page ni peinte avant d'en
 * approcher : la page fait treize écrans sur téléphone, et la calculer d'un bloc
 * prenait environ deux secondes de mise en page sur un téléphone moyen (mesuré).
 * « auto » retient la taille réelle une fois la section vue : le défilement ne
 * saute pas, et le texte reste trouvable par la recherche du navigateur.
 */
.section, .cta, .foot { content-visibility: auto; contain-intrinsic-size: auto 1000px; }
/* Un lien interne met en page, avant de défiler, les sections qui précèdent sa cible (header.js). */
.section__head { max-width: 46rem; margin-bottom: clamp(32px, 4vw, 56px); }
.section__title {
  margin: 0 0 22px;
  font: 600 clamp(2rem, 1.2rem + 3vw, 3.5rem)/1.08 var(--font-display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.section__lead { margin: 0; max-width: 40rem; color: var(--muted); font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem); }

/* --- tiroirs (détails animés) --------------------------------------------- */

details[data-accordion] summary { list-style: none; }
details[data-accordion] summary::-webkit-details-marker { display: none; }
/* La marge du dernier paragraphe reste dans le tiroir, au repos comme en mouvement : sinon la hauteur saute aux deux bouts de l'animation. */
details[data-accordion] .accordion__body { display: flow-root; }

/* --- système de mouvement -------------------------------------------------- */

/*
 * Apparitions. Le texte n'est caché que si un script peut le révéler ; s'il ne
 * vient jamais, une animation de secours le montre après trois secondes. Un
 * texte caché faute d'animation est pire qu'un texte qui apparaît sans elle.
 */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .reveal:not(.is-visible) { opacity: 0; transform: translateY(var(--dist-lg)); animation: failsafe 0.01s 3s forwards; }
  .js-ready .reveal:not(.is-visible) { animation: none; }
  .reveal {
    transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
    transition-delay: calc(var(--stagger, 0) * 60ms);
  }

  /* L'overline se trace avant son texte. */
  .reveal.overline::before { transition: transform var(--dur-slow) var(--ease) 0.1s; }
  .reveal.overline:not(.is-visible)::before { transform: scaleX(0); }

  /*
   * Titres découpés en mots : le titre ne bouge pas, ses mots montent d'un
   * masque, l'un après l'autre. Le découpage est fait par site.js ; sans lui,
   * le titre apparaît d'un bloc comme le reste.
   */
  .js-ready .reveal[data-split]:not(.is-visible) { opacity: 1; transform: none; }
  [data-split] .w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding: 0.1em 0.03em 0.16em;
    margin: -0.1em -0.03em -0.16em;
  }
  [data-split] .w__in {
    display: inline-block;
    transition: transform var(--dur-gentle) var(--spring-gentle), opacity var(--dur-normal) var(--ease);
    transition-delay: calc(var(--i, 0) * 38ms);
  }
  [data-split]:not(.is-visible) .w__in { transform: translateY(112%); opacity: 0; }

  /* Les icônes se dessinent. */
  .draw path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset calc(var(--dur-slow) * 1.6) var(--ease) 0.15s; }
  .is-visible .draw path { stroke-dashoffset: 0; }
  .is-visible .draw path + path { transition-delay: 0.45s; }
}
@keyframes failsafe { to { opacity: 1; transform: none; } }

.motion-toggle {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--ivory);
  background: var(--bg);
  font: inherit;
  cursor: pointer;
}
.motion-toggle:disabled { cursor: default; }
.motion-toggle[aria-pressed="true"]::before { content: "✓\a0"; content: "✓\a0" / ""; }
.reduce-motion { scroll-behavior: auto; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}
.reduce-motion .reveal { opacity: 1 !important; transform: none !important; }
.reduce-motion [data-split] .w__in { opacity: 1 !important; transform: none !important; }

/* Une boucle ne tourne que si on la voit : hors écran ou onglet caché, elle dort. */
[data-loop].is-paused,
.is-hidden [data-loop] { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
