/* pot-au-noir.fr : socle commun. Jetons, thèmes, marque, pictogrammes.
   Les feuilles de page (landing.css, carte.css, article.css, design.css,
   admin.css) ne redéfinissent aucune couleur : elles lisent ces variables. */

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

:root {
  /* Les deux palettes, nommées une fois. Tout le reste (thème de la page,
     thème imposé par un article, aperçu de l'éditeur) lit ces six valeurs.
     Nuit : noir mat et chaud, pas le noir profond des maquettes (#080807),
     qui brille sur un écran. */
  --night-bg: #131311;
  --night-ink: #f1ece1;
  --night-accent: #e3a23c;
  --night-teal: #2f9e9e;
  --day-bg: #f2ede2;
  --day-ink: #14110d;
  --day-accent: #b06d14;
  --day-teal: #17605f;

  --bg: var(--night-bg);
  --ink: var(--night-ink);
  --accent: var(--night-accent);
  --btn-ink: #14110d;
  --danger: #e2705a;
  --ok: #7fb58a;

  /* Trois familles, pas une de plus. Marque : Fraunces (100 en grand, 400 en
     petit). Titres : Lora 400. Texte et interface : Lexend 300. Le chasse-fixe
     ne sert qu'au code et à la zone markdown de l'éditeur, sans police web. */
  --f-brand: "Fraunces", Georgia, serif;
  --f-title: "Lora", Georgia, serif;
  --f-text: "Lexend", system-ui, sans-serif;
  /* les petites lignes en capitales (surtitres, signatures, genres, outils) :
     la police des titres, en capitales espacées, et non plus Lexend */
  --f-label: var(--f-title);
  --f-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --w-brand: 400;
  --w-brand-large: 400;
  --w-title: 400;
  --w-text: 300;
  --w-label: 400;
  --w-strong: 500;

  --mx: clamp(24px, 7vw, 96px);
  --fade: 0.3s;

  /* traits et surfaces dérivés de l'encre : ils suivent le thème seuls */
  --rule: color-mix(in srgb, var(--ink) 14%, transparent);
  --rule-strong: color-mix(in srgb, var(--ink) 26%, transparent);
  --surface: color-mix(in srgb, var(--ink) 4%, var(--bg));
  --muted: color-mix(in srgb, var(--ink) 55%, transparent);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: var(--day-bg);
  --ink: var(--day-ink);
  --accent: var(--day-accent);
  --btn-ink: #f7f2e7;
  --danger: #a8371f;
  --ok: #2f6b3d;
  color-scheme: light;
}

[data-accent="teal"] {
  --accent: var(--night-teal);
}
:root[data-theme="light"] [data-accent="teal"],
:root[data-theme="light"][data-accent="teal"] {
  --accent: var(--day-teal);
}

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

body {
  margin: 0;
  font-family: var(--f-text);
  font-weight: var(--w-text);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  transition:
    background var(--fade),
    color var(--fade);
}

