/* ==========================================================================
   Studiomaleya — design tokens
   The single source for color, type, space, depth and motion.
   Every component reads from here; nothing hard-codes a value.
   ========================================================================== */

:root {
  /* ---- Palette ---------------------------------------------------------
     Sampled from the identity files, then refined:
     · burgundy  — brief gave #640017 (cool, crimson). The embossed ماليا card
                   and the logo block read warmer, brick-red: #611815.
     · oxblood   — logo block of the identity deck (#4D0902) → #4B0A05.
     Never pure black, never pure white.                                    */
  --burgundy: #5b0e19;   /* identity palette (Green · Burgundy · Brown · Cream), exact values */
  --oxblood: #470a13;    /* deeper burgundy for colour fields */
  --brown: #2c1c1b;
  --olive: #5b5e2f;      /* “Green” in the identity */
  --cream: #eae7d3;
  --paper: #f8f7f2;
  --kraft: #c9ae86;
  --powder: #c9dceb;

  /* Derived tones (all checked for WCAG AA on their intended surface) */
  --ink: var(--brown);            /* body text: 16.4:1 on paper, 14.1:1 on cream */
  --ink-muted: #6b5a52;           /* captions: 6.1:1 on paper, 5.2:1 on cream    */
  --on-dark: var(--cream);        /* on brown 14.1 · oxblood 12.5 · burgundy 10.2 */
  --on-dark-muted: #cbbfae;       /* on brown 9.2 · oxblood 8.1 · burgundy 6.6    */
  --kraft-deep: #b39469;          /* folder edges, shadows of kraft           */
  --kraft-ink: #4a3420;           /* text printed on kraft: 5.5:1                */
  --polaroid: #f3efe3;            /* polaroid frame — warm, never white       */
  --line: rgb(42 18 15 / 0.16);   /* hairlines on paper                       */
  --line-dark: rgb(236 230 208 / 0.18);

  /* Aged paper for notes & sheets (v2) */
  --sheet: #ebe2c9;               /* aged cream: brown 13.6 · burgundy 9.9 · pencil 7.0 */
  --sheet-edge: rgb(132 98 52 / 0.22);
  --pencil: #4f4740;              /* graphite, handwriting */

  /* Contrast rule of thumb:
     burgundy text → paper 11.9 · cream 10.2 · kraft 6.0 — never on brown (1.4:1).
     on brown or oxblood → cream or kraft text only.                        */

  /* ---- Typography -------------------------------------------------------- */
  --font-display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --font-script: "Pinyon Script", "Cormorant Garamond", cursive;
  --font-mono: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;   /* v9: three families only — small labels are Jost small caps */
  --font-sans: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --font-arabic: "Aref Ruqaa", "Amiri", "Geeza Pro", serif;
  --font-type: "Cormorant Garamond", "Cormorant", Garamond, serif;     /* v9: typed notes become the serif */
  --font-hand: "Pinyon Script", "Cormorant Garamond", cursive;         /* v9: the one script accent */

  /* Fluid scale — min @ 360px, max @ 1600px */
  --fs-mega: clamp(3.75rem, 1.6rem + 11vw, 12.5rem);   /* logotype, hero quote  */
  --fs-display: clamp(3rem, 1.6rem + 6.4vw, 8.5rem);   /* section titles        */
  --fs-h1: clamp(2.5rem, 1.6rem + 4vw, 5.75rem);       /* brand on project page */
  --fs-h2: clamp(2rem, 1.5rem + 2.4vw, 3.75rem);       /* index rows            */
  --fs-h3: clamp(1.375rem, 1.2rem + 0.8vw, 1.875rem);
  --fs-lead: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);
  --fs-body: clamp(1.125rem, 1.06rem + 0.28vw, 1.3125rem); /* Cormorant runs small */
  --fs-mono: clamp(0.8125rem, 0.78rem + 0.12vw, 0.875rem);
  --fs-small: 0.8125rem;
  --fs-micro: 0.6875rem;

  --lh-tight: 0.92;
  --lh-snug: 1.12;
  --lh-body: 1.55;
  --lh-mono: 1.7;

  --track-caps: 0.32em;   /* SET & SPACE DESIGN — ART DIRECTION */
  --track-wide: 0.14em;
  --track-tight: -0.02em;

  /* ---- Space (4px base) -------------------------------------------------- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 7rem;
  --s-10: 10rem;
  --gutter: clamp(1rem, 0.6rem + 2vw, 2.5rem);
  --section: clamp(3.5rem, 2.4rem + 4.5vw, 7rem);   /* tighter rhythm (v2) */
  --maxw: 1560px;
  --measure: 34rem;

  /* ---- Material: depth, radius, texture --------------------------------- */
  --r-sheet: 2px;
  --r-folder: 6px;
  --r-pill: 999px;
  --shadow-doc: 0 1px 1px rgb(42 18 15 / 0.08), 0 6px 14px -6px rgb(42 18 15 / 0.22),
    0 22px 40px -22px rgb(42 18 15 / 0.35);
  --shadow-lift: 0 2px 2px rgb(42 18 15 / 0.08), 0 14px 24px -10px rgb(42 18 15 / 0.28),
    0 40px 60px -30px rgb(42 18 15 / 0.4);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .16 0 0 0 0 .07 0 0 0 0 .06 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  /* Paper fibers + low-frequency aging, multiplied over --sheet / kraft */
  --paper-tex: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='a'><feTurbulence type='fractalNoise' baseFrequency='.011' numOctaves='3' seed='8' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .38 0 0 0 0 .22 0 0 0 .5 -.12'/></filter><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='.018 .55' numOctaves='2' seed='5' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .32 -.08'/></filter><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3 0 0 0 0 .22 0 0 0 0 .14 0 0 0 .2 0'/></filter><rect width='100%' height='100%' filter='url(%23a)'/><rect width='100%' height='100%' filter='url(%23f)'/><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  /* ---- Motion — slow and restrained ------------------------------------- */
  --ease-paper: cubic-bezier(0.22, 0.61, 0.36, 1);   /* a sheet settling */
  --ease-drawer: cubic-bezier(0.65, 0, 0.35, 1);     /* tabs, folders    */
  --dur-1: 220ms;
  --dur-2: 480ms;
  --dur-3: 900ms;
  --dur-4: 1400ms;

  --z-cursor: 90;
  --z-nav: 50;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 1ms;
    --dur-2: 1ms;
    --dur-3: 1ms;
    --dur-4: 1ms;
  }
}
