/* Espace nonono — site public.
   Charte reprise de l'ancien site WordPress / Elementor : fond gris, étiquettes orange (texte noir) qui passent
   au bleu au survol, bandeau « nonono » manuscrit, Roboto. Jamais de capitales forcées. */

@font-face {
  font-family: "Roboto";
  src: url("../fonts/roboto-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("../fonts/roboto-italic-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --fond: #dbdbdb;
  --noir: #000;
  --orange: #ff3800;
  --bleu: #8cbee4;
  --creme: #ffecca;
  --e: 10px;                                   /* espacement de base */
  --bandeau: min(100vw - 20px, 960px);         /* largeur du bandeau « nonono » (titre) */
  --marche-menu: 22px;                         /* hauteur d'une marche de l'escalier des étiquettes */
  --taille-menu: 32px;
  /* hauteur de l'en-tête : marge, titre (proportions 1377 × 149), écart, étiquettes en escalier, marge */
  --haut-entete: calc(14px + var(--bandeau) * 0.108 + 8px + var(--taille-menu) + 2 * var(--marche-menu) + 14px);
  /* largeur des affiches qui se promènent : selon la largeur de l'écran, et jamais plus de la moitié de la hauteur libre */
  --taille-affiche: min(clamp(200px, 21vw, 330px), (100vh - var(--haut-entete)) * 0.36);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;                           /* jamais de défilement horizontal, même pendant un déplacement */
  background: var(--fond);
  color: var(--noir);
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 18px;                            /* une seule taille pour tout le texte, intertitres compris */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--orange); text-decoration: none; }
a:hover, a:focus-visible { color: var(--noir); text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: .15em; }
:focus-visible { outline: 3px solid var(--noir); outline-offset: 2px; }

