/* Sibaq design tokens.
   Three contexts, set with data-context on <body> or any container:
     stage  : projector, dark navy, read from the back of a hall
     hand   : phone, dark navy, one thumb
     studio : laptop, cream paper, calm (this is the default when no context is set)
   Every size in the system is a multiple of --u, the context unit:
     studio and hand : 1/16 rem (so it follows the reader's font size)
     stage           : 1/1920 of the screen width (or of the nearest container with container-type: size)
   Load order: tokens.css, components.css, motion.css. */

@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('fonts/fraunces.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('fonts/inter.woff2') format('woff2'); }
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 122%; src: url('fonts/amiri-regular.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 700; font-display: swap; size-adjust: 122%; src: url('fonts/amiri-bold.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }

:root {
    /* Brand palette. Navy is the official colour; cream and gold support it. */
    --navy-950: #06142A;   /* stage and phone background, and the ink on every answer tile */
    --navy-900: #0A1F3D;
    --navy-800: #0F2B52;
    --navy-700: #0E3B6B;   /* MYM navy */
    --navy-500: #2A5F9E;
    --navy-300: #9DB8DC;   /* quiet text on navy: 9.0:1 on navy-950 */
    --cream-50: #FFFDF9;
    --cream-100: #F5F2EC;  /* MYM cream */
    --cream-200: #EDE8DD;
    --cream-300: #DDD6C8;
    --cream-500: #8A826F;  /* control borders on cream: 3.4:1 */
    --gold-300: #E6C987;   /* gold for text and lines on navy: 11.4:1 on navy-950 */
    --gold-500: #C9A24B;   /* MYM gold: 7.7:1 on navy-950 */
    --gold-700: #7A5A12;   /* gold for text on cream: 5.7:1 */
    --slate-600: #55627A;  /* quiet text on cream: 5.5:1 */
    --brick-600: #A63A2A;  /* remove, delete: 5.8:1 on cream */
    --pine-600: #256B4D;   /* saved, published: 5.7:1 on cream */

    /* Answer colours. Our own set: ember, iris, tide, sand. Ink on each is navy-950 (5.2:1 or better).
       Checked for protan, deutan and tritan vision: every pair stays clearly apart, and shape + letter always repeat the signal. */
    --answer-a: #F07F3F;   /* ember : arch    : 6.9:1 */
    --answer-b: #9A70F2;   /* iris  : star    : 5.2:1 */
    --answer-c: #4FD2E3;   /* tide  : moon    : 10.2:1 */
    --answer-d: #F4E7C5;   /* sand  : hexagon : 15.0:1 */
    --answer-ink: var(--navy-950);

    /* Type families. Arabic falls through to Amiri in every stack. */
    --font-display: 'Fraunces', 'Amiri', 'Iowan Old Style', Georgia, serif;
    --font-ui: 'Inter', 'Amiri', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-arabic: 'Amiri', 'Geeza Pro', 'Noto Naskh Arabic', serif;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 120ms;
    --t-base: 220ms;
    --t-slow: 420ms;
    --t-slower: 720ms;
    --stagger: 60ms;
}

/* Context roots. :root is studio until told otherwise. */
:root,
[data-context="studio"] {
    --u: 0.0625rem;
    --k: 1;                /* density: spacing and radius multiplier */
    color-scheme: light;
    --bg: var(--cream-100);
    --surface: var(--cream-50);
    --surface-2: var(--cream-200);
    --line: var(--cream-300);
    --line-strong: var(--cream-500);
    --text: #0B2545;
    --text-muted: var(--slate-600);
    --accent: var(--navy-700);
    --on-accent: var(--cream-50);
    --highlight: var(--gold-700);
    --highlight-fill: var(--gold-500);
    --on-highlight: var(--navy-950);
    --danger: var(--brick-600);
    --good: var(--pine-600);
    --focus: var(--navy-500);
    --scrim: rgb(6 20 42 / 0.5);
    --shadow-1: 0 1px 2px rgb(11 37 69 / 0.06), 0 2px 6px rgb(11 37 69 / 0.05);
    --shadow-2: 0 2px 4px rgb(11 37 69 / 0.06), 0 10px 24px rgb(11 37 69 / 0.09);
    --shadow-3: 0 6px 12px rgb(11 37 69 / 0.08), 0 28px 60px rgb(11 37 69 / 0.18);

    /* Type scale, in px at the reference size */
    --fs-1: calc(12 * var(--u));
    --fs-2: calc(14 * var(--u));
    --fs-3: calc(16 * var(--u));   /* body */
    --fs-4: calc(19 * var(--u));
    --fs-5: calc(24 * var(--u));
    --fs-6: calc(32 * var(--u));
    --fs-7: calc(44 * var(--u));
    --fs-8: calc(64 * var(--u));   /* display */
    --fs-mega: calc(96 * var(--u));
}

[data-context="hand"] {
    --u: 0.0625rem;
    --k: 1;
    color-scheme: dark;
    --bg: var(--navy-950);
    --surface: var(--navy-900);
    --surface-2: var(--navy-800);
    --line: rgb(245 242 236 / 0.14);
    --line-strong: rgb(245 242 236 / 0.42);
    --text: var(--cream-100);
    --text-muted: var(--navy-300);
    --accent: var(--gold-500);
    --on-accent: var(--navy-950);
    --highlight: var(--gold-300);
    --highlight-fill: var(--gold-500);
    --on-highlight: var(--navy-950);
    --danger: #F2A190;
    --good: #8FD9B4;
    --focus: var(--gold-300);
    --scrim: rgb(3 10 22 / 0.72);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3), 0 2px 8px rgb(0 0 0 / 0.2);
    --shadow-2: 0 2px 6px rgb(0 0 0 / 0.3), 0 12px 28px rgb(0 0 0 / 0.32);
    --shadow-3: 0 8px 16px rgb(0 0 0 / 0.3), 0 30px 70px rgb(0 0 0 / 0.5);

    --fs-1: calc(13 * var(--u));
    --fs-2: calc(15 * var(--u));
    --fs-3: calc(17 * var(--u));
    --fs-4: calc(20 * var(--u));
    --fs-5: calc(26 * var(--u));
    --fs-6: calc(34 * var(--u));
    --fs-7: calc(46 * var(--u));
    --fs-8: calc(64 * var(--u));
    --fs-mega: calc(104 * var(--u));
}

