/*
 * Bicontinental Group — design tokens.
 * Owner: WP-002. Authority: plans/bicontinental-wp-rebuild/01-CONTRACTS/07-design-tokens.md.
 *
 * TOKENS ONLY. This file is the single place a colour or size literal may appear
 * in the delivered CSS. It contains custom properties, the @font-face blocks, the
 * [dir="rtl"] overrides and the one global :focus-visible rule. No component
 * selectors, no layout, no resets — WP-004 owns all of that and must reference
 * these tokens via var(--bicon-*).
 *
 * Rationale for every value: site/design/01-TOKENS.md.
 */

/* ---------------------------------------------------------------------------
 * Self-hosted fonts (NFR-9, NFR-25, ADR-7). woff2 only, no third-party origin.
 * Latin and Arabic are split by unicode-range so an English page never
 * downloads the Arabic face and vice versa (contract 07 section 2.1). Latin
 * characters appearing on RTL pages (entity names, phone digits) deliberately
 * fall through to the declared system fallbacks; see design/01-TOKENS.md.
 * File provenance and hashes: ../fonts/FONTS.md.
 * ------------------------------------------------------------------------- */

@font-face {
	font-family: "Roboto";
	src: url("../fonts/roboto-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02CC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Roboto";
	src: url("../fonts/roboto-500.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02CC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Roboto";
	src: url("../fonts/roboto-700.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02CC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* Roboto Slab ships under Apache-2.0, not OFL-1.1 — relicensed upstream (contract 07 §2.2,
 * CR-1). Modification note and licence text: ../fonts/FONTS.md §1.1, ../fonts/LICENCE-APACHE-2.0.txt.
 * Kept vendored (still used as a fallback face) even though the emergency re-skin below no
 * longer references it in --bicon-font-display — see the Asap block for why. */
@font-face {
	font-family: "Roboto Slab";
	src: url("../fonts/roboto-slab-600.woff2") format("woff2");
	font-weight: 600;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02CC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Roboto Slab";
	src: url("../fonts/roboto-slab-700.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02CC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* Asap — kept as the sitewide face by the 2026 redesign spec (design/2026-REDESIGN-SPEC.md
 * §2.2: "Faces unchanged"), carried over unchanged from the 2026-08-12 emergency re-skin that
 * first vendored it (see ../fonts/FONTS.md addendum for the vendoring method — single
 * unsubsetted variable file via wawoff2, no fonttools in this environment — and the contract 07
 * change-log for the formal record). Roboto/Roboto Slab stay vendored as unused fallback faces.
 * One variable file covers the whole weight axis (100-900) — "font-weight: 100 900" is a
 * range, valid on a variable-font @font-face; the browser interpolates the 400/600/700 instances
 * theme.css asks for, so no per-weight static files are needed. */
@font-face {
	font-family: "Asap";
	src: url("../fonts/asap-variable.woff2") format("woff2-variations"), url("../fonts/asap-variable.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02CC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "IBM Plex Sans Arabic";
	src: url("../fonts/plex-sans-arabic-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

@font-face {
	font-family: "IBM Plex Sans Arabic";
	src: url("../fonts/plex-sans-arabic-600.woff2") format("woff2");
	font-weight: 600;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

@font-face {
	font-family: "IBM Plex Sans Arabic";
	src: url("../fonts/plex-sans-arabic-700.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

/* ---------------------------------------------------------------------------
 * Tokens. Values fixed by contract 07; additions are documented in
 * design/01-TOKENS.md section 7.
 * Breakpoints are spec values, not custom properties (custom properties cannot
 * drive media queries): sm 375px, md 768px (navigation breakpoint), lg 1024px,
 * xl 1440px, xxl 1920px. Verified viewports: 320, 375, 768, 1024, 1440, 1920.
 * ------------------------------------------------------------------------- */

:root {
	/* Palette — 2026 redesign spec §2.1 (design/2026-REDESIGN-SPEC.md), superseding both the
	   original contract 07 "Era B" values and the 2026-08-12 emergency re-skin's old-site-match
	   palette (client-rejected). --bicon-brand is the one constant across every palette this
	   project has shipped — the registered mark, #6F0C14 — now scoped to accents only (CTAs,
	   links, active states, rules), never a full-width surface. Everything else moves to a
	   neutral ink/body/muted system so maroon reads as deliberate emphasis, not decoration.
	   Contrast (design/2026-REDESIGN-SPEC.md §2.1, re-measure once live): brand #6F0C14 on
	   white 12.08:1; ink #16181D on white ≈16.8:1; body #343B42 on white ≈11.3:1; muted #5B646D
	   on white ≈6.0:1 (now passes AA for normal text — the old #7A7A7A value failed at 4.29:1). */
	--bicon-brand: #6F0C14;
	--bicon-ink: #16181D;
	--bicon-body: #343B42;
	--bicon-muted: #5B646D;
	--bicon-line: #8A929A;         /* interactive borders (inputs, outlined buttons) — ≈3.15:1 non-text */
	--bicon-hairline: #E2E5E8;     /* decorative separators only, never information-bearing */
	--bicon-surface: #FFFFFF;
	--bicon-surface-alt: #F5F6F7;
	--bicon-surface-dark: #14171B; /* footer, inner-page hero band, hero scrim base */
	--bicon-on-dark: #FFFFFF;      /* headings/links on dark — ≈17.9:1 */
	--bicon-on-dark-muted: #B8BFC6; /* body/meta on dark — ≈9.6:1 */
	--bicon-on-brand: #FFFFFF;

	/* Interaction-state derivations — only from --bicon-brand, only via color-mix()
	   (contract 07 section 1.3, unchanged by the redesign). */
	--bicon-brand-hover: color-mix(in srgb, var(--bicon-brand) 85%, black);
	--bicon-brand-active: color-mix(in srgb, var(--bicon-brand) 70%, black);
	--bicon-brand-tint: color-mix(in srgb, var(--bicon-brand) 8%, white);

	/* Font stacks — Asap for Latin, IBM Plex Sans Arabic for RTL, both vendored by the
	   2026-08-12 re-skin (../fonts/FONTS.md). Roboto/Roboto Slab stay vendored as an unused
	   fallback face.

	   CJK families added 2026-08-15 with the Simplified Chinese language (D-68). Asap has no
	   CJK coverage, so before this every Chinese glyph fell through the whole stack to the
	   generic `sans-serif` — fine on Windows and macOS, tofu on a Linux client with no CJK
	   font installed. Font fallback is per-glyph, so these families never affect Latin text:
	   they are only consulted for codepoints Asap cannot render.

	   Ordered by platform so each OS reaches its own native Simplified face first — PingFang SC
	   (macOS/iOS), Microsoft YaHei (Windows), Noto Sans CJK SC / Source Han Sans SC (Linux,
	   Android, Chrome OS) — with the older Hiragino/WenQuanYi faces behind them and the
	   pan-Unicode "Arial Unicode MS" kept last as a final safety net. Simplified (SC) faces are
	   named deliberately: Han unification means a Japanese font would render some shared
	   characters with Japanese glyph shapes.

	   NOT self-hosted, and that is a real (documented) exception to this project's
	   no-third-party-font rule. A full Simplified face is 5-20 MB, far past any sane budget;
	   these are system fonts, so they cost no network request and break no CSP, but Chinese is
	   now the one language whose rendering depends on the visitor's machine. Subsetting a Noto
	   Sans SC to just the ~1k glyphs this site actually uses (~150-300 KB woff2) would restore
	   the guarantee — see STATUS.md. */
	--bicon-font-cjk: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC",
		"Hiragino Sans GB", "WenQuanYi Micro Hei";
	--bicon-font-display: "Asap", Arial, Helvetica, var(--bicon-font-cjk), "Arial Unicode MS", sans-serif;
	--bicon-font-body: "Asap", Arial, Helvetica, var(--bicon-font-cjk), "Arial Unicode MS", sans-serif;
	--bicon-font-arabic: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;

	/* Arabic sizing controls — neutral in LTR, set by the [dir="rtl"] block below.
	   Added by WP-002 so the RTL overrides have a single source of truth. */
	--bicon-font-scale: 1;
	--bicon-lh-bump: 0;

	/* Type scale — 2026 redesign spec §2.2, ≈1.25 modular scale at desktop, compressed by
	   clamp() at mobile. rem only. Per-heading-level line-height/letter-spacing replace the
	   old shared --bicon-lh-tight (h1-h4 no longer share one line-height). */
	--bicon-fs-h1: clamp(2.25rem, 1.6rem + 2.8vw, 3.5rem);
	--bicon-fs-h2: clamp(1.75rem, 1.4rem + 1.4vw, 2.375rem);
	--bicon-fs-h3: clamp(1.375rem, 1.25rem + 0.5vw, 1.625rem);
	--bicon-fs-h4: 1.25rem;
	--bicon-fs-body: 1rem;         /* 16px floor — no body copy below this (US-13) */
	--bicon-fs-lead: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
	--bicon-fs-meta: 0.875rem;     /* labels, breadcrumbs, PDF size — never body copy */
	--bicon-lh-h1: 1.1;
	--bicon-lh-h2: 1.15;
	--bicon-lh-h3: 1.25;
	--bicon-lh-h4: 1.35;
	--bicon-lh-body: 1.7;
	--bicon-lh-lead: 1.55;
	--bicon-fw-heading: 600;       /* 700 remains for <strong>, the active nav item, and buttons only */
	--bicon-ls-h1: -0.015em;
	--bicon-ls-h2: -0.01em;
	--bicon-measure: 65ch;
	--bicon-measure-lead: 55ch;
	--bicon-fs-eyebrow: 0.8125rem; /* kicker/eyebrow — CSS class only, no new DOM */
	--bicon-ls-eyebrow: 0.08em;

	/* Casing helper (contract 07 section 2.3): all-caps looks are CSS-only. */
	--bicon-caps-tracking: 0.04em;

	/* Spacing, radius, layout — 2026 redesign spec §2.3. */
	--bicon-space-1: 0.25rem;
	--bicon-space-2: 0.5rem;
	--bicon-space-3: 0.75rem;
	--bicon-space-4: 1rem;
	--bicon-space-5: 1.5rem;
	--bicon-space-6: 2rem;
	--bicon-space-7: 3rem;
	--bicon-space-8: 4rem;
	--bicon-space-9: 6rem;
	--bicon-space-10: 8rem;
	--bicon-radius: 6px;
	--bicon-radius-lg: 10px;
	--bicon-container: 1200px;
	--bicon-gutter: clamp(1.25rem, 5vw, 2.5rem);
	--bicon-section-y: clamp(3.5rem, 8vw, 6.5rem);
	--bicon-section-y-sm: clamp(2rem, 4vw, 3rem); /* compact strips: anchor bar, breadcrumbs, notices */
	--bicon-shadow-1: 0 1px 2px rgb(20 23 27 / 0.06); /* scrolled header */
	--bicon-shadow-2: 0 8px 24px rgb(20 23 27 / 0.14); /* dropdowns, card hover */

	/* Header/sub-nav chrome heights — drive sticky offsets (§3.2/§3.3: 72px desktop nav row,
	   60px below the 1024px nav breakpoint; §4: constant 48px anchor bar). */
	--bicon-header-h: 60px;
	--bicon-subnav-h: 48px;

	/* Component tokens (contract 07 section 4). */
	--bicon-btn-py: 0.75rem;
	--bicon-btn-px: 1.5rem;
	--bicon-card-gap: var(--bicon-space-5);
	--bicon-logo-max: 147px;       /* the only logo is a 147x147 raster — never render wider (AQ-3, NFR-46) */
	--bicon-link-underline-offset: 0.15em;
	--bicon-tap-min: 44px;         /* minimum touch target at <= 768px (NFR-33) */

	/* Hero scrim — RETIRED by the 2026 redesign spec (design/2026-REDESIGN-SPEC.md §2.3, §5.1):
	   the Home hero overlay is now two fixed, non-token gradient layers (see theme.css's hero
	   section) rather than one opacity value. Token kept, not deleted, for provenance. */
	--bicon-hero-scrim: 0.66;

	/* Motion (NFR-35): every transition uses this duration; nothing exceeds 200ms. */
	--bicon-motion: 160ms;
}

@media (min-width: 1024px) {
	:root {
		--bicon-header-h: 72px;
	}
}

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

/* ---------------------------------------------------------------------------
 * RTL / Arabic overrides (contract 07 sections 2 and 2.2, AQ-4).
 * Neither Roboto face has Arabic coverage, so both slots are reassigned.
 * Every size token multiplies by --bicon-font-scale; every line-height token
 * adds --bicon-lh-bump.
 * ------------------------------------------------------------------------- */

[dir="rtl"] {
	--bicon-font-display: var(--bicon-font-arabic);
	--bicon-font-body: var(--bicon-font-arabic);
	--bicon-font-scale: 1.05;
	--bicon-lh-bump: 0.15;

	--bicon-fs-h1: calc(clamp(2.25rem, 1.6rem + 2.8vw, 3.5rem) * var(--bicon-font-scale));
	--bicon-fs-h2: calc(clamp(1.75rem, 1.4rem + 1.4vw, 2.375rem) * var(--bicon-font-scale));
	--bicon-fs-h3: calc(clamp(1.375rem, 1.25rem + 0.5vw, 1.625rem) * var(--bicon-font-scale));
	--bicon-fs-h4: calc(1.25rem * var(--bicon-font-scale));
	--bicon-fs-body: calc(1rem * var(--bicon-font-scale));
	--bicon-fs-lead: calc(clamp(1.125rem, 1rem + 0.6vw, 1.375rem) * var(--bicon-font-scale));
	--bicon-fs-meta: calc(0.875rem * var(--bicon-font-scale));
	--bicon-fs-eyebrow: calc(0.8125rem * var(--bicon-font-scale));
	--bicon-lh-h1: calc(1.1 + var(--bicon-lh-bump));
	--bicon-lh-h2: calc(1.15 + var(--bicon-lh-bump));
	--bicon-lh-h3: calc(1.25 + var(--bicon-lh-bump));
	--bicon-lh-h4: calc(1.35 + var(--bicon-lh-bump));
	--bicon-lh-body: calc(1.7 + var(--bicon-lh-bump));
	--bicon-lh-lead: calc(1.55 + var(--bicon-lh-bump));
}

/* ---------------------------------------------------------------------------
 * Global focus indicator (contract 07 section 1.4, NFR-29). A token-level
 * guarantee, never removed. On brand/scrim surfaces WP-004 supplements the
 * outline colour per design/03-COMPONENTS.md section 1.3 — it never removes it.
 * ------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--bicon-brand);
	outline-offset: 2px;
	border-radius: 2px;
}
