/* Système de boutons FDSP (décidé le 2026-10-23, maquette : docs/buttons-proposal.html).
   5 types : .b--pri (plein, un seul par écran), .b--sec (contour blanc), .b--quiet (bord gris), .b--ghost (sans bord : icônes utilitaires), .b--link (souligné).
   3 tailles : .b--s (36 px), .b--m (44 px), .b--l (56 px). .b--icon = carré. .b--full = pleine largeur. .b--fit = remplit sa case sans dépasser le carré.
   Le style de index.html est dans la couche « legacy » : ce fichier, hors couche, passe toujours devant lui.
   Seul « display » reste dans la couche b-base, sous legacy, pour que les règles qui masquent un bouton (display:none) gardent la main. */

@layer b-base {
  .b { display: inline-flex; }
}

:root { --b-line: #555; --b-press: #cfcfcf; --b-wash: rgba(255, 255, 255, .12); }

.b {
  --h: 44px; --fs: 12px; --px: 16px; --ic: 18px;
  align-items: center; justify-content: center; gap: 10px;
  height: var(--h); min-height: var(--h); padding: 0 var(--px);
  font: 700 var(--fs)/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-align: center; text-decoration: none;
  border: 1px solid transparent; border-radius: 0; box-shadow: none; background: transparent; color: var(--fg);
  cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, box-shadow .08s, background-color .08s, border-color .08s, color .08s;
}
.b svg { width: var(--ic); height: var(--ic); flex: none; }
.b--s { --h: 36px; --fs: 11px; --px: 12px; --ic: 16px; }
.b--m { --h: 44px; --fs: 12px; --px: 16px; --ic: 18px; }
.b--l { --h: 56px; --fs: 14px; --px: 24px; --ic: 22px; }
.b--icon { width: var(--h); padding: 0; }
.b--fit { width: 100%; max-width: var(--h); }
.b--full { width: 100%; }
.b--start { justify-content: flex-start; text-align: left; }
.b--split { justify-content: space-between; }

.b--pri { background: var(--fg); color: var(--ink); border-color: var(--fg); }
.b--sec { border-color: var(--fg); }
.b--quiet { border-color: var(--b-line); }
.b--ghost { border-color: transparent; }
.b--link { height: auto; min-height: 0; padding: 4px 0; border: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* Survol (souris seulement) : le plein et le contour se soulèvent, le discret éclaire son bord, le sans-bord prend un fond léger, le lien épaissit son trait */
@media (hover: hover) {
  .b--pri:hover:not(:disabled), .b--sec:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 2px 2px 0 var(--b-line); }
  .b--quiet:hover:not(:disabled) { border-color: var(--fg); }
  .b--ghost:hover:not(:disabled) { background: var(--b-wash); }
  .b--link:hover:not(:disabled) { text-decoration-thickness: 3px; }
}

/* Appui : le même partout, c'est le seul retour sur téléphone */
.b:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
.b--pri:active:not(:disabled) { background: var(--b-press); border-color: var(--b-press); color: var(--ink); }
.b--sec:active:not(:disabled), .b--quiet:active:not(:disabled), .b--ghost:active:not(:disabled) { background: var(--b-wash); }
.b--link:active:not(:disabled) { color: var(--dim); }

.b:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.b:disabled { opacity: .35; cursor: default; transform: none; box-shadow: none; }

/* Sélectionné (pastilles, choix, ♥ aimé) : le contour devient plein */
.b--sec[aria-pressed="true"], .b--quiet[aria-pressed="true"] { background: var(--fg); color: var(--ink); border-color: var(--fg); }
.b--quiet.on { border-color: var(--fg); }

/* Occupé : les deux barres du loader à la place du texte */
.b[aria-busy="true"] { position: relative; pointer-events: none; color: transparent; }
.b[aria-busy="true"] > * { visibility: hidden; }
.b[aria-busy="true"]::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 12px; margin: -6px 0 0 -7px;
  background: linear-gradient(var(--fg) 0 0) left / 5px 100% no-repeat, linear-gradient(var(--fg) 0 0) right / 5px 100% no-repeat; animation: b-busy 1s steps(1) infinite; }
.b--pri[aria-busy="true"]::after { background: linear-gradient(var(--ink) 0 0) left / 5px 100% no-repeat, linear-gradient(var(--ink) 0 0) right / 5px 100% no-repeat; }
@keyframes b-busy { 50% { opacity: .25; } }

@media (prefers-reduced-motion: reduce) { .b { transition: none; } .b[aria-busy="true"]::after { animation: none; } }

/* Croix des fenêtres : iOS met le focus dessus à l'ouverture et affichait le contour ; on le garde masqué comme avant. */
.dlg-x.b:focus-visible { outline: none; }

