/* =========================================================================
   Isabelle Beaugrand — Design System (library)
   Strictement dérivé de assets/css/styles.css (Figma node 346:124).
   Tokens + primitives + utilitaires partagés par toutes les variantes.
   Aucune valeur arbitraire : tout passe par les tokens ci-dessous.
   ========================================================================= */

:root {
  /* ---- Couleurs (identiques à la source) ---- */
  --cream:        #fdf9f2;
  --cream-soft:   #fefdfb;
  --card:         #f6f1ea;
  --ink:          #3e3a36;
  --ink-70:       rgba(62, 58, 54, 0.7);
  --ink-50:       rgba(62, 58, 54, 0.5);
  --green:        #818b69;
  --green-deep:   #646b51;
  --taupe:        #d9d3c3;
  --sage:         #c7d2ab;        /* présent dans les cercles SVG */
  --line-green:   rgba(129, 139, 105, 0.35);
  --line-green-soft: rgba(129, 139, 105, 0.18);
  --line-cream:   rgba(253, 249, 242, 0.18);

  /* ---- Typographie ---- */
  --font: "Optima", "Optima Nova", Candara, "Gill Sans", "Gill Sans MT",
          "Segoe UI", "Trebuchet MS", sans-serif;

  /* Échelle (clamp pour production-grade ; bornes = valeurs source) */
  --fs-display: clamp(34px, 4.4vw, 48px);
  --fs-h2:      clamp(30px, 3.4vw, 40px);
  --fs-h2-lg:   clamp(34px, 4.4vw, 48px);
  --fs-h3:      clamp(24px, 2.4vw, 28px);
  --fs-h4:      23px;
  --fs-lead:    20px;
  --fs-body:    16px;
  --fs-small:   14px;
  --fs-micro:   13px;

  --ls-tight:  -0.04em;
  --ls-snug:   -0.03em;
  --ls-tiny:   -0.01em;
  --ls-wide:    0.04em;
  --ls-caps:    0.06em;

  --lh-tight: 1.05;
  --lh-head:  1.1;
  --lh-snug:  1.3;
  --lh-body:  1.5;

  /* ---- Espacement (base 8) ---- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  --s-20: 80px; --s-24: 96px; --s-30: 120px;

  /* ---- Layout ---- */
  --gutter: 96px;
  --container: 1248px;
  --header-h: 96px;

  /* ---- Motion ---- */
  --t-fast: 0.2s;
  --t-base: 0.25s;
  --t-slow: 0.4s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: var(--cream);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 400; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

/* Accessibilité : focus visible homogène (jamais d'outline:none nu) */
:where(a, button, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* --------------------------------------------------------------- layout */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--s-20); position: relative; }
.section--sm { padding-block: var(--s-16); }
.section--lg { padding-block: var(--s-30); }
.section--cream { background: var(--cream); }
.section--soft  { background: var(--cream-soft); }
.section--card  { background: var(--card); }
.section--olive { background: var(--green-deep); color: var(--cream); }
.section--ink   { background: var(--ink); color: var(--cream); }

/* mesures de lecture confortables (50-75 caractères) */
.measure   { max-width: 582px; }
.measure-sm{ max-width: 430px; }
.measure-lg{ max-width: 760px; }

/* --------------------------------------------------------- typographie */
.eyebrow {
  font-weight: 700;
  font-size: var(--fs-body);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--green);
  line-height: var(--lh-head);
}
.section--olive .eyebrow,
.section--ink .eyebrow { color: var(--taupe); }

.display { font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: var(--ls-snug); }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-head); letter-spacing: var(--ls-tight); }
.h2-lg { font-size: var(--fs-h2-lg); line-height: var(--lh-head); letter-spacing: var(--ls-tight); }
.h3 { font-size: var(--fs-h3); line-height: var(--lh-tight); letter-spacing: var(--ls-snug); }
.lead { font-size: var(--fs-lead); line-height: var(--lh-body); }
.muted { color: var(--ink-70); }
.italic { font-style: italic; }
.accent { color: var(--green); }
.section--olive .accent, .section--ink .accent { color: var(--taupe); }

/* Pull-quote (filet olive à gauche) */
.pullquote {
  border-left: 2px solid var(--line-green);
  padding: var(--s-2) 0 var(--s-2) var(--s-5);
  font-style: italic;
  font-weight: 700;
  font-size: var(--fs-lead);
  color: var(--ink);
  line-height: 1.25;
}
.section--olive .pullquote { color: var(--cream); border-color: var(--taupe); }

/* Lien fléché */
.arrow-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-weight: 700; font-size: 18px; color: var(--green);
  line-height: var(--lh-head); transition: gap var(--t-base) var(--ease);
}
.arrow-link svg, .arrow-link img { width: 24px; height: 24px; }
.arrow-link:hover { gap: var(--s-4); }
.section--olive .arrow-link { color: var(--taupe); }

/* Tag / chip (dérivé de episode__tag) */
.tag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-weight: 700; font-size: var(--fs-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--green);
}
.tag--box {
  padding: 6px 12px; border: 1px solid var(--line-green); color: var(--green);
}
.section--olive .tag { color: var(--taupe); }
.section--olive .tag--box { border-color: var(--line-cream); }

/* Statistique (grand nombre + label) */
.stat__num { font-size: clamp(40px, 5vw, 56px); line-height: 1; letter-spacing: var(--ls-tight); color: var(--green); }
.stat__label { font-size: var(--fs-body); color: var(--ink-70); margin-top: var(--s-2); }
.section--olive .stat__num { color: var(--cream); }
.section--olive .stat__label { color: var(--taupe); }

