/* ==========================================================================
   Sud Bâti Patrimoine — socle : tokens, reset, typographie, grille, boutons
   Direction : patrimoine / artisanat haut de gamme. Anthracite + doré.
   ========================================================================== */

/* --- 1. Tokens ---------------------------------------------------------- */
:root {
  --encre: #1C1917;
  --anthracite: #3A352F;
  --anthracite-clair: #4E473F;
  --dore: #CB9A3D;
  --dore-clair: #E0B55C;
  /* Assombri pour le contraste : en #A07526 le sur-titre tombait a 3,89:1
     sur creme et 3,53:1 sur pierre, sous le seuil AA de 4,5:1.
     En #8A631E : 5,07 et 4,61. */
  --dore-sombre: #8A631E;
  --creme: #FFF6F1;
  --pierre: #F2ECE4;
  --pierre-moyen: #E6DCD2;
  --pierre-sombre: #D9D0C6;
  --gris-texte: #574F46;
  --rouge: #B3261E;

  --fond: var(--creme);
  --fond-alt: var(--pierre);
  --surface: #FFFFFF;
  --texte: var(--encre);
  --texte-doux: var(--gris-texte);
  --bordure: var(--pierre-moyen);

  --serif: "Playfair Display", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-base: 1.0625rem;
  --t-lg: clamp(1.125rem, 0.4vw + 1.03rem, 1.3125rem);
  --t-xl: clamp(1.375rem, 1vw + 1.15rem, 1.75rem);
  --t-2xl: clamp(1.75rem, 1.8vw + 1.35rem, 2.5rem);
  --t-3xl: clamp(2.125rem, 3vw + 1.4rem, 3.5rem);
  --t-4xl: clamp(2.5rem, 4.6vw + 1.35rem, 4.75rem);

  --e-1: 0.5rem;
  --e-2: 1rem;
  --e-3: 1.5rem;
  --e-4: 2.25rem;
  --e-5: 3.5rem;
  --e-6: 5rem;
  --e-7: 7rem;

  --largeur: 76rem;
  --largeur-texte: 38rem;
  --rayon: 2px;

  --ombre-1: 0 1px 2px rgba(28, 25, 23, .06), 0 2px 8px rgba(28, 25, 23, .04);
  --ombre-2: 0 2px 4px rgba(28, 25, 23, .07), 0 12px 28px rgba(28, 25, 23, .08);
  --ombre-3: 0 4px 8px rgba(28, 25, 23, .08), 0 24px 56px rgba(28, 25, 23, .12);

  --rapide: 160ms;
  --normal: 240ms;
  --lent: 420ms;
  --sortie: cubic-bezier(.22, 1, .36, 1);
  --entree: cubic-bezier(.4, 0, .2, 1);
}

