/* Praecepta — front public. Palette et polices : celles de l'app (mobile/src/theme.ts). */

@font-face { font-family: "Playfair Display SC"; src: url("fonts/PlayfairDisplaySC-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/Cinzel-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/Cinzel-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Special Elite"; src: url("fonts/SpecialElite-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  color-scheme: light;
  /* mobile/src/theme.ts — mêmes noms de rôle, mêmes valeurs */
  --fond: #f8f5f1;          /* background */
  --surface: #ede8df;       /* surface */
  --surface-2: #ddd4c8;     /* surfaceVariant */
  --encre: #372010;         /* onBackground */
  --encre-2: #6b5040;       /* onSurfaceVariant */
  --ardoise: #5a7490;       /* primary */
  --ardoise-clair: #d0e4f0; /* primaryContainer */
  --or-sombre: #8c6b1a;     /* secondary */
  --or-clair: #f5e6a0;      /* secondaryContainer */
  --or: #eec42b;            /* ACCENT — avec parcimonie */
  --trait: #c4b9aa;         /* outline */
  --erreur: #b91c1c;
  --erreur-fond: #fde8e8;

  --f-logo: "Playfair Display SC", Georgia, serif;
  --f-titre: "Cinzel", Georgia, serif;
  --f-texte: "Special Elite", "Courier New", monospace;

  --largeur: 44rem;
  --rayon: 6px;
}

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

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--f-texte);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration-color: var(--trait); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--encre); }

:focus-visible { outline: 2px solid var(--ardoise); outline-offset: 3px; border-radius: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── En-tête ─────────────────────────────────────────────────────────────── */

.site {
  width: 100%;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem 1.5rem;
}

.marque {
  font-family: var(--f-logo);
  font-size: 1.6rem;
  letter-spacing: .12em;
  text-decoration: none;
  position: relative;
  padding-bottom: .2rem;
}
.marque::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 2.5rem; height: 2px;
  background: var(--or);
}

.site nav { display: flex; gap: 1.25rem; }
.site nav a {
  font-family: var(--f-titre);
  font-size: .9rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--encre-2);
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.site nav a:hover { color: var(--encre); }
.site nav a[aria-current="page"] { color: var(--encre); border-bottom-color: var(--or); }

/* ── Corps ───────────────────────────────────────────────────────────────── */

main {
  flex: 1;
  width: 100%;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

h1, h2 { font-family: var(--f-titre); font-weight: 600; letter-spacing: .06em; }
h1 { font-size: 1.4rem; margin: 0 0 1.5rem; }

.label {
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--encre-2);
  margin: 0 0 .25rem;
}

.aide { font-size: .9rem; color: var(--encre-2); margin: 0 0 1rem; }

.sep {
  display: flex; align-items: center; gap: 1rem;
  margin: 2.5rem 0;
  color: var(--or);
}
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--trait); }

/* ── Citation ────────────────────────────────────────────────────────────── */

.citation { margin: 0; }

.citation blockquote { margin: 0; }
.citation blockquote p {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.citation.compacte blockquote p { font-size: 1.0625rem; }

.citation figcaption { margin-top: .75rem; color: var(--encre-2); font-size: .95rem; }
.citation .auteur { font-family: var(--f-titre); font-weight: 600; color: var(--encre); }
.citation .oeuvre { font-style: italic; }

.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem;
  margin-top: .6rem;
  font-size: .85rem;
}

.tag {
  font-family: var(--f-titre);
  font-size: .75rem;
  letter-spacing: .04em;
  padding: .1rem .55rem;
  border: 1px solid var(--trait);
  border-radius: 999px;
  text-decoration: none;
  color: var(--encre-2);
}
a.tag:hover { border-color: var(--encre-2); color: var(--encre); }

.lien-fiche { margin-left: auto; color: var(--encre-2); font-size: .85rem; }