.invisible {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.evitement {
  position: absolute;
  left: var(--e); top: -100px;
  z-index: 20;
  padding: var(--e);
  background: var(--noir);
  color: #fff;
}
.evitement:focus { top: var(--e); color: #fff; }


/* ---------- EN-TÊTE : le bandeau « nonono » (titre) en grand, les étiquettes en escalier dessous, calées à droite du titre ---------- */

.entete {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  height: var(--haut-entete);
  padding: 14px var(--e) 0;
  pointer-events: none;                       /* le texte reste cliquable sous les zones vides */
}
.entete a { pointer-events: auto; }
/* Le texte qui remonte s'efface doucement sous l'en-tête, au lieu de passer dessous */
.entete::before {
  content: "";
  position: absolute;
  inset: 0 0 -40px 0;
  background: linear-gradient(var(--fond) 0, var(--fond) calc(100% - 40px), rgb(219 219 219 / 0));
}

.bandeau {
  position: relative;
  z-index: 1;
  flex: none;
  width: var(--bandeau);
  margin: 0;
  font-size: 1em;
}
/* Le menu a la largeur du titre : ses étiquettes se calent sur son bord droit */
.entete nav { position: relative; z-index: 2; width: var(--bandeau); }
.bandeau a { display: block; }
.bandeau img { width: 100%; }
.bandeau a:hover img { filter: contrast(200%) hue-rotate(336deg); }

.menu {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  margin: 0; padding: 0;
  list-style: none;
}
.menu li { margin-top: calc(var(--marche) * var(--marche-menu)); }
.menu a {
  display: block;
  padding: 0 .04em;
  background: var(--orange);
  color: var(--noir);
  font-size: var(--taille-menu);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}
.menu a:hover, .menu a:focus-visible { background: var(--bleu); color: var(--noir); text-decoration: none; }
/* Rubrique en cours de lecture (site.js) */
.menu a[aria-current] { background: var(--bleu); }
/* Écran tactile : étiquettes plus faciles à toucher (36 px de haut environ) */
@media (pointer: coarse) {
  .menu a { padding: .18em .06em; }
}


/* ---------- AFFICHES : se promènent sur tout l'écran (site.js), par-dessus le texte qui s'écarte ---------- */

/* Toutes les affiches sont superposées dans un cadre aux proportions de la première : fondu enchaîné de l'une
   à l'autre (--fondu, calculé par site.js selon la vitesse). À chaque affiche, le cadre part à un autre endroit
   de l'écran (--x, --y) et l'affiche qui s'en va laisse une trace sur le fond, qui s'efface lentement. */
/* Zone de l'écran où passent les affiches : rien ne dépasse (pas de défilement horizontal quand une affiche
   sort à droite, même sur iPhone) */
.affiches-zone {
  position: fixed;
  inset: 0;
  z-index: 5;                                 /* au-dessus du texte, sous l'en-tête */
  overflow: hidden;
  pointer-events: none;
}
.affiches {
  position: absolute;
  top: 0; left: 0;
  width: var(--taille-affiche);
  pointer-events: auto;
  margin: 0;
  transform: translate(var(--x, var(--e)), var(--y, calc(var(--haut-entete) + var(--e) * 2)));
}
.affiches-cadre { position: relative; aspect-ratio: var(--format, 1 / 1.414); cursor: pointer; }
.affiches-cadre img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top left;
  opacity: 0;
  transition: opacity var(--fondu, .6s) ease-in-out;
}
.affiches-cadre img.visible { opacity: 1; }
.affiches-pause:not(:focus-visible) {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.affiches-pause {
  margin-top: var(--e);
  padding: 4px 6px;
  border: 0;
  background: var(--orange);
  color: var(--noir);
  font: inherit;
}

/* Traces : sur le fond de l'écran, derrière le texte */
.affiches-traces { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.trace {
  position: absolute;
  top: 0; left: 0;
  width: var(--taille-affiche);
  height: auto;
  mix-blend-mode: multiply;
  filter: grayscale(1) contrast(.85);
  animation: reminiscence var(--memoire, 60s) cubic-bezier(.2, 0, .4, 1) forwards;
}
@keyframes reminiscence {
  from { opacity: .42; }
  to   { opacity: 0; }
}


/* ---------- RUBRIQUES : en escalier, chacune sur 5 colonnes de 12 ---------- */

.grille {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: calc(var(--e) * 2);
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(var(--haut-entete) + var(--e)) var(--e) 30vh;
}

.rubrique {
  position: relative;
  z-index: 1;                                 /* au-dessus des traces */
  grid-column: var(--debut) / span 5;
  grid-row: var(--rang);
  margin-top: 15vh;
  scroll-margin-top: calc(var(--haut-entete) + var(--e) * 2);
}
.rubrique:first-of-type { margin-top: 40vh; }

/* Chaque paragraphe s'écarte de l'affiche qui passe (site.js règle « translate ») */
.rubrique > * { transition: translate .6s cubic-bezier(.3, .6, .2, 1); }

.rubrique p { margin: 0 0 1em; }
.rubrique p, .rubrique li { text-wrap: pretty; }

/* Apparition douce des paragraphes qui arrivent à l'écran (site.js ; seulement ceux encore hors de l'écran au chargement) */
.a-venir { opacity: 0; transform: translateY(14px); }
.apparu { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1), translate .6s cubic-bezier(.3, .6, .2, 1); }
.rubrique h3 {
  margin: 1.5em 0 0;
  font-size: 1em;
  font-weight: 700;
  line-height: inherit;
}
.rubrique h3:first-of-type { margin-top: 0; }
.rubrique ul, .rubrique ol { margin: 0 0 1em; padding-left: 1.2em; }
.rubrique strong { font-weight: 700; }


/* ---------- TABLETTE : rubriques plus larges, escalier plus serré ---------- */

@media (max-width: 899px) {
  :root {
    --bandeau: calc(100vw - 40px);
    --taille-menu: 26px;
    --marche-menu: 18px;
    --haut-entete: calc(10px + var(--bandeau) * 0.108 + 10px + var(--taille-menu) + 2 * var(--marche-menu) + 10px);
    --taille-affiche: min(clamp(170px, 30vw, 260px), (100vh - var(--haut-entete)) * 0.36);
  }
  /* Le titre prend toute la largeur (sinon il rétrécit pour laisser la place au menu), les étiquettes dessous */
  .entete {
    position: sticky;
    top: 0;
    flex-direction: column;
    gap: 10px;
    height: auto;
    padding: 10px 20px;
    background: var(--fond);
    pointer-events: auto;
  }
  .entete::before { display: none; }
  .grille { padding-top: var(--e); }
  .rubrique { grid-column: var(--debut-tablette) / span 8; margin-top: 12vh; }
  .rubrique:first-of-type { margin-top: 40vh; }
}


/* ---------- ÉCRAN BAS ET ÉTROIT (téléphone à l'horizontale) : titre et menu sur une ligne, en-tête qui défile ---------- */

@media (max-width: 899px) and (max-height: 500px) {
  :root {
    --bandeau: 55vw;
    --taille-menu: 22px;
    --marche-menu: 12px;
    --haut-entete: 120px;
    --taille-affiche: min(30vw, (100vh - var(--haut-entete)) * 0.55);
  }
  .entete { position: relative; }
  .rubrique:first-of-type { margin-top: 60vh; }
}


/* ---------- TÉLÉPHONE : bandeau sur toute la largeur, étiquettes dessous ---------- */

@media (max-width: 599px) {
  :root {
    --bandeau: calc(100vw - 32px);
    --taille-menu: 22px;
    --marche-menu: 9px;
    --haut-entete: 120px;
    --taille-affiche: min(40vw, (100vh - var(--haut-entete)) * 0.36);
  }
  .entete {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    height: auto;
    padding: 10px 16px 8px;
    background: var(--fond);
    pointer-events: auto;
    transition: transform .35s ease;
  }
  .entete::before { display: none; }
  /* En descendant, l'en-tête se range pour laisser la place au texte ; il revient dès qu'on remonte (site.js) */
  .entete.rangee { transform: translateY(calc(-100% - 2px)); }
  .menu a { padding: .15em .08em; }

  .grille { display: block; padding: 0 16px 20vh; }
  /* Téléphone : l'affiche passe sous le texte, qui ne bouge pas (pas de place pour s'écarter) ; traces plus légères */
  .affiches-zone { z-index: 0; }
  .affiches { pointer-events: none; }
  .affiches-cadre img.visible { opacity: .6; }
  .trace { mix-blend-mode: normal; filter: grayscale(1); }
  @keyframes reminiscence { from { opacity: .3; } to { opacity: 0; } }
  .rubrique { margin-top: 56px; scroll-margin-top: 130px; }
  .rubrique:first-of-type { margin-top: 45vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .a-venir { opacity: 1; transform: none; }
  .trace { display: none; }
}


/* ---------- PAGE INTROUVABLE ---------- */

.introuvable { max-width: 810px; padding: 58px 16px; }
.introuvable h1 { margin: 40px 0 10px; font-size: 1em; font-weight: 700; }
