:root {
  --ink: #111;
  --ink-2: #555;
  --ink-3: #9a9a9a;
  --line: #e6e6e6;
  --paper: #fbfaf7;
  --surligneur: rgba(228, 184, 52, .38);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
}
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark;
  --ink: #ededed; --ink-2: #a8a8a8; --ink-3: #6b6b6b; --line: #262626; --paper: #111;
  --surligneur: rgba(228, 184, 52, .22); }
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans);
  font-weight: 400; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
small { font-size: .85em; }

.container { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }

/* En-tête fixe au défilement */
body > header { position: sticky; top: 0; z-index: 20; background: var(--paper); padding-bottom: .6rem; }
header .barre { display: flex; justify-content: space-between; align-items: flex-start;
  gap: .8rem 2rem; padding: 1.6rem 0 1.2rem; }
header .devise { font-family: var(--serif); font-style: italic; font-size: 1.25rem; letter-spacing: .005em;
  color: var(--ink-2); margin: 0; line-height: 1.3; white-space: nowrap; flex: none; }
header .devise:hover { text-decoration: none; color: var(--ink); }
header .devise { display: block; }
/* Trait de surligneur : un fond ocre aux bords légèrement biseautés, ligne par ligne. */
header .devise span { padding: .04em .28em .02em; margin: 0 -.28em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: linear-gradient(100deg, transparent 0, transparent 1.5%, var(--surligneur) 3%,
    var(--surligneur) 96.5%, transparent 98.5%, transparent 100%); }
header nav { display: flex; gap: 1.2rem; font-size: .9rem; color: var(--ink-3); margin-left: auto; }
header nav a.actif { color: var(--ink); border-bottom: 1px solid var(--ink); }
header .theme { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-3);
  display: inline-flex; align-items: center; margin-left: 1.6rem; height: 1.3em; font-size: .9rem; }
header .theme:hover { color: var(--ink); }
header .theme svg { width: 1rem; height: 1rem; display: block; }
header nav a:hover { text-decoration: none; color: var(--ink); }

/* Recherche : une ligne, un filet */
.recherche { position: relative; display: flex; align-items: baseline; gap: 1.5rem;
  border-bottom: 1px solid var(--ink); padding-bottom: .5rem; margin-bottom: 0; }
main.container { padding-top: 3rem; }
.recherche input[type=search] { flex: 1; border: 0; background: none; color: var(--ink);
  font: inherit; font-family: var(--serif); font-size: 1.6rem; padding: 0; outline: none;
  -webkit-appearance: none; appearance: none; }
.recherche input::placeholder { color: var(--ink-3); }
.recherche input::-webkit-search-cancel-button { -webkit-appearance: none; }
.recherche button { display: none; }
.suggestions { position: absolute; top: 100%; left: 0; right: 0; z-index: 10; }
.suggestions ul { background: var(--paper); border-bottom: 1px solid var(--line); padding: .4rem 0;
  box-shadow: 0 12px 24px -12px rgba(0,0,0,.18); }
.suggestions a { display: flex; justify-content: space-between; padding: .3rem .5rem; margin: 0 -.5rem;
  font-family: var(--serif); font-size: 1.1rem; }
.suggestions a:hover, .suggestions a.actif { text-decoration: none; background: var(--line); }
.suggestions small { font-family: var(--serif); color: var(--ink-3); }

/* Accueil */
.hero { padding: 2rem 0 4rem; max-width: 34rem; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: 2.6rem; line-height: 1.1; letter-spacing: -.02em; margin-bottom: 1rem; }
.hero p { color: var(--ink-2); font-size: 1.05rem; }
.stats { display: flex; gap: 3rem; color: var(--ink-3); font-size: .85rem; margin: 3rem 0 4rem; flex-wrap: wrap; }
.stats strong { display: block; color: var(--ink); font-weight: 400; font-size: 1.4rem; font-family: var(--serif); }

