/* ============================================================
   CATALOGUE — chrome des pages de démonstration
   ============================================================
   Ce fichier n'appartient PAS au design system : il habille les pages
   qui le présentent (index.html, page-builder.html, theme-builder.html).
   Un projet qui consomme le système n'a aucune raison de le charger —
   d'où sa place hors de styles/.

   C'est la raison pour laquelle il s'autorise ce que components.css
   s'interdit : primitives brutes et couleurs littérales. Ces libertés
   étaient auparavant prises à l'intérieur de components.css, derrière
   un stylelint-disable ; les sortir rend components.css entièrement
   soumis au garde-fou, sans exception de zone.

   Chargement : après les feuilles du design system, dans les pages de
   démonstration uniquement.
   ============================================================ */


.hero {
  text-align: center;
  padding: var(--base-space-20) 0 var(--base-space-16);
  position: relative;
}
.hero h1 { font-size: var(--base-text-6xl); font-weight: var(--base-weight-black); line-height: var(--base-leading-none); }
.hero::before {
  content: ''; position: absolute;
  top: -200px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px;
  background: var(--brand-mesh);
  opacity: 0.35; filter: blur(80px);
  pointer-events: none; z-index: var(--base-layer-behind);
}
.hero p { max-width: 640px; margin-inline: auto; font-size: var(--base-text-xl); color: var(--text-secondary); }

/* Chaque bloc .demo est une <section aria-labelledby> avec un vrai
   titre (h3/h4) dans son <header> — conforme à HTML5-SEMANTIQUE.md.
   Le titre reprend l'apparence du cartouche, pas celle d'un h3. */
.demo {
  container-type: inline-size;   /* les démos s'adaptent à leur cellule de grille */
  background: var(--surface-raised);
  border: 1px solid var(--border-muted);
  border-radius: var(--layout-radius-card);
  padding: var(--space-demo-padding);
  margin-bottom: var(--space-stack-gap);
}
.demo > header:first-child {
  font-size: var(--base-text-xs); font-weight: var(--base-weight-semi);
  text-transform: uppercase; letter-spacing: var(--base-tracking-widest);
  color: var(--text-tertiary); margin-bottom: var(--space-stack-gap);
  border-bottom: none; padding: 0; background: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; position: static;
}
.demo > header:first-child > :is(h3, h4) {
  font: inherit; letter-spacing: inherit; color: inherit; margin: 0;
}

.swatch-label {
  display: block;
  font-size: var(--base-text-xs) !important; font-weight: var(--base-weight-semi);
  color: var(--text-tertiary) !important;
  text-transform: uppercase; letter-spacing: var(--base-tracking-widest);
  margin-bottom: var(--base-space-2); margin-top: var(--space-group-gap);
}
.swatch-label:first-child { margin-top: 0; }

.swatch-live {
  display: inline-flex; align-items: center;
  padding: var(--base-space-3) var(--base-space-4); border-radius: var(--layout-radius-button);
  font-family: var(--font-code); font-size: var(--base-text-xs); font-weight: var(--base-weight-semi);
  color: var(--text-on-action); box-shadow: var(--shadow-swatch);
}
/* Échantillon sur fond clair du thème : texte courant + liseré,
   au lieu du texte « sur action » par défaut. */
.swatch-live.on-surface { color: var(--text); border: 1px solid var(--border); }

/* Hooks typographiques de démonstration — même mécanisme que la
   section 22 (valeur ponctuelle via variable CSS inline), préfixés
   --demo-* pour ne pas collisionner avec les hooks génériques ;
   ce sont les seules propriétés inline autorisées par le garde-fou
   HTML (voir .htmlvalidate.json, no-inline-style). */
[style*="--demo-ff"] { font-family: var(--demo-ff); }
[style*="--demo-fs"] { font-size: var(--demo-fs); }
[style*="--demo-fw"] { font-weight: var(--demo-fw); }
[style*="--demo-ls"] { letter-spacing: var(--demo-ls); }

