/* L'ÉDITEUR D'IDÉE, ACCORDS (idee-accords.js) : les six accords de la
 * tonalité dans le pupitre, et la feuille des accords en roue.
 *
 * Deux marques, les mêmes dans la roue et dans le pupitre :
 *   - cerclé (anneau bleu) : l'accord vient souvent après celui d'avant ;
 *   - teinté (fond bleu doux) : la mélodie de la mesure l'appelle.
 * L'accord posé est jaune, comme une note choisie. Rien que des jetons. */

/* ----- Le pupitre ----- */
.pupitre-accords { display: flex; flex-direction: column; gap: 6px; }
.accords-ou-pupitre { flex: none; display: flex; align-items: center; gap: 2px; }
.accords-mesure { min-width: 6.5em; text-align: center; font-weight: 600; font-size: var(--t-15); }
.accords-lien { margin-left: auto; color: var(--stylo); padding: 0 8px; }
.accords-pads { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(48px, 1fr); gap: 8px; }
.accord-pad { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 6px 10px 8px; border: 1px solid transparent; border-radius: var(--r-12); background: var(--creux); color: var(--encre); text-align: left; cursor: pointer; }
.accord-pad:hover { border-color: var(--trait-fort); }
.accord-pad .degre { font-size: var(--t-12); color: var(--gris); }
.accord-pad .nom { font-family: var(--f-titre); font-size: var(--t-22); line-height: 1; }
.accord-pad.melodie { background: var(--stylo-doux); }
.accord-pad.suite { box-shadow: inset 0 0 0 2.5px var(--stylo); }
.accord-pad[aria-pressed="true"] { background: var(--surligneur); color: var(--sur-surligneur); }
.accord-pad[aria-pressed="true"] .degre { color: var(--sur-surligneur); opacity: 0.7; }

/* ----- La feuille ----- */
.feuille-accords[open] { gap: 10px; }
.accords-tete h2 { text-align: center; }

/* La bande des mesures : numéro et accord posé, la mesure courante en jaune.
   Elle défile : on y voit quatre mesures à la fois. */
.accords-bande { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px; margin: -2px; }
.accords-bande::-webkit-scrollbar { display: none; }
.accords-cellule { flex: 0 0 calc((100% - 18px) / 4); min-width: 74px; display: flex; border-radius: var(--r-12); background: var(--creux); }
.accords-cellule.double { flex-basis: calc((100% - 18px) / 4 * 1.6); }
.accords-cellule.on { background: var(--surligneur-doux); box-shadow: 0 0 0 2px var(--surligneur); }
.accords-place { flex: 1 1 0; min-width: 44px; min-height: 52px; padding: 5px 10px; border: 0; border-radius: var(--r-12); background: transparent; color: var(--encre); display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; cursor: pointer; }
.accords-place .num { font-size: var(--t-11); line-height: 1.2; color: var(--gris); }
.accords-place .acc { font-family: var(--f-titre); font-size: var(--t-20); line-height: 1.1; color: var(--stylo); white-space: nowrap; }
.accords-place .acc.rien { color: var(--gris); }
.accords-place[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--surligneur); }
.accords-cellule:not(.double) .accords-place[aria-pressed="true"] { box-shadow: none; }

/* L'aperçu : un mini rouleau de piano de la mesure, et le bouton qui l'écoute */
.accords-apercu-ligne { flex: none; display: flex; align-items: center; gap: 8px; }
.accords-apercu-ligne > .btn { flex: none; }
.accords-apercu { position: relative; flex: 1 1 auto; min-width: 0; height: 80px; border-radius: var(--r-12); background: var(--papier); border: 1px solid var(--trait); overflow: hidden; }
.apercu-temps { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--trait); }
.apercu-zone { position: absolute; top: 0; bottom: 0; background: var(--surligneur); opacity: 0.16; }
.apercu-note { position: absolute; border-radius: var(--r-trait); background: var(--stylo); }
.apercu-note.acc { background: var(--gris); opacity: 0.8; }
.apercu-accord { position: absolute; top: 3px; padding-left: 5px; font-family: var(--f-titre); font-size: var(--t-13); line-height: 1.2; color: var(--encre); white-space: nowrap; }
.apercu-tete { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--surligneur); box-shadow: var(--lueur); pointer-events: none; }
.apercu-aide { position: absolute; left: 8px; right: 8px; bottom: 5px; text-align: center; font-size: var(--t-12); line-height: 1.3; color: var(--gris); }

