/* ============================================
   BLAFA — base.css
   Design tokens · Reset · Typographie · Layout
   ============================================ */

@layer reset, tokens, base, typography, layout, utilities;

/* ═══════════════════════════════════════════
   RESET MODERNE
   ═══════════════════════════════════════════ */
@layer reset {
  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: auto; /* Lenis gère le smooth */
    scrollbar-gutter: stable;
    overflow-x: hidden;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    overflow-x: hidden;
    text-wrap: pretty;
  }

  img, svg, video, picture {
    display: block;
    max-width: 100%;
    height: auto;
  }

  img {
    font-style: italic; /* alt text stylé si l'image casse */
    background-repeat: no-repeat;
    background-size: cover;
    shape-margin: 1rem;
  }

  button, input, textarea, select {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
  }

  button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  ul, ol {
    list-style: none;
  }

  h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    font-weight: inherit;
  }

  p {
    text-wrap: pretty;
  }

  :focus-visible {
    outline: 2px solid var(--sage);
    outline-offset: 3px;
    border-radius: 2px;
  }

  ::selection {
    background: var(--ink);
    color: var(--paper);
  }
}

/* ═══════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════ */
@layer tokens {
  :root {
    /* ── Couleurs ───────────────────────── */
    --ink: #0A0F0C;            /* noir profond — texte, fonds sombres */
    --ink-soft: #1A211D;       /* variante ink */
    --paper: #F4F1EA;          /* ivoire chaud — fond principal */
    --cream: #FAF8F3;          /* blanc cassé — sections alternées */
    --forest: #1B4332;         /* vert forêt — hero, CTA, accents forts */
    --forest-deep: #133024;    /* vert forêt hover */
    --sage: #2E936F;           /* vert sauge — labels, italiques, icônes */
    --sage-light: #7DDE92;     /* vert clair — soulignement hero */
    --mist: #DEEDE0;           /* vert brume — formes derrière images */
    --mist-soft: #EBF5EC;      /* brume légère — backgrounds */

    /* Neutres */
    --stone: #8A8578;          /* texte secondaire */
    --stone-soft: #B8B4A8;     /* texte tertiaire */
    --stone-line: #E4E0D6;     /* séparateurs subtils */
    --stone-light: #E4E0D6;    /* alias utilisé par pages secondaires */

    /* Alias couleurs — cohérence entre home et pages secondaires */
    --seal: #2E936F;           /* alias de --sage pour vanso/tarifs/clients */
    --seal-deep: #1B4332;      /* alias de --forest pour hover accents */
    --paper-soft: #FAF8F3;     /* alias de --cream */
    --correction: #C73E1D;     /* rouge erreur / barré prix */

    /* Ombres — système unifié */
    --shadow-xs: 0 1px 2px rgba(10, 15, 12, 0.04);
    --shadow-sm: 0 2px 8px rgba(10, 15, 12, 0.06);
    --shadow-md: 0 8px 24px rgba(10, 15, 12, 0.08);
    --shadow-lg: 0 16px 40px rgba(10, 15, 12, 0.10);
    --shadow-xl: 0 24px 60px rgba(10, 15, 12, 0.14);

    /* ── Typographie ────────────────────── */
    --font-display: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

    /* Échelle fluide (ratio 1.25 modulaire + clamp responsive) */
    --fs-micro: 0.6875rem;     /* 11px — overlines, meta */
    --fs-xs: 0.75rem;          /* 12px — captions */
    --fs-sm: 0.875rem;         /* 14px — nav, labels */
    --fs-base: 1rem;           /* 16px — body */
    --fs-md: 1.0625rem;        /* 17px — body large */
    --fs-lg: 1.1875rem;        /* 19px — lead paragraphs */
    --fs-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
    --fs-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
    --fs-3xl: clamp(2.25rem, 1.7rem + 2.6vw, 3.5rem);
    --fs-4xl: clamp(2.75rem, 2rem + 3.8vw, 5rem);
    --fs-5xl: clamp(3.5rem, 2.2rem + 6.5vw, 8rem);

    /* Alias typographiques — pages secondaires */
    --fs-body-l: var(--fs-lg);
    --fs-display-s: var(--fs-xl);
    --fs-display-m: var(--fs-2xl);
    --fs-display-l: var(--fs-3xl);

    /* Line-heights */
    --lh-tight: 1.05;
    --lh-snug: 1.2;
    --lh-normal: 1.5;
    --lh-relaxed: 1.65;

    /* Letter-spacings */
    --ls-tight: -0.03em;
    --ls-snug: -0.02em;
    --ls-normal: 0;
    --ls-wide: 0.05em;
    --ls-widest: 0.15em;

    /* ── Espacement (base 4px) ──────────── */
    --space-1: 0.25rem;   /* 4 */
    --space-2: 0.5rem;    /* 8 */
    --space-3: 0.75rem;   /* 12 */
    --space-4: 1rem;      /* 16 */
    --space-5: 1.5rem;    /* 24 */
    --space-6: 2rem;      /* 32 */
    --space-7: 3rem;      /* 48 */
    --space-8: 4rem;      /* 64 */
    --space-9: 6rem;      /* 96 */
    --space-10: 8rem;     /* 128 */

    /* Sections — padding vertical fluide */
    --section-y: clamp(4rem, 8vw, 7rem);
    --section-y-lg: clamp(5rem, 10vw, 9rem);

    /* ── Layout ─────────────────────────── */
    --container: 1280px;
    --container-narrow: 960px;
    --margin-x: clamp(1.25rem, 4vw, 3.5rem);
    --gutter: clamp(1rem, 2vw, 1.5rem);

    /* Rayons */
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --radius-2xl: 56px;
    --radius-full: 9999px;

    /* ── Motion ─────────────────────────── */
    --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);

    --dur-fast: 200ms;
    --dur-base: 400ms;
    --dur-slow: 700ms;
    --dur-xslow: 1100ms;

    /* ── Nav ────────────────────────────── */
    --nav-h: 72px;

    /* ── Z-index (échelle claire) ───────── */
    --z-base: 1;
    --z-raised: 10;
    --z-sticky: 50;
    --z-nav: 100;
    --z-overlay: 200;
    --z-modal: 500;
    --z-transition: 9999;
  }

  /* Reduced motion — respect absolu */
  @media (prefers-reduced-motion: reduce) {
    :root {
      --dur-fast: 0ms;
      --dur-base: 0ms;
      --dur-slow: 0ms;
      --dur-xslow: 0ms;
    }
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ═══════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════ */
@layer base {
  body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--ink);
    background: var(--paper);
    font-feature-settings: 'ss01', 'cv11';
  }

  strong, b {
    font-weight: 600;
  }

  em, i {
    font-style: italic;
  }

  /* Prévention du layout shift au scroll Lenis */
  html.lenis {
    height: auto;
  }
  html.lenis body {
    overscroll-behavior: none;
  }
}