.swatches {
  display: flex; border-radius: var(--layout-radius-card); overflow: hidden;
  box-shadow: var(--shadow-swatch); margin-bottom: var(--space-stack-gap);
}
.swatches > * {
  flex: 1; aspect-ratio: 1; min-width: 36px;
  position: relative; cursor: default;
  transition: transform var(--motion-spring);
}
.swatches > *:hover { transform: scaleY(1.15); z-index: 2; }

.swatches > [title]::after {
  content: attr(title);
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  font-size: 0.55rem; font-family: var(--font-code); font-weight: var(--base-weight-semi);
  opacity: 0; transition: opacity var(--motion-fast);
  mix-blend-mode: difference; color: white;
}
.swatches > [title]:hover::after { opacity: 1; }

.gradient-card {
  height: 100px; border-radius: var(--layout-radius-card);
  display: flex; align-items: flex-end; padding: var(--base-space-3);
  font-size: var(--base-text-xs); font-weight: var(--base-weight-semi); color: white;
  box-shadow: var(--shadow-gradient-card);
  transition: transform var(--motion-spring), box-shadow var(--motion-fast);
}
.gradient-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-gradient-card-hover); }

.type-sample {
  display: flex; align-items: baseline; gap: var(--space-group-gap);
  padding: var(--base-space-2) 0; border-bottom: 1px solid var(--border-muted);
}
.type-sample > :first-child {
  flex-shrink: 0; width: 80px;
  font-family: var(--font-code); font-size: var(--base-text-xs); color: var(--text-tertiary);
}

.space-item {
  display: flex; align-items: center; gap: var(--space-stack-gap); margin-bottom: var(--base-space-2);
}
.space-item > :first-child {
  flex-shrink: 0; width: 80px;
  font-family: var(--font-code); font-size: var(--base-text-xs); color: var(--text-tertiary);
}
.space-bar {
  height: var(--base-space-5); background: var(--brand-gradient);
  border-radius: var(--layout-radius-button-sm); display: block;
}

.radius-demo {
  width: 64px; height: 64px; background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-code); font-size: var(--base-text-xs);
  color: white; font-weight: var(--base-weight-semi);
  transition: transform var(--motion-spring);
}
.radius-demo:hover { transform: scale(1.1); }

.shadow-demo {
  background: var(--surface-raised); border-radius: var(--layout-radius-card);
  padding: var(--base-space-6) var(--base-space-3); text-align: center;
  font-family: var(--font-code); font-size: var(--base-text-xs); color: var(--text-secondary);
  transition: transform var(--motion-normal);
}
.shadow-demo:hover { transform: translateY(-3px); }

.anim-cell {
  background: var(--surface-raised); border: 1px solid var(--border-muted);
  border-radius: var(--layout-radius-card); padding: var(--base-space-5) var(--base-space-3);
  text-align: center; font-family: var(--font-code);
  font-size: var(--base-text-xs); color: var(--text-secondary);
}
.anim-shape {
  display: inline-block;
  width: 36px; height: 36px; background: var(--brand-gradient);
  border-radius: var(--layout-radius-button); margin: 0 auto var(--base-space-3);
}
/* La démo doit boucler pour être visible en continu ; l'utilitaire
   data-animate="scale-in" reste à un seul passage pour un usage réel
   (apparition d'une carte, etc.). */
.anim-shape[data-animate="scale-in"] { animation-duration: 1.2s; animation-iteration-count: infinite; animation-direction: alternate; }

.compare > * > small { display: block; margin-bottom: var(--base-space-2); }
.compare > * > small > strong { font-size: var(--base-text-sm); }

.theme-switcher {
  display: flex; align-items: center; gap: var(--base-space-2);
  padding: var(--base-space-1); background: var(--action-secondary); border-radius: var(--layout-radius-badge);
}
.theme-switcher button {
  background: transparent; color: var(--text-secondary); box-shadow: none;
  padding: var(--base-space-1\.5) var(--base-space-3); font-size: var(--base-text-xs);
}
.theme-switcher button:hover { background: var(--surface-base); box-shadow: none; }
.theme-switcher button[aria-pressed="true"] { background: var(--action-primary); color: var(--text-on-action); }
