/* LVD Juridique — feuille de style unique (aucune ressource distante). */

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

:root {
  --marine: #0f1440;
  --bg: #f4f5f2;
  --panneau: #ffffff;
  --encre: #17182a;
  --encre-douce: #5d5f72;
  --trait: #e3e4de;
  --accent: #1f5f4f;
  --accent-doux: #e8f1ee;
  --presse: #7b2d8e;
  --presse-doux: #f3e9f6;
  --an: #2b5c8a;
  --an-doux: #e6eef6;
  --senat: #a8571f;
  --senat-doux: #f8efe4;
  /* Couleurs des boutons pleins. Elles ne peuvent pas se déduire des autres
     variables : « --panneau » comme couleur de texte ne vaut qu'en thème
     clair, où le panneau est blanc. En sombre, cela donnait du sombre sur du
     sombre, donc un bouton illisible. */
  --bouton-fond: #0f1440;
  --bouton-encre: #ffffff;
  --rayon: 12px;
  --ombre: 0 1px 2px rgba(15, 20, 64, .06), 0 4px 14px rgba(15, 20, 64, .05);
}

/*
 * Thème sombre, décliné en trois temps :
 *
 *   1. le réglage du système, honoré par défaut ;
 *   2. « clair » forcé, qui doit l'emporter sur un système en sombre ;
 *   3. « sombre » forcé, qui doit l'emporter sur un système en clair.
 *
 * D'où la garde « :not([data-theme=clair]) » sur la règle média : sans
 * elle, un système en sombre écraserait le choix explicite du lecteur.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #14151c;
    --panneau: #1c1e28;
    --encre: #e9e9e6;
    --encre-douce: #a0a2b0;
    --trait: #2c2f3c;
    --accent: #6bbfa5;
    --accent-doux: #1b2c28;
    --presse: #d6a3e6;
    --presse-doux: #2a1f30;
    --an: #86b4de;
    --an-doux: #1a2634;
    --senat: #dda86c;
    --senat-doux: #2c2318;
    --ombre: none;
    /* Sur fond sombre, le marine disparaîtrait : on passe à l'accent, avec
       un texte très foncé. */
    --bouton-fond: #6bbfa5;
    --bouton-encre: #101210;
  }
}

:root[data-theme="sombre"] {
    --bg: #14151c;
    --panneau: #1c1e28;
    --encre: #e9e9e6;
    --encre-douce: #a0a2b0;
    --trait: #2c2f3c;
    --accent: #6bbfa5;
    --accent-doux: #1b2c28;
    --presse: #d6a3e6;
    --presse-doux: #2a1f30;
    --an: #86b4de;
    --an-doux: #1a2634;
    --senat: #dda86c;
    --senat-doux: #2c2318;
    --ombre: none;
    /* Sur fond sombre, le marine disparaîtrait : on passe à l'accent, avec
       un texte très foncé. */
    --bouton-fond: #6bbfa5;
    --bouton-encre: #101210;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--encre);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Encoches des téléphones : on respecte les zones sûres. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.enveloppe { max-width: 1080px; margin: 0 auto; padding: 18px 16px 72px; }

/* ---------------------------------------------------------- en-tête */

.entete {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.entete img { height: 62px; width: auto; }
.entete .sous-titre {
  color: var(--encre-douce); font-size: .84rem; margin: 2px 0 0;
}
.entete .grandir { flex: 1 1 auto; }

button.action {
  font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--bouton-encre); background: var(--bouton-fond);
  border: 0; border-radius: 8px; padding: 9px 15px; cursor: pointer;
}
button.action:hover { opacity: .9; }
button.action[hidden] { display: none; }

/* ------------------------------------------------------- compteurs */

.compteurs {
  display: grid; gap: 10px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.carte {
  background: var(--panneau); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 12px 14px; box-shadow: var(--ombre);
}
.carte b {
  display: block; font-size: 1.5rem; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.carte span {
  color: var(--encre-douce); font-size: .74rem;
  text-transform: uppercase; letter-spacing: .05em;
}

/* --------------------------------------------------------- filtres */

.filtres {
  background: var(--panneau); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 14px; margin-bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 10px; box-shadow: var(--ombre);
}
.filtres input[type=search], .filtres select {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--trait); border-radius: 8px; padding: 8px 11px;
  max-width: 100%;
}
.filtres input[type=search] { flex: 1 1 230px; min-width: 0; }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.pastille {
  font: inherit; font-size: .81rem; cursor: pointer;
  background: var(--bg); color: var(--encre-douce);
  border: 1px solid var(--trait); border-radius: 999px; padding: 4px 12px;
}
.pastille[aria-pressed=true] {
  background: var(--accent-doux); color: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.decompte { color: var(--encre-douce); font-size: .85rem; margin: 0 0 12px; }

/* ----------------------------------------------------------- liste */

article {
  background: var(--panneau); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 10px;
  display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--ombre);
}
.vignette {
  flex: 0 0 128px; width: 128px; aspect-ratio: 16 / 10;
  object-fit: cover; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--trait);
}
.corps { flex: 1 1 auto; min-width: 0; }

.meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 7px; font-size: .79rem; color: var(--encre-douce);
}
.etiquette {
  font-size: .71rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 9px; border-radius: 999px; text-transform: uppercase;
}
.etiquette.presse {
  background: var(--presse-doux); color: var(--presse);
  text-transform: none; letter-spacing: 0;
}
.etiquette.an { background: var(--an-doux); color: var(--an); }
.etiquette.senat { background: var(--senat-doux); color: var(--senat); }
.quand { font-variant-numeric: tabular-nums; }

