/* noesiology.education — css/site.css
   Charte « Vésale rencontre l'interface » : la gravure anatomique servie
   par une lisibilité moderne. Papier ivoire, encre presque noire, filets
   et cartouches, quatorze teintes de famille désaturées (Régences en tons
   plus profonds), ocre = régime génératif, ardoise = régime évaluatif. */

/* ================================================================ */
/* Variables du contrat d'interface                                  */
/* ================================================================ */
:root {
  /* Fond et encres */
  --papier: #f6f1e6;
  --papier-2: #efe8d8;
  --encre: #221c14;
  --encre-2: #5a5140;
  --filet: #c8bda2;

  /* Régimes */
  --ocre: #9c6414;        /* régime génératif */
  --ocre-clair: #eadfc8;
  --ardoise: #45525e;     /* régime évaluatif */
  --ardoise-claire: #dde2e5;

  /* Les onze familles des Puissances — teintes désaturées */
  --fam-a: #8a9573;  --fam-a-fonce: #59624a;
  --fam-b: #7d99a3;  --fam-b-fonce: #4d626b;
  --fam-c: #a98f6f;  --fam-c-fonce: #6e5a43;
  --fam-d: #9a7e9b;  --fam-d-fonce: #644f65;
  --fam-e: #7f9c8b;  --fam-e-fonce: #4f6658;
  --fam-f: #7189a3;  --fam-f-fonce: #46586c;
  --fam-g: #a3907e;  --fam-g-fonce: #6b5c4e;
  --fam-h: #b3956d;  --fam-h-fonce: #755f42;
  --fam-i: #a08080;  --fam-i-fonce: #664e4e;
  --fam-j: #7ba397;  --fam-j-fonce: #4c6b62;
  --fam-k: #8c81a0;  --fam-k-fonce: #585067;

  /* Les trois Régences — tons profonds */
  --fam-m: #52405f;  --fam-m-fonce: #3a2d44;
  --fam-p: #3f5261;  --fam-p-fonce: #2c3a45;
  --fam-r: #5f4049;  --fam-r-fonce: #442d34;

  /* Divers */
  --focus: #8a5a12;
  --erreur: #8c3a2e;
  --valide: #4a6b3f;

  /* Typographie : piles système uniquement (aucune police externe) */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Times New Roman", serif;
  --humaniste: "Seravek", "Gill Sans Nova", "Gill Sans", Ubuntu, Calibri,
               "Segoe UI", "Trebuchet MS", "DejaVu Sans", Verdana, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "DejaVu Sans Mono", Menlo, monospace;
}

/* ================================================================ */
/* Base                                                              */
/* ================================================================ */
* { box-sizing: border-box; }

html {
  background: var(--papier);
  color: var(--encre);
  font-family: var(--humaniste);
  font-size: 100%;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--encre);
  margin: 1.6em 0 0.5em;
}
h1 { font-size: 2rem; margin-top: 0.6em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0.7em 0; }

a { color: var(--fam-f-fonce); text-underline-offset: 2px; }
a:hover { color: var(--encre); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--ocre-clair); }

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

/* ================================================================ */
/* Structure de page (gabarit)                                       */
/* ================================================================ */
.entete-site {
  border-bottom: 2px solid var(--encre);
  background: var(--papier);
}
.entete-site .interieur {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.8rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.4rem;
}
.marque {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--encre);
}
.marque svg { width: 2.2rem; height: 2.2rem; }
.marque .nom-site {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.nav-site ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
}
.nav-site a {
  display: inline-block;
  padding: 0.35rem 0.15rem;
  text-decoration: none;
  color: var(--encre-2);
  border-bottom: 3px solid transparent;
  font-size: 0.98rem;
}
.nav-site a:hover { color: var(--encre); border-bottom-color: var(--filet); }
.nav-site a[aria-current="page"] {
  color: var(--encre);
  font-weight: 600;
  border-bottom-color: var(--ocre);
}

