/* Styles communs aux pages musique des Éditions Douces.
   Chaque page redéfinit ses couleurs dans son propre <style>. */
@font-face { font-family: "IM Fell English"; src: url("/commun/fonts/im-fell-english.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/commun/fonts/eb-garamond-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/commun/fonts/eb-garamond-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/commun/fonts/eb-garamond-semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #d9d3ca;
  --bar: #cfc8bd;
  --ink: #221c19;
  --muted: #5e554f;
  --rust: #873a1f;
  --lead: #56616c;
  --on-rust: #fbf3ee;
  --trait: #c21f1b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #241e1b;
    --bar: #2f2825;
    --ink: #e8dfd3;
    --muted: #a5998e;
    --rust: #d8793f;
    --lead: #8d99a6;
    --on-rust: #1c1311;
    --trait: #ff3b30;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  font-size: 1.1875rem;
  line-height: 1.6;
}
[hidden] { display: none !important; }

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 2.25rem) max(1.25rem, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12rem) max(1.25rem, env(safe-area-inset-left, 0px));
}
h1, h2, h3 { font-family: "IM Fell English", "EB Garamond", Georgia, serif; font-weight: 400; }
.publisher { margin: 0 0 1.4rem; font-style: italic; }
.publisher a { color: var(--muted); text-decoration: none; }
.publisher a:hover { color: var(--rust); }
h1 { font-size: clamp(2.5rem, 10.5vw, 4rem); line-height: 1; margin: 0 0 1rem; letter-spacing: -0.01em; }
.intro { margin: 0; max-width: 34rem; }

/* Onglets Musiques / Chansons */
.tabs {
  position: sticky; top: 0; z-index: 5;
  margin: 1.5rem calc(-1 * max(1.25rem, env(safe-area-inset-left, 0px))) 0;
  padding: calc(env(safe-area-inset-top, 0px) + 0.6rem) max(1.25rem, env(safe-area-inset-left, 0px)) 0.6rem;
  background: var(--bg);
}
.tabs-inner { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rust); border-radius: 2px; max-width: 26rem; }
.tabs button {
  font: inherit; font-weight: 600; min-height: 3rem; padding: 0.5rem 1rem;
  color: var(--rust); background: transparent; border: 0; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--rust); color: var(--on-rust); }
.tab-note { margin: 1.3rem 0 0; color: var(--muted); font-style: italic; max-width: 34rem; }

/* Une série */
.serie { position: relative; margin-top: 2.5rem; padding-left: 1.35rem; }
.serie .scar {
  position: absolute; left: 0; top: 0.4rem; bottom: 0;
  width: 3px; border-radius: 3px;
  background: linear-gradient(to bottom, var(--trait) 0%, var(--trait) 92%, transparent 100%);
  box-shadow: 0 0 6px color-mix(in srgb, var(--trait) 45%, transparent);
  opacity: 0.6;
  transition: opacity 1.2s ease;
}
.serie.playing .scar { opacity: 0.95; animation: beat 120s ease-out infinite; }
@keyframes beat {
  0%   { box-shadow: 0 0 6px color-mix(in srgb, var(--trait) 45%, transparent); }
  0.7% { box-shadow: 0 0 26px 4px color-mix(in srgb, var(--trait) 60%, transparent); }
  2%, 100% { box-shadow: 0 0 6px color-mix(in srgb, var(--trait) 45%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .serie.playing .scar { animation: none; } }
.serie h2 { font-size: clamp(2.3rem, 9.5vw, 3.4rem); line-height: 0.95; margin: 0.1rem 0 0; }
.serie .accroche { margin: 0.45rem 0 0.4rem; font-style: italic; color: var(--muted); }
.buy { color: var(--rust); font-size: 0.95rem; text-decoration-color: currentColor; text-underline-offset: 0.18em; }

.head { display: grid; grid-template-columns: 6.25rem 1fr; gap: 1.1rem; align-items: start; }
@media (min-width: 34rem) { .head { grid-template-columns: 8rem 1fr; gap: 1.4rem; } }
.cover { display: block; }
.cover img {
  display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 2px;
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--ink) 18%, transparent);
  background: var(--bar);
}
a.cover:hover img { transform: translateY(-2px); transition: transform .15s ease; }
.cover-empty {
  aspect-ratio: 2 / 3; display: grid; place-items: center; text-align: center;
  padding: 0.5rem; border: 1px dashed var(--lead); border-radius: 2px;
  font-size: 0.85rem; font-style: italic; color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.3rem 0 0.4rem; }
