/* =======================
   RESET
   ======================= */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* =======================
   BASE + VARIABLES
   ======================= */
:root {
  --blue-900: #003366;
  --blue-600: #0052cc;
  --blue-500: #0066ff;
  --blue-300: #99BBFF;
  --blue-200: #E0ECFF;
  --ink: #000;
  --bg: #fff;
  --line: #ccc;

  /* largeur fixe pour colonnes Image/Lecteur */
  --track-cell: 220px;
}

html:focus-within {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
}

/* =======================
   PAGE WRAPPER
   ======================= */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Fond spécifique pour la page index */
body#index-page .page-wrapper {
  background-color: var(--blue-200);
  color: var(--blue-900);
  border-radius: 8px;
  padding: 20px;
}

/* =======================
   HEADER + NAV
   ======================= */
header {
  background: var(--blue-200);
  color: var(--blue-900);
  padding: 10px 20px;
  border-bottom: 2px solid var(--blue-300);
  position: relative;
  z-index: 50;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: bold;
  color: var(--blue-900);
}

.logo-img {
  width: 60px;
  height: 60px;
}

.logo span {
  color: var(--blue-900);
  font-size: 20px;
  font-weight: bold;
}

/* Liens du menu */
.nav-links {
  list-style: none;
  display: flex;
  gap: 15px;
  position: relative;
}

.nav-links a,
.dropdown-link {
  color: var(--blue-900);
  text-decoration: none;
  padding: 5px 10px;
  transition: background 0.3s, color 0.3s;
  border-radius: 4px;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.dropdown-link:hover,
.dropdown-link:focus-visible {
  background: var(--blue-300);
  color: #ffffff;
}

/* Bouton hamburger (mobile) */
.hamburger {
  display: none;
  font-size: 1.5em;
  background: none;
  border: none;
  color: var(--blue-900);
  cursor: pointer;
}

/* =======================
   SOUS-MENU (Musique → Chorale)
   ======================= */
.dropdown {
  position: relative;
  display: flex;
  /* mobile : lien + bouton ▾ côte à côte */
  align-items: center;
  gap: 6px;
}

.submenu-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--blue-900);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.submenu-toggle:focus-visible {
  outline: 3px solid #99bbff80;
  outline-offset: 2px;
}

.submenu {
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--blue-300);
  border-radius: 6px;
  padding: 6px 0;
  margin: 6px 0 0 0;
  min-width: 200px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
}

.submenu[hidden] {
  display: none;
}

.submenu li a {
  display: block;
  padding: 8px 12px;
  color: var(--blue-900);
  text-decoration: none;
}

.submenu li a:hover,
.submenu li a:focus-visible {
  background: var(--blue-300);
  color: #fff;
}

/* au-dessus du contenu */
.dropdown .submenu {
  z-index: 1000;
}

/* =======================
   FOOTER
   ======================= */
footer {
  text-align: center;
  padding: 1em;
  margin-top: 2em;
  border-top: 1px solid #ccc;
  font-size: 0.9rem;
  color: #555;
}

/* =======================
   MAIN
   ======================= */
main {
  padding: 20px;
}

main p {
  line-height: 1.7;
  margin-bottom: 1.2em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--blue-900);
}

/* =======================
   TITRE PLEINE LARGEUR (index)
   ======================= */
#index-page .fullwidth-title {
  background: #ffffff;
  height: 2cm;
  line-height: 2cm;
  margin: 0 0 1.2em 0;
  text-align: center;
  border-bottom: 2px solid var(--blue-300);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 6px;
}

/* =======================
   INTRO
   ======================= */
.intro {
  text-align: center;
  margin: 2em auto;
  max-width: 800px;
}

.intro h1 {
  font-size: 2rem;
  margin-bottom: 0.4em;
}

.intro p {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--blue-900);
}

/* =======================
   CONTENT
   ======================= */
.content h2 {
  margin-bottom: 1.2em;
}

/* ——— Spécifique à la page Légendes ——— */
#page-legendes .content p i {
  display: inline-block;
  margin-left: 2rem;
}

