/* dev.zelhay-host.fr : récit défilant, charte de zelhay-host.fr en sombre (D-20261120-2) */
@font-face {
  font-family: "Outfit";
  src: url("/polices/Outfit-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
:root {
  --bg: #1B2A41;
  --surface: #243349;
  --fg: #F5F3EE;
  --fg-muted: #CCCDCF;
  --line: rgba(245, 243, 238, 0.10);
  --accent: #F28C28;
  --accent-strong: #FE9F4C;
  --grid-line: rgba(245, 243, 238, 0.045);
  --glow: 0 0 14px rgba(242, 140, 40, 0.55);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --titre: "Outfit", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--fg);
  font: 400 1.0625rem/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2 { font-family: var(--titre); font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; margin: 0 0 0.6em; }
h1 { font-size: clamp(2.1rem, 5.6vw, 4.4rem); line-height: 1.06; max-width: 16ch; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.9rem); line-height: 1.1; }
p { margin: 0 0 1em; text-wrap: pretty; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evitement { position: absolute; left: 1rem; top: -4rem; z-index: 30; background: var(--accent); color: var(--bg); padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600; }
.evitement:focus { top: 1rem; }

/* En-tête : logo et chapitre en cours */
.tete {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(0.9rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 2.5rem) 1.4rem;
  background: linear-gradient(rgba(27, 42, 65, 0.92), rgba(27, 42, 65, 0));
  pointer-events: none;
}
.tete a { pointer-events: auto; }
.tete-logo { flex-shrink: 0; }
.tete-logo img { height: 28px; width: auto; }
.tete-ch { margin: 0; min-width: 0; font: 500 0.8125rem/1 var(--mono); color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599px) { .tete-logo img { height: 24px; } }
#ch-num { color: var(--accent); }

/* Barre de progression (téléphone) et fil des chapitres (ordinateur) */
.barre { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 25; }
.barre span { display: block; height: 100%; background: var(--accent); box-shadow: var(--glow); transform-origin: 0 50%; transform: scaleX(0); }
.fil { display: none; }

/* Ouverture */
/* Le texte occupe le ciel vide, la fenêtre allumée reste visible en bas */
.ouv { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: flex-start; overflow: hidden; }
.ouv-img { position: absolute; inset: 0; margin: 0; }
.ouv-img picture { display: block; height: 100%; }
.ouv-img img { width: 100%; height: 100%; object-fit: cover; object-position: 27% 60%; }
@media (max-width: 899px) and (orientation: portrait) { .ouv-img img { object-position: 50% 55%; } }
.ouv-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(27, 42, 65, 0.55) 0%, rgba(27, 42, 65, 0) 50%, rgba(27, 42, 65, 0) 85%, var(--bg) 100%); }
.ouv-txt { position: relative; z-index: 1; padding: max(6rem, 16vh) clamp(1.25rem, 6vw, 6rem) 3rem; max-width: 52rem; }
.ouv-txt > p { color: var(--fg-muted); max-width: 36rem; font-size: 1.125rem; }
.ouv-suite { margin-top: 2rem; }
.ouv-suite a { display: inline-flex; align-items: center; gap: 0.75rem; font: 500 0.875rem/1 var(--mono); color: var(--fg); text-decoration: none; }
.chevron { position: relative; width: 14px; height: 22px; }
.chevron::before, .chevron::after {
  content: ""; position: absolute; left: 2px; width: 9px; height: 9px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(45deg); filter: drop-shadow(0 0 4px rgba(242, 140, 40, 0.8));
}
.chevron::before { top: 0; }
.chevron::after { top: 7px; }