a {
  color: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* le mot-symbole : toujours en Fraunces, c'est le logo. Regular partout
   (le Thin 100 en manchette a été jugé trop fin). --w-brand-large reste un
   jeton à part pour pouvoir régler la manchette seule. */
.wm {
  font-family: var(--f-brand);
  font-weight: var(--w-brand);
  letter-spacing: -0.01em;
}
.wm .fr {
  opacity: 0.45;
}
.wm--large {
  font-weight: var(--w-brand-large);
  letter-spacing: -0.02em;
}

strong,
b {
  font-weight: var(--w-strong);
}
button,
input,
select,
textarea {
  font-family: inherit;
  font-weight: inherit;
}

/* la marque : mark.js pose un svg dans tout élément [data-mark] */
[data-mark] {
  display: block;
  color: inherit;
}
[data-mark] svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* pictogrammes fixes des coins (jour / nuit, son, menu) */
.corner {
  position: fixed;
  top: 22px;
  z-index: 4;
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  /* un léger contour et un voile du fond : lisibles en nuit comme en jour,
     et par-dessus les isobathes ; jamais à pleine opacité au repos */
  box-sizing: border-box;
  min-width: 38px;
  height: 38px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  opacity: 0.8;
  transition: opacity 0.2s;
}
.corner:hover,
.corner[aria-expanded="true"] {
  opacity: 1;
}
.corner svg {
  width: 22px;
  height: 22px;
  display: block;
}
.corner--right {
  right: 26px;
}
.corner--right2 {
  right: 68px;
}
.corner--left {
  left: 26px;
}

/* le bouton "Aa" (pages/_police.html) : juste à gauche du pictogramme jour / nuit */
.corner--police {
  right: 68px;
  font-family: var(--f-title);
  font-size: 17px;
  line-height: 22px;
  min-width: 38px;
  text-align: center;
}
/* sur les pages de lecture les pictogrammes défilent avec la page */
body:has(.art-corner) .corner--police {
  position: absolute;
}
.corner--police[hidden] {
  display: none;
}
/* la taille du texte d'un article (pages/_taille.html) : "A−" et "A+", à
   gauche de "Aa". Comme lui, ils défilent avec la page. */
.corner--moins,
.corner--plus {
  position: absolute;
  font-family: var(--f-title);
  line-height: 22px;
  min-width: 38px;
  text-align: center;
  white-space: nowrap;
  touch-action: manipulation;
}
.corner--moins {
  right: 152px;
  font-size: 14.5px;
}
.corner--plus {
  right: 110px;
  font-size: 18.5px;
}
.corner--moins:disabled,
.corner--plus:disabled {
  opacity: 0.25;
  cursor: default;
}
:root:not(.js) .corner-taille {
  display: none;
}
/* "1er" dans une date : l'exposant reste en bas de casse dans une ligne en capitales */
.er {
  font-size: 0.82em;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: 0.32em;
  line-height: 0;
}
/* avec le son : son, "Aa", jour / nuit, de gauche à droite */
body:has(.corner--police:not([hidden])) #sound.corner {
  right: 114px;
}
:root[data-police] .corner--police {
  opacity: 1;
  color: var(--accent);
}
.police-etat {
  position: fixed;
  top: 64px;
  right: 26px;
  z-index: 4;
  font-family: var(--f-text);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  padding: 5px 10px;
  pointer-events: none;
}
.police-etat:empty {
  display: none;
}

/* les deux polices de remplacement : mêmes rôles, une seule famille, et une
   graisse normale là où Lexend est en maigre */
@font-face {
  font-family: "OpenDyslexic";
  src: url("/static/site/polices/opendyslexic-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("/static/site/polices/opendyslexic-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root[data-police="lisible"] {
  --f-title: "Atkinson Hyperlegible", Verdana, sans-serif;
  --f-text: "Atkinson Hyperlegible", Verdana, sans-serif;
  --w-text: 400;
  --w-label: 400;
  --w-strong: 700;
}
:root[data-police="dys"] {
  --f-title: "OpenDyslexic", Verdana, sans-serif;
  --f-text: "OpenDyslexic", Verdana, sans-serif;
  --w-text: 400;
  --w-label: 400;
  --w-strong: 700;
}

/* le bouton son (pages/_son.html) : un seul des deux pictogrammes selon l'état */
#sound[aria-pressed="true"] .ico-off,
#sound[aria-pressed="false"] .ico-on {
  display: none;
}

/* lune (classe ico-storm) et soleil : un seul des deux est affiché selon le thème */
:root[data-theme="dark"] .theme-toggle .ico-storm,
:root:not([data-theme="light"]) .theme-toggle .ico-storm {
  display: none;
}
:root[data-theme="light"] .theme-toggle .ico-sun {
  display: none;
}
/* sans JavaScript le bouton ne ferait rien */
:root:not(.js) .theme-toggle {
  display: none;
}

/* en-tête commun des pages de lecture (carnets, design) */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 22px 24px 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}
.brand .wm {
  font-size: 19px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-kicker {
  margin-left: auto;
  font-family: var(--f-text);
  font-weight: var(--w-label);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  opacity: 0.5;
  text-decoration: none;
  transition: opacity 0.2s;
}
a.brand-kicker:hover {
  opacity: 1;
}
.brand .theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.55;
  padding: 6px;
  margin-left: 6px;
  transition: opacity 0.2s;
}
.brand .theme-toggle:hover {
  opacity: 1;
}
.brand .theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* fond de carte marine (isobathes.js), fixe derrière la page */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}
.bg svg {
  width: 100%;
  height: 100%;
  display: block;
}
.iso-ink {
  stroke: var(--ink);
}
.iso-accent {
  stroke: var(--accent);
}
.iso-fill-ink {
  fill: var(--ink);
}
.iso-fill-accent {
  fill: var(--accent);
}
.iso-cache {
  fill: none;
  stroke: var(--bg);
}
.bg svg * {
  transition:
    fill var(--fade),
    stroke var(--fade);
}