.play {
  font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.7rem;
  min-height: 3.1rem; padding: 0.65rem 1.3rem 0.65rem 1.05rem;
  background: var(--rust); color: var(--on-rust);
  border: 1px solid var(--rust); border-radius: 2px; cursor: pointer;
  max-width: 100%; text-align: left;
}
.play svg { flex-shrink: 0; }
.play:hover { filter: brightness(1.08); }
.play.alt { background: transparent; color: var(--rust); font-weight: 400; }
.play.alt:hover { background: color-mix(in srgb, var(--rust) 10%, transparent); filter: none; }
.play[disabled] { opacity: 0.55; cursor: default; }
.mini-wrap { margin-top: 0.7rem; }
.play.mini { min-height: 2.5rem; padding: 0.35rem 0.85rem 0.35rem 0.7rem; gap: 0.5rem; font-size: 0.95rem; }
.play.mini svg { width: 18px; height: 18px; }
.small-note { margin: 0.2rem 0 0; font-size: 0.92rem; font-style: italic; color: var(--muted); }

/* Un tome (vue Chansons) */
.group { margin-top: 2.4rem; }
.group h3 { font-size: 1.75rem; line-height: 1.05; margin: 0.1rem 0 0.15rem; }
.group .book { margin: 0 0 0.35rem; font-style: italic; }
.group .when { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--muted); }

