/* ==========================================================================
   base.css — Charte atisma : tokens, polices, reset, typographie, composants
   ========================================================================== */

/* ---- Polices auto-hébergées ------------------------------------------- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/static/fonts/CormorantGaramond-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/static/fonts/CormorantGaramond-Variable-Italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("/static/fonts/DMMono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("/static/fonts/DMMono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ----------------------------------------------------------- */
:root {
  /* Couleurs de la charte « Tons de terre » */
  --encre: #1E1814;
  --sable: #E9DDCA;
  --os: #F4EEE4;
  --terracotta: #A24B30;
  --argile: #D9B99A;
  --sauge: #6E7E68;

  /* Dérivés (contraste AA garanti) */
  --encre-doux: #5A4E45;          /* texte secondaire sur sable / os : 6.4:1 */
  --terracotta-texte: #8E3F27;    /* terracotta pour petit texte sur sable */
  --terracotta-clair: #C86A4C;    /* terracotta lisible sur encre */
  --encre-2: #2A221D;             /* surface légèrement relevée sur encre */
  --trait: rgba(30, 24, 20, 0.22);
  --trait-clair: rgba(244, 238, 228, 0.18);

  /* Thème courant (basculé par [data-theme="dark"]) */
  --bg: var(--sable);
  --fg: var(--encre);
  --fg-soft: var(--encre-doux);
  --accent: var(--terracotta);
  --accent-text: var(--terracotta-texte);
  --line: var(--trait);

  /* Typographies : deux voix */
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Échelle typographique fluide */
  --fs-mono: clamp(0.72rem, 0.68rem + 0.15vw, 0.8rem);
  --fs-small: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --fs-body: clamp(1.125rem, 1.05rem + 0.35vw, 1.3rem);      /* ≈ 20 px, charte */
  --fs-lead: clamp(1.4rem, 1.15rem + 1vw, 2rem);             /* ≈ 32 px, charte */
  --fs-story: clamp(1.75rem, 1.2rem + 2.2vw, 3.4rem);
  --fs-h3: clamp(1.6rem, 1.3rem + 1.2vw, 2.4rem);
  --fs-title: clamp(3.4rem, 1.6rem + 7.5vw, 9.5rem);         /* italique 64+ */
  --fs-giant: clamp(5.5rem, 1rem + 24vw, 26rem);
  --fs-hero: clamp(6.5rem, 0.5rem + 30vw, 34rem);

  /* Espacements */
  --pad: clamp(1.5rem, 0.4rem + 6vw, 9rem);
  --max: 1560px;
  --gap: clamp(1rem, 0.6rem + 1.6vw, 2.25rem);
  --section-y: clamp(6rem, 3rem + 12vw, 15rem);
  --spine-w: 0px;

  /* Mouvements */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);

  --z-field: 1;
  --z-content: 2;
  --z-spine: 40;
  --z-header: 50;
  --z-menu: 60;
  --z-grain: 70;
  --z-cursor: 90;
  --z-preloader: 100;
}


[data-theme="dark"] {
  --bg: var(--encre);
  --fg: var(--os);
  --fg-soft: var(--argile);
  --accent: var(--terracotta-clair);
  --accent-text: var(--terracotta-clair);
  --line: var(--trait-clair);
}
[data-tone="bone"] { --bg: var(--os); }

/* ---- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  background: var(--sable);
  color: var(--encre);
  font-family: var(--serif);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:where(ul[role="list"], ol) { list-style: none; padding: 0; }
h1, h2, h3 { font-weight: 400; line-height: 1; text-wrap: balance; }
p { text-wrap: pretty; }
address { font-style: normal; }
[hidden] { display: none !important; }

::selection { background: var(--terracotta); color: var(--os); }

/* Barre de défilement discrète */
html { scrollbar-color: var(--encre-doux) var(--sable); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--sable); }
::-webkit-scrollbar-thumb { background: var(--encre-doux); border: 3px solid var(--sable); border-radius: 10px; }

/* ---- Accessibilité ---------------------------------------------------- */
.visually-hidden {
  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: 1rem; left: 1rem;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--encre);
  color: var(--os);
  font-family: var(--mono);
  font-size: var(--fs-mono);
  transform: translateY(-200%);
  transition: transform 0.3s var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

:focus { outline: none; }
:focus-visible {
  outline: 1.5px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- Typographie ------------------------------------------------------ */
/* DM Mono : la voix précise, en capitales espacées, pour les infos pratiques */
.mono {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.section-num {
  color: var(--accent-text);
  margin-bottom: clamp(1rem, 2vw, 1.75rem);
}
.section-title {
  font-size: var(--fs-title);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.92;
}
.section-sub {
  font-size: var(--fs-lead);
  line-height: 1.15;
  margin-bottom: 0.75em;
}

/* ---- Liens ------------------------------------------------------------ */
/* Soulignement en pointillés qui se « pique » au survol */
.link-line {
  position: relative;
  display: inline;
  background-image: radial-gradient(circle, currentColor 0.9px, transparent 1.2px);
  background-size: 5px 3px;
  background-repeat: repeat-x;
  background-position: 0 100%;
  padding-bottom: 0.12em;
  transition: color 0.3s var(--ease-soft), background-size 0.45s var(--ease-out);
}
.link-line:hover { color: var(--accent-text); background-size: 3px 3px; }

/* ---- Boutons ---------------------------------------------------------- */
.btn {
  --btn-bg: var(--terracotta);
  --btn-fg: var(--os);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  min-height: 3.4rem;
  padding: 0.9rem 1.9rem;
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  isolation: isolate;
  overflow: hidden;
  will-change: transform;
  transition: color 0.4s var(--ease-soft);
}
/* L'encre monte dans le bouton au survol */
.btn::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: var(--encre);
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
  transform: translateY(102%);
  transition: transform 0.6s var(--ease-out), border-radius 0.6s var(--ease-out);
}
.btn:hover::before,
.btn:focus-visible::before { transform: translateY(0); border-radius: 0; }
.btn__label { position: relative; display: inline-block; pointer-events: none; }

.btn--small { min-height: 2.75rem; padding: 0.55rem 1.25rem; }
.btn--large { min-height: 4.2rem; padding: 1.2rem 2.6rem; font-size: 0.85rem; }
.btn--light { --btn-bg: var(--os); --btn-fg: var(--encre); }
.btn--light::before { background: var(--terracotta); }
.btn--light:hover, .btn--light:focus-visible { color: var(--os); }

/* ---- Pastille « disponible » ----------------------------------------- */
.pulse {
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 0.8em;
  border-radius: 50%;
  background: var(--terracotta);
  vertical-align: 0.1em;
  box-shadow: 0 0 0 0 rgba(162, 75, 48, 0.5);
  animation: pulse 2.4s var(--ease-soft) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(162, 75, 48, 0.45); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(162, 75, 48, 0); }
}