@media (max-width: 719px) {
  .corner {
    top: 14px;
  }
  .corner--right {
    right: 14px;
  }
  .corner--right2 {
    right: 56px;
  }
  .corner--police {
    right: 56px;
  }
  .corner--moins {
    right: 140px;
  }
  .corner--plus {
    right: 98px;
  }
  body:has(.corner--police:not([hidden])) #sound.corner {
    right: 98px;
  }
  .police-etat {
    top: 54px;
    right: 14px;
  }
  .corner--left {
    left: 14px;
  }
}
@media (max-width: 760px) {
  .brand-kicker {
    display: none;
  }
  .brand .theme-toggle {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }
}

/* liens discrets des pieds de page (mentions légales) : ils prennent la
   couleur et l'opacité de la ligne qui les porte */
.hint a,
.foot a,
.garde-foot a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- le logo et son menu (templates/carnets/_menu.html) ----------
   Un <details> en haut à gauche. Par défaut il défile avec la page ;
   .menu--fixe le garde à l'écran (accueil). */
.menu {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 5;
  font-family: var(--f-text);
}
.menu--fixe {
  position: fixed;
}
.menu summary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  padding: 6px;
  border-radius: 8px;
  list-style: none;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.72;
  transition: opacity 0.2s;
}
.menu summary::-webkit-details-marker {
  display: none;
}
.menu summary:hover,
.menu[open] summary {
  opacity: 1;
}
.menu-logo {
  width: 46px;
  height: 46px;
}
/* le mot "menu" : lu par les lecteurs d'écran, affiché seulement sans
   JavaScript, quand mark.js n'a pas pu dessiner le logo */
:root.js .menu-mot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:root:not(.js) .menu-logo {
  display: none;
}
.menu-mot {
  font-weight: var(--w-label);
  font-size: 14px;
  letter-spacing: 0.1em;
}
/* le panneau : un filet vertical qui descend du centre du logo, deux
   groupes de liens séparés par un blanc. Ni cadre, ni fond, ni ombre.
   Seul un voile sans bord, de la couleur du fond, éteint ce qui passe
   dessous (le nom du site sur l'accueil quand l'écran est bas). */
