/* ==========================================================================
   POLARIX — base
   Reset, primitives typographiques, boutons, grain, ciel de repli.
   Thème sombre verrouillé sur tout le site : le ciel est le sujet, il ne
   peut pas s'inverser section par section.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Le rail de déclinaison et la barre de nav ne doivent pas recouvrir la
     cible d'une ancre. */
  scroll-padding-top: calc(var(--nav-h) + 2rem);
}

body {
  margin: 0;
  background: var(--void);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: var(--t-md);
  font-weight: 300;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; }

::selection { background: var(--polaris); color: var(--void); }

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Typographie
   ========================================================================== */

/* Titrage. La chasse ouverte d'Archivo (wdth 112) donne aux titres l'allure
   d'une plaque gravée plutôt que d'une page web ; l'interlettrage négatif
   récupère l'espace que la chasse ajoute. */
.display {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 112;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
  color: var(--paper);
}

/* Emphase dans un titre : même famille, même chasse, poids et couleur
   changent. Aucune police étrangère injectée au milieu d'une ligne. */
.display b {
  font-weight: 600;
  color: var(--polaris);
}

/* Un titre coupé volontairement sur deux registres de graisse. */
.display i {
  font-style: normal;
  font-weight: 200;
  color: var(--muted);
}

.t-mega { font-size: var(--t-mega); }
.t-xxl  { font-size: var(--t-xxl); }
.t-xl   { font-size: var(--t-xl); }

.lede {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: var(--t-lg);
  line-height: 1.45;
  color: var(--paper);
  max-width: 34ch;
  text-wrap: pretty;
}

.body {
  color: var(--muted);
  max-width: 62ch;
  font-size: var(--t-md);
  line-height: 1.75;
  text-wrap: pretty;
}

/* Libellé technique. B612 Mono, chasse fixe : les indices, les prix et les
   coordonnées s'alignent verticalement sans effort. */
.tech {
  font-family: var(--font-tech);
  font-size: var(--t-micro);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ice);
}

.tech--warm { color: var(--polaris); }

/* Indice de section, gravé dans la marge. */
.index {
  font-family: var(--font-tech);
  font-size: var(--t-xs);
  color: var(--dim);
  letter-spacing: 0.08em;
}

/* ==========================================================================
   Boutons
   Forme pilule, contraste vérifié dans les deux variantes :
     .btn        fond ambre  #f2b75e / encre void #04060c  -> 11.4:1
     .btn--ghost encre paper #eef3fb sur fond void          -> 16.9:1
   ========================================================================== */

.btn {
  --btn-bg: var(--polaris);
  --btn-fg: var(--void);
  --btn-bd: var(--polaris);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  white-space: nowrap;
  padding: 0.95rem 1.9rem;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-tech);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: background var(--d-mid) var(--ease),
              color var(--d-mid) var(--ease),
              border-color var(--d-mid) var(--ease),
              transform var(--d-fast) var(--ease);
}

/* Balayage de lumière au survol : une seule passe, déclenchée par le
   pointeur, jamais en boucle. Elle dit « l'action est armée ». */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg,
              transparent 30%,
              rgba(255, 255, 255, 0.55) 50%,
              transparent 70%);
  transform: translateX(-120%);
  transition: transform var(--d-slow) var(--ease-io);
}

.btn:hover::before,
.btn:focus-visible::before { transform: translateX(120%); }

.btn:hover  { --btn-bg: #ffd08a; --btn-bd: #ffd08a; }
.btn:active { transform: scale(0.975); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--paper);
  --btn-bd: var(--line);
}
.btn--ghost:hover {
  --btn-bg: transparent;
  --btn-fg: var(--polaris);
  --btn-bd: var(--line-warm);
}
.btn--ghost::before { display: none; }

.btn__arrow {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
  transition: transform var(--d-mid) var(--ease);
}
.btn:hover .btn__arrow { transform: translate(3px, -3px); }

/* Lien souligné par un filet qui se rétracte puis se redéploie depuis
   l'autre bord : le retour d'état est immédiat et sans déplacement. */
.link {
  position: relative;
  color: var(--paper);
  padding-bottom: 2px;
}
.link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transition: transform var(--d-mid) var(--ease);
}
.link:hover { color: var(--polaris); }
.link:hover::after {
  transform: scaleX(0);
  transform-origin: right;
}

/* ==========================================================================
   Ciel de repli
   Le ciel WebGL (assets/js/sky.js) se pose par-dessus. Sans WebGL, sans
   JavaScript, ou sous prefers-reduced-motion, c'est ce dégradé qui reste :
   la page ne perd que le mouvement, jamais l'atmosphère.
   ========================================================================== */

.sky {
  position: fixed;
  inset: 0;
  z-index: var(--z-sky);
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 76% 8%,  rgba(29, 52, 104, 0.55), transparent 58%),
    radial-gradient(90% 70% at 12% 92%, rgba(16, 30, 66, 0.5),   transparent 62%),
    var(--void);
}

.sky canvas {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.6s var(--ease);
}
.sky canvas.is-lit { opacity: 1; }

/* Le contenu vit au-dessus du ciel. */
.page { position: relative; z-index: var(--z-page); }

/* ==========================================================================
   Grain
   Fixe, pointer-events:none, jamais sur un conteneur qui défile.
   ========================================================================== */

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-skip);
  background: var(--polaris);
  color: var(--void);
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-pill);
  font-family: var(--font-tech);
  font-size: var(--t-xs);
}
.skip:focus { left: 1rem; top: 1rem; }

/* ==========================================================================
   Révélations au défilement
   Un IntersectionObserver pose [data-reveal] -> .is-in. Sans JavaScript,
   la règle @supports du bloc no-js ci-dessous n'entre jamais en jeu et le
   contenu reste visible : rien n'est masqué par défaut pour un robot
   d'indexation ou un lecteur d'écran.
   ========================================================================== */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--d-slow) var(--ease),
              transform var(--d-slow) var(--ease);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Cascade : chaque enfant part avec --i * 70ms de retard. */
.js [data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--d-slow) var(--ease),
              transform var(--d-slow) var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js [data-reveal-stagger].is-in > * {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Mouvement réduit
   Tout ce qui bouge s'arrête. Les états finaux restent : rien ne disparaît.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js [data-reveal],
  .js [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
