/* ==========================================================================
   Terra Vigneronne — socle : tokens, reset, typographie, grille, boutons.
   Direction : vigne et pierre. Vert du logo, creme, taupe dore.
   Contrastes verifies : toutes les paires texte/fond sont >= 4,5:1.
   ========================================================================== */

/* --- 1. Tokens ---------------------------------------------------------- */
:root {
  --encre: #1E241F;
  --vert: #47704C;
  --vert-sombre: #335740;
  --vert-profond: #22382A;
  --taupe: #C2A486;
  --taupe-clair: #D9BE9C;
  --taupe-sombre: #8A6240;
  --creme: #FBF6F2;
  --sable: #F3EBE1;
  --sable-moyen: #E6DACB;
  --gris-texte: #55604F;
  --rouge: #A3261E;

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

  --serif: "Cormorant Garamond", Garamond, "Iowan Old Style", Georgia, serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, 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.3rem, 0.9vw + 1.1rem, 1.6rem);
  --t-2xl: clamp(1.7rem, 1.8vw + 1.3rem, 2.4rem);
  --t-3xl: clamp(2.2rem, 3.2vw + 1.4rem, 3.6rem);
  --t-4xl: clamp(2.4rem, 4vw + 1.1rem, 4.25rem);

  --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: 74rem;
  --largeur-texte: 40rem;
  --rayon: 3px;

  --ombre-1: 0 1px 2px rgba(34, 56, 42, .06), 0 2px 10px rgba(34, 56, 42, .05);
  --ombre-2: 0 2px 5px rgba(34, 56, 42, .08), 0 14px 30px rgba(34, 56, 42, .09);
  --ombre-3: 0 5px 10px rgba(34, 56, 42, .09), 0 28px 60px rgba(34, 56, 42, .14);

  --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.68;
  -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(--vert-sombre);
  outline-offset: 3px;
  border-radius: var(--rayon);
}

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

/* --- 3. Typographie ----------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.005em;
  text-wrap: balance;
  color: var(--vert-profond);
}

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

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

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

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

.sur-titre--centre { justify-content: center; }

/* --- 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--sable { background: var(--fond-alt); }

.section--sombre { background: var(--vert-profond); color: var(--creme); }
.section--sombre h2, .section--sombre h3, .section--sombre h4 { color: var(--creme); }
.section--sombre .lede { color: rgba(251, 246, 242, .82); }
.section--sombre .sur-titre { color: var(--taupe-clair); }
.section--sombre .sur-titre::before { background: var(--taupe-clair); }

.entete-section { max-width: 46rem; margin-bottom: var(--e-5); }
.entete-section--centre { margin-inline: auto; text-align: center; }

.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, 1.05fr) minmax(0, .95fr); }
  .duo--serre { gap: var(--e-5); }
}

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

.saut-contenu {
  position: absolute;
  left: 50%;
  top: -4rem;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--vert-profond);
  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(--vert-profond);
  --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: .04em;
  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);
}

.bouton::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--taupe);
  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--taupe { --fond-bouton: var(--taupe); --texte-bouton: var(--encre); }
.bouton--taupe::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; }

.actions { display: flex; flex-wrap: wrap; gap: var(--e-2); }

.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(--vert-sombre);
  padding-bottom: 2px;
  background-image: linear-gradient(var(--taupe), var(--taupe));
  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(--taupe-sombre); }
.lien-fleche svg { flex: none; transition: transform var(--normal) var(--sortie); }
.lien-fleche:hover svg { transform: translateX(4px); }

/* --- 6. Motion ---------------------------------------------------------- */
/* Rien n'est masque sans JS : l'etat de depart est pose 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); transform-origin: left; }
[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-2 { margin-top: var(--e-2); }
.mt-3 { margin-top: var(--e-3); }
.mt-4 { margin-top: var(--e-4); }
.mt-5 { margin-top: var(--e-5); }
