/* ==========================================================================
   MELIA design tokens — the single source of truth for the visual system.
   Every page links this file first. Change values here, not in components.
   See DESIGN.md for usage rules and contrast notes.
   ========================================================================== */

:root {
  /* ---- Color: raw palette ------------------------------------------------ */
  --ivory-50:  #FBF8F1;   /* raised surfaces, cards                        */
  --ivory-100: #F6F1E6;   /* page background                               */
  --ivory-200: #EDE6D6;   /* alternate section band                        */
  --ivory-300: #DAD2BF;   /* hairlines, borders                            */

  --forest-950: #0E1F17;
  --forest-900: #12261C;  /* dark section background                       */
  --forest-800: #1B3A2B;  /* primary hover                                 */
  --forest-700: #24503A;  /* primary — buttons, links, emphasis (8.2:1)    */

  --sage-700: #4E6852;    /* sage as TEXT on ivory (5.4:1) — eyebrows, meta */
  --sage-400: #93A88F;    /* decorative only on light; text OK on forest   */
  --sage-300: #A9BBA5;    /* text on forest-900 (7.8:1)                    */
  --sage-200: #C9D5C3;    /* fills, illustration                           */
  --sage-100: #E3E9DC;    /* soft tint backgrounds                         */

  --ink-900: #1E2320;     /* charcoal: body text (14.9:1 on ivory)         */
  --ink-700: #343B37;     /* charcoal: strong secondary, rules on dark     */
  --ink-600: #4A564E;     /* secondary text (6.8:1 on ivory)               */

  /* Brass: a restrained warm-metal accent. Leaves/outcome nodes, fine
     rules and small marks only; never large fills or body text.           */
  --brass-500: #A8885A;   /* decorative (2.9:1 on ivory; never for text)   */
  --brass-700: #7A6036;   /* small labels on ivory (5.3:1)                 */
  --brass-200: #E6D8BC;   /* tint                                          */

  --warn-700: #7A3A1F;    /* cautions / errors only                        */

  /* ---- Color: semantic roles (use these in components) ------------------ */
  --color-bg:        var(--ivory-100);
  --color-bg-alt:    var(--ivory-200);
  --color-surface:   var(--ivory-50);
  --color-line:      var(--ivory-300);
  --color-text:      var(--ink-900);
  --color-text-soft: var(--ink-600);
  --color-accent:    var(--sage-700);
  --color-primary:   var(--forest-700);
  --color-primary-hover: var(--forest-800);
  --color-on-primary: var(--ivory-50);
  --color-tint:      var(--sage-100);
  --color-focus:     var(--forest-700);
  --color-leaf:      var(--brass-500);   /* outcomes in tree drawings      */

  --color-inverse-bg:   var(--forest-900);
  --color-inverse-text: var(--ivory-100);
  --color-inverse-soft: var(--sage-300);
  --color-inverse-line: rgba(201, 213, 195, .18);

  /* ---- Typography -------------------------------------------------------- */
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  /* Newsreader (editorial serif) for headings, Geist for reading, Geist Mono
     for technical labels: section numbers, kickers, data, references.     */
  --font-sans:  "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:  "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Fluid type scale (≈ 1.25 at mobile → ≈ 1.333 at desktop) */
  --text-xs:   0.8125rem;                               /* 13px meta      */
  --text-sm:   0.9375rem;                               /* 15px           */
  --text-base: 1.0625rem;                               /* 17px body      */
  --text-lg:   clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);   /* lede      */
  --text-xl:   clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);     /* h3        */
  --text-2xl:  clamp(1.75rem, 1.4rem + 1.6vw, 2.625rem);     /* h2        */
  --text-3xl:  clamp(2.375rem, 1.7rem + 3vw, 4.125rem);      /* display   */
  --text-4xl:  clamp(2.625rem, 1.5rem + 4.6vw, 5.5rem);     /* hero h1   */

  --leading-tight: 1.08;
  --leading-snug:  1.25;
  --leading-body:  1.65;
  --tracking-caps: 0.14em;
  --tracking-mono: 0.08em;  /* uppercase mono labels                        */

  --measure:      64ch;   /* comfortable reading line length */
  --measure-wide: 76ch;

  /* ---- Space (4px base) ------------------------------------------------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-section: clamp(4.5rem, 3rem + 7vw, 9rem);

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --container: 1200px;

  /* ---- Shape & depth ---------------------------------------------------- */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --radius-plate: 2px;    /* figure plates, panels, doors: near-square    */
  --rule: 1px solid var(--color-line);
  --rule-strong: 1px solid var(--color-text);
  --rule-accent: 3px solid var(--color-primary);  /* active / selected edge */

  /* Elevation: one soft, low shadow for things that sit on the page
     (figure plates, panels). Never glows, never coloured.                  */
  --shadow-plate: 0 1px 0 var(--ivory-300), 0 30px 60px -40px rgba(18, 38, 28, .35);
  --shadow-plate-lift: 0 1px 0 var(--ivory-300), 0 40px 70px -40px rgba(18, 38, 28, .5);
  --shadow-menu: 0 24px 40px -28px rgba(18, 38, 28, .35);

  /* ---- Branching system (the ash) --------------------------------------
     Every tree drawing uses these, so the drawings read as one family:
     sage roots, an ink trunk, forest branches, brass leaves.              */
  --branch-root:   var(--sage-400);
  --branch-trunk:  var(--ink-900);
  --branch-line:   var(--forest-700);
  --branch-idle:   var(--sage-400);   /* branches not in focus              */
  --branch-leaf:   var(--brass-500);  /* outcomes                           */
  /* Foliage: three greens so a crown has depth; brass leaves (above) are
     the few that have turned, as ash leaves do: the outcomes.            */
  --leaf-a: var(--forest-700);
  --leaf-b: var(--sage-700);
  --leaf-c: var(--forest-800);
  --leaf-idle: var(--sage-300);       /* foliage not in focus              */
  --wood-idle: #8D998F;               /* wood not in focus (decorative)    */
  --branch-w:      1.6px;             /* branch stroke                      */
  --branch-w-root: 1.3px;
  --branch-w-trunk: 3px;
  /* Decorative fields: how strongly background patterns show.             */
  --pattern-opacity: .07;
  --pattern-opacity-inverse: .09;

  /* ---- Layers ----------------------------------------------------------- */
  --z-raised: 5;
  --z-header: 50;
  --z-skip: 100;

  /* ---- Motion ----------------------------------------------------------- */
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dur-fast: 150ms;
  --dur-med:  320ms;
  --dur-slow: 700ms;
  --dur-grow: 1000ms;   /* a line drawing itself                           */
  --stagger:  90ms;     /* delay between items revealed in sequence        */
}
