/**
 * AKNB Global — Design Tokens
 * ---------------------------------------------------------------------------
 * The single source of truth for the entire visual system. NEVER hard-code a
 * hex value, spacing number, or radius anywhere else in the theme — reference
 * these custom properties. Values here are mirrored in theme.json so the block
 * editor and the front end stay in lockstep.
 *
 * Layered token model:
 *   1. Primitives  — raw scale values (--navy-900, --space-4). No meaning.
 *   2. Semantic    — role-based aliases (--color-primary, --color-surface).
 *   3. Component   — consumed locally inside component CSS (defined there).
 *
 * @package AKNB_Global
 */

:root {
	/* ===================================================================
	 * 1. PRIMITIVE — COLOR SCALES
	 * Cool, professional neutrals + trust navy + professional blue.
	 * =================================================================== */

	/* Ink / Navy — brand primary ramp */
	--navy-950: #020617;
	--navy-900: #0f172a; /* brand primary */
	--navy-800: #1e293b;
	--navy-700: #334155;
	--navy-600: #475569;

	/* Professional Blue — brand secondary ramp */
	--blue-900: #1e3a8a; /* brand secondary */
	--blue-800: #1e40af;
	--blue-700: #1d4ed8;
	--blue-600: #2563eb;
	--blue-500: #3b82f6;
	--blue-100: #dbeafe;
	--blue-50: #eff6ff;

	/* Accent — restrained premium gold, reserved for sparing emphasis.
	   Adjusted to #A16207 to hold WCAG AA on light surfaces. */
	--gold-700: #a16207;
	--gold-600: #ca8a04;
	--gold-100: #fef9c3;

	/* Neutral (cool grey) ramp */
	--neutral-0: #ffffff;
	--neutral-50: #f8fafc;
	--neutral-100: #f1f5f9;
	--neutral-150: #e8ecf1;
	--neutral-200: #e2e8f0;
	--neutral-300: #cbd5e1;
	--neutral-400: #94a3b8;
	--neutral-500: #64748b;
	--neutral-600: #475569;
	--neutral-700: #334155;
	--neutral-800: #1e293b;
	--neutral-900: #0f172a;

	/* Functional status ramps */
	--green-600: #16a34a;
	--green-50: #f0fdf4;
	--amber-600: #d97706;
	--amber-50: #fffbeb;
	--red-600: #dc2626;
	--red-50: #fef2f2;
	--sky-600: #0284c7;
	--sky-50: #f0f9ff;

	/* ===================================================================
	 * 2. SEMANTIC — COLOR ROLES (referenced everywhere in the theme)
	 * =================================================================== */
	--color-primary: var(--navy-900);
	--color-primary-hover: var(--navy-800);
	--color-primary-active: var(--navy-950);
	--color-on-primary: var(--neutral-0);

	--color-secondary: var(--blue-900);
	--color-secondary-hover: var(--blue-800);
	--color-on-secondary: var(--neutral-0);

	--color-accent: var(--gold-700);
	--color-accent-hover: var(--gold-600);
	--color-on-accent: var(--neutral-0);

	--color-background: var(--neutral-50);
	--color-surface: var(--neutral-0);
	--color-surface-elevated: var(--neutral-0);
	--color-surface-sunken: var(--neutral-100);
	--color-surface-inverse: var(--navy-900);

	--color-text: var(--navy-950);
	--color-text-secondary: var(--neutral-600);
	--color-text-muted: var(--neutral-500);
	--color-text-inverse: var(--neutral-0);
	--color-text-on-muted: var(--neutral-700);

	--color-border: var(--neutral-200);
	--color-border-strong: var(--neutral-300);
	--color-border-subtle: var(--neutral-150);

	--color-link: var(--blue-700);
	--color-link-hover: var(--blue-800);

	--color-success: var(--green-600);
	--color-success-surface: var(--green-50);
	--color-warning: var(--amber-600);
	--color-warning-surface: var(--amber-50);
	--color-error: var(--red-600);
	--color-error-surface: var(--red-50);
	--color-info: var(--sky-600);
	--color-info-surface: var(--sky-50);

	/* Focus ring — visible, high-contrast, used site-wide (WCAG 2.2 AA) */
	--color-focus: var(--blue-600);
	--focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-focus);

	/* Overlay / scrim for modals, drawers, mega-menu backdrop */
	--color-overlay: rgba(2, 6, 23, 0.55);
	--color-overlay-light: rgba(2, 6, 23, 0.35);

	/* Price + sale semantics */
	--color-price: var(--navy-950);
	--color-price-sale: var(--red-600);
	--color-price-original: var(--neutral-500);

	/* ===================================================================
	 * 3. TYPOGRAPHY
	 * Poppins — display / brand.  Inter — body, UI, pricing (tabular nums).
	 * =================================================================== */
	--font-display: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--font-arabic: "IBM Plex Sans Arabic", "Cairo", "Segoe UI", Tahoma, sans-serif; /* RTL-ready */
	--font-mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;

	/* Fluid type scale — clamp(min, preferred, max). Restrained: no giant text.
	   Ratio ~1.2 (minor third) on mobile widening slightly on desktop. */
	--text-2xs: 0.6875rem; /* 11px — micro labels only */
	--text-xs: 0.75rem; /* 12px */
	--text-sm: 0.875rem; /* 14px */
	--text-base: 1rem; /* 16px — body min */
	--text-md: 1.0625rem; /* 17px */
	--text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem); /* 18→20 */
	--text-xl: clamp(1.375rem, 1.25rem + 0.6vw, 1.625rem); /* 22→26 */
	--text-2xl: clamp(1.625rem, 1.4rem + 1vw, 2.125rem); /* 26→34 */
	--text-3xl: clamp(2rem, 1.65rem + 1.6vw, 2.75rem); /* 32→44 */
	--text-4xl: clamp(2.5rem, 2rem + 2.4vw, 3.5rem); /* 40→56 hero max, restrained */

	/* Weights — deliberately capped. Display tops out at 600, not 900. */
	--fw-regular: 400;
	--fw-medium: 500;
	--fw-semibold: 600;
	--fw-bold: 700;

	/* Line heights */
	--lh-tight: 1.15;
	--lh-snug: 1.3;
	--lh-normal: 1.5;
	--lh-relaxed: 1.65;

	/* Letter spacing */
	--ls-tighter: -0.02em;
	--ls-tight: -0.011em;
	--ls-normal: 0;
	--ls-wide: 0.02em;
	--ls-wider: 0.06em; /* eyebrow / overline caps */

	/* ===================================================================
	 * 4. SPACING SCALE (tokens — do not invent ad-hoc spacing)
	 * =================================================================== */
	--space-0: 0;
	--space-1: 0.25rem; /* 4 */
	--space-2: 0.5rem; /* 8 */
	--space-3: 0.75rem; /* 12 */
	--space-4: 1rem; /* 16 */
	--space-5: 1.25rem; /* 20 */
	--space-6: 1.5rem; /* 24 */
	--space-8: 2rem; /* 32 */
	--space-10: 2.5rem; /* 40 */
	--space-12: 3rem; /* 48 */
	--space-16: 4rem; /* 64 */
	--space-20: 5rem; /* 80 */
	--space-24: 6rem; /* 96 */
	--space-30: 7.5rem; /* 120 */

	/* Fluid section rhythm — vertical padding for major page sections */
	--section-gap: clamp(3rem, 2rem + 5vw, 6rem);
	--section-gap-sm: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);

	/* ===================================================================
	 * 5. LAYOUT / GRID
	 * =================================================================== */
	--content-width: 1280px; /* default max content */
	--content-width-wide: 1400px; /* wide sections */
	--content-width-narrow: 768px; /* prose / article measure */
	--gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem); /* horizontal page gutter */
	--grid-columns: 12;
	--grid-gap: clamp(1rem, 0.75rem + 1vw, 1.5rem);

	/* ===================================================================
	 * 6. BORDER RADIUS — restrained hierarchy (no universal pills)
	 * =================================================================== */
	--radius-xs: 4px;
	--radius-sm: 6px; /* small controls */
	--radius-md: 8px; /* buttons, inputs */
	--radius-lg: 12px; /* cards */
	--radius-xl: 16px; /* large containers */
	--radius-2xl: 20px; /* hero / feature panels */
	--radius-full: 9999px; /* deliberate pills only (badges, avatars) */

	/* ===================================================================
	 * 7. SHADOW SYSTEM — extremely subtle; prefer borders + contrast
	 * =================================================================== */
	--shadow-none: none;
	--shadow-subtle: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
	--shadow-medium: 0 2px 4px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.08);
	--shadow-elevated: 0 8px 24px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.06);
	--shadow-overlay: 0 16px 48px rgba(2, 6, 23, 0.18);

	/* ===================================================================
	 * 8. MOTION — subtle, meaningful, reduced-motion aware
	 * =================================================================== */
	--ease-standard: cubic-bezier(0.2, 0, 0.2, 1);
	--ease-out: cubic-bezier(0, 0, 0.2, 1);
	--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
	--dur-instant: 80ms;
	--dur-fast: 150ms;
	--dur-base: 220ms;
	--dur-slow: 320ms;
	--transition-base: var(--dur-base) var(--ease-standard);

	/* ===================================================================
	 * 9. Z-INDEX SCALE (no magic numbers scattered in code)
	 * =================================================================== */
	--z-base: 1;
	--z-sticky-bar: 100; /* sticky add-to-cart */
	--z-header: 200;
	--z-mega-menu: 250;
	--z-drawer: 300; /* cart / mobile nav */
	--z-overlay: 290;
	--z-modal: 400;
	--z-toast: 500;
	--z-skip-link: 999;

	/* Component sizing */
	--header-height: 72px;
	--header-height-compact: 60px;
	--announcement-height: 40px;
	--tap-target: 44px; /* WCAG 2.2 minimum touch target */
	--focus-outline-width: 2px;
}

