/* ==========================================================================
   M Rénova 95 — Base
   Design tokens · reset · typographie · utilitaires · boutons · animations
   ========================================================================== */

/* ---------- Polices (hébergées sur le site, licence OFL — voir assets/fonts/LICENCE.txt) ---------- */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 300 700; font-display: swap; size-adjust: 100%; src: url("../fonts/cormorant-garamond.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 300 700; font-display: swap; size-adjust: 100%; src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("../fonts/dm-sans-variable.woff2") format("woff2"); }

/* ---------- Design tokens ---------- */
:root {
  /* Couleurs */
  --c-ivory: #f5f2ec;        /* fond principal */
  --c-paper: #fbfaf7;        /* cartes, champs */
  --c-stone: #ece7de;        /* sections alternées */
  --c-line: #dcd5c9;         /* filets */
  --c-line-soft: #e6e0d6;
  --c-ink: #141517;          /* texte principal / fonds sombres */
  --c-ink-2: #1c1e21;
  --c-ink-3: #2a2d31;
  --c-muted: #64666b;        /* texte secondaire */
  --c-muted-2: #8b877f;
  --c-accent: #a2804f;       /* bronze — accent discret */
  --c-accent-deep: #84663b;
  --c-on-dark: #f2eee7;
  --c-on-dark-muted: rgba(242, 238, 231, 0.64);
  --c-on-dark-line: rgba(242, 238, 231, 0.16);
  --c-error: #a23b2a;

  /* Typographie */
  --f-display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --f-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Mise en page */
  --container: 1380px;
  --gutter: clamp(16px, 4.2vw, 64px);
  --section-y: clamp(96px, 12vw, 176px);
  --header-h: 88px;
  --radius: 4px;
  --radius-lg: 10px;

  /* Mouvement */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast: 0.3s;
  --t-med: 0.6s;
  --t-slow: 1.1s;
}

@media (max-width: 1023px) {
  :root { --header-h: 72px; }
}

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

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

body {
  margin: 0;
  font-family: var(--f-sans);
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 400;
  color: var(--c-ink);
  background: var(--c-ivory);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
legend { padding: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
em { font-style: italic; }
[hidden] { display: none !important; }
::selection { background: var(--c-ink); color: var(--c-ivory); }

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

section[id], [id="devis"] { scroll-margin-top: calc(var(--header-h) - 1px); }

/* ---------- Accessibilité ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 1000;
  padding: 12px 18px;
  background: var(--c-ink);
  color: var(--c-ivory);
  font-weight: 600;
  border-radius: var(--radius);
  transform: translateY(-160%);
  transition: transform var(--t-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }
.section--stone { background: var(--c-stone); }
.section--dark { background: var(--c-ink); color: var(--c-on-dark); }

/* ---------- Typographie ---------- */
.h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.h2 em, .cta__title em, .hero__title em { font-style: italic; }
.h2 em { color: var(--c-accent-deep); }
.section--dark .h2 em { color: #c6a878; }

.lead {
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
  line-height: 1.55;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--c-ink);
}

.body-text {
  font-size: 1.0625rem;
  color: var(--c-muted);
  max-width: 54ch;
}
.section--dark .body-text { color: var(--c-on-dark-muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 28px;
}
.eyebrow__num {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--c-accent-deep);
  font-variant-numeric: tabular-nums;
}
.eyebrow__num::after {
  content: "";
  width: 36px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.eyebrow--light { color: var(--c-on-dark-muted); }
.eyebrow--light .eyebrow__num { color: #c6a878; }
/* Fonds « pierre » : bronze un peu plus foncé pour un contraste suffisant (AA) */
.section--stone .eyebrow__num { color: #735731; }
.eyebrow--center { justify-content: center; }

/* ---------- Icônes ---------- */
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--c-ink);
  --btn-fg: var(--c-ivory);
  --btn-fill: var(--c-accent-deep);
  --btn-fg-hover: #fff;
  --btn-border: transparent;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: color 0.45s var(--ease-out), border-color 0.45s var(--ease-out), transform 0.45s var(--ease-out), scale 0.1s ease-out;
  -webkit-tap-highlight-color: transparent;
}
/* Retour visuel dès l’appui (17/10/2026) : le bouton s’enfonce légèrement.
   Propriété « scale » séparée, pour ne pas gêner l’effet magnétique (transform). */
.btn:active { scale: 0.97; }
.btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--btn-fill);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform 0.55s var(--ease-out);
}
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }
.btn:hover, .btn:focus-visible { color: var(--btn-fg-hover); }

.btn__label {
  position: relative;
  display: inline-block;
  overflow: hidden;
  line-height: 1.3;
}
.btn__label > span { display: inline-block; transition: transform 0.55s var(--ease-out); }
.btn__label::after {
  content: attr(data-label);
  position: absolute;
  left: 0; top: 100%;
  white-space: nowrap;
  transition: transform 0.55s var(--ease-out);
}
.js .btn__label { color: transparent; }
.js .btn__label > span,
.js .btn__label::after { color: var(--btn-fg); transition: transform 0.55s var(--ease-out), color 0.45s var(--ease-out); }
.js .btn:hover .btn__label > span,
.js .btn:focus-visible .btn__label > span,
.js .btn:hover .btn__label::after,
.js .btn:focus-visible .btn__label::after { transform: translateY(-100%); color: var(--btn-fg-hover); }

.btn__icon { width: 18px; height: 18px; transition: transform 0.5s var(--ease-out); }
.btn:hover .btn__icon, .btn:focus-visible .btn__icon { transform: translateX(4px); }

.btn--sm { min-height: 46px; padding: 0 22px; font-size: 0.875rem; }
.btn--lg { min-height: 64px; padding: 0 36px; font-size: 1rem; }
.btn--block { width: 100%; }

.btn--light { --btn-bg: var(--c-ivory); --btn-fg: var(--c-ink); --btn-fill: #fff; --btn-fg-hover: var(--c-ink); }
.btn--ghost-light {
  --btn-bg: transparent; --btn-fg: var(--c-ivory); --btn-fill: var(--c-ivory); --btn-fg-hover: var(--c-ink);
  --btn-border: rgba(242, 238, 231, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.btn--outline {
  --btn-bg: transparent; --btn-fg: var(--c-ink); --btn-fill: var(--c-ink); --btn-fg-hover: var(--c-ivory);
  --btn-border: var(--c-ink);
}
.btn--text {
  --btn-bg: transparent; --btn-fg: var(--c-ink); --btn-fill: transparent; --btn-fg-hover: var(--c-ink);
  padding: 0 6px;
  min-height: 48px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 6px;
  transition: text-decoration-color var(--t-fast);
}
.btn--text:hover { text-decoration-color: currentColor; }

.btn[disabled], .btn.is-loading { pointer-events: none; }
.btn__spinner {
  display: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.btn.is-loading .btn__spinner { display: inline-block; }
.btn.is-loading .btn__icon { display: none; }
.btn.is-loading { opacity: 0.85; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Lien flèche */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 0.9375rem;
  padding-block: 8px;
  background: linear-gradient(currentColor, currentColor) no-repeat left bottom / 0% 1px;
  transition: background-size 0.6s var(--ease-out);
}
.link-arrow .icon { width: 18px; height: 18px; transition: transform 0.5s var(--ease-out); }
.link-arrow:hover { background-size: 100% 1px; }
.link-arrow:hover .icon { transform: translateX(5px); }

/* ---------- Animations d’apparition (activées uniquement avec JS) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition:
    opacity 1s var(--ease-out) calc(var(--d, 0) * 110ms),
    transform 1.2s var(--ease-out) calc(var(--d, 0) * 110ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* Révélation d’image : rideau + léger dézoom */
.js [data-reveal="image"] {
  opacity: 1;
  transform: none;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.4s var(--ease-in-out) calc(var(--d, 0) * 110ms);
}
.js [data-reveal="image"] img {
  transform: scale(1.18);
  transition: transform 1.8s var(--ease-out) calc(var(--d, 0) * 110ms);
}
.js [data-reveal="image"].is-in { clip-path: inset(0 0 0 0); }
.js [data-reveal="image"].is-in img { transform: scale(1); }

/* Titres découpés mot par mot */
.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
.split-word > span {
  display: inline-block;
  transform: translate3d(0, 105%, 0);
  transition: transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 55ms);
}
.is-in .split-word > span, .is-in.split-word > span { transform: none; }

/* Préférence « réduire les animations » */
@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;
    transition-delay: 0ms !important;
  }
  .js [data-reveal], .js [data-reveal="image"] { opacity: 1; transform: none; clip-path: none; }
  .js [data-reveal="image"] img, .split-word > span { transform: none; }
}

/* ---------- Ajustement typographique (Cormorant Garamond : graisse 500 pour la lisibilité des titres) ---------- */
h1, h2, h3, h4, .h2, .hero__title, [class*="__title"], [class*="__name"] { font-weight: 500; }
h1 em, h2 em, h3 em, .hero__title em, .h2 em { font-weight: 500; }

/* Titre d’accueil : Cormorant Garamond est plus large et plus haut que l’ancienne police, on réduit l’échelle */
.hero__title { font-size: clamp(2.4rem, 5vw, 4.5rem); line-height: 0.96; letter-spacing: -0.02em; }
