/* =========================================================
   styles.css — composants du site.

   Aucune couleur, police, rayon ou espacement n'est écrit en
   dur ici : tout vient de tokens.css, chargé juste avant.
   Les composants .site-nav, .site-footer, .btn et .frame sont
   partagés par TOUTES les pages, y compris les pages légales.
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* L'attribut `hidden` doit toujours l'emporter.
   Le navigateur applique bien [hidden] { display: none }, mais toute
   règle d'auteur posant un `display` (ex. .card { display: flex })
   la neutralise et l'élément reste visible. Cette règle globale évite
   ce piège pour tout élément masqué, présent ou futur. */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-pill);
}

/* Dégradé de haut de page, à la limite du perceptible. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 60vh;
  background: linear-gradient(var(--page-top), var(--page));
  pointer-events: none;
  z-index: -1;
}

/* ---------------------------------------------------------
   1. Bannière pleine largeur — accueil uniquement, vide
   --------------------------------------------------------- */
.banner {
  width: 100%;
  /* Occupe désormais tout le haut de page : c'est le premier écran.
     Plafonnée pour ne pas repousser la grille hors de vue sur les
     très grands écrans. */
  height: clamp(280px, 58vh, 520px);
  background: var(--banner);
  border-bottom: 1px solid var(--rule);
}

/* Campagne active : la bannière, jusque-là vide, reçoit son message.
   Hors campagne aucune de ces règles ne s'applique — le bloc reste
   exactement tel qu'il est aujourd'hui. */
.banner--campaign {
  display: grid;
  place-items: center;
  padding: var(--gutter);
  text-align: center;
}

.banner__inner { max-width: 40rem; }

.banner__message {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: var(--display-sm);
  font-size: clamp(1.25rem, 3.5vw, 2rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--ink);
  text-wrap: balance;
}

/* Code et date de fin : texte simple, volontairement discret. */
.banner__details {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------
   2. En-tête et navigation — partagés par toutes les pages
   --------------------------------------------------------- */
.site-head {
  max-width: var(--w-hero);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) 0;
  text-align: center;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.5rem;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.8125rem;
  text-decoration: none;
}

.site-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ---------------------------------------------------------
   3. Boutons en pilule — un plein, un contour
   --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 120ms linear, border-color 120ms linear;
}

/* Variante compacte, utilisée par les filtres. */
.btn--sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }

/* Au doigt, la puce compacte descendrait sous le seuil de confort :
   on lui rend une cible de 44 px sans toucher au rendu souris. */
@media (pointer: coarse) {
  .btn--sm { min-height: 44px; padding-inline: 1.1rem; }
}

.btn--solid   { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn--solid:hover { opacity: 0.85; }

.btn--outline { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--outline:hover { border-color: var(--ink); }

/* ---------------------------------------------------------
   5. Cadre technique à marques d'angle
   --------------------------------------------------------- */
.frame {
  position: relative;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--rule);
}

/* Quatre équerres en léger débord, dessinées sans aucun élément
   supplémentaire : huit aplats sur un seul pseudo-élément. */
.frame::before {
  content: "";
  position: absolute;
  inset: var(--tick-offset);
  pointer-events: none;
  background-image:
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink));
  background-size:
    var(--tick) 1px, 1px var(--tick), var(--tick) 1px, 1px var(--tick),
    var(--tick) 1px, 1px var(--tick), var(--tick) 1px, 1px var(--tick);
  background-position:
    top left, top left, top right, top right,
    bottom left, bottom left, bottom right, bottom right;
  background-repeat: no-repeat;
  opacity: 0.5;
}

/* ---------------------------------------------------------
   6. Grille de produits — 1 / 2 / 3 / 4 colonnes
   --------------------------------------------------------- */
main {
  max-width: var(--w-grid);
  margin: var(--flow) auto 0;
  padding: 0 var(--gutter);
}

/* --- Filtres par type, au-dessus de la grille --- */
.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: clamp(1rem, 3vw, 1.75rem);
  padding-bottom: clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--rule);
}

.products {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 34rem) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 58rem) { .products { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 74rem) { .products { grid-template-columns: repeat(4, 1fr); } }

.products__state {
  grid-column: 1 / -1;
  padding: var(--pad);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  color: var(--muted);
  font-size: 0.9375rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
}

/* --- Artwork : ratio 1:1 identique pour toutes les cartes --- */
.card__art {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--page);
  border-bottom: 1px solid var(--rule);
}

.card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Voile plat pendant la lecture — aucune ombre, aucun dégradé. */
.card__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms linear;
}

.card.is-playing .card__art::after { opacity: 0.24; }

/* --- Play en overlay --- */
.play {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  color: var(--ink);
  cursor: pointer;
  transition: opacity 120ms linear, border-color 120ms linear, color 120ms linear;
  -webkit-tap-highlight-color: transparent;
}