/* --- 2. Reset ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

:where(a, button, summary, input, textarea, select):focus-visible {
  outline: 2px solid var(--dore-sombre);
  outline-offset: 3px;
  border-radius: var(--rayon);
}

::selection { background: var(--dore); color: var(--encre); }

/* --- 3. Typographie ----------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.015em;
  text-wrap: balance;
}

h1 { font-size: var(--t-4xl); }
h2 { font-size: var(--t-3xl); }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }
p { text-wrap: pretty; }

.lede {
  font-size: var(--t-lg);
  line-height: 1.55;
  color: var(--texte-doux);
  max-width: 46ch;
}

.sur-titre {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-family: var(--sans);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dore-sombre);
  margin-bottom: var(--e-3);
}

.sur-titre::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: var(--dore);
  flex: none;
}

/* --- 4. Mise en page ---------------------------------------------------- */
.enveloppe {
  width: 100%;
  max-width: var(--largeur);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

.section { padding-block: var(--e-7); }
.section--serre { padding-block: var(--e-6); }
.section--pierre { background: var(--fond-alt); }

.section--sombre { background: var(--anthracite); color: var(--creme); }
.section--sombre h2, .section--sombre h3 { color: var(--creme); }
.section--sombre .lede { color: rgba(255, 246, 241, .74); }
.section--sombre .sur-titre { color: var(--dore-clair); }

.duo { display: grid; gap: var(--e-5); align-items: start; }

@media (min-width: 60rem) {
  .duo { grid-template-columns: 1fr 1fr; gap: var(--e-6); }
  .duo--texte { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}

.grille {
  display: grid;
  gap: var(--e-3);
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
}

.saut-contenu {
  position: absolute;
  left: 50%;
  top: -4rem;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--anthracite);
  color: var(--creme);
  padding: .75rem 1.25rem;
  text-decoration: none;
  transition: top var(--rapide) var(--entree);
}

.saut-contenu:focus { top: .5rem; }

/* --- 5. Boutons et liens ------------------------------------------------ */
.bouton {
  --fond-bouton: var(--anthracite);
  --texte-bouton: var(--creme);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .625rem;
  min-height: 3rem;
  padding: .875rem 1.75rem;
  background: var(--fond-bouton);
  color: var(--texte-bouton);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  border: 1px solid var(--fond-bouton);
  border-radius: var(--rayon);
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--normal) var(--sortie),
              box-shadow var(--normal) var(--sortie),
              color var(--normal) var(--entree);
}

/* Remplissage doré qui monte depuis le bas au survol */
.bouton::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--dore);
  transform: translateY(101%);
  transition: transform var(--lent) var(--sortie);
}

.bouton:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); color: var(--encre); }
.bouton:hover::after { transform: translateY(0); }
.bouton:active { transform: translateY(0); transition-duration: var(--rapide); }

.bouton--dore { --fond-bouton: var(--dore); --texte-bouton: var(--encre); }
.bouton--dore::after { background: var(--creme); }

.bouton--fantome {
  --fond-bouton: transparent;
  --texte-bouton: currentColor;
  border-color: currentColor;
}

.bouton--fantome::after { background: var(--creme); }
.bouton--fantome:hover { color: var(--encre); }
.bouton__icone { flex: none; width: 1.125rem; height: 1.125rem; }

.lien-fleche {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: .02em;
  text-decoration: none;
  color: var(--anthracite);
  padding-bottom: 2px;
  background-image: linear-gradient(var(--dore), var(--dore));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--normal) var(--sortie), color var(--normal) var(--entree);
}

.lien-fleche:hover { background-size: 100% 1px; color: var(--dore-sombre); }
.lien-fleche svg { flex: none; transition: transform var(--normal) var(--sortie); }
.lien-fleche:hover svg { transform: translateX(4px); }

/* --- 6. Motion ---------------------------------------------------------- */
/* Tout reste visible sans JS : l'état masqué est posé par le script via
   [data-pret], jamais par la feuille seule. Aucun contenu invisible. */
[data-anime][data-pret] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--lent) var(--entree), transform var(--lent) var(--sortie);
  transition-delay: var(--retard, 0ms);
}

[data-anime][data-pret][data-vu] { opacity: 1; transform: none; }
[data-anime="filet"][data-pret] { opacity: 1; transform: scaleX(0); }
[data-anime="filet"][data-pret][data-vu] { transform: scaleX(1); }
[data-anime="voile"][data-pret] { opacity: 0; transform: none; }
[data-anime="voile"][data-pret][data-vu] { opacity: 1; }

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

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  [data-anime][data-pret] { opacity: 1 !important; transform: none !important; }
  .heros__fond img { transform: none !important; }
}

/* --- 7. Utilitaires ----------------------------------------------------- */
.visuellement-masque {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.texte-mesure { max-width: var(--largeur-texte); }
.pile { display: grid; gap: var(--e-2); }
.pile--large { gap: var(--e-3); }
.centre { text-align: center; margin-inline: auto; }
.mt-3 { margin-top: var(--e-3); }
.mt-4 { margin-top: var(--e-4); }
.mt-5 { margin-top: var(--e-5); }
