/* ==========================================================================
   Base : remise à zéro, typographie, états d'accessibilité, utilitaires.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  background: var(--acier);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: var(--lh-text);
  letter-spacing: var(--track-text);
  font-kerning: normal;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
p, li, figcaption, dd { text-wrap: pretty; overflow-wrap: break-word; }
h1, h2, h3, h4 { font-weight: 800; line-height: var(--lh-head); letter-spacing: var(--track-head); text-wrap: balance; }
strong, b { font-weight: 700; }
abbr[title] { text-decoration: none; }
:where(table) { font-variant-numeric: tabular-nums; }

::selection { background: var(--incandescent); color: var(--acier); }

/* Focus visible : un anneau franc, jamais retiré. */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 4px;
}
[data-field="incandescent"] :focus-visible { outline-color: var(--acier); }

/* Lien d'évitement vers le contenu. */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: calc(var(--z-preloader) + 1);
  padding: 0.75rem 1.1rem;
  background: var(--incandescent);
  color: var(--acier);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform var(--t-ui) var(--ease-out);
}
.skip-link:focus-visible { transform: none; outline-color: var(--craie); }

/* Masqué visuellement, lu par les lecteurs d'écran. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Typographie courante */
.text-lead { font-size: var(--step-lead); line-height: 1.32; letter-spacing: -0.015em; font-weight: 500; }
.text-small { font-size: var(--step-small); line-height: 1.45; }
.muted { color: var(--muted); }
.accent-text { color: var(--accent-text); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.title-head {
  font-size: var(--step-head);
  line-height: 0.98;
  letter-spacing: var(--track-head);
  font-weight: 800;
}

/* Liens de texte : soulignement qui apparaît au survol. */
.link {
  text-decoration: underline;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease;
}
@media (hover: hover) and (pointer: fine) {
  .link:hover { text-decoration-color: currentColor; }
}

/* Contenu provisoire à compléter par Amaury : visible exprès. */
.todo {
  background: color-mix(in srgb, var(--incandescent) 22%, transparent);
  color: var(--ink);
  padding: 0.05em 0.3em;
  font-style: normal;
  font-weight: 600;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
[data-field="incandescent"] .todo { background: color-mix(in srgb, var(--acier) 16%, transparent); }

/* Médias : coins carrés, jamais d'étirement. */
.cover { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Apparitions (le contenu reste visible sans JavaScript : tout passe par html.js)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 26px, 0);
    transition: opacity 700ms var(--ease-out), transform var(--t-reveal) var(--ease-out);
    transition-delay: calc(var(--i, 0) * 80ms);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }

  /* Rideau : une image s'ouvre depuis le bas en se posant. */
  .js [data-reveal="shutter"] {
    opacity: 1;
    transform: none;
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1100ms var(--ease-in-out);
  }
  .js [data-reveal="shutter"] > * { transform: scale(1.1); transition: transform 1500ms var(--ease-soft); }
  .js [data-reveal="shutter"].is-in { clip-path: inset(0); }
  .js [data-reveal="shutter"].is-in > * { transform: none; }

  /* Titres découpés en mots (js/modules/split.js) : chaque mot monte depuis sa ligne de base. */
  /* Le masque déborde un peu de la ligne : avec un interlignage serré, accents et jambages restent entiers. */
  .js [data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.16em 0.04em 0.14em; margin: -0.16em -0.04em -0.14em; }
  .js [data-split] .w > span { display: inline-block; transform: translate3d(0, 108%, 0); transition: transform 950ms var(--ease-out); transition-delay: calc(var(--w, 0) * 55ms + var(--d, 0ms)); }
  .js [data-split].is-in .w > span { transform: none; }
}

/* ==========================================================================
   Filet de sécurité : si les scripts ne démarrent pas (html.js sans html.amo-ok, posé par
   js/main.js dès son lancement), rien ne reste caché. Au bout de 4 s, les éléments en attente
   d'apparition s'affichent et le préchargement s'efface. Sans effet quand tout fonctionne.
   ========================================================================== */
@keyframes amo-failsafe { to { opacity: 1; transform: none; clip-path: inset(0); } }
@keyframes amo-failsafe-out { to { opacity: 0; visibility: hidden; } }
html.js:not(.amo-ok) [data-reveal],
html.js:not(.amo-ok) [data-reveal="shutter"] > *,
html.js:not(.amo-ok) [data-rise],
html.js:not(.amo-ok) .macbook[data-lid],
html.js:not(.amo-ok) .macbook[data-lid] .macbook__lid { animation: amo-failsafe 0.6s ease 4s forwards; }
html.js.preload:not(.amo-ok) .preloader { animation: amo-failsafe-out 0.5s ease 4s forwards; }