h2 { margin: 0 0 6px; font-size: 1.01rem; font-weight: 600; line-height: 1.4; }
h2 a { color: inherit; text-decoration-color: var(--trait);
       text-underline-offset: 3px; }
h2 a:hover { text-decoration-color: currentColor; }

.contenu { margin: 8px 0 0; color: var(--encre-douce); font-size: .89rem; }
.contenu.tronque {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.contenu p { margin: 0 0 8px; }
.contenu p:last-child { margin-bottom: 0; }
.contenu.tronque p { display: inline; }
.reponse b { color: var(--encre); }

.plus {
  font: inherit; font-size: .81rem; background: none; border: 0;
  color: var(--accent); cursor: pointer; padding: 6px 0 0;
}
.plus:hover { text-decoration: underline; }
.plus[hidden] { display: none; }

.termes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.terme {
  font-size: .74rem; background: var(--accent-doux); color: var(--accent);
  border-radius: 5px; padding: 2px 8px;
}

mark { background: #ffe9a8; color: #4a3a00; border-radius: 3px; padding: 0 2px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) mark { background: #5c4a12; color: #ffe9a8; }
}
:root[data-theme="sombre"] mark { background: #5c4a12; color: #ffe9a8; }

.vide { text-align: center; color: var(--encre-douce); padding: 46px 20px; }

.bandeau {
  background: var(--accent-doux); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 9px 13px; margin-bottom: 14px; font-size: .86rem;
}
.bandeau[hidden] { display: none; }

footer {
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--trait);
  color: var(--encre-douce); font-size: .79rem;
}

@media (max-width: 560px) {
  article { flex-direction: column; }
  .vignette { flex-basis: auto; width: 100%; }
  .entete img { height: 46px; }
}

/* --------------------------------------- actualisation et nouveautés */

button.action.secondaire {
  background: var(--panneau); color: var(--encre);
  border: 1px solid var(--trait);
}
button.action.secondaire:disabled { opacity: .55; cursor: default; }

.annonce {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--accent-doux); color: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--rayon);
  padding: 11px 15px; margin-bottom: 14px; font-size: .89rem;
  font-weight: 600;
}
.annonce[hidden] { display: none; }
.annonce .grandir { flex: 1 1 auto; }
.lien-annonce {
  font: inherit; font-size: .85rem; font-weight: 600;
  background: none; border: 0; color: inherit;
  text-decoration: underline; cursor: pointer; padding: 2px 0;
}
.lien-annonce:hover { opacity: .75; }