main {
  flex: 1;
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.pied-site {
  border-top: 1px solid var(--filet);
  background: var(--papier-2);
  color: var(--encre-2);
  font-size: 0.92rem;
}
.pied-site .interieur {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.1rem 1rem 1.4rem;
}
.pied-site nav ul {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.4rem;
}
.pied-site a { color: var(--encre-2); }
.pied-site a:hover { color: var(--encre); }
.pied-site .placeholder {
  color: var(--encre-2);
  opacity: 0.75;
  text-decoration: none;
  border-bottom: 1px dashed var(--filet);
  cursor: default;
}
.pied-site .placeholder::after { content: " (à venir)"; font-style: italic; }

.devise-honnetete {
  font-family: var(--serif);
  font-style: italic;
  color: var(--encre);
  border-top: 1px solid var(--filet);
  margin: 0.6rem 0 0;
  padding-top: 0.7rem;
}

/* ================================================================ */
/* Composants du contrat                                             */
/* ================================================================ */

/* Cartouche — l'encadré gravé */
.cartouche {
  border: 1px solid var(--encre);
  box-shadow: 0 0 0 1px var(--papier), 0 0 0 2px var(--filet);
  background: var(--papier);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
  position: relative;
}
.cartouche > :first-child { margin-top: 0; }
.cartouche > :last-child { margin-bottom: 0; }

/* Filet — la ligne de séparation gravée */
.filet {
  border: 0;
  border-top: 1px solid var(--filet);
  margin: 1.6rem 0;
  position: relative;
}

/* Bandeau — l'avertissement permanent (éthique, règle d'or…) */
.bandeau {
  background: var(--ardoise-claire);
  border-left: 4px solid var(--ardoise);
  padding: 0.7rem 1rem;
  margin: 1.2rem 0;
  color: var(--encre);
}
.bandeau.genératif, .bandeau.generatif {
  background: var(--ocre-clair);
  border-left-color: var(--ocre);
}

/* Tribune — le bandeau des Régences, tons profonds */
.tribune {
  background: var(--fam-p-fonce);
  color: var(--papier);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
  border: 1px solid var(--encre);
}
.tribune a { color: var(--papier); }
.tribune h2, .tribune h3 { color: var(--papier); }

/* Code-lien — la règle transversale du site */
.code, a.code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 0 0.25em;
  border-radius: 3px;
  background: var(--papier-2);
  border: 1px solid var(--filet);
  color: var(--fam-f-fonce);
  text-decoration: none;
  white-space: nowrap;
}
a.code:hover, a.code:focus-visible {
  color: var(--encre);
  border-color: var(--encre-2);
  background: var(--ocre-clair);
}

/* Popover du code-lien */
.popover-code {
  position: absolute;
  z-index: 1000;
  max-width: 26rem;
  background: var(--encre);
  color: var(--papier);
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.45rem 0.7rem;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(34, 28, 20, 0.35);
  pointer-events: none;
}

/* Boutons */
.btn {
  display: inline-block;
  font-family: var(--humaniste);
  font-size: 0.98rem;
  color: var(--encre);
  background: var(--papier);
  border: 1px solid var(--encre);
  box-shadow: 2px 2px 0 var(--filet);
  padding: 0.45rem 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.btn:hover { background: var(--papier-2); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--filet); }
.btn.principal { background: var(--encre); color: var(--papier); }
.btn.principal:hover { background: var(--encre-2); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Prose — la colonne de lecture */
.prose { max-width: 44rem; }
.prose blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1.2rem;
  border-left: 3px solid var(--ocre);
  font-family: var(--serif);
  font-style: italic;
  color: var(--encre-2);
}

/* Accessibilité : contenu pour lecteurs d'écran seulement */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* Pastilles de familles (utilitaires) */
.fam-a { color: var(--fam-a-fonce); } .fond-fam-a { background: var(--fam-a); }
.fam-b { color: var(--fam-b-fonce); } .fond-fam-b { background: var(--fam-b); }
.fam-c { color: var(--fam-c-fonce); } .fond-fam-c { background: var(--fam-c); }
.fam-d { color: var(--fam-d-fonce); } .fond-fam-d { background: var(--fam-d); }
.fam-e { color: var(--fam-e-fonce); } .fond-fam-e { background: var(--fam-e); }
.fam-f { color: var(--fam-f-fonce); } .fond-fam-f { background: var(--fam-f); }
.fam-g { color: var(--fam-g-fonce); } .fond-fam-g { background: var(--fam-g); }
.fam-h { color: var(--fam-h-fonce); } .fond-fam-h { background: var(--fam-h); }
.fam-i { color: var(--fam-i-fonce); } .fond-fam-i { background: var(--fam-i); }
.fam-j { color: var(--fam-j-fonce); } .fond-fam-j { background: var(--fam-j); }
.fam-k { color: var(--fam-k-fonce); } .fond-fam-k { background: var(--fam-k); }
.fam-m { color: var(--fam-m-fonce); } .fond-fam-m { background: var(--fam-m); color: var(--papier); }
.fam-p { color: var(--fam-p-fonce); } .fond-fam-p { background: var(--fam-p); color: var(--papier); }
.fam-r { color: var(--fam-r-fonce); } .fond-fam-r { background: var(--fam-r); color: var(--papier); }

/* États de validation (validation.html et messages) */
.etat-ok { color: var(--valide); font-weight: 600; }
.etat-echec { color: var(--erreur); font-weight: 600; }

/* ================================================================ */
/* Impression — base commune (la « planche » de P2 la complètera)    */
/* ================================================================ */
@media print {
  html { background: #fff; color: #000; }
  .entete-site, .pied-site nav, .nav-site, .btn, .popover-code { display: none !important; }
  main { max-width: none; padding: 0; }
  .devise-honnetete { border: 0; }
  a { color: #000; text-decoration: none; }
  .code, a.code { border: 0; background: none; padding: 0; }
  .cartouche { box-shadow: none; }
}

/* ================================================================ */
/* Mouvement réduit — respecté partout                               */
/* ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
