:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --text: #1c1e26;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #e63946;
  --accent-dark: #c1121f;
  --gold: #c99a2e;
  --silver: #8a8f98;
  --bronze: #a9714a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1c1f27;
    --text: #eceef2;
    --muted: #9aa0ab;
    --border: #2a2e38;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; }
header.site { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-inner { max-width: 1100px; margin: 0 auto; padding: .75rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--accent); text-decoration: none; white-space: nowrap; }
nav.radios { display: flex; gap: .4rem; flex-wrap: wrap; }
nav.radios a { padding: .35rem .7rem; border-radius: 999px; text-decoration: none; color: var(--text); font-size: .85rem; border: 1px solid transparent; }
nav.radios a:hover { background: var(--bg); }
nav.radios a.active { background: var(--accent); color: #fff; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.card h3 a { text-decoration: none; }
.mini-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-top: 1px dashed var(--border); }
.mini-list li:first-child { border-top: none; }
.rank { font-weight: 700; width: 1.4rem; text-align: center; color: var(--muted); flex: none; }
.rank.r1 { color: var(--gold); } .rank.r2 { color: var(--silver); } .rank.r3 { color: var(--bronze); }
.cover { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--border); flex: none; }
/* Cadre titre/artiste : largeur flexible mais toujours fixe une fois calculée,
   ne mange jamais sur .count (flex:none) ni sur la pochette (flex:none). */
.title-artist { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .2rem; cursor: default; }
.title-artist .titre, .title-artist .artiste { overflow: hidden; white-space: nowrap; position: relative; }
.title-artist .titre { font-weight: 600; cursor: pointer; }
.title-artist .artiste { font-size: .8rem; color: var(--muted); }
.title-artist .t { display: inline-block; white-space: nowrap; max-width: 100%; vertical-align: top; }
.title-artist .titre:not(.has-overflow) .t, .title-artist .artiste:not(.has-overflow) .t { overflow: hidden; text-overflow: ellipsis; }
/* Au survol (desktop) ou après un clic (tactile), le texte trop long défile
   dans son cadre fixe au lieu d'être juste tronqué. */
.title-artist .titre.has-overflow:hover .t,
.title-artist .artiste.has-overflow:hover .t,
.title-artist .titre.expanded .t {
  animation: marquee 6s linear infinite;
}
@keyframes marquee {
  0%, 12% { transform: translateX(0); }
  88%, 100% { transform: translateX(calc(-1 * var(--overflow-px, 0px))); }
}
.count { font-size: .8rem; color: var(--muted); flex: none; }
.more-link { display: inline-block; margin-top: .75rem; font-size: .85rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 .75rem; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 1.15rem; }
.subnav { display: flex; gap: .5rem; margin: 0 0 1.25rem; flex-wrap: wrap; position: sticky; top: var(--header-h, 57px); background: var(--bg); padding: .6rem 0; z-index: 9; }
.subnav a { padding: .3rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-size: .85rem; }
.subnav a:hover { border-color: var(--accent); }
/* Évite que le titre d'une section n'atterrisse caché sous le header + les
   chips sticky après un clic sur une ancre du sous-menu. */
section[id] { scroll-margin-top: var(--sticky-h, 120px); }
.period-switcher { display: flex; gap: .5rem; margin: 0 0 1.5rem; flex-wrap: wrap; }
.period-btn { padding: .4rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-family: inherit; color: var(--text); cursor: pointer; }
.period-btn:hover { border-color: var(--accent); }
.period-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Spécificité classe+attribut nécessaire : sinon .card-grid{display:grid} (règle
   auteur) prime sur le display:none par défaut de [hidden] (règle user-agent). */
.period-panel[hidden] { display: none; }
.stats { color: var(--muted); font-size: .85rem; margin: 0 0 1rem; }
.empty { color: var(--muted); font-style: italic; padding: 1rem 0; }
footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }
footer.site .disclaimer-title { font-weight: 700; letter-spacing: .05em; margin: 1rem 0 .35rem; }
footer.site .disclaimer { max-width: 40rem; margin: 0 auto; line-height: 1.5; }
@media (max-width: 640px) { .site-inner { flex-direction: column; align-items: flex-start; } }

/* ------------------------- Encart accordéon ------------------------------ */
/* La ligne entière est cliquable (role="button" en HTML, pas un vrai <button> :
   ça évite de remanier la mise en page flex dont dépend le calcul de
   débordement du marquee). */
.track { cursor: pointer; }
.track:hover { background: var(--bg); }
.track:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chev { flex: none; width: 1rem; text-align: center; color: var(--muted); font-size: .7rem;
        transition: transform .18s ease; }
.chev::before { content: "\25B6"; display: inline-block; }
.track[aria-expanded="true"] .chev { transform: rotate(90deg); color: var(--accent); }
.track[aria-expanded="true"] { background: var(--bg); }

/* Le panneau vit dans un frère de la ligne (li.panel-li) : un li en
   display:flex ne peut pas l'héberger directement. */
.mini-list li.panel-li { display: block; padding: 0; border-top: none; }
/* Même piège de spécificité que .period-panel plus haut : une règle auteur
   display:block/grid bat le [hidden] de l'agent utilisateur. */
.mini-list li.panel-li[hidden] { display: none; }

/* Ouverture animée sans connaître la hauteur du contenu : 0fr -> 1fr. Les
   navigateurs qui ne l'animent pas ouvrent instantanément, ce qui est correct. */
.track-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.track-panel > * { overflow: hidden; min-height: 0; }
.track-panel.open { grid-template-rows: 1fr; }
.panel-inner { padding: .85rem .25rem 1rem; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.track-player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000;
                border-radius: var(--radius); overflow: hidden; }
.track-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Le widget Deezer n'est pas un lecteur vidéo : lui imposer du 16/9 laisserait
   une grande zone vide sous les contrôles. */
.track-player.is-deezer { aspect-ratio: auto; height: 152px; background: none; }
.panel-meta { font-size: .85rem; min-width: 0; }
.panel-meta dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .6rem; margin: 0; }
.panel-meta dt { color: var(--muted); }
.panel-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.panel-stats { margin: .5rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.panel-bio { margin: .6rem 0 0; line-height: 1.45; }
.panel-bio p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
               overflow: hidden; }
.panel-bio.unfold p { -webkit-line-clamp: unset; overflow: visible; }
.panel-bio button { background: none; border: 0; padding: 0; margin-top: .2rem; font: inherit;
                    font-size: .8rem; color: var(--accent); cursor: pointer; }
.panel-bio .src { color: var(--muted); font-size: .75rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0 0; }
.tag { font-size: .72rem; padding: .15rem .5rem; border-radius: 999px; background: var(--bg);
       border: 1px solid var(--border); color: var(--muted); }
.panel-links { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 0; }
.panel-links a { font-size: .78rem; padding: .3rem .7rem; border-radius: 999px; background: var(--surface);
                 border: 1px solid var(--border); text-decoration: none; }
.panel-links a:hover { border-color: var(--accent); color: var(--accent); }
.panel-note { color: var(--muted); font-size: .8rem; font-style: italic; margin: .5rem 0 0; }
/* Accueil : une carte ne fait que ~260px, le lecteur prend toute la largeur et
   les métadonnées passent dessous. */
main[data-skin="compact"] .panel-grid { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
@media (max-width: 560px) {
  .panel-grid { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .panel-meta dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .panel-meta dt { margin-top: .35rem; }
}