ol.tracks { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.track {
  font: inherit; color: inherit; text-align: left;
  width: 100%; display: flex; align-items: baseline; gap: 0.8rem;
  padding: 0.5rem 0.4rem 0.5rem 0.9rem; min-height: 2.75rem;
  background: none; border: 0; border-left: 2px solid transparent;
  cursor: pointer;
}
.track:hover { background: color-mix(in srgb, var(--rust) 9%, transparent); }
.track .state { margin-left: auto; font-size: 0.9rem; font-style: italic; color: var(--trait); white-space: nowrap; }
.track[aria-current="true"] { border-left-color: var(--trait); font-weight: 600; }
.empty { color: var(--muted); font-style: italic; margin: 0.8rem 0 0; }

footer { margin-top: 4.5rem; color: var(--muted); font-size: 0.95rem; text-align: center; }
footer .logo { display: inline-block; border-radius: 50%; }
footer .logo img { display: block; width: 120px; height: 120px; }
footer .logo:hover img { transform: rotate(-4deg); transition: transform .2s ease; }
footer p { margin: 0.8rem auto 0; max-width: 30rem; }
footer p:empty { display: none; }
footer a:not(.logo) { color: var(--ink); text-decoration-color: var(--rust); text-underline-offset: 0.18em; }

/* Lecteur fixé en bas */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--bar);
  border-top: 2px solid var(--trait);
  padding: 0.7rem max(1rem, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 0.7rem) max(1rem, env(safe-area-inset-left, 0px));
}
.player-inner { max-width: 44rem; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; gap: 0.2rem 0.9rem; align-items: center; }
.now-cover { width: 3rem; aspect-ratio: 1; object-fit: cover; border-radius: 2px; display: block; }
.now { min-width: 0; }
.now-title { font-family: "IM Fell English", "EB Garamond", Georgia, serif; font-size: 1.3rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-context { font-size: 0.88rem; font-style: italic; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; gap: 0.2rem; }
.controls button, .vol button {
  width: 3rem; height: 3rem; display: grid; place-items: center;
  color: var(--ink); background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.controls button.main { background: var(--rust); color: var(--on-rust); }
.controls button:hover, .vol button:hover { background: color-mix(in srgb, var(--rust) 14%, transparent); }
.controls button.main:hover { background: var(--rust); filter: brightness(1.08); }
.seek { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.7rem; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek input { flex: 1; accent-color: var(--rust); min-width: 0; height: 1.5rem; }
.vol { display: flex; align-items: center; gap: 0.1rem; flex: 0 0 auto; }
.vol button { width: 2.5rem; height: 2.5rem; }
.seek .vol input { flex: 0 0 auto; width: 5rem; }
@media (min-width: 34rem) { .seek .vol input { width: 7rem; } }
.message { grid-column: 1 / -1; font-size: 0.9rem; color: var(--trait); margin: 0; }
.message:empty { display: none; }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--trait); outline-offset: 2px; }

/* Texte réservé aux lecteurs d'écran */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barre du haut : retour aux albums (bouton) et retour au site (lien discret) */
.barre-haut { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.retour {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.75rem; padding: 0.4rem 1rem;
  border: 1px solid var(--rust); border-radius: 2px; color: var(--rust);
  font-weight: 600; text-decoration: none; background: transparent;
}
.retour:hover { background: color-mix(in srgb, var(--rust) 12%, transparent); }
.lien-site {
  display: inline-flex; align-items: center; min-height: 2.75rem;
  color: var(--muted); font-size: 0.95rem; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); text-underline-offset: 0.2em;
}
.lien-site:hover { color: var(--rust); text-decoration-color: currentColor; }

/* En-tête d'un album : la pochette porte le titre, elle s'affiche en grand */
.album-tete { text-align: center; margin-top: 0.8rem; }
.pochette {
  display: block; width: min(100%, 26rem); height: auto; aspect-ratio: 1; margin: 0 auto;
  object-fit: cover; border-radius: 4px; background: var(--bar);
  box-shadow: 0 10px 30px color-mix(in srgb, #000 35%, transparent);
}
.pochette-vide {
  width: min(100%, 26rem); aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center;
  border: 1px dashed var(--muted); border-radius: 4px; color: var(--muted); font-style: italic; padding: 1rem;
}
.album-tete .intro { margin: 1.3rem auto 0; }
.album-tete .actions { justify-content: center; }

/* Une partie d'album (un tome, par exemple) */
.tome { position: relative; margin-top: 2.8rem; padding-left: 1.35rem; }
.tome .scar {
  position: absolute; left: 0; top: 0.4rem; bottom: 0; width: 3px; border-radius: 3px;
  background: linear-gradient(to bottom, var(--trait) 0%, var(--trait) 92%, transparent 100%);
  opacity: 0.7;
}
.tome h2 { font-size: clamp(1.9rem, 7vw, 2.5rem); line-height: 1; margin: 0; }
.tome .sous-titre { margin: 0.3rem 0 0; font-style: italic; color: var(--muted); }
.tome .lien-livre { display: inline-block; margin-top: 0.3rem; }
.tome.playing .scar { opacity: 1; box-shadow: 0 0 14px color-mix(in srgb, var(--trait) 55%, transparent); }

/* Accueil : les albums */
.albums { display: flex; flex-wrap: wrap; justify-content: center; gap: 2.6rem 1.8rem; margin-top: 2.4rem; }
.album-carte { display: block; flex: 0 1 26rem; color: inherit; text-decoration: none; text-align: center; }
@media (min-width: 40rem) { .album-carte { flex-basis: calc(50% - 0.9rem); } }
.album-carte img, .album-carte .pochette-vide { width: 100%; }
.album-carte img {
  display: block; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--bar);
  box-shadow: 0 10px 28px color-mix(in srgb, #000 30%, transparent);
  transition: transform .2s ease, box-shadow .2s ease;
}
.album-carte:hover img { transform: translateY(-3px); box-shadow: 0 14px 34px color-mix(in srgb, #000 38%, transparent); }
@media (prefers-reduced-motion: reduce) { .album-carte img { transition: none; } }
.album-carte .legende { display: block; margin-top: 0.8rem; font-style: italic; color: var(--muted); }
.album-carte .ouvrir { display: inline-block; margin-top: 0.2rem; font-weight: 600; color: var(--rust); }

/* L'accueil n'a pas de lecteur en bas : moins de marge */
main.accueil { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 3rem); }
main.accueil header { margin-top: 1rem; }
