/* =====================================================================
   matteom.design — Design tokens  (proposal v1, 24 Nov 2026)
   Two layers:
   1. PRIMITIVES  raw values, named after what they are (never used by components)
   2. SEMANTIC    named after what they do (the only layer components may use)
   Base unit: 8px. Spacing, line-heights and component sizes are multiples of 8.
   Font sizes use the 4px half-step below 24px (12, 16, 20) and 8px above.
   ===================================================================== */

/* ---------- Fonts ---------- */
@font-face{font-family:"Absans";src:url("fonts/Absans-Regular.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2");font-weight:700;font-style:normal;font-display:swap}

:root{
  /* =================== 1. PRIMITIVES =================== */

  /* Colour — from the Figma prototype */
  --cream-50:  #fffbf0;   /* page background */
  --cream-100: #f8f4ea;   /* Ababo page tint */
  --cream-300: #d9d3c0;   /* hairlines */
  --ink-900:   #16140f;   /* text, strong borders */
  --ink-600:   #5b574c;   /* secondary text */
  --white:     #ffffff;
  --pink-400:  #ff5dc8;   /* hotspots, highlighter */
  --magenta-500:#e334d6;  /* menu icon in the prototype */
  --magenta-700:#b0189f;  /* derived: magenta that passes AA as text */
  --lime-100:  #f6f9cb;   /* Salaborsa page tint */
  --yellow-400:#ffcc33;   /* Salaborsa mark */
  --red-600:   #e2011a;   /* Zanichelli mark */

  /* Size scale — 8px base (4px half-step only where noted) */
  --unit: 8px;

  /* =================== 2. SEMANTIC =================== */

  /* --- Colour roles --- */
  --color-bg:            var(--cream-50);
  --color-surface:       var(--white);       /* About band, panels */
  --color-text:          var(--ink-900);     /* 17.8:1 on bg */
  --color-text-muted:    var(--ink-600);     /*  7.0:1 on bg */
  --color-border:        var(--ink-900);     /* component outlines */
  --color-border-subtle: var(--cream-300);   /* dividers only (decorative) */
  --color-highlight:     var(--pink-400);    /* FILL ONLY — 2.65:1, never as text */
  --color-focus:         var(--magenta-500); /* 3.55:1, passes 3:1 for UI */
  --color-text-accent:   var(--magenta-700); /* 5.8:1, for the rare coloured text */

  /* Project theme (overridden by [data-project]) */
  --color-project-bg:    var(--color-bg);
  --color-accent:        var(--ink-900);     /* fills, markers, underlines */
  --color-on-accent:     var(--cream-50);    /* text on an accent fill */
  --color-accent-text:   var(--ink-900);     /* accent used as text (must pass 4.5:1) */

  /* --- Typography --- */
  --font-display: "Absans","Helvetica Neue",Arial,sans-serif;
  --font-mono:    "IBM Plex Mono",ui-monospace,Menlo,Consolas,monospace;

  /* size / line-height pairs — line-heights always on the 8px grid.
     Stepped (not fluid) on purpose: clamp() would break the 8px rhythm. */
  --text-display-xl: 80px;  --leading-display-xl: 88px;  /* page titles */
  --text-display-l:  56px;  --leading-display-l:  64px;  /* section titles, metrics */
  --text-display-m:  32px;  --leading-display-m:  40px;  /* sub-titles, next project */
  --text-lead:       20px;  --leading-lead:       32px;  /* intro paragraphs */
  --text-body:       16px;  --leading-body:       24px;  /* default */
  --text-small:      12px;  --leading-small:      16px;  /* captions, roles, nav */
  --tracking-label:  0.08em;                              /* uppercase kickers */
  --weight-regular: 400;
  --weight-bold:    700;

  /* --- Spacing (multiples of 8) --- */
  --space-half: 4px;     /* optical tweaks only */
  --space-1:  8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-5:  40px;
  --space-6:  48px;
  --space-8:  64px;
  --space-10: 80px;
  --space-12: 96px;
  --space-16: 128px;

  /* --- Layout & grid --- */
  --container-text: 640px;   /* reading width (~65 characters of mono) */
  --container:      1040px;  /* content */
  --container-wide: 1280px;  /* full-bleed images */
  --grid-columns:   12;
  --grid-gutter:    var(--space-3);
  --page-margin:    var(--space-3);
  --section-gap:    var(--space-12);   /* between blocks of a page */
  --nav-height:     64px;

  /* --- Shape --- */
  --radius-sm:   4px;     /* tags, small controls */
  --radius-md:   8px;     /* images, panels */
  --radius-lg:   16px;    /* cards, About box */
  --radius-pill: 999px;   /* nav items, buttons */
  --border-thin:   1px;   /* dividers */
  --border-strong: 1.5px; /* component outlines (house detail, kept from v0) */
  --shadow-hard:   4px 4px 0 var(--color-border);   /* "lifted" state */
  --shadow-none:   0 0 0 var(--color-border);

  /* --- Motion --- */
  --duration-fast:   120ms;   /* colour, opacity */
  --duration-base:   200ms;   /* hover lifts, underlines */
  --duration-slow:   400ms;   /* panels, nav indicator */
  --duration-reveal: 600ms;   /* scroll reveal */
  --ease-out:    cubic-bezier(.2,.7,.2,1);
  --ease-in-out: cubic-bezier(.65,0,.35,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);  /* playful, small elements only */

  /* --- Layers --- */
  --z-base: 0;
  --z-raised: 10;
  --z-nav: 100;
  --z-overlay: 200;
  --z-toast: 300;
  --z-grain: 400;    /* noise overlay, above everything, never clickable */

  /* --- Texture --- */
  --grain-opacity: .12;
  --grain-size: 160px;

  /* Breakpoints (CSS vars can't be used inside @media — reference values):
     sm  < 640px   mobile   4 columns, gutter 16
     md  640–1023  tablet   8 columns, gutter 24
     lg  ≥ 1024    desktop 12 columns, gutter 24 */
}

/* Tablet */
@media (max-width:1023px){
  :root{
    --grid-columns: 8;
    --text-display-xl: 64px; --leading-display-xl: 72px;
    --text-display-l:  48px; --leading-display-l:  56px;
  }
}
/* Mobile */
@media (max-width:639px){
  :root{
    --grid-columns: 4;
    --grid-gutter: var(--space-2);
    --page-margin: var(--space-2);
    --section-gap: var(--space-8);
    --nav-height: 56px;
    --text-display-xl: 48px; --leading-display-xl: 56px;
    --text-display-l:  32px; --leading-display-l:  40px;
    --text-display-m:  24px; --leading-display-m:  32px;
    --text-lead:       16px; --leading-lead:       24px;
  }
}

/* ---------- Project themes ---------- */
[data-project="zanichelli"]{
  --color-accent:      var(--red-600);
  --color-on-accent:   var(--white);
  --color-accent-text: var(--red-600);   /* 4.8:1 on cream */
}
[data-project="ababo"]{
  --color-project-bg:  var(--cream-100);
  --color-accent:      var(--ink-900);
  --color-on-accent:   var(--cream-50);
  --color-accent-text: var(--ink-900);
}
[data-project="salaborsa"]{
  --color-project-bg:  var(--lime-100);
  --color-accent:      var(--yellow-400);
  --color-on-accent:   var(--ink-900);
  --color-accent-text: var(--ink-900);   /* yellow fails as text: use ink */
}