.etiquette.nouveau {
  background: var(--accent); color: var(--panneau);
}
article.nouveau { border-color: var(--accent); }

#etat-veille { margin: 6px 0 0; opacity: .85; }

.reglage {
  display: flex; align-items: center; gap: 7px;
  color: var(--encre-douce); font-size: .84rem;
}
.reglage select {
  font: inherit; font-size: .84rem; color: inherit; background: var(--bg);
  border: 1px solid var(--trait); border-radius: 7px; padding: 4px 8px;
}


/* ------------------------------------------------------------- thème */

.theme {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--panneau); border: 1px solid var(--trait);
  border-radius: 9px; padding: 3px;
}
.theme button {
  font: inherit; font-size: .84rem; line-height: 1; cursor: pointer;
  background: none; border: 0; border-radius: 6px;
  color: var(--encre-douce); padding: 6px 9px;
}
.theme button[aria-pressed="true"] {
  background: var(--bouton-fond); color: var(--bouton-encre);
  font-weight: 600;
}

.reglage input[type=number] {
  font: inherit; font-size: .84rem; color: inherit; background: var(--bg);
  border: 1px solid var(--trait); border-radius: 7px;
  padding: 4px 6px; width: 5.2em; text-align: right;
  font-variant-numeric: tabular-nums;
}
.reglage input[type=number]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* ---------------------------------------------------------- réglages */

dialog#reglages {
  border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--panneau); color: var(--encre);
  padding: 22px 24px; max-width: 30rem; width: calc(100% - 32px);
  box-shadow: 0 10px 40px rgba(15, 20, 64, .22);
}
dialog#reglages::backdrop { background: rgba(15, 20, 64, .42); }

dialog#reglages h2 { margin: 0 0 18px; font-size: 1.15rem; }
dialog#reglages h3 {
  margin: 0 0 4px; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--encre-douce);
}
dialog#reglages section { margin-bottom: 22px; }
dialog#reglages section:last-of-type { margin-bottom: 18px; }

.explication {
  margin: 0 0 10px; font-size: .85rem; color: var(--encre-douce);
}
.explication:empty { display: none; }

.ligne-reglage {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 8px; font-size: .9rem;
}
.ligne-reglage input[type=number] {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--trait); border-radius: 7px;
  padding: 6px 8px; width: 5.5em; text-align: right;
  font-variant-numeric: tabular-nums;
}
.ligne-reglage input[type=number]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.ligne-reglage button[hidden] { display: none; }

.actions-dialogue { margin: 0; text-align: right; }

.pastille-etat {
  font-size: .78rem; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; background: var(--bg); color: var(--encre-douce);
  border: 1px solid var(--trait);
}
.pastille-etat.actif {
  background: var(--accent-doux); color: var(--accent);
  border-color: var(--accent);
}

/* --------------------------------- interrupteur et termes personnels */

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.interrupteur {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: .9rem;
}
.interrupteur[hidden] { display: none; }
.interrupteur input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

.ligne-reglage input[type=text] {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--trait); border-radius: 7px;
  padding: 6px 10px; flex: 1 1 11rem; min-width: 0;
}
.ligne-reglage input[type=text]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.liste-termes {
  list-style: none; margin: 0 0 10px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.liste-termes:empty { display: none; }
.liste-termes li {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-doux); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 3px 5px 3px 12px; font-size: .84rem;
}
.liste-termes button {
  font: inherit; line-height: 1; cursor: pointer;
  background: none; border: 0; color: inherit;
  padding: 2px 6px; border-radius: 999px; opacity: .75;
}
.liste-termes button:hover { opacity: 1; background: var(--panneau); }

.mes-termes[hidden] { display: none; }
.mes-termes .pastille { border-style: dashed; }
.mes-termes .pastille[aria-pressed=true] { border-style: solid; }