/* La roue : sept accords dans l'ordre des degrés, l'accord posé au centre */
/* Deux lignes de haut, toujours : un message n'y fait pas sauter la roue. */
.accords-roue-tete { flex: none; display: flex; align-items: center; gap: 12px; min-height: 36px; }
.accords-roue-tete .surtitre { flex: none; }
.accords-roue-tete .remarque { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; text-align: right; font-size: var(--t-13); line-height: 1.35; }
.accords-roue-tete.avec-phrase .surtitre { display: none; }
.accords-roue-tete.avec-phrase .remarque { display: block; text-align: left; }
.legende { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pt { flex: none; width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.pt.suite { box-shadow: inset 0 0 0 2px var(--stylo); }
.pt.melodie { background: var(--stylo-doux); box-shadow: inset 0 0 0 1px var(--stylo); }
.accords-roue { flex: none; position: relative; width: 100%; max-width: 358px; height: 252px; margin: 0 auto; }
.roue-orbite { position: absolute; left: 50%; top: 131px; width: 200px; height: 200px; transform: translate(-50%, -50%); border-radius: 50%; border: 1px dashed var(--trait-fort); pointer-events: none; }
.roue-centre { position: absolute; left: 50%; width: 112px; height: 112px; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: var(--stylo); color: var(--sur-stylo); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 6px; cursor: pointer; }
.roue-centre.rien { background: var(--creux); color: var(--gris); cursor: default; }
.roue-centre .nom { font-family: var(--f-titre); font-size: var(--t-32); line-height: 1; white-space: nowrap; }
.roue-centre .nom.long { font-size: var(--t-24); }
.roue-centre .nom.tres-long { font-size: var(--t-20); }
.roue-centre .notes { font-size: var(--t-12); line-height: 1.25; text-align: center; opacity: 0.88; text-wrap: balance; }
.roue-accord { position: absolute; width: 58px; height: 58px; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: var(--creux); color: var(--encre); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0; cursor: pointer; }
.roue-accord .nom { font-family: var(--f-titre); font-size: var(--t-18); line-height: 1.15; white-space: nowrap; }
.roue-accord .degre { font-size: var(--t-10); line-height: 1.2; color: var(--gris); }
.roue-accord:hover { box-shadow: inset 0 0 0 1.5px var(--trait-fort); }
.roue-accord.melodie { background: var(--stylo-doux); color: var(--stylo); }
.roue-accord.melodie .degre { color: var(--stylo); }
.roue-accord.suite { box-shadow: inset 0 0 0 2.5px var(--stylo); }
.roue-accord.on { background: var(--surligneur); color: var(--sur-surligneur); }
.roue-accord.on .degre { color: var(--sur-surligneur); opacity: 0.7; }

/* Les couleurs : des puces, sur une ligne */
.accords-couleurs { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.accords-couleurs .puce { min-width: 72px; justify-content: center; }
.accords-couleurs .puce[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Le style d'accompagnement : quatre cartes qui dessinent leur motif */
.accords-accomp { flex: none; display: flex; flex-direction: column; gap: 6px; }
.accords-styles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.accords-style { min-height: 78px; padding: 8px 8px 9px; border: 1px solid var(--trait); border-radius: var(--r-12); background: var(--creux); color: var(--encre); display: flex; flex-direction: column; justify-content: space-between; gap: 6px; text-align: left; cursor: pointer; }
.accords-style:hover { border-color: var(--trait-fort); }
.accords-style .nom { font-size: var(--t-13); line-height: 1.2; font-weight: 600; }
.accords-style .motif { position: relative; display: block; height: 26px; }
.accords-style .motif i { position: absolute; height: 4px; border-radius: var(--r-trait); background: currentColor; opacity: 0.8; }
.accords-style .motif.rien::after { content: ""; position: absolute; left: 0; right: 0; top: 12px; border-top: 2px dashed currentColor; opacity: 0.35; }
.accords-style[aria-pressed="true"] { border-color: var(--stylo); box-shadow: inset 0 0 0 1px var(--stylo); background: var(--stylo-doux); color: var(--stylo); }

/* Un autre accord, replié */
.accords-choix { display: flex; flex-wrap: wrap; gap: 6px; }
.accords-choix .btn { min-width: 3.6em; justify-content: center; font-weight: 600; font-size: var(--t-16); }
.accords-choix .btn[aria-pressed="true"] { background: var(--stylo); color: var(--sur-stylo); border-color: var(--stylo); }
.accords-choix.petits .btn { min-width: 44px; font-size: var(--t-14); font-weight: 500; }
.accords-autres { flex: none; }
.accords-autres summary { cursor: pointer; color: var(--gris); font-size: var(--t-14); padding: 8px 0; min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; }
.accords-autres summary::-webkit-details-marker { display: none; }
.accords-autres[open] summary .ico { transform: rotate(180deg); }
.accords-autres[open] { display: flex; flex-direction: column; gap: 8px; }

/* Les actions : changer au milieu, retirer, harmoniser */
.accords-actions { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.accords-actions .btn { white-space: normal; text-align: center; line-height: 1.2; padding-top: 6px; padding-bottom: 6px; min-height: 44px; }
.accords-actions #accord-milieu { grid-column: 1 / -1; }

@media (max-width: 380px) {
  .accords-style .nom { font-size: var(--t-12); }
}
/* Trop étroit (320 px, ou le texte agrandi) : « Tous les accords » se réduit à son icône (44 px,
   son nom reste celui du bouton, et sa bulle à l'appui long) ; avec ‹ et ›, il débordait. La
   place se compte en em : elle suit la taille du texte. Le nom de la mesure garde sa largeur
   (les flèches ne sautent pas de « Mesure 9 » à « Mesure 10 »), sauf s'il n'y en a plus. */
.accords-ou-pupitre { container: accords-rang / inline-size; }
@container accords-rang (max-width: 22em) {
  .accords-mesure { min-width: min(5em, calc(100% - 140px)); }
  .accords-lien { font-size: 0; gap: 0; min-width: 44px; padding: 0; }
}