/* ── Contrôles ───────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--f-titre);
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .65rem 1.25rem;
  border-radius: var(--rayon);
  border: 1px solid var(--encre);
  background: var(--encre);
  color: var(--fond);
  cursor: pointer;
  min-height: 44px;
}
.btn:hover { background: var(--encre-2); border-color: var(--encre-2); }
.btn.secondaire { background: transparent; color: var(--encre); }
.btn.secondaire:hover { background: var(--surface); }
.btn:disabled { opacity: .5; cursor: default; }

.tirage { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1.25rem; }

.segment { display: inline-flex; border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.segment label {
  font-family: var(--f-titre);
  font-size: .8rem;
  letter-spacing: .06em;
  padding: .55rem .9rem;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex; align-items: center;
}
.segment label + label { border-left: 1px solid var(--trait); }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment label:has(input:checked) { background: var(--surface-2); }
.segment label:has(input:focus-visible) { outline: 2px solid var(--ardoise); outline-offset: -2px; }

form.filtres { display: grid; gap: .9rem; margin-bottom: 1.5rem; }
.filtres .ligne { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
@media (max-width: 36rem) { .filtres .ligne { grid-template-columns: 1fr; } }

.champ { display: grid; gap: .25rem; }
.champ label { font-family: var(--f-titre); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--encre-2); }
.champ input, .champ select {
  font: inherit;
  font-size: 1rem;
  color: var(--encre);
  background: #fff;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: .55rem .7rem;
  min-height: 44px;
  width: 100%;
}
.champ input:focus, .champ select:focus { border-color: var(--ardoise); outline: none; box-shadow: 0 0 0 2px var(--ardoise-clair); }

.actifs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .9rem; color: var(--encre-2); }
.actifs button {
  font: inherit; font-size: .85rem;
  background: var(--surface); color: var(--encre);
  border: 1px solid var(--trait); border-radius: 999px;
  padding: .15rem .65rem; cursor: pointer;
}
.actifs button:hover { border-color: var(--encre-2); }

/* ── Listes ──────────────────────────────────────────────────────────────── */

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { padding: 1.25rem 0; border-bottom: 1px solid var(--surface-2); }
.liste > li:first-child { padding-top: 0; }

.compte { font-size: .9rem; color: var(--encre-2); margin: 0 0 1rem; }
.suite { margin-top: 1.5rem; text-align: center; }

/* ── États ───────────────────────────────────────────────────────────────── */

.etat { color: var(--encre-2); font-size: .95rem; }
.etat.erreur { color: var(--erreur); background: var(--erreur-fond); padding: .6rem .8rem; border-radius: var(--rayon); }
.chargement { color: var(--encre-2); font-size: .95rem; }
.chargement::after { content: " …"; }

/* ── Fiche ───────────────────────────────────────────────────────────────── */

.fiche .citation blockquote p { font-size: 1.35rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; align-items: center; }
.retour { display: inline-block; margin-bottom: 1.5rem; font-size: .9rem; color: var(--encre-2); }

/* ── API publique ────────────────────────────────────────────────────────── */

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .85em;
  background: var(--surface);
  padding: .05rem .3rem;
  border-radius: 3px;
}

dl.api { margin: 0 0 1rem; }
dl.api dt { margin-top: 1rem; }
dl.api dt:first-child { margin-top: 0; }
dl.api dt a { text-decoration: none; }
dl.api dt code { overflow-wrap: anywhere; color: var(--encre); }
dl.api dt a:hover code { background: var(--surface-2); }
dl.api dd { margin: .25rem 0 0; font-size: .9rem; color: var(--encre-2); }

/* ── Pied ────────────────────────────────────────────────────────────────── */

footer.pied {
  width: 100%;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  border-top: 1px solid var(--surface-2);
  font-size: .85rem;
  color: var(--encre-2);
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
}

@media (prefers-reduced-motion: no-preference) {
  .slot > * { animation: apparition .25s ease-out; }
  @keyframes apparition { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
