/* Thème par défaut — chaque variable peut être changée pour créer un autre style */
:root {
  --fond: #f3eee3;
  --texte: #111111;
  --doux: #777777;
  --bord: #cccccc;
  --accent: #e10600;   /* puces, ENS du logo, bouton play, barre */
  --lien: #111111;     /* liens, boucle active */
  --police: "Noto Sans Mono", "DejaVu Sans Mono", ui-monospace, Menlo, Consolas, monospace;
  --h1-prefixe: "";
  --h2-prefixe: "";
  --puce: "■";
  --separateur: "";
  --compte-avant: "(";
  --compte-apres: ")";
  --num: none;         /* "inline" pour afficher les numéros 01, 02… */
  color-scheme: light;
}

* { box-sizing: border-box; }

body { margin: 0; background: var(--fond); }

.recueil {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 1.02rem;
  line-height: 1.65;
}

.recueil ::selection { background: var(--accent); color: var(--fond); }

.entete, .recueil main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}
.entete { padding-block: 40px 8px; }
.recueil main { padding-bottom: 64px; }

/* ---------- En-tête ---------- */
.recueil h1 {
  margin: 0;
  font-family: var(--police-titre, inherit);
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  line-height: 1.3;
}
.recueil h1::before { content: var(--h1-prefixe); color: var(--accent); }
.intro { margin: 12px 0 0; max-width: 52ch; }
.pied {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: var(--doux);
  font-size: .85rem;
  text-align: center;
}
.compte { margin: 4px 0 0; color: var(--doux); font-size: .9rem; }
.compte::before { content: var(--compte-avant); }
.compte::after { content: var(--compte-apres); }

.recueil a { color: var(--lien); text-decoration: none; }
.recueil a:hover { color: var(--accent); }

.num { display: var(--num); color: var(--accent); }

/* ---------- Sommaire ---------- */
.sommaire { margin: 28px 0 8px; }
.sommaire ol { list-style: none; margin: 0; padding: 0; }
.sommaire .categorie + .categorie { margin-top: 14px; }
.nom-categorie { font-weight: 700; }
.nom-categorie::before { content: var(--puce) " "; color: var(--accent); }
.sommaire ul { list-style: none; margin: 2px 0 0; padding-left: 1.6em; }
.recueil a.nom-categorie { color: var(--texte); }
.recueil a.nom-categorie:hover { color: var(--accent); }

/* Bouton déplier : seulement sur mobile */
.deplier { display: none; margin-top: 12px; font-size: .9rem; }
.deplier span {
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  transform: rotate(-90deg);          /* < tourné vers le bas */
  transition: transform .2s;
}
.deplier[aria-expanded="true"] span { transform: rotate(90deg); }   /* vers le haut */
@media (max-width: 480px) {
  .deplier { display: inline-block; }
  .sommaire:not(.ouvert) .titres { display: none; }
  .sommaire:not(.ouvert) .categorie + .categorie { margin-top: 4px; }
}

/* Sur PC : catégories sur deux colonnes */
@media (min-width: 640px) {
  .sommaire > ol { display: flex; flex-wrap: wrap; gap: 18px 32px; }
  .sommaire .categorie { flex: 1 1 calc(50% - 16px); }
  .sommaire .categorie + .categorie { margin-top: 0; }
}

/* ---------- Chanson ---------- */
.chanson { scroll-margin-top: 16px; }
.chanson::before {
  content: var(--separateur);
  display: block;
  text-align: center;
  color: var(--doux);
  letter-spacing: .3em;
  margin: 40px auto;
}

/* Logo image + titre côte à côte */
.marque { display: flex; align-items: center; gap: 16px; }
.logo { width: 96px; height: 96px; flex: none; }

/* « ~ / » rouge : lien vers la page perso */
.recueil .maison {
  flex: none;
  color: var(--accent);
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  font-weight: 700;
  white-space: nowrap;
}
.recueil .maison:hover { color: var(--accent); text-decoration: underline; }


.btn-texte {
  padding: 0;
  border: none;
  background: none;
  color: var(--texte);
  font: inherit;
  cursor: pointer;
}
.btn-texte::before { content: "[ "; color: var(--doux); }
.btn-texte::after  { content: " ]"; color: var(--doux); }
.btn-texte:hover { color: var(--accent); }
.btn-texte:disabled { opacity: .5; cursor: wait; }
.btn-texte:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }


@media (max-width: 480px) {
  .marque { gap: 10px; }
  .logo { width: 56px; height: 56px; }
  .recueil h1, .recueil .maison { font-size: 1.25rem; }
}

