/* Base commune des cinq pages. Chargée après `tokens.css` et `polices.css`,
   avant le CSS propre à chaque page.

   Fichier gelé après la fondation : une page qui a besoin d'une règle la
   met dans SON fichier (`accueil.css`, `offres.css`…). Une règle partagée
   qui manque se demande, elle ne se recopie pas d'une page à l'autre.

   La DA est celle de l'app (« Noir Lunaire ») : couleurs par jetons
   uniquement, ni dégradé, ni lueur, ni flou, ni ombre de texte. Les zones se
   séparent par paliers de noir, pas par des cadres. `check-css` tient ces
   interdits. */

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

html {
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* L'en-tête collant masquerait le haut d'une ancre (`/#outils`). Il tient
     sur deux lignes à 375 px (~79 px) : 72 px coupait le titre visé. */
  scroll-padding-top: 88px;
}

/* `.btn { display: inline-flex }` et ses cousins l'emportaient sur l'attribut
   `hidden` : un bouton de paquet Linux sans fichier restait affiché. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 15px/1.55 var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Un `<pre>` large ou un long mot ne doit jamais faire défiler la page de
     côté : c'est au bloc fautif de se tenir, pas au corps de le masquer. */
  overflow-wrap: break-word;
}

main {
  flex: 1 0 auto;
}

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

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote,
pre {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* ── Typographie ───────────────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h1 {
  font-family: var(--display);
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 650;
  letter-spacing: -0.02em;
}

h2 {
  font-family: var(--display);
  font-size: clamp(22px, 3.2vw, 30px);
}

h3 {
  font-size: 17px;
}

p {
  text-wrap: pretty;
}

/* Données, chemins, commandes : en mono, comme dans l'app. */
code,
kbd,
pre,
samp {
  font-family: var(--mono);
  font-size: 0.92em;
}

pre {
  /* Un dessin ASCII ne se replie pas : il défile dans sa propre boîte. */
  overflow-x: auto;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms var(--ease);
}

a:hover {
  text-decoration-color: var(--text);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* Un seul anneau de focus, partout, visible au clavier seulement. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Utilitaires ───────────────────────────────────────────────────── */
.mono {
  font-family: var(--mono);
}

.tabulaire {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* La colonne de contenu : 16 px de gouttière sur mobile, 1120 px au plus. */
.page {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

/* Lien d'évitement : invisible jusqu'au premier Tab. */
.sauter {
  position: absolute;
  top: 8px;
  left: 16px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-200%);
}

.sauter:focus-visible {
  transform: none;
}

/* ── En-tête ───────────────────────────────────────────────────────────
   Identique octet pour octet sur toutes les pages (`check-html`) : seul
   `aria-current="page"` change. Fond plein, aucun flou : il passe au-dessus
   du contenu, il ne le laisse pas transparaître. */
.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 14px;
  padding-inline: max(16px, (100% - 1120px) / 2);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  view-transition-name: site-head;
}

.site-head-marque {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-head-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 14px;
}

.site-head-nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 150ms var(--ease);
}

.site-head-nav a:hover,
.site-head-nav a[aria-current="page"] {
  color: var(--text);
}

.site-head-nav a[aria-current="page"] {
  text-decoration-line: underline;
  text-decoration-color: var(--text-dim);
}

/* ── Horizon ───────────────────────────────────────────────────────────
   Un seul filet pleine largeur en haut de chaque page : le seuil qu'on
   franchit. Pas un cadre, une ligne d'horizon : elle se tient à distance
   de l'en-tête, sinon les deux filets se lisent comme un seul trait épais. */
.horizon {
  display: block;
  height: 0;
  margin: clamp(28px, 5vw, 56px) 0 clamp(28px, 5vw, 48px);
  border: 0;
  border-top: 1px solid var(--border-strong);
}

/* ── Boutons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 150ms var(--ease),
    border-color 150ms var(--ease),
    color 150ms var(--ease);
}

.btn:hover {
  background: var(--surface-2);
}

/* L'action principale : blanc lunaire, texte quasi noir, comme dans l'app.
   Une seule par écran. */
.btn-primaire {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primaire:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-secondaire {
  background: var(--surface);
}

.btn-secondaire:hover {
  background: var(--surface-2);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn[aria-busy="true"] {
  cursor: progress;
}

/* ── Page de manuel ────────────────────────────────────────────────────
   NOM / SYNOPSIS / DESCRIPTION / LIMITES / FICHIERS / VOIR AUSSI, comme une
   page `man` : titre en petites capitales mono, corps indenté. */
.manuel {
  display: grid;
  gap: 36px;
}

.manuel-section {
  display: grid;
  gap: 12px;
}

.manuel-titre {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.manuel-corps {
  display: grid;
  gap: 12px;
  max-width: 72ch;
  padding-inline-start: clamp(16px, 6vw, 64px);
  color: var(--text-muted);
}

.manuel-corps strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Planche ───────────────────────────────────────────────────────────
   Une planche d'encyclopédie par catégorie : la figure d'un côté, la
   légende numérotée de l'autre, et le côté alterne d'une planche à la
   suivante. Sous 720 px, tout s'empile. */
.planche {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas:
    "tete tete"
    "figure legende";
  gap: 20px 48px;
  align-items: start;
  padding-block: 40px;
}

.planche:nth-of-type(even) {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas:
    "tete tete"
    "legende figure";
}

.planche-tete {
  grid-area: tete;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.planche-tete .mono {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.planche-figure {
  grid-area: figure;
  margin: 0;
  color: var(--text-dim);
}

.planche-figure pre {
  font-size: 13px;
  line-height: 1.15;
}

.planche-legende {
  grid-area: legende;
  list-style: none;
  padding: 0;
}

.planche-total {
  padding-block: 24px 48px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
}

.planche-total data {
  color: var(--text);
}

@media (max-width: 720px) {
  .planche,
  .planche:nth-of-type(even) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "tete"
      "figure"
      "legende";
  }
}

/* ── Un outil dans la légende ──────────────────────────────────────────
   Aucun texte sous 14 px en --text-dim (contraste) : `check-css` le tient.
   `num | contenu`. Au survol, seul le numéro s'allume : pas de fond, pas de
   déplacement, rien d'autre. La limite reste toujours visible — c'est elle
   qui rend la planche honnête. */
.outil {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 2px;
  padding-block: 12px;
  border-top: 1px solid var(--hairline);
}

.outil > * {
  grid-column: 2;
}

.outil-num {
  grid-column: 1;
  grid-row: 1 / span 4;
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
  text-align: right;
  color: var(--text-muted);
  transition: color 150ms var(--ease);
}

.outil:hover .outil-num,
.outil:focus-within .outil-num {
  color: var(--text);
}

.outil-nom {
  font-weight: 560;
  color: var(--text);
}

.outil-desc {
  font-size: 14px;
  color: var(--text-muted);
}

.outil-limites {
  font-size: 13px;
  color: var(--text-muted);
}

.outil-plateforme {
  justify-self: start;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Pied de page (colophon) ───────────────────────────────────────── */
.site-foot {
  margin-top: 64px;
  padding-block: 28px 36px;
  padding-inline: max(16px, (100% - 1120px) / 2);
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 32px;
}

.site-foot dl,
.site-foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding: 0;
  list-style: none;
}

.site-foot dl > div {
  display: flex;
  gap: 8px;
}

/* Le pied entier est en --text-muted (un texte de 12 px en --text-dim ne se
   lit pas) : les valeurs et les liens montent donc d'un cran. */
.site-foot dd {
  color: var(--text);
}

.site-foot a {
  color: var(--text);
}

/* ── Région d'annonces ─────────────────────────────────────────────────
   Lue par les lecteurs d'écran (« copié », « 7 outils affichés »), jamais
   vue. */
#annonces {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Ascenseurs, comme dans l'app ──────────────────────────────────────
   Pas de `scrollbar-width` ni de `scrollbar-color` : Chrome ignore ce bloc
   dès qu'une des deux est déclarée. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Transitions entre pages ───────────────────────────────────────────
   Un fondu court d'une page à l'autre, l'en-tête reste en place. Firefox
   l'ignore : la navigation y reste instantanée, ce qui est un repli
   acceptable. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 160ms;
  animation-timing-function: var(--ease);
}

/* ── Mouvement réduit : tout s'arrête ──────────────────────────────────
   Pas d'exception par page : un réglage système se respecte partout. */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

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