/* ==========================================================
   Jean Grobry | Design system partagé (copie identique dans portfolio/ et devis/)
   Tokens, typo, boutons, utilitaires.
   ========================================================== */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Couleurs : thème sombre par défaut */
  --bg: #0c0d0b;
  --bg-2: #121310;
  --surface: #171814;
  --surface-2: #1f201b;
  --line: rgba(236, 236, 230, 0.09);
  --line-strong: rgba(236, 236, 230, 0.18);
  --text: #ecece6;
  --muted: #9a9b93;
  --accent: #c8f560;        /* accent unique */
  --accent-ink: #c8f560;    /* accent utilisé comme texte */
  --on-accent: #10120b;
  --danger: #ff8a7a;

  /* Formes */
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 28px;
  --r-pill: 999px;

  /* Typo */
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Espacements */
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --section: clamp(88px, 12vw, 160px);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f1f2ee;
  --bg-2: #e9eae4;
  --surface: #fafaf7;
  --surface-2: #ecede7;
  --line: rgba(20, 21, 18, 0.1);
  --line-strong: rgba(20, 21, 18, 0.2);
  --text: #141512;
  --muted: #595b53;
  --accent: #c8f560;
  --accent-ink: #46660a;
  --on-accent: #10120b;
  --danger: #b3261e;
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

/* Grain discret, fixe, sans interaction */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--on-accent); }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-pill);
  font-weight: 600;
}
.skip-link:focus { top: 16px; }

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

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

/* ---------- Typo ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.035em; line-height: 1.02; }
p { margin: 0; }

.display {
  font-size: clamp(2.6rem, 6.4vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}
.h2 {
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  letter-spacing: -0.04em;
}
.h3 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); letter-spacing: -0.03em; line-height: 1.1; }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.25rem); color: var(--muted); max-width: 52ch; line-height: 1.55; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .8rem; letter-spacing: .02em; }
.accent { color: var(--accent-ink); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .04em;
}
.eyebrow .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(200, 245, 96, .6);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(200, 245, 96, .55); }
  70% { box-shadow: 0 0 0 10px rgba(200, 245, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 245, 96, 0); }
}

/* Lignes masquées pour les révélations de titres */
.line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.line > span { display: inline-block; will-change: transform; }

/* ---------- Boutons ---------- */
.btn {
  --h: 54px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--h);
  padding: 0 26px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-weight: 550;
  font-size: .98rem;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform .5s var(--ease), background-color .3s, border-color .3s, color .3s;
}
.btn i { font-size: 1.1em; transition: transform .5s var(--ease); }
.btn:hover i { transform: translate(2px, -2px); }
.btn:active { transform: scale(.97); }

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--text);
  transform: translateY(101%);
  border-radius: inherit;
  transition: transform .55s var(--ease);
}
.btn--primary:hover { color: var(--bg); }
.btn--primary:hover::before { transform: translateY(0); }

.btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--text); }

.btn--sm { --h: 42px; padding: 0 18px; font-size: .9rem; }

.icon-btn {
  width: 42px; height: 42px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 1.1rem;
  transition: border-color .3s, transform .4s var(--ease);
}
.icon-btn:hover { border-color: var(--text); }

/* Magnetique (piloté en JS) */
[data-magnetic] { will-change: transform; }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 8px; }
.field label { font-size: .88rem; font-weight: 500; }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .textarea, .select {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color .25s, background-color .25s;
}
.textarea { resize: vertical; min-height: 130px; }
.input:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent-ink); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.form-status { font-size: .92rem; min-height: 1.4em; }
.form-status.is-ok { color: var(--accent-ink); }
.form-status.is-error { color: var(--danger); }

/* ---------- Animations d'entrée (repli sans JS) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(28px); }
.reduced [data-reveal] { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
