/* ==========================================================================
   Arriqaaq design tokens — the single source of truth for colour, type,
   spacing, radius, shadow and motion. Rules for using them live in
   /DESIGN.md. Never hard-code a hex value, font stack or radius in a
   component: add or reuse a token here.
   ========================================================================== */

:root {
	color-scheme: light;

	/* ---- Brand palette (kigo-experiment) ------------------------------------
	   Six woodblock-print pigments, sampled from ukiyo-e prints: soft, matte,
	   never neon. They replace the five vibrant brand colours. Use the
	   pigment names; the old vivid names (--pink, --purple…) are gone. */
	--sakura: #e0587c; /* blossom rose (Kigo's pink): the single highlight */
	--indigo: #0f3d73; /* ai-zome indigo: the primary */
	--pine: #13605c; /* deep sea teal */
	--celadon: #4f9c91; /* celadon glaze */
	--sand: #f2d39b; /* washi sand */
	--oxblood: #c8283c; /* seal red (Kigo's stamp) */

	--sakura-ink: #c23a62;
	--indigo-ink: #0f3d73;
	--pine-ink: #13605c;
	--celadon-ink: #2f6f66;
	--sand-ink: #7a5a1e;
	--oxblood-ink: #b0202f;

	/* Soft companions for grounds, washes and pattern lines. */
	--sakura-soft: #fbdbe3;
	--indigo-soft: #dce7f5;
	--pine-soft: #d8eeeb;
	--celadon-soft: #ddf0ec;
	--sand-soft: #fcf1dc;
	--oxblood-soft: #fadadd;

	/* The original vivid brand colours, kept only for the hero title's
	   pixel reveal ("Roots before branches"). */
	--vivid-pink: #ff00a0;
	--vivid-purple: #9800ff;
	--vivid-blue: #0066ff;
	--vivid-amber: #ffbe00;
	--vivid-green: #00c25a;

	--on-colour: #ffffff;

	/* Diagram ramp: indigo deepening toward the focus; washi for context. */
	--ramp-0: #0b3060;
	--ramp-1: #0f3d73;
	--ramp-2: #1f5590;
	--ramp-3: #3a6fa8;
	--lavender: #efebe3;
	--lavender-ink: #6d675c;
	--obsidian: #24221f;


	/* Paper grain, laid over woodblock scenes with multiply. */
	--grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .33 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

	/* Print materials (Kigo's denim, gouache and washi), as tiling textures.
	   mottle: large soft light and dark blotches (worn dye, uneven paint).
	   streak: horizontal brush drag. fleck: fine white fibres and slubs. */
	--tex-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.6 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
	--tex-streak: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .09' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
	--tex-fleck: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .18' numOctaves='2' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 3 -1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
	/* Denim twill: a fine diagonal weave of light warp and dark weft. */
	--tex-twill: repeating-linear-gradient(-62deg, rgba(255, 255, 255, 0.13) 0 1px, transparent 1px 3.5px),
		repeating-linear-gradient(28deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 5px);

	/* ---- Neutrals: warm washi paper and sumi ink -------------------------- */
	--page: #ffffff;
	--surface: #f7f4ef;
	--surface-2: #efebe4;
	--ink: #211f1c; /* sumi */
	--ink-2: #4a4641;
	--ink-3: #6f6a62;
	--line: #e6e1d8;
	--line-strong: #cec7bb;
	--scrim: rgba(33, 31, 28, 0.04);

	/* ---- Subjects: one pigment each -------------------------------------- */
	--subj-tajweed: var(--sand);
	--subj-nahw: var(--celadon);
	--subj-aqeedah: var(--sakura);
	--subj-hadith: var(--oxblood);
	--subj-fiqh: var(--indigo);
	--subj-tafsir: var(--pine);
	--bk-hadith: var(--oxblood);
	--bk-tafsir: var(--pine);
	--bk-family: var(--indigo);
	--bk-history: var(--ink);
	--bk-children: var(--celadon);

	/* ---- Type -------------------------------------------------------------
	   Reading settings copy the OpenAI article template: 17px / 28px,
	   weight 400, -0.01em tracking; headings weight 500. Inter is the
	   licensed stand-in for OpenAI Sans. Arabic falls through to Noto Naskh. */
	--font-sans: 'Inter', 'Noto Naskh Arabic', ui-sans-serif, system-ui, -apple-system,
		'Segoe UI', Roboto, sans-serif;
	--font-arabic: 'Noto Naskh Arabic', 'Inter', serif; /* Arabic inside article text */
	--font-arabic-display: 'IBM Plex Sans Arabic', 'Noto Naskh Arabic', sans-serif; /* Arabic in UI and headings */
	--font-quran: 'Amiri Quran', 'Noto Naskh Arabic', serif; /* Qur'anic verses in quotes */
	--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	/* Articles (owner, 2026-11-01): the build-log type of farhan.arriqaaq.com/blog.
	   Running text in Newsreader, titles and h2 in Instrument Serif, labels in
	   uppercase JetBrains Mono. Arabic still falls through to Noto Naskh. */
	--font-read: 'Newsreader', 'Noto Naskh Arabic', Georgia, 'Times New Roman', serif;
	--font-display: 'Instrument Serif', 'Noto Naskh Arabic', Georgia, serif;
	--fs-read: clamp(1.15625rem, 1.1rem + 0.25vw, 1.25rem); /* 18.5px phone, 20px desktop */
	--lh-read: 1.6;
	--fs-article-title: clamp(2.875rem, 1.5rem + 6.2vw, 7.75rem); /* 46px to 124px */
	--fs-article-h2: clamp(2rem, 1.6rem + 1.8vw, 3rem); /* 32px to 48px */

	--fs-display: clamp(3.25rem, 1.6rem + 9vw, 9rem); /* landing statements */
	--fs-section: clamp(2rem, 1.45rem + 2.6vw, 3.3rem); /* split section headings (arriqaaqlabs) */
	--fs-h1: clamp(2rem, 1.55rem + 2.2vw, 3.25rem);
	--fs-h2: clamp(1.5rem, 1.35rem + 0.7vw, 1.875rem);
	--fs-h3: clamp(1.1875rem, 1.12rem + 0.3vw, 1.3125rem);
	--fs-lead: clamp(1.125rem, 1.07rem + 0.3vw, 1.3125rem);
	--fs-body: 1.0625rem; /* 17px */
	--fs-small: 0.875rem; /* 14px */
	--fs-xs: 0.8125rem; /* 13px — chips */
	--fs-eyebrow: 0.75rem; /* 12px Inter, uppercase */
	--fs-poster: clamp(3.2rem, 1rem + 11vw, 10rem); /* woodblock poster titles */
	--fw-poster: 900;
	--ls-poster: -0.055em;

	--lh-body: 1.647; /* 28px at 17px */
	--lh-heading: 1.18;
	--lh-display: 0.92;
	--ls-body: -0.01em;
	--ls-heading: -0.02em;
	--ls-display: -0.05em;
	--ls-eyebrow: 0.12em;

	/* ---- Layout ----------------------------------------------------------- */
	--measure: 680px; /* reading column */
	--wide: 1040px; /* figures, roadmaps */
	--max: 1200px; /* landing sections */
	--gutter: clamp(20px, 5vw, 32px); /* 20px on a 375px phone */
	--topbar-h: 56px;
	--tap: 44px; /* minimum touch target */

	/* 4px spacing scale */
	--s-1: 4px;
	--s-2: 8px;
	--s-3: 12px;
	--s-4: 16px;
	--s-5: 24px;
	--s-6: 32px;
	--s-7: 48px;
	--s-8: 64px;
	--s-9: 96px;
	--section: clamp(64px, 10vw, 128px); /* vertical rhythm between landing bands */

	/* ---- Shape ------------------------------------------------------------ */
	--r-xs: 6px;
	--r-sm: 10px; /* chips (OpenAI) */
	--r: 14px; /* cards */
	--r-lg: 24px; /* feature panels and sheets (38labs) */
	--r-pill: 999px; /* tabs, buttons */

	--shadow-1: 0 1px 2px rgba(33, 31, 28, 0.05), 0 8px 24px -14px rgba(33, 31, 28, 0.16);
	/* Neutral shadow for objects standing on a shelf (never a coloured wash). */
	--shade: rgba(33, 31, 28, 0.16);
	--shade-soft: rgba(33, 31, 28, 0.07);
	--shadow-2: 0 2px 6px rgba(33, 31, 28, 0.06), 0 24px 48px -24px rgba(33, 31, 28, 0.28);
	--ring: 0 0 0 3px color-mix(in srgb, var(--indigo) 35%, transparent);

	/* ---- Motion ----------------------------------------------------------- */
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* SurrealDB rise */
	--ease-soft: cubic-bezier(0.25, 1, 0.5, 1);
	--dur-fast: 160ms;
	--dur: 300ms;
	--dur-slow: 900ms;
}