/* Filet de séparation */
.rule { height: 1px; background: var(--line-green); border: 0; }
.section--olive .rule { background: var(--line-cream); }

/* -------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: 12px 16px;
  font-size: var(--fs-body);
  color: var(--ink);
  border: 1px solid transparent;
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn--solid { background: var(--taupe); }
.btn--solid:hover { box-shadow: 0 10px 24px -12px rgba(62, 58, 54, 0.5); }
.btn--olive { background: var(--green); color: var(--cream); }
.btn--olive:hover { background: var(--green-deep); box-shadow: 0 12px 28px -14px rgba(100,107,81,0.7); }
.btn--outline { background: transparent; border-color: var(--line-green); color: var(--green-deep); }
.btn--outline:hover { background: rgba(129,139,105,0.08); }
.btn--cream { background: var(--cream); color: var(--green-deep); }
.btn--cream:hover { box-shadow: 0 12px 30px -14px rgba(0,0,0,0.45); }
.btn--glass {
  background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.35);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.btn--glass:hover { background: rgba(255,255,255,0.3); }
.btn--lg { padding: 16px 28px; font-size: 18px; }
.btn--block { width: 100%; }

/* --------------------------------------------------------------- inputs */
.field {
  width: 100%; min-width: 0; font-family: inherit; font-size: var(--fs-body);
  color: var(--ink); padding: 12px 16px; background: #fff;
  border: 1px solid var(--taupe);
}
.field::placeholder { color: var(--ink-50); }
.field:focus-visible { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }

/* check note (dérivé de form-note) */
.note { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-body); letter-spacing: var(--ls-snug); }
.note svg, .note img { width: 20px; height: 20px; flex: none; }

/* ----------------------------------------------------------- décoratifs */
/* Cercles concentriques : composant inline, teinté via currentColor olive */
.rings { position: absolute; pointer-events: none; z-index: 0; opacity: 0.9; }
.rings svg { width: 100%; height: 100%; display: block; }
.leaf { position: absolute; pointer-events: none; mix-blend-mode: darken; opacity: 0.85; z-index: 2; }

/* En-tête de section centré, réutilisable */
.head-center {
  text-align: center; max-width: 720px; margin-inline: auto;
  display: flex; flex-direction: column; gap: var(--s-5); align-items: center;
  margin-bottom: var(--s-12);
}
.head-center .h2, .head-center .h2-lg { letter-spacing: var(--ls-tight); }

/* Reveal on scroll (optionnel, repris de la source) */
.reveal { opacity: 0; translate: 0 24px; transition: opacity 0.7s var(--ease), translate 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; translate: 0 0; transition: none; }
  html { scroll-behavior: auto; }
  .btn:hover, .arrow-link:hover { transform: none; }
}

/* ======================================================= GALLERY CHROME */
/* Bandeau de variante : étiquette discrète au-dessus de chaque section */
.variant {
  border-top: 1px solid var(--line-green-soft);
}
.variant__bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: baseline; gap: var(--s-3);
  padding: 10px var(--gutter);
  background: rgba(253,249,242,0.9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-green-soft);
  font-size: var(--fs-micro);
}
.variant__id {
  font-weight: 700; text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--green);
}
.variant__name { color: var(--ink-70); }

/* Hub */
.lib-hero { padding-block: var(--s-24) var(--s-16); }
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.lib-card {
  display: flex; flex-direction: column; gap: var(--s-3);
  background: var(--card); padding: var(--s-8) var(--s-6);
  border: 1px solid var(--line-green-soft);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.lib-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -24px rgba(62,58,54,0.45); }
.lib-card__n { font-size: var(--fs-micro); color: var(--green); font-weight: 700; letter-spacing: var(--ls-caps); }
.lib-card__t { font-size: var(--fs-h3); line-height: var(--lh-tight); letter-spacing: var(--ls-snug); }
.lib-card__d { font-size: var(--fs-body); color: var(--ink-70); font-style: italic; }

/* Swatches palette */
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
.swatch { border: 1px solid var(--line-green-soft); }
.swatch__chip { height: 96px; }
.swatch__meta { padding: var(--s-3) var(--s-4); font-size: var(--fs-small); display: flex; flex-direction: column; gap: 2px; }
.swatch__name { color: var(--ink); }
.swatch__hex { color: var(--ink-50); font-feature-settings: "tnum"; }

/* Type & component specimen rows */
.specimen { display: flex; flex-direction: column; gap: var(--s-10); }
.specimen__row { display: grid; grid-template-columns: 200px 1fr; gap: var(--s-8); align-items: baseline; padding-bottom: var(--s-8); border-bottom: 1px solid var(--line-green-soft); }
.specimen__label { font-size: var(--fs-small); color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: var(--ls-caps); }

/* ============================================================ RESPONSIVE */
@media (max-width: 1180px) { :root { --gutter: 56px; } }
@media (max-width: 900px) {
  :root { --gutter: 32px; --header-h: 72px; }
  .lib-grid { grid-template-columns: 1fr 1fr; }
  .swatches { grid-template-columns: repeat(2, 1fr); }
  .specimen__row { grid-template-columns: 1fr; gap: var(--s-3); }
  .variant__bar { padding-inline: var(--gutter); }
}
@media (max-width: 620px) {
  .lib-grid { grid-template-columns: 1fr; }
}