/* Titre : ENS en rouge */
.l-ens { color: var(--accent); }

.recueil h2 {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin: 0;
  font-family: var(--police-titre, inherit);
  font-size: 1.4rem;
  line-height: 1.3;
}
.recueil h2::before { content: var(--h2-prefixe); color: var(--accent); margin-right: -12px; }
.recueil h2 .num { font-size: .9rem; font-weight: 400; }

.remarque { margin: 2px 0 0; color: var(--doux); font-style: italic; }

.paroles {
  white-space: pre-line;
  margin: 20px 0 0;
  padding-left: 16px;
  border-left: 2px solid var(--bord);
}

/* ---------- Lecteur audio ---------- */
.lecteur {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--texte);
  font: inherit;
  font-family: var(--police);
  cursor: pointer;
}
/* crochets autour des icônes : [▶] */
/* crochets dessinés (bordures) : toujours centrés, quel que soit le navigateur */
.btn::before, .btn::after {
  content: "";
  display: block;
  flex: none;
  width: 4px;
  height: var(--crochet, 15px);
  border: 1.5px solid var(--doux);
}
.btn::before { border-right: none; margin-right: 2px; }
.btn::after  { border-left: none;  margin-left: 2px; }
.btn svg { width: 18px; height: 18px; margin: 0; fill: currentColor; }
.btn:hover { color: var(--accent); }
.btn:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

.btn-play { color: var(--accent); }
.btn-boucle[aria-pressed="false"] svg { opacity: .4; }
.btn-boucle[aria-pressed="true"] { color: var(--lien); }
.btn-boucle:hover, .btn-boucle[aria-pressed="true"]:hover { color: var(--accent); }
.btn-boucle:hover svg { opacity: 1; }

/* barre de progression fine */
.progression {
  flex: 1;
  min-width: 0;
  height: 18px;
  margin: 0 6px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  --pct: 0%;
}
.progression::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--pct) 100% no-repeat, var(--bord);
}
.progression::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
}
.progression::-moz-range-track { height: 2px; background: var(--bord); }
.progression::-moz-range-progress { height: 2px; background: var(--accent); }
.progression::-moz-range-thumb {
  width: 10px; height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
}

.temps {
  min-width: 11ch;
  text-align: right;
  flex: none;
  font-size: .85rem;
  color: var(--doux);
  font-variant-numeric: tabular-nums;
}

.erreur-audio { margin: 8px 0 0; color: var(--accent); font-size: .9rem; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .recueil { font-size: .98rem; }
  /* Lecteur mobile : grille sur 2 lignes
       ▶  ⏮  🔁            ⬇
       ━━━━━━●──────  0:07 / 0:30          */
  .lecteur {
    display: grid;
    grid-template-columns: auto auto auto 1fr auto;
    grid-template-areas:
      "play debut boucle . dl"
      "barre barre barre barre temps";
    align-items: center;
    gap: 4px 12px;
    padding: 6px 0;
  }
  .lecteur .btn-play   { grid-area: play; }
  .lecteur .btn-debut  { grid-area: debut; }
  .lecteur .btn-boucle { grid-area: boucle; }
  .lecteur .btn-dl-audio { grid-area: dl; }
  .lecteur .progression  { grid-area: barre; }
  .lecteur .temps        { grid-area: temps; }

  /* boutons : même style [▶] que sur PC, juste un peu plus hauts pour le doigt */
  .lecteur .btn { height: 44px; --crochet: 20px; }
  .lecteur .btn::before { margin-right: 2px; }
  .lecteur .btn::after { margin-left: 2px; }
  .lecteur .btn svg { width: 26px; height: 26px; margin: 0; }
  .lecteur .btn-dl-audio { justify-self: end; }

  .progression { width: 100%; height: 32px; margin: 0; }
  .progression::-webkit-slider-runnable-track { height: 4px; }
  .progression::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7px; }
  .progression::-moz-range-track,
  .progression::-moz-range-progress { height: 4px; }
  .progression::-moz-range-thumb { width: 18px; height: 18px; }
  .temps { font-size: .85rem; }
}

/* ---------- Variante : lecteur sans barre de temps ----------
   (ajoute la classe "sans-barre" sur <div class="recueil">) */
.sans-barre .progression { display: none; }
.sans-barre .temps { margin-left: auto; }
@media (max-width: 480px) {
  .sans-barre .lecteur {
    grid-template-columns: auto auto auto 1fr auto;
    grid-template-areas: "play debut boucle temps dl";
  }
  .sans-barre .temps { margin: 0; font-size: .8rem; }
}