/* Frequency cards: square editorial artwork, using the standard button interactions. */
.b--frequency {
  position:relative; isolation:isolate; aspect-ratio:1; height:auto; min-height:0;
  padding:0; overflow:hidden; flex-direction:column; align-items:stretch;
  justify-content:flex-end; gap:0; text-align:left; white-space:normal; background:var(--ink);
}
.b--frequency[data-empty] { opacity:.45; }   /* pas assez de morceaux en direct : la carte reste là, estompée */
.b--frequency[data-empty]:hover { opacity:.7; }
.b--frequency .frequency-art { position:absolute; inset:0 0 21%; display:block; overflow:hidden; pointer-events:none; }
.b--frequency .frequency-art svg { width:100%; height:100%; display:block; }
.b--frequency .frequency-motion { transform-origin:120px 95px; }
.b--frequency .frequency-footer { position:relative; display:flex; align-items:flex-end; justify-content:space-between; gap:8px; padding:10px 12px; background:var(--ink); }
.b--frequency .frequency-name { font:400 clamp(20px,calc(var(--cw,180px) * .145),30px)/.9 var(--pix); letter-spacing:0; overflow-wrap:normal; }
.b--frequency .frequency-play { display:flex; flex:none; padding-bottom:1px; }
.b--frequency .frequency-play svg { width:16px; height:16px; }
@keyframes frequency-breathe { from { transform:translateY(2px) scale(.96); } to { transform:translateY(-2px) scale(1.03); } }
@keyframes frequency-scan { from { stroke-dashoffset:0; } to { stroke-dashoffset:-276; } }
@keyframes frequency-spin { from { transform:rotate(0); } to { transform:rotate(360deg); } }
@keyframes frequency-cut { 0% { transform:translate(-6px,3px) rotate(-5deg) scale(1.08); } 50% { transform:translate(7px,-4px) rotate(4deg) scale(1.08); } 100% { transform:translate(-3px,-2px) rotate(-2deg) scale(1.08); } }
@keyframes frequency-swing { from { transform:translateY(8px) rotate(-5deg); } to { transform:translateY(-8px) rotate(5deg); } }
@keyframes frequency-tide { from { transform:translateX(-14px) scale(1.08); } to { transform:translateX(14px) scale(1.08); } }
@keyframes frequency-ray { 0% { stroke-dashoffset:1; } 30%,80% { stroke-dashoffset:0; } 100% { stroke-dashoffset:1; } }
@keyframes frequency-pad { 0%,100% { fill:transparent; } 25%,55% { fill:currentColor; } }
@keyframes frequency-breath { from { transform:scaleY(.55); } to { transform:scaleY(1.05); } }
@keyframes frequency-pump { 0% { transform:scale(1); } 12% { transform:scale(1.09); } 40%,100% { transform:scale(1); } }
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
  .b--frequency:hover .frequency-motion { animation:frequency-swing .85s ease-in-out infinite alternate; }
  .b--frequency[data-frequency="Jazz"]:hover .frequency-motion { animation:none; }   /* seules les barres respirent, chacune à son tempo */
  .b--frequency[data-frequency="Jazz"]:hover .frequency-bars path { transform-box:fill-box; transform-origin:50% 100%; animation:frequency-breath 1.6s ease-in-out infinite alternate; }
  .b--frequency[data-frequency="Jazz"]:hover .frequency-bars path:nth-child(2) { animation-delay:-.4s; }
  .b--frequency[data-frequency="Jazz"]:hover .frequency-bars path:nth-child(3) { animation-delay:-.9s; }
  .b--frequency[data-frequency="Jazz"]:hover .frequency-bars path:nth-child(4) { animation-delay:-1.3s; }
  .b--frequency[data-frequency="Electronic"]:hover .frequency-motion { animation:frequency-tide .65s ease-in-out infinite alternate; }
  .b--frequency[data-frequency="Electronic"]:hover .frequency-motion path { stroke-dasharray:120 18; animation:frequency-scan 1.1s linear infinite; }
  .b--frequency[data-frequency="Groove"]:hover .frequency-motion { transform-origin:120px 98px; animation:frequency-spin 2.4s linear infinite; }
  .b--frequency[data-frequency="World"]:hover .frequency-motion { animation:none; }   /* la terre reste fixe : seule l'orbite en diagonale tourne */
  .b--frequency[data-frequency="World"]:hover .frequency-orbit { transform-origin:120px 94px; animation:frequency-spin 6s linear infinite; }
  .b--frequency[data-frequency="All"]:hover .frequency-motion { animation:none; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path { stroke-dasharray:1; animation:frequency-ray 2s ease-out infinite; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(2) { animation-delay:0.16s; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(3) { animation-delay:0.32s; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(4) { animation-delay:0.48s; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(5) { animation-delay:0.64s; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(6) { animation-delay:0.80s; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(7) { animation-delay:0.96s; }
  .b--frequency[data-frequency="All"]:hover .frequency-rays path:nth-child(8) { animation-delay:1.12s; }
  .b--frequency[data-frequency="Rock & Indie"]:hover .frequency-motion { animation:frequency-cut .7s steps(3,end) infinite; }
  .b--frequency[data-frequency="Metal"]:hover .frequency-motion { animation:frequency-cut .5s steps(2,end) infinite; }
  .b--frequency[data-frequency="Chill"]:hover .frequency-motion { animation:frequency-tide 2.8s ease-in-out infinite alternate; }
  .b--frequency[data-frequency="Hip-hop"]:hover .frequency-motion,
  .b--frequency[data-frequency="Reggae"]:hover .frequency-motion { animation:none; }
  .b--frequency[data-frequency="Hip-hop"]:hover .frequency-pads rect { animation:frequency-pad 2.4s steps(1,end) infinite; animation-delay:calc(var(--i) * .2s); }
  .b--frequency[data-frequency="Reggae"]:hover .frequency-cone { transform-origin:120px 95px; animation:frequency-pump .9s cubic-bezier(.2,.7,.3,1) infinite; }   /* le haut-parleur pompe sur chaque temps */
}
@media (prefers-reduced-motion:no-preference) {
  .b--frequency:focus-visible .frequency-motion,
  .b--frequency:active .frequency-motion { animation:frequency-breathe 1.5s ease-in-out infinite alternate; }
}
@media (prefers-reduced-motion:reduce) { .b--frequency .frequency-motion, .b--frequency .frequency-motion * { animation:none; } }