/* Chapitres : image collante, texte qui défile par-dessus */
.ch { position: relative; }
.ch-img { position: sticky; top: 0; height: 100vh; height: 100svh; margin: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 14%, #000 86%, transparent 100%); }
.ch-img img { width: 100%; height: 100%; object-fit: cover; transform: scale(var(--z, 1)); will-change: transform; }
.ch-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(27, 42, 65, 0.9) 0%, rgba(27, 42, 65, 0.6) 38%, rgba(27, 42, 65, 0) 68%); }
.ch-txt { position: relative; z-index: 1; width: min(34rem, 88vw); margin: -62vh 0 0 clamp(5.5rem, 10vw, 10rem); padding-bottom: 55vh; text-shadow: 0 1px 14px rgba(27, 42, 65, 0.9); }
.ch-txt p { max-width: 62ch; }
.ch-num { font: 500 0.875rem/1 var(--mono); color: var(--accent); margin-bottom: 1rem; text-shadow: var(--glow); }
.ch-txt a:not(.btn) { color: var(--accent); text-underline-offset: 3px; }
.ch-fin .ch-txt { padding-bottom: 40vh; }
.liste { margin: 0 0 1.2em; padding-left: 1.1rem; }
.liste li { margin-bottom: 0.35em; padding-left: 0.3rem; }
.liste li::marker { content: "›"; color: var(--accent); font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem; }
.btn {
  display: inline-block; background: var(--accent); color: var(--bg); text-shadow: none;
  font-weight: 700; padding: 0.85rem 1.4rem; border-radius: 10px; text-decoration: none;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.4);
  transition: box-shadow 200ms ease, transform 120ms ease, background 200ms ease;
}
.btn:hover { background: var(--accent-strong); box-shadow: 0 10px 36px -6px var(--accent); transform: translateY(-2px); }
.ch-txt .lien { color: var(--fg); }

/* Pied */
.pied { border-top: 1px solid var(--line); padding: 2.5rem clamp(1.25rem, 6vw, 6rem) 3rem; color: var(--fg-muted); font-size: 0.9375rem; background: var(--bg); }
.pied img { height: 26px; width: auto; margin-bottom: 1rem; }
.pied a { margin-right: 1.25rem; text-underline-offset: 3px; }
.pied p { margin: 0 0 0.5rem; }

/* Ordinateur : fil des chapitres à gauche */
@media (min-width: 900px) {
  .barre { display: none; }
  .fil { display: block; position: fixed; left: clamp(1.25rem, 2.5vw, 2.5rem); top: 50%; transform: translateY(-50%); height: 56vh; z-index: 20; }
  .fil-trait { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; background: var(--line); }
  .fil-trait span { display: block; height: 100%; background: var(--accent); box-shadow: var(--glow); transform-origin: 50% 0; transform: scaleY(0); }
  .fil ol { position: relative; list-style: none; margin: 0; padding: 0; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
  .fil a { display: block; width: 24px; height: 24px; position: relative; }
  .fil a::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1px solid rgba(245, 243, 238, 0.45); background: var(--bg); transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease; }
  .fil a:hover::before { border-color: var(--accent); }
  .fil a[aria-current="true"]::before { background: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }
}

/* Téléphone : image puis texte, sans image collante */
@media (max-width: 899px) {
  .ch-img { position: relative; height: auto; aspect-ratio: 16 / 9;
    -webkit-mask-image: linear-gradient(#000 70%, transparent 100%); mask-image: linear-gradient(#000 70%, transparent 100%); }
  .ch-img::after { display: none; }
  .ch-img img { transform: none; will-change: auto; }
  .ch-txt { width: auto; margin: -1.5rem 0 0; padding: 0 1.25rem 3.5rem; text-shadow: none; }
  .ch-fin .ch-txt { padding-bottom: 4rem; }
  .ch + .ch { margin-top: 1rem; }
}

/* Révélation au défilement, seulement si le mouvement est accepté */
@media (prefers-reduced-motion: no-preference) {
  .js .rv { opacity: 0; transform: translateY(14px); transition: opacity 700ms ease, transform 700ms ease; }
  .js .rv.vu { opacity: 1; transform: none; }
  .chevron { animation: descend 2.4s ease-in-out infinite; }
  @keyframes descend { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .fil a::before { transition: none; }
  .btn:hover { transform: none; }
}