@media (max-width: 640px) {
  #page-legendes .content p i {
    margin-left: 1.25rem;
  }
}

/* =======================
   BLOC-TITRE
   ======================= */
.bloc-titre {
  font-style: italic;
  color: var(--blue-900);
  margin-top: 1em;
}

/* =======================
   RESPONSIVE — MOBILE (≤ 768px)
   ======================= */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    background: var(--blue-200);
    position: absolute;
    top: 60px;
    right: 0;
    width: 220px;
    padding: 10px;
    border-left: 2px solid var(--blue-300);
    border-bottom: 2px solid var(--blue-300);
  }

  .nav-links.show {
    display: flex;
  }

  .hamburger {
    display: block;
  }

  .dropdown .submenu {
    position: static;
    margin-left: 0;
    box-shadow: none;
    background: #fff;
    border-color: var(--blue-300);
  }
}

/* =======================
   RESPONSIVE — DESKTOP (≥ 769px)
   ======================= */
@media (min-width: 769px) {
  .nav-links {
    display: flex;
    position: static;
  }

  .hamburger {
    display: none;
  }

  .submenu-toggle {
    display: none;
  }

  .dropdown {
    position: relative;
    display: inline-block;
  }

  .dropdown .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    margin-top: 0;
    padding: 6px 0;
    background: #fff;
    border: 1px solid var(--blue-300);
    border-radius: 6px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
    display: none;
    z-index: 1000;
  }

  .dropdown:hover .submenu,
  .dropdown:focus-within .submenu,
  .dropdown .submenu:hover {
    display: block;
  }

  .dropdown .submenu li a {
    white-space: nowrap;
  }
}

/* =======================
   LIENS GLOBAUX
   ======================= */
a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed #ccc;
  padding-bottom: 2px;
  transition: border-color 0.3s ease;
}

a:hover,
a:focus-visible {
  border-bottom-color: #666;
}

.nav-links a,
.glossaire-nav a,
.animaginaux-nav a {
  border-bottom: none !important;
}

/* ===============================================================
   Bannière de navigation – Animaginaux
   =============================================================== */
.animaginaux-nav {
  margin-bottom: 20px;
  padding: 10px;
  background: var(--blue-200);
  border: 1px solid var(--blue-300);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.animaginaux-nav a {
  display: inline-block;
  padding: 6px 10px;
  color: var(--blue-900);
  text-decoration: none;
  font-weight: bold;
  border-radius: 4px;
  transition: background 0.3s, color 0.3s;
}

.animaginaux-nav a:hover,
.animaginaux-nav a:focus-visible {
  background: #6699FF;
  color: #ffffff;
}

/* =======================
   GLOSSAIRE – barre de lettres
   ======================= */
.glossaire-nav {
  margin-top: 20px;
  padding: 10px;
  background: var(--blue-200);
  border: 1px solid var(--blue-300);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.glossaire-nav a {
  display: inline-block;
  padding: 4px 8px;
  color: var(--blue-900);
  text-decoration: none;
  font-weight: bold;
  border-radius: 4px;
  transition: background 0.3s, color 0.3s;
}

.glossaire-nav a:hover,
.glossaire-nav a:focus-visible {
  background: #6699FF;
  color: #ffffff;
}

/* =======================
   PHRASES COMMUNES & BANNIÈRES
   ======================= */
p.phrase-commune {
  margin: 0;
}

.glossaire-banner {
  display: flex;
  justify-content: center;
  margin: 30px 0;
}

.glossaire-banner img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ——— Renvois de notes ——— */
sup a {
  text-decoration: none;
  font-size: 0.75em;
  color: var(--text-muted, #666);
}

sup a:hover {
  text-decoration: underline;
}

/* Séparateur de notes */
.notes-sep {
  border: none;
  border-top: 1px solid var(--line-soft, #ddd);
  margin: 2.5rem 0 1.5rem;
}

/* Bloc des notes */
#notes {
  font-size: 0.92em;
  line-height: 1.45;
  color: var(--text-dim, #444);
}

#notes p {
  margin: 0.5em 0;
}

#notes a {
  text-decoration: none;
  color: var(--text-muted, #666);
}

#notes a:hover {
  text-decoration: underline;
}

/* =======================
   LIGNE DE SÉPARATION GÉNÉRIQUE
   ======================= */
.separator {
  display: block;
  width: 100%;
  height: 1px;
  background-color: var(--line);
  opacity: 0.3;
  margin: 2rem 0;
}

/* =======================
   PLAYER PERSONNALISÉ
   ======================= */
.player {
  margin: 2rem auto;
  padding: 1rem;
  background: #f0f8ff;
  border: 1px solid var(--blue-300);
  border-radius: 8px;
  text-align: center;
  max-width: 400px;
}

.play-btn {
  background: var(--blue-500);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 0.8rem;
  width: 120px;
}

.play-btn:hover,
.play-btn:focus-visible {
  background: var(--blue-600);
}

.play-btn:focus-visible,
.seek-bar:focus-visible {
  outline: 3px solid #99bbff80;
  outline-offset: 2px;
}

.seek-bar {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #cce4ff;
  border-radius: 3px;
  outline: none;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--blue-500);
  border-radius: 50%;
  cursor: pointer;
}

.seek-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--blue-500);
  border-radius: 50%;
  cursor: pointer;
}