/* Fiche */
.fiche { margin-bottom: 2.5rem; }
.fiche h1 { font-family: var(--serif); font-weight: 400; font-size: 3rem; line-height: 1.05; letter-spacing: -.02em; }
.fiche h1 mark { background: none; color: inherit; font-style: italic; }
.fiche .api { font-family: var(--serif); color: var(--ink-3); font-size: 1.2rem; margin-left: .6rem; }
.meta { margin-top: .6rem; color: var(--ink-2); font-size: .9rem; }
.meta a { color: var(--ink); }
.meta .sep { color: var(--ink-3); margin: 0 .5rem; }

/* Filtres : texte, pas de boîtes */
.filtres { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: baseline; font-size: .85rem;
  color: var(--ink-2); margin-bottom: 2.5rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.filtres fieldset { display: contents; border: 0; padding: 0; margin: 0; }
.filtres select { border: 0; background: none; color: inherit; font: inherit; padding: 0 1.1rem 0 0;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'><path d='M0 0l4 5 4-5z' fill='%23999'/></svg>") no-repeat right center; }
.filtres select:hover, .filtres label:hover { color: var(--ink); }
.filtres label { cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; }
.filtres input[type=checkbox] { margin: 0; accent-color: var(--ink); width: .8rem; height: .8rem; }

/* Sections et listes de mots */
section { margin-bottom: 3rem; }
section h2 { font-size: .8rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
  display: flex; gap: .6rem; align-items: baseline; margin-bottom: .8rem; }
section h2 small { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
section h3 { font-size: .9rem; font-weight: 400; color: var(--ink-2); font-style: italic; margin: 1.2rem 0 .4rem; }
.explication { color: var(--ink-3); font-size: .85rem; margin-bottom: 1rem; }
ul.mots { font-family: var(--serif); font-size: 1.15rem; columns: 11rem; column-gap: 2rem; }
ul.mots li { break-inside: avoid; line-height: 1.7; }
ul.mots a.rare { color: var(--ink-3); }
ul.mots.riches { font-size: 1.35rem; }
ul.mots.synonymes a { font-size: calc(0.95rem + 0.45rem * var(--score, 0.5)); }
ul.mots.synonymes a.sur { font-weight: 500; }
.croisement { border-top: 1px solid var(--ink); padding-top: 1rem; }
.variantes { font-size: .9rem; color: var(--ink-2); margin: -1.5rem 0 2rem; }
.variantes a { font-family: var(--serif); color: var(--ink); }

/* Sonorités : transcription avec les sons partagés en noir */
ul.mots.sons { columns: 14rem; }
ul.mots.sons li { white-space: nowrap; }
.api-mini { font-family: var(--serif); font-size: .85rem; color: var(--ink-3); margin-left: .3rem; }
.api-mini b { font-weight: 400; color: var(--ink); background: var(--line); border-radius: 2px; padding: 0 .08em; }
.explication .tete { margin-left: .6rem; color: var(--ink-2); font-family: var(--serif); font-size: 1rem; }
.explication .tete .api-mini { margin-left: .1rem; }

/* Versification */
ul.mots.vers { columns: auto; }
ul.mots.vers li { font-size: 1.05rem; }
.fiche .metre { font-family: var(--serif); font-size: 1.6rem; color: var(--ink-2); margin-left: .4rem; }
.vers-scande { font-family: var(--serif); font-size: 1.7rem; line-height: 1.5; margin-bottom: .4rem; }
.vers-scande .tiret { color: var(--ink-3); margin: 0 .05em; }
.vers-scande .muet { color: var(--ink-3); }
.vers-scande .cesure { color: var(--ink-3); font-size: .8em; }
.vers-scande .annote { border-bottom: 1px dotted var(--ink-3); }
.api-vers { font-family: var(--serif); font-size: 1rem; }
ul.notes li { line-height: 1.7; color: var(--ink-2); }
ul.notes .mot-note { font-family: var(--serif); color: var(--ink); margin-right: .4rem; }

/* Anthologie */
ul.poemes li { margin: 0 0 1.2rem; }
ul.poemes a { display: block; }
ul.poemes .titre { font-family: var(--serif); font-size: 1.5rem; display: block; }
ul.poemes .auteur { color: var(--ink-2); font-size: .9rem; }
ul.poemes .sep { color: var(--ink-3); margin: 0 .5rem; }
.poeme { max-width: 40rem; padding-top: .5rem; }
.poeme h1 { font-family: var(--serif); font-weight: 400; font-size: 2.4rem; letter-spacing: -.02em; }
.poeme .dedicace { font-family: var(--serif); color: var(--ink-2); font-variant: small-caps; letter-spacing: .05em; margin-top: 1rem; }
.poeme h2.section { text-transform: none; letter-spacing: 0; font-family: var(--serif); font-size: 1.1rem; color: var(--ink-2); margin: 2.5rem 0 1rem; display: block; text-align: center; }
.poeme header { margin-bottom: 2.5rem; }
.strophe { font-family: var(--serif); font-size: 1.2rem; line-height: 1.75; margin-bottom: 1.5rem; }
.strophe .vers { display: block; color: var(--ink); }
.strophe .vers.retrait { padding-left: 2.2rem; }
.strophe .vers.suite { padding-left: 12ch; }
.strophe .vers:hover { text-decoration: none; color: var(--ink-2); }
.poeme .fin { margin-top: 2.5rem; }

/* Conjugaison */
.mode h2 { margin-bottom: 1rem; }
.temps-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.5rem 2.5rem; }
.temps h3 { margin: 0 0 .4rem; font-style: normal; font-size: .8rem; color: var(--ink-3); }
.temps li { font-family: var(--serif); font-size: 1.05rem; line-height: 1.6; white-space: nowrap; }
.temps .pronom { color: var(--ink-3); }
.temps li.cible { background: var(--line); margin: 0 -.4rem; padding: 0 .4rem; }

/* Pages texte */
.prose { max-width: 38rem; }
.prose h1 { font-family: var(--serif); font-weight: 400; font-size: 2.4rem; margin-bottom: 1.5rem; }
.prose h2 { font-size: 1rem; font-weight: 500; margin: 2rem 0 .5rem; }
.prose p, .prose li { color: var(--ink-2); margin-bottom: .6rem; }
.prose ul { padding-left: 1.2rem; list-style: disc; }
.prose a { color: var(--ink); text-decoration: underline; text-underline-offset: .18em; text-decoration-color: var(--ink-3); }

footer { margin-top: 6rem; padding: 1.5rem 0 3rem; border-top: 1px solid var(--line); color: var(--ink-3);
  font-family: var(--serif); font-style: italic; font-size: .95rem; }
footer a { color: var(--ink-2); font-style: normal; }
footer .sep { margin: 0 .6rem; }

header nav { flex-wrap: wrap; }

/* La nav passe sous la devise. Le passage à la ligne n'est
   jamais laissé au flex : il se fait ici, et seulement ici. */
@media (max-width: 960px) {
  header .barre { flex-wrap: wrap; }
  header nav { flex-basis: 100%; order: 3; margin-left: 0; }
  header .theme { order: 2; margin-left: auto; }  /* première ligne, face à la devise */
}
@media (max-width: 760px) {
  .container { padding: 0 1.1rem; }
  header .barre { padding: 1.1rem 0 .9rem; gap: .6rem 1.5rem; }
  header nav { flex-wrap: wrap; gap: .4rem 1rem; row-gap: .4rem; }
  .recherche input[type=search] { font-size: 1.25rem; }
  main.container { padding-top: 2rem; }
  .fiche h1, .poeme h1 { font-size: 1.9rem; }
  .fiche .api { display: block; margin: .3rem 0 0; font-size: 1rem; }
  .hero h1 { font-size: 2rem; }
  .stats { gap: 1.5rem; }
  ul.mots { columns: 9rem; column-gap: 1.2rem; }
  ul.mots.sons { columns: 1; }
  .filtres { gap: .6rem .9rem; }
  .filtres fieldset { display: flex; flex-wrap: wrap; gap: .6rem .9rem; }
  .vers-scande { font-size: 1.25rem; }
  .strophe { font-size: 1.05rem; }
  .strophe .vers.retrait { padding-left: 1.2rem; }
  .temps-grille { grid-template-columns: 1fr 1fr; gap: 1.2rem 1.5rem; }
  .temps li { white-space: normal; }
  footer { font-size: .85rem; }
}
@media (max-width: 440px) {
  body > header { position: static; }  /* trois lignes de nav + recherche : trop haut pour rester collé */
  header .devise { display: none; }
  header .barre { padding: .9rem 0 .7rem; position: relative; }
  header nav { padding-right: 2rem; }
  header .theme { position: absolute; right: 0; top: .9rem; margin: 0; }
  header nav { font-size: .85rem; gap: .35rem .8rem; }
  .temps-grille { grid-template-columns: 1fr; }
}

/* À propos */
.apropos { max-width: 40rem; }
.apropos h1 { font-family: var(--serif); font-weight: 400; font-size: 2.6rem; line-height: 1.1; letter-spacing: -.02em; margin-bottom: 1.2rem; }
.apropos > p { color: var(--ink-2); font-size: 1.05rem; margin-bottom: 3rem; }
.apropos section p { color: var(--ink-2); margin-bottom: 1rem; }
.apropos dt { font-family: var(--serif); font-size: 1.15rem; margin-top: 1.2rem; }
.apropos dd { margin: .3rem 0 0; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.apropos dd i { font-family: var(--serif); }

/* Littré */
.littre { max-width: 44rem; margin-bottom: 3.5rem; }
.littre header h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--ink); margin-bottom: 1rem; }
.littre header .num, .littre .sens > p .num { font-family: var(--sans); font-size: .75rem; color: var(--ink-3); margin-right: .6rem; vertical-align: .15em; }
.littre .nature { font-style: italic; color: var(--ink-2); font-size: 1.05rem; }
.littre .pron { color: var(--ink-3); font-size: 1rem; }
.littre .suppl-marque, .littre .sens.suppl > p::before { font-family: var(--sans); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.littre .sens.suppl > p::before { content: "suppl. "; }
.sens-liste, .sous-sens { list-style: none; padding: 0; }
.sens-liste > .sens { margin-bottom: 1.2rem; }
.sous-sens { margin: .4rem 0 0 1.2rem; }
.sous-sens > .sens { margin-top: .5rem; }
.littre .sens > p { font-family: var(--serif); font-size: 1.05rem; line-height: 1.55; }
.littre em.ind, .littre em.nat, .littre em.dom { font-style: italic; color: var(--ink-2); }
.littre q { quotes: "« " " »"; }
.littre a { color: var(--ink); text-decoration: underline dotted var(--ink-3); }
.citations { margin: .4rem 0 0 1.2rem; }
.citations li { font-family: var(--serif); font-size: .95rem; line-height: 1.5; color: var(--ink-2); margin-bottom: .25rem; }
.citations .vers a { display: block; color: var(--ink-2); text-decoration: none; }
.citations .vers a:hover { color: var(--ink); text-decoration: underline; }
.citations cite { font-style: normal; font-family: var(--sans); font-size: .75rem; color: var(--ink-3); margin-left: .4rem; white-space: nowrap; }
.citations .vers + cite { display: block; margin-left: 0; }
.rubrique { margin: 1.4rem 0 0; }
.rubrique h3 { font-size: .75rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-style: normal; margin: 0 0 .3rem; }
.rubrique p { font-family: var(--serif); font-size: .95rem; line-height: 1.55; color: var(--ink-2); }
.nuances p { font-family: var(--serif); font-size: 1rem; line-height: 1.55; color: var(--ink-2); max-width: 44rem; margin-bottom: .8rem; }
@media (max-width: 640px) {
  .citations { margin-left: .6rem; }
  .sous-sens { margin-left: .6rem; }
}
