/*
  Studio 36 — Reset, polices auto-hebergees, typographie de base (design.md
  §3, §4, §16). S'appuie exclusivement sur les tokens de tokens.css.
*/

/* ---------- Polices auto-hebergees (design.md §3.1, PLAN.md §9.3) ---------- */
/* Fraunces : police variable (wght 300-900, opsz auto via font-optical-sizing). */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/fraunces-variable.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/fraunces-variable-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/inter-variable.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-500.woff2') format('woff2');
}

/* ---------- Reset ---------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Barre de scroll dans la DA neon du logo (rouge sur piste sombre) plutot
     que la barre grise par defaut du systeme — proprietes heritees, donc
     appliquees a toute la page sauf ou un composant la desactive deja
     explicitement (ex. .gallery-chips, .studio-carousel__track). */
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-raised);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-raised);
}

::-webkit-scrollbar-thumb {
  background-color: var(--accent);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent-strong);
}

body {
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
}

/*
  `<picture>` (media-picture.php, des qu'une variante AVIF existe) n'a par
  defaut aucune hauteur propre : un enfant <img> style en `height: 100%`
  pour remplir son conteneur ne peut alors pas resoudre ce pourcentage,
  et retombe sur sa hauteur naturelle — chaque photo s'affichait alors a
  une hauteur differente selon son propre ratio (visible sur /equipements
  des qu'une categorie a une vraie photo).
  `display: contents` "efface" la boite de <picture> de la mise en page :
  l'<img> qu'il contient devient un enfant direct de son vrai parent utile
  pour toute resolution de pourcentage/flex/grid, comme si <picture>
  n'existait pas. Corrige le cas ci-dessus ET evite la regression du
  premier correctif (width/height:100% explicites) qui faisait de
  <picture> un item flex/grid a part entiere a cote de ses freres — ca
  poussait par exemple le texte du hero studio hors de son alignement
  normal des qu'une photo avec variante AVIF existait.
*/
picture {
  display: contents;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

table {
  border-collapse: collapse;
}

/* ---------- Hierarchie typographique (design.md §3.2) ---------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
}

h5,
h6 {
  font-family: var(--font-body);
  color: var(--text-primary);
}

h1 {
  font-weight: 600;
  font-size: var(--text-h1-size);
  line-height: var(--text-h1-line);
  letter-spacing: var(--text-h1-tracking);
}

h2 {
  font-weight: 600;
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-line);
  letter-spacing: var(--text-h2-tracking);
}

h3 {
  font-weight: 500;
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-line);
}

h4 {
  font-weight: 500;
  font-size: var(--text-h4-size);
  line-height: var(--text-h4-line);
}

/* Decouple la taille "h4" du niveau semantique (PLAN.md §10 : jamais de saut
   de niveau Hn) - reutilisable partout ou un titre doit visuellement peser
   comme un h4 sans etre precede d'un h3 dans le flux de la page. */
.text-h4-size {
  font-size: var(--text-h4-size);
  line-height: var(--text-h4-line);
  font-weight: 500;
}

h5 {
  font-weight: 600;
  font-size: var(--text-h5-size);
  line-height: var(--text-h5-line);
}

h6 {
  font-weight: 600;
  font-size: var(--text-h6-size);
  line-height: var(--text-h6-line);
}

/* Italiques Fraunces : reservees a des mots isoles en accent rythmique (design.md §3.3) */
h1 em,
h2 em {
  font-style: italic;
  font-weight: 500;
}

p {
  color: var(--text-secondary);
}

/* ---------- Classes typographiques utilitaires ---------- */

/* Couleur "or" (accent secondaire du logo) par defaut : rappelle
   l'enseigne neon sur chaque etiquette de section, partout sur le site,
   sans la charge visuelle d'un aplat rouge repete a chaque titre. Les
   variantes sur fond photo (hero, card-studio) restent en text-primary
   pour la lisibilite et ne sont pas concernees par ce changement. */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-eyebrow-size);
  line-height: var(--text-eyebrow-line);
  letter-spacing: var(--text-eyebrow-tracking);
  text-transform: uppercase;
  color: var(--accent-warm);
}

/* Le reset global (`* { margin: 0 }`) laissait l'eyebrow coller directement
   au titre suivant sur toutes les pages du site (aucune regle ne les
   separait) : un ecart constant, quel que soit le niveau du titre. */
.eyebrow + h1,
.eyebrow + h2,
.eyebrow + h3 {
  margin-top: var(--space-3);
}

.body-lg {
  font-size: var(--text-body-lg-size);
  line-height: var(--text-body-lg-line);
  color: var(--text-secondary);
}

.body-sm {
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line);
  color: var(--text-secondary);
}

.label {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-label-size);
  line-height: var(--text-label-line);
  letter-spacing: var(--text-label-tracking);
  color: var(--text-primary);
}

.micro {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--text-micro-size);
  line-height: var(--text-micro-line);
  letter-spacing: var(--text-micro-tracking);
  color: var(--text-muted);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-accent {
  color: var(--accent);
}

/* Titre de niveau semantique variable mais style visuel H5 (ex. sous-titre de bloc lateral). */
.heading-sm {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-h5-size);
  line-height: var(--text-h5-line);
  color: var(--text-primary);
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: 20px;
}