/* Temps écoulé / durée */
.time {
  margin-top: .6rem;
  font-size: .95rem;
  color: var(--blue-900);
  display: flex;
  justify-content: center;
  gap: .35rem;
  font-variant-numeric: tabular-nums;
}

/* =======================
   TABLEAU DES MORCEAUX
   ======================= */
.tracks {
  display: grid;
  grid-template-columns: 1fr var(--track-cell) var(--track-cell);
  /* Titre | Image | Lecteur */
  gap: 16px 20px;
  align-items: stretch;
}

.tracks .track-title,
.tracks .track-art,
.tracks .track-cell {
  height: 100%;
  display: flex;
  align-items: center;
  background: #f0f8ff;
  border: 1px solid var(--blue-300);
  border-radius: 8px;
  padding: 1rem;
  margin: 0;
}

.tracks .track-title {
  justify-content: flex-start;
  font-weight: bold;
  color: var(--blue-900);
  text-align: left;
}

.tracks .track-art {
  justify-content: center;
}

/* Vignette carrée */
.tracks .track-art .art-box {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 6px;
  overflow: hidden;
}

.tracks .track-art .art-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Cellule lecteur centrée */
.tracks .track-cell {
  justify-content: center;
}

.tracks .track-cell .player {
  margin: 0;
  max-width: 200px;
  padding: 0.5rem;
}

/* Empilement mobile */
@media (max-width: 640px) {
  .tracks {
    grid-template-columns: 1fr;
  }
}

/* =======================
   LIGHTBOX IMAGE
   ======================= */
#img-lightbox {
  padding: 0;
  border: none;
  background: transparent;
}

#img-lightbox::backdrop {
  background: rgba(0, 0, 0, .65);
}

#img-lightbox img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

/* =======================
   TRANSITIONS / ANIMS (optionnel)
   ======================= */
.nav-links,
.submenu,
.nav-links a,
.dropdown-link,
.submenu li a {
  transition: background-color .2s ease, color .2s ease, opacity .2s ease, transform .2s ease;
}

.nav-links.show {
  animation: fadeSlide .18s ease;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =======================
   ACCESSIBILITÉ
   ======================= */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =======================
   LECTEUR EN HAUT À DROITE (spécifique page Légendes)
   ======================= */
#page-legendes .player-float {
  float: right;
  width: 300px;
  margin: 0 0 1rem 1.5rem;
}

#page-legendes .player-float .player {
  max-width: 100%;
}

/* Clearfix local à la page Légendes */
#page-legendes .content::after {
  content: "";
  display: table;
  clear: both;
}

/* Mobile : annule le float */
@media (max-width: 768px) {
  #page-legendes .player-float {
    float: none;
    width: 100%;
    margin: 0 0 1rem 0;
  }
}