.play svg { width: 11px; height: 13px; fill: currentColor; display: block; }
.play .icon-pause { display: none; }
.play[aria-pressed="true"] .icon-play  { display: none; }
.play[aria-pressed="true"] .icon-pause { display: block; }
.play:disabled { opacity: 0.4; cursor: default; }

.card.is-playing .play { border-color: var(--accent); color: var(--accent); }

/* Au tactile le bouton reste visible ; il ne s'efface qu'en présence
   d'un vrai survol souris, et réapparaît au focus clavier. */
@media (hover: hover) and (pointer: fine) {
  .play { opacity: 0; }
  .card:hover .play,
  .card:focus-within .play,
  .card.is-playing .play { opacity: 1; }
}

/* --- Barre d'avancement --- */
.card__progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  height: 3px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  opacity: 0;
  transition: opacity 140ms linear;
}

.card.is-playing .card__progress { opacity: 1; }
.card__progress span { display: block; width: 0; height: 100%; background: var(--accent); }

/* --- Soundwave : ligne continue --- */
.card__wave {
  position: relative;
  height: 28px;
  margin-bottom: 0.875rem;
}

.card__wave::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: var(--rule);
  transition: opacity 160ms linear;
}

.card__wave canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 160ms linear;
}

.card__wave.is-live canvas { opacity: 1; }
.card__wave.is-live::after  { opacity: 0; }

.card__wave.is-static::after { background: var(--accent); opacity: 1; }

/* --- Corps de carte --- */
.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.875rem 1.125rem 1.25rem;
}

.card__title {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: var(--display-sm);
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.4rem 0 1.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.card__price { color: var(--ink); font-weight: 500; }
.card__price--free { color: var(--accent); }

/* Badge Sale : même discrétion que « Free » — la couleur d'accent
   déjà en place, aucune teinte « rouge promo » introduite. */
.card__sale {
  color: var(--accent);
  font-weight: 500;
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  padding: 0.05em 0.5em;
  font-size: 0.75rem;
  line-height: 1.4;
}
.card__details::before { content: "· "; }

/* --- Buy / Download : unique bouton plein de la carte --- */
.cta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--on-ink);
  border: 1px solid var(--ink);
  border-radius: var(--r-pill);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 120ms linear;
}

.cta:hover { opacity: 0.85; }

/* Le script de Gumroad injecte de force un <span class="logo-full">
   dans chaque lien produit, et sa CSS globale en fait un bloc de
   7,14 em rempli de currentColor, masqué par leur logo. Le chemin du
   masque est relatif (/images/logo.svg) et n'existe pas sur ce
   domaine : on obtiendrait un rectangle plein en travers du bouton.
   On le neutralise — l'overlay fonctionne sans. */
.cta .logo-full { display: none !important; }
.cta__arrow { font-size: 0.85em; }

/* ---------------------------------------------------------
   7. Pages légales — contenu long, colonne de lecture
   --------------------------------------------------------- */
.legal {
  max-width: var(--w-reading);          /* ~70 caractères : confort de lecture */
  margin: var(--flow) auto 0;
  padding: var(--pad);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}

.legal h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-variation-settings: var(--display-lg);
  font-size: clamp(1.875rem, 5vw, 2.75rem);  /* même famille que la home, plus petit */
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0;
}

.legal h2 {
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-variation-settings: var(--display-sm);
  font-size: 1.25rem;
  font-weight: 400;
}

.legal h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.legal p,
.legal li { font-size: 0.9375rem; line-height: 1.7; }

.legal p { margin: 0 0 1rem; }
.legal ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.legal li { margin-bottom: 0.4rem; }
.legal a { color: var(--accent); }

.legal__intro {
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-style: italic;
}

/* Les tableaux défilent seuls, jamais la page. */
.legal__table { overflow-x: auto; margin: 0 0 1.5rem; }

.legal table {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.legal th,
.legal td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.legal th { font-weight: 600; white-space: nowrap; }
.legal tbody tr:last-child td { border-bottom: 0; }

/* Champ restant à renseigner : volontairement visible. */
.todo {
  background: none;
  padding: 0 0.15em;
  color: var(--accent);
  font-weight: 500;
  border-bottom: 1px dashed currentColor;
}

/* ---------------------------------------------------------
   8. Pied de page — partagé par toutes les pages
   --------------------------------------------------------- */
.site-footer {
  max-width: var(--w-grid);
  margin: var(--flow) auto 0;
  padding: 1.5rem var(--gutter) 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8125rem;
}

.site-footer p { margin: 0; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer__links a { text-decoration: none; }
.site-footer__links a:hover { color: var(--ink); text-decoration: underline; }

.site-footer__links--legal { flex-basis: 100%; }
@media (min-width: 52rem) { .site-footer__links--legal { flex-basis: auto; } }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