/* Subject scoping. Put one of these on any component root; children use
   var(--subject) (fills), var(--subject-ink) (text) and var(--subject-on)
   (text placed ON a --subject fill). */
.subject--tajweed { --subject: var(--sand); --subject-ink: var(--sand-ink); --subject-soft: var(--sand-soft); --subject-on: var(--ink); }
.subject--nahw { --subject: var(--celadon); --subject-ink: var(--celadon-ink); --subject-soft: var(--celadon-soft); --subject-on: var(--ink); }
.subject--aqeedah { --subject: var(--sakura); --subject-ink: var(--sakura-ink); --subject-soft: var(--sakura-soft); --subject-on: #fff; }
.subject--hadith { --subject: var(--oxblood); --subject-ink: var(--oxblood-ink); --subject-soft: var(--oxblood-soft); --subject-on: #fff; }
.subject--fiqh { --subject: var(--indigo); --subject-ink: var(--indigo-ink); --subject-soft: var(--indigo-soft); --subject-on: #fff; }
.subject--tafsir { --subject: var(--pine); --subject-ink: var(--pine-ink); --subject-soft: var(--pine-soft); --subject-on: #fff; }
.subject--general { --subject: var(--ink); --subject-ink: var(--ink); --subject-soft: var(--surface); --subject-on: #fff; }

@media (prefers-reduced-motion: reduce) {
	:root {
		--dur-fast: 0ms;
		--dur: 0ms;
		--dur-slow: 0ms;
	}
}

/* ---- Article mode (kigo-experiment) ---------------------------------------
   Inside an article (`.read`, set on the [slug] page) the subject's pigment
   is lifted one notch brighter, the beige surfaces take the subject's own
   soft tint, and the figures' lit parts and diagram context follow the
   subject. The landing prints keep the calmer pigments. */
.subject--tajweed { --subject-bright: #f2b73f; --subject-bright-ink: #8a5d00; }
.subject--nahw { --subject-bright: #1fae98; --subject-bright-ink: #0b7a6a; }
.subject--aqeedah { --subject-bright: #f2457a; --subject-bright-ink: #d11f5a; }
.subject--hadith { --subject-bright: #e8233f; --subject-bright-ink: #c8102e; }
.subject--fiqh { --subject-bright: #1f63e0; --subject-bright-ink: #1452c4; }
.subject--tafsir { --subject-bright: #0e9488; --subject-bright-ink: #0a7268; }
.subject--general { --subject-bright: var(--ink); --subject-bright-ink: var(--ink); }

.read[class*='subject--'] {
	--subject: var(--subject-bright);
	--subject-ink: var(--subject-bright-ink);
	--surface: color-mix(in oklab, var(--subject-bright) 8%, #fff);
	--surface-2: color-mix(in oklab, var(--subject-bright) 15%, #fff);
	--line: color-mix(in oklab, var(--subject-bright) 14%, #fff);
	--line-strong: color-mix(in oklab, var(--subject-bright) 30%, #fff);
	--lavender: color-mix(in oklab, var(--subject-bright) 12%, #fff);
	--lavender-ink: var(--subject-bright-ink);
	--ramp-0: color-mix(in oklab, var(--subject-bright) 78%, #000);
	--ramp-1: var(--subject-bright);
	--ramp-2: color-mix(in oklab, var(--subject-bright) 82%, #fff);
	--ramp-3: color-mix(in oklab, var(--subject-bright) 66%, #fff);
	--indigo: var(--subject-bright);
	--indigo-ink: var(--subject-bright-ink);
	--ring: 0 0 0 3px color-mix(in srgb, var(--subject-bright) 35%, transparent);
}

/* Tajweed's bright sand is a fill colour; text on it stays ink. */
.read.subject--tajweed { --subject-on: var(--ink); }