@media (min-width: 768px) {
  .container {
    padding-inline: 40px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-max-laptop);
    padding-inline: 56px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-max-desktop);
    padding-inline: 64px;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: var(--container-max-large);
    padding-inline: 96px;
  }
}

@media (min-width: 1920px) {
  .container {
    max-width: var(--container-max-xlarge);
    padding-inline: 0;
  }
}

.section {
  padding-block: var(--section-padding-mobile);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--section-padding-tablet);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-block: var(--section-padding-desktop);
  }
}

.section--dense {
  padding-block: var(--section-padding-dense-mobile);
}

@media (min-width: 768px) {
  .section--dense {
    padding-block: var(--section-padding-dense-tablet);
  }
}

@media (min-width: 1024px) {
  .section--dense {
    padding-block: var(--section-padding-dense-desktop);
  }
}

.section--raised {
  background: var(--bg-raised);
}

/*
  Separation du bloc hero (eyebrow + H1 + intro) du reste du contenu de page
  (/studios, /tarifs, /equipements, /galerie, /a-propos) : filet pleine
  largeur (pose sur la <section>, jamais sur le .container interieur, pour
  traverser tout l'ecran) + fond distinct de la section suivante (laquelle
  porte elle-meme .section--raised) — le hero reste en --bg-base, le bloc
  d'apres bascule en --bg-raised, meme logique de rupture que le reste du
  site plutot qu'une couleur inventee pour l'occasion. Pas de margin-bottom
  ici : l'espacement apres le filet vient du padding-top naturel de la
  section suivante.
*/
.page-hero-divider {
  padding-bottom: var(--space-7);
  border-bottom: 1px solid var(--border-hairline);
}

/* Evite le cumul avec la marge basse propre a .content-page__intro (content.css)
   quand ce paragraphe termine le bloc hero : sans ca, son margin-bottom
   s'ajoute au padding-bottom ci-dessus et double l'espace avant le filet. */
.page-hero-divider .content-page__intro:last-child {
  margin-bottom: 0;
}

/*
  Reveal au scroll (design.md §18.2, §18.4) : fade + translateY(24px→0),
  duree "expressive", stagger via nth-child pour les groupes. Portee par
  `.js-reveal-ready` (posee par scroll-reveal.js une fois l'observateur pret)
  plutot que le selecteur nu : si le JS echoue/est desactive, [data-reveal]
  et .reveal-group restent visibles par defaut (repli accessibilite).
*/
.js-reveal-ready [data-reveal],
.js-reveal-ready .reveal-group > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-reveal) var(--ease-out),
              transform var(--duration-reveal) var(--ease-out);
}

.js-reveal-ready [data-reveal].is-revealed,
.js-reveal-ready .reveal-group.is-revealed > * {
  opacity: 1;
  transform: none;
}

.js-reveal-ready .reveal-group > *:nth-child(2) { transition-delay: 40ms; }
.js-reveal-ready .reveal-group > *:nth-child(3) { transition-delay: 80ms; }
.js-reveal-ready .reveal-group > *:nth-child(4) { transition-delay: 120ms; }
.js-reveal-ready .reveal-group > *:nth-child(5) { transition-delay: 160ms; }
.js-reveal-ready .reveal-group > *:nth-child(n+6) { transition-delay: 200ms; }

/*
  Decalage du contenu principal sous le header fixe (design.md §6.1/§6.6).
  Non applique sur les pages a hero immersif : le hero est concu pour aller
  bord a bord derriere le header transparent (design.md §6.2).
*/
.main-content--with-header-offset {
  padding-top: 64px;
}

@media (min-width: 768px) {
  .main-content--with-header-offset {
    padding-top: 72px;
  }
}

/*
  Ancres de defilement interne (ex. "Decouvrir les espaces" -> #espaces, home.php) :
  meme hauteur que .main-content--with-header-offset, pour que la cible ne
  se retrouve jamais masquee sous le header fixe, y compris sur les pages a
  hero ou cet offset n'est pas applique au conteneur principal.
*/
section[id] {
  scroll-margin-top: 64px;
}

@media (min-width: 768px) {
  section[id] {
    scroll-margin-top: 72px;
  }
}

/* ---------- Pages systeme (404/403/429/500, design.md §14.7-14.8) ---------- */

.system-page {
  max-width: 640px;
  margin-inline: auto;
  padding: var(--space-9) var(--space-4);
  text-align: center;
}

.system-page__frame {
  width: 160px;
  height: 100px;
  margin: 0 auto var(--space-6);
  border: 1px solid var(--border-strong);
  transform: rotate(-3deg) translateX(6px);
}

.system-page h1 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.system-page__subtitle {
  margin-bottom: var(--space-6);
}

.system-page__actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 428px) {
  .system-page__actions {
    flex-direction: column;
  }

  .system-page__actions .btn {
    width: 100%;
  }
}

/* ---------- Accessibilite transverse (design.md §16) ---------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  transition: top var(--duration-micro) var(--ease-out);
}

.skip-link:focus-visible {
  top: var(--space-4);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