.menu-panneau {
  position: relative;
  margin: 10px 0 0 28px;
  padding: 2px 0;
  border-left: 1px solid var(--rule-strong);
}
.menu-panneau::before {
  content: "";
  position: absolute;
  inset: -28px -90px -28px -60px;
  z-index: -1;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--bg) 92%, transparent) 65%,
    transparent
  );
  -webkit-mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
  pointer-events: none;
}
.menu-groupe {
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu-groupe + .menu-groupe {
  margin-top: 22px;
}
.menu-panneau a {
  display: block;
  width: max-content;
  padding: 5px 16px;
  font-weight: var(--w-label);
  font-size: 15px;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
  text-decoration: none;
  transition: color 0.15s;
}
.menu-panneau a[aria-current="page"] {
  color: var(--ink);
}
/* loupe de la recherche, bouée de l'aide : après le mot, à la taille du texte */
.menu-ico {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-left: 0.45em;
  vertical-align: -0.1em;
}
.menu-panneau a:hover,
.menu-panneau a:focus-visible {
  color: var(--accent);
}
/* l'en-tête des articles en style "carnet" laisse la place du logo */
.brand--menu {
  padding-left: 84px;
  min-height: 72px;
}
@media (max-width: 719px) {
  .menu {
    top: 8px;
    left: 8px;
  }
  .menu-logo {
    width: 40px;
    height: 40px;
  }
  .menu-panneau {
    margin-left: 25px;
  }
  /* sur un écran étroit le texte passe sous tout le panneau : le voile
     couvre la largeur entière */
  .menu-panneau::before {
    right: auto;
    left: -33px;
    width: 100vw;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
  }
  .brand--menu {
    padding-left: 66px;
  }
}
@media print {
  .menu {
    display: none;
  }
}

/* ---------- boutons et champs des pages publiques ----------
   Le modèle est le formulaire de la page de garde. Deux boutons seulement :
   .btn, en aplat d'accent ; .btn--second, en contour. Les marges intérieures
   sont en em : la hauteur suit la taille du texte. .champ est le champ de
   saisie qui les accompagne. */
.btn {
  display: inline-block;
  font-family: var(--f-text);
  font-weight: var(--w-strong);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  color: var(--btn-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.86em 1.3em;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(1.07);
}
.btn--second {
  color: var(--accent);
  background: transparent;
}
.btn--second:hover {
  filter: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.btn[disabled] {
  opacity: 0.6;
  cursor: default;
}
.champ {
  min-width: 0;
  font-family: var(--f-text);
  font-weight: var(--w-text);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.8em 0.93em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.champ::placeholder {
  color: color-mix(in srgb, var(--ink) 40%, transparent);
}
.champ:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ---------- le petit formulaire d'adresse (carnets/_inscription.html) ----------
   En bas de l'accueil et en fin d'article : discret, une ligne. */
.inscription {
  max-width: 460px;
  font-family: var(--f-text);
}
.inscription .inscription-invite {
  font-weight: var(--w-label);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 8px;
}
.inscription-form {
  display: flex;
  gap: 8px;
}
.inscription-form .champ {
  flex: 1;
}
.inscription .inscription-ok,
.inscription .inscription-err {
  font-weight: var(--w-label);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  margin: 8px 0 0;
}
.inscription .inscription-ok {
  color: var(--accent);
}
.inscription .inscription-err {
  color: var(--danger);
}

/* ---------- le pied commun (templates/pages/_pied.html) ----------
   Une bande pleine sur toute la largeur, d'un ton à peine distinct du fond.
   Quand la page porte cette bande, le corps occupe au moins la hauteur de
   l'écran et la bande se cale en bas, même sous un texte court. */
body:has(> .pied:not(.pied--discret)) {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}
.pied {
  margin-top: auto;
  padding: 30px var(--mx) 34px;
  background: color-mix(in srgb, var(--ink) 5%, var(--bg));
  font-family: var(--f-text);
  font-weight: var(--w-label);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  transition: background var(--fade);
}
.pied ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 30px;
}
.pied a {
  color: color-mix(in srgb, var(--ink) 62%, transparent);
  text-decoration: none;
  transition: color 0.15s;
}
.pied a[aria-current="page"] {
  color: var(--ink);
}
.pied a:hover,
.pied a:focus-visible {
  color: var(--accent);
}
/* sur l'accueil : une ligne de liens sans bande, posée sur la carte */
.pied--discret {
  margin-top: 0;
  padding: 0;
  background: none;
  font-size: 11.5px;
  letter-spacing: 0.06em;
}
.pied--discret ul {
  justify-content: flex-start;
  gap: 6px 22px;
}
.pied--discret a {
  color: color-mix(in srgb, var(--ink) 45%, transparent);
}
@media print {
  .pied {
    display: none;
  }
}

/* ---------- formulaire long (templates/pages/_contribuer.html) ----------
   Des champs empilés avec leur libellé au-dessus, dans la colonne du texte.
   Les champs et le bouton sont ceux du site (.champ, .btn). */
.formulaire {
  max-width: 620px;
  margin: 34px 0 0;
  font-family: var(--f-text);
}
.formulaire-champ {
  margin: 0 0 18px;
}
.formulaire-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.formulaire label {
  display: block;
  font-weight: var(--w-label);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 6px;
}
.formulaire .formulaire-facultatif {
  color: var(--muted);
}
.formulaire .champ {
  display: block;
  box-sizing: border-box;
  width: 100%;
}
.formulaire textarea.champ {
  min-height: 9em;
  line-height: 1.55;
  resize: vertical;
}
.formulaire .champ[aria-invalid="true"] {
  border-color: var(--danger);
}
.formulaire-pied {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.formulaire .formulaire-note,
.formulaire .formulaire-err,
.formulaire-ok {
  font-family: var(--f-text);
  font-weight: var(--w-label);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0;
}
.formulaire .formulaire-note {
  color: var(--muted);
}
.formulaire .formulaire-err {
  color: var(--danger);
  margin: 6px 0 0;
}
.formulaire > .formulaire-err {
  margin: 0 0 16px;
}
.formulaire-ok {
  font-size: 15px;
  color: var(--accent);
  margin: 30px 0 0;
}
@media (max-width: 560px) {
  .formulaire-duo {
    grid-template-columns: 1fr;
  }
}
