/* Mon petit informaticien : esthétique de journal, sans police ni ressource externe. */

:root {
  --papier: #f6f2e9;
  --papier-fonce: #ece6d8;
  --encre: #1c1a16;
  --encre-douce: #5a554b;
  --filet: #cfc6b3;
  --accent: #b3261e;
  --accent-doux: #f3dcd6;
  --snt: #1f5f8b;
  --snt-doux: #dce9f2;
  --nsi: #5b3f8c;
  --nsi-doux: #e7e0f2;
  --carte: #fffdf8;
  --ombre: 0 1px 0 var(--filet);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --largeur: 72rem;
  --lecture: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #17150f;
    --papier-fonce: #211e17;
    --encre: #ece6d8;
    --encre-douce: #b0a894;
    --filet: #3d382c;
    --accent: #f07a6a;
    --accent-doux: #3a1f1a;
    --snt: #8cc3e8;
    --snt-doux: #1b2c38;
    --nsi: #c3aef0;
    --nsi-doux: #2a2238;
    --carte: #1d1a14;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.evitement { position: absolute; left: -999px; }
.evitement:focus { left: 1rem; top: 1rem; background: var(--carte); padding: 0.5rem 1rem; z-index: 10; }

.bandeau-apercu {
  background: var(--accent);
  color: var(--papier);
  text-align: center;
  font-size: 0.875rem;
  padding: 0.4rem 1rem;
  font-weight: 600;
}

/* En-tête : manchette de journal */

.entete {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
}

.entete-haut {
  text-align: center;
  border-bottom: 3px double var(--encre);
  padding-bottom: 0.75rem;
}

.marque { text-decoration: none; display: inline-block; line-height: 1; }
.marque:hover { color: inherit; }
.marque-petit {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--accent);
}
.marque-nom {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 4.75rem);
  letter-spacing: -0.02em;
}

.devise {
  margin: 0.5rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--encre-douce);
}

.navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--encre);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.navigation a { text-decoration: none; }
.navigation a[aria-current="page"] { color: var(--accent); }

/* Choix du niveau */