/* Reduced-motion: collapse durations globally. Individual components also
   guard their own keyframes, but this is the safety net. */
@media (prefers-reduced-motion: reduce) {
	:root {
		--dur-instant: 0ms;
		--dur-fast: 0ms;
		--dur-base: 0ms;
		--dur-slow: 0ms;
	}
}

/* Auto dark mode via prefers-color-scheme (also togglable via [data-theme="dark"]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-background: #0A0D13;
    --color-surface: #141822;
    --color-surface-elevated: #1A1F2A;
    --color-surface-sunken: #11151E;
    --color-surface-inverse: var(--neutral-0);
    --color-text: #F8FAFC;
    --color-text-secondary: #C7CDD6;
    --color-text-muted: #8B93A3;
    --color-text-inverse: var(--navy-950);
    --color-text-on-muted: var(--neutral-200);
    --color-border: #2A303C;
    --color-border-strong: #3A4152;
    --color-border-subtle: #1F2530;
    --color-primary: #F8FAFC;
    --color-on-primary: #0A0D13;
    --color-secondary: #5B9BFF;
    --color-link: #5B9BFF;
    --color-link-hover: #93B4FF;
    color-scheme: dark;
  }
}
/* Explicit user choice — [data-theme="dark"] wins over media query */
:root[data-theme="dark"] {
  --color-background: #0A0D13;
  --color-surface: #141822;
  --color-surface-elevated: #1A1F2A;
  --color-surface-sunken: #11151E;
  --color-text: #F8FAFC;
  --color-text-secondary: #C7CDD6;
  --color-text-muted: #8B93A3;
  --color-border: #2A303C;
  --color-border-strong: #3A4152;
  --color-border-subtle: #1F2530;
  --color-primary: #F8FAFC;
  --color-on-primary: #0A0D13;
  --color-secondary: #5B9BFF;
  --color-link: #5B9BFF;
  color-scheme: dark;
}