/* ═══════════════════════════════════════════
   TYPOGRAPHIE — Classes utilitaires
   ═══════════════════════════════════════════ */
@layer typography {
  .t-overline {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: var(--ls-widest);
    text-transform: uppercase;
    color: var(--sage);
  }

  .t-caption {
    font-size: var(--fs-xs);
    color: var(--stone);
  }

  .t-body {
    font-size: var(--fs-base);
    line-height: var(--lh-relaxed);
  }

  .t-lead {
    font-size: var(--fs-lg);
    line-height: var(--lh-relaxed);
    color: var(--ink);
  }

  .t-display-sm {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 500;
    line-height: var(--lh-snug);
    letter-spacing: var(--ls-snug);
  }

  .t-display-md {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 500;
    line-height: var(--lh-snug);
    letter-spacing: var(--ls-snug);
  }

  .t-display-lg {
    font-family: var(--font-display);
    font-size: var(--fs-3xl);
    font-weight: 500;
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
  }

  .t-display-xl {
    font-family: var(--font-display);
    font-size: var(--fs-4xl);
    font-weight: 500;
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
  }

  .t-display-2xl {
    font-family: var(--font-display);
    font-size: var(--fs-5xl);
    font-weight: 500;
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
  }

  /* Accent italique vert — utilisé pour les mots-clés */
  .accent {
    color: var(--sage);
    font-style: italic;
    font-weight: 500;
  }

  /* Soulignement SVG animé (mot "jamais") */
  .underlined {
    position: relative;
    display: inline-block;
    white-space: nowrap;
  }

  .underlined svg {
    position: absolute;
    left: -2%;
    bottom: -0.08em;
    width: 104%;
    height: 0.3em;
    pointer-events: none;
    overflow: visible;
  }

  .underlined svg path {
    fill: none;
    stroke: var(--sage-light);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.4s var(--ease-out-expo) 0.3s;
  }

  .underlined.is-drawn svg path,
  .is-visible .underlined svg path {
    stroke-dashoffset: 0;
  }
}

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */
@layer layout {
  .wrap {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--margin-x);
  }

  .wrap--narrow {
    max-width: var(--container-narrow);
  }

  section {
    position: relative;
    padding-block: var(--section-y);
  }

  section.section--lg {
    padding-block: var(--section-y-lg);
  }

  .section--ink {
    background: var(--ink);
    color: var(--paper);
  }

  .section--cream {
    background: var(--cream);
  }

  .section--paper {
    background: var(--paper);
  }

  .rule {
    width: 100%;
    height: 1px;
    background: var(--stone-line);
    border: none;
  }

  .section--ink .rule {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* ═══════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════ */
@layer utilities {
  .text-center { text-align: center; }
  .text-balance { text-wrap: balance; }

  .stack > * + * { margin-top: var(--space-4); }
  .stack-sm > * + * { margin-top: var(--space-2); }
  .stack-lg > * + * { margin-top: var(--space-6); }

  .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;
  }

  .no-scroll {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
  }

  body.no-scroll {
    position: fixed;
  }
}