.choix-niveau {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  margin: 0;
  padding: 0.9rem 0;
}
.choix-niveau legend {
  float: left;
  margin-right: 0.25rem;
  font-family: var(--serif);
  font-style: italic;
  color: var(--encre-douce);
}
.choix-niveau input { position: absolute; opacity: 0; pointer-events: none; }
.choix-niveau label {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 7.5rem;
  padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--encre);
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
  background: var(--carte);
}
.niveau-nom { font-weight: 700; }
.niveau-public { font-size: 0.75rem; color: var(--encre-douce); }
.choix-niveau input:checked + label { background: var(--encre); color: var(--papier); }
.choix-niveau input:checked + label .niveau-public { color: var(--papier-fonce); }
.choix-niveau input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Un seul niveau visible à la fois, sans JavaScript */
body:has(#niveau-decouverte:checked) [data-niveau]:not([data-niveau="decouverte"]),
body:has(#niveau-lycee:checked) [data-niveau]:not([data-niveau="lycee"]),
body:has(#niveau-specialite:checked) [data-niveau]:not([data-niveau="specialite"]) {
  display: none;
}

/* Contenu */

.contenu {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.surtitre {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.surtitre a { text-decoration: none; }

.une-entete { margin-bottom: 1.5rem; }
.une-titre {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 0.25rem 0 0.5rem;
}

.chapo {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: var(--lecture);
}

/* Cartes et grille de la une */

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1.5rem;
}

.carte {
  background: var(--carte);
  border-top: 4px solid var(--encre);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: var(--ombre);
}
.carte-une { grid-column: 1 / -1; border-top-color: var(--accent); }
.carte-une .carte-titre { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.carte-une .carte-chapo { font-size: 1.2rem; max-width: var(--lecture); }
.carte-brouillon { outline: 2px dashed var(--accent); }

.carte-titre {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.2;
  margin: 0.5rem 0;
}
.carte-titre a { text-decoration: none; }
.carte-titre a:hover { text-decoration: underline; }
.carte-chapo { margin: 0 0 0.6rem; font-family: var(--serif); }
.carte-source { margin: 0; font-size: 0.8rem; color: var(--encre-douce); }

.rubriques { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0; }
.pastille {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
}
.pastille-snt { background: var(--snt-doux); color: var(--snt); }
.pastille-nsi { background: var(--nsi-doux); color: var(--nsi); }

.renvoi { margin-top: 2rem; text-align: center; font-weight: 600; }

/* Article */

.article { max-width: var(--lecture); margin: 0 auto; }
.article-entete h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1.12;
  margin: 0.35rem 0 0.75rem;
}
.mise-a-jour, .lien-suite {
  font-size: 0.95rem;
  background: var(--papier-fonce);
  border-left: 4px solid var(--accent);
  padding: 0.5rem 0.75rem;
}

.niveau { margin-top: 1.5rem; }
.niveau-etiquette {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--encre-douce);
  border-bottom: 1px solid var(--filet);
  padding-bottom: 0.25rem;
  margin: 0;
}
.niveau .chapo { font-weight: 600; margin-top: 0.75rem; }
.texte p { margin: 0 0 1em; }
.texte h2 { font-family: var(--serif); font-size: 1.4rem; margin: 1.5em 0 0.5em; }

.question, .mots, .a-verifier {
  margin: 1.75rem 0;
  padding: 1rem 1.1rem;
  background: var(--carte);
  border: 1px solid var(--filet);
}
.question { border-left: 6px solid var(--accent); }
.question h2, .mots h2 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: 1.15rem;
}
.question p { margin: 0; font-family: var(--serif); font-size: 1.1rem; }

.mots dl { margin: 0; }
.mot { padding: 0.4rem 0; border-top: 1px solid var(--filet); }
.mot:first-child { border-top: 0; }
.mot dt { font-weight: 700; }
.mot dd { margin: 0; }
.mot-a-relire { opacity: 0.7; }

.a-verifier { border: 2px dashed var(--accent); background: var(--accent-doux); }
.a-verifier-titre { font-weight: 700; margin-top: 0; }

.article-pied { margin-top: 2rem; padding-top: 1rem; border-top: 3px double var(--encre); }
.source { font-weight: 600; }

/* Termes du glossaire dans le texte */

.terme {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: help;
  text-decoration: underline dotted var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
.terme:hover { color: var(--accent); }

.definition {
  position: fixed;
  inset: auto 1rem 1rem;
  margin: 0 auto;
  max-width: 34rem;
  background: var(--carte);
  color: var(--encre);
  border: 2px solid var(--encre);
  border-radius: 0.75rem;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 0.6rem 2rem rgb(0 0 0 / 0.25);
}
.definition p { margin: 0 0 0.5rem; }
.definition-mot { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.definition-analogie { color: var(--encre-douce); }
.definition-pied {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  margin-bottom: 0 !important;
}
.definition-pied button {
  font: inherit;
  font-weight: 600;
  background: var(--encre);
  color: var(--papier);
  border: 0;
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  cursor: pointer;
}

/* Archives, thèmes, glossaire */

.archives { list-style: none; padding: 0; max-width: var(--lecture); }
.archives > li { border-top: 1px solid var(--filet); padding: 0.75rem 0; }
.archives h2 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 0.25rem; }
.archives-date { font-family: var(--sans); font-size: 0.9rem; font-weight: 400; color: var(--encre-douce); }

.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 2rem; }
.themes h2 { font-family: var(--serif); border-bottom: 1px solid var(--encre); padding-bottom: 0.25rem; }
.liste-themes { list-style: none; padding: 0; margin: 0; }
.liste-themes li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--filet); }
.compte { color: var(--encre-douce); font-variant-numeric: tabular-nums; }

.glossaire { max-width: var(--lecture); margin: 0; }
.entree { padding: 0.9rem 0; border-top: 1px solid var(--filet); scroll-margin-top: 1rem; }
.entree:target { background: var(--accent-doux); }
.entree dt { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; }
.entree dd { margin: 0.2rem 0 0; }
.entree-articles { font-size: 0.9rem; color: var(--encre-douce); }

/* Recherche */

.recherche { max-width: var(--lecture); display: grid; gap: 0.4rem; }
.recherche label { font-weight: 600; }
.recherche input {
  font: inherit;
  font-size: 1.15rem;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--encre);
  border-radius: 0.5rem;
  background: var(--carte);
  color: var(--encre);
}
.recherche-etat { color: var(--encre-douce); }
.recherche-resultats { padding: 0; list-style: none; max-width: var(--lecture); }
.recherche-resultats li { border-top: 1px solid var(--filet); padding: 0.75rem 0; }
.recherche-resultats a { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }
.recherche-resultats p { margin: 0.2rem 0 0; }
.recherche-resultats .date { font-size: 0.85rem; color: var(--encre-douce); }

/* Pied de page */

.pied {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  border-top: 3px double var(--encre);
  font-size: 0.875rem;
  color: var(--encre-douce);
  text-align: center;
}

@media (max-width: 30rem) {
  .choix-niveau legend { float: none; width: 100%; text-align: center; }
  .choix-niveau label { min-width: 0; flex: 1; padding: 0.35rem 0.4rem; }
  .niveau-public { display: none; }
}

@media print {
  .navigation, .choix-niveau, .bandeau-apercu, .definition { display: none; }
  body { background: white; color: black; }
}