[data-context="stage"] {
    /* 1 unit = 1px on a 1920 x 1080 screen. In a framed preview, give the frame container-type: size. */
    --u: min(calc(100cqw / 1920), calc(100cqh / 1080));
    --k: 2;
    color-scheme: dark;
    --bg: var(--navy-950);
    --surface: var(--navy-900);
    --surface-2: var(--navy-800);
    --line: rgb(245 242 236 / 0.14);
    --line-strong: rgb(245 242 236 / 0.42);
    --text: var(--cream-100);
    --text-muted: var(--navy-300);
    --accent: var(--gold-500);
    --on-accent: var(--navy-950);
    --highlight: var(--gold-300);
    --highlight-fill: var(--gold-500);
    --on-highlight: var(--navy-950);
    --danger: #F2A190;
    --good: #8FD9B4;
    --focus: var(--gold-300);
    --scrim: rgb(3 10 22 / 0.72);
    --shadow-1: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgb(0 0 0 / 0.3);
    --shadow-2: 0 calc(6 * var(--u)) calc(12 * var(--u)) rgb(0 0 0 / 0.28), 0 calc(24 * var(--u)) calc(56 * var(--u)) rgb(0 0 0 / 0.34);
    --shadow-3: 0 calc(16 * var(--u)) calc(32 * var(--u)) rgb(0 0 0 / 0.3), 0 calc(60 * var(--u)) calc(140 * var(--u)) rgb(0 0 0 / 0.5);

    /* Read from 15 m: on a 3 m wide screen the smallest size here (36) has a 40 mm cap height. Nothing on stage goes below --fs-1. */
    --fs-1: calc(36 * var(--u));
    --fs-2: calc(42 * var(--u));
    --fs-3: calc(50 * var(--u));   /* body, answer text */
    --fs-4: calc(60 * var(--u));
    --fs-5: calc(76 * var(--u));   /* question */
    --fs-6: calc(96 * var(--u));
    --fs-7: calc(132 * var(--u));
    --fs-8: calc(160 * var(--u));
    --fs-mega: calc(320 * var(--u));
}

/* Derived tokens. They are declared on every context root so they pick up that root's --u and --k. */
:root,
[data-context] {
    --g: calc(var(--u) * var(--k));
    --sp-1: calc(4 * var(--g));
    --sp-2: calc(8 * var(--g));
    --sp-3: calc(12 * var(--g));
    --sp-4: calc(16 * var(--g));
    --sp-5: calc(24 * var(--g));
    --sp-6: calc(32 * var(--g));
    --sp-7: calc(48 * var(--g));
    --sp-8: calc(64 * var(--g));
    --sp-9: calc(96 * var(--g));
    --r-1: calc(6 * var(--g));
    --r-2: calc(10 * var(--g));
    --r-3: calc(16 * var(--g));
    --r-4: calc(24 * var(--g));
    --r-pill: 999px;
    --hair: max(1px, calc(1 * var(--g)));
    --ring: max(2px, calc(3 * var(--g)));
    --tap: calc(48 * var(--g));       /* smallest touch target */
    --lh-tight: 1.08;
    --lh-snug: 1.25;
    --lh-body: 1.5;
    --track-caps: 0.14em;
}
