/**
 * iNKPPL Design System — Unified Tokens
 * Single source of truth for all v2 subsystems.
 * @version 1.0.0
 * @date 2026-02-21
 */

:root {
  /* -- Brand -- */
  --color-brand: #000000;
  --color-brand-accent: #E8C547;
  --color-brand-accent-hover: #F0D060;
  --color-brand-ink: #1A1A2E;
  /* -- Tier System — subscription visual encoding -- */
  --color-tier-standard: var(--color-text-muted);
  --color-tier-plus: var(--color-brand-accent);
  --color-tier-profi: #C084FC;
  --tier-ring-width: 3px;
  --tier-ring-gap: 3px;

  /* -- Neutral Scale -- */
  --color-white: #FFFFFF;
  --color-gray-50: #FAFAFA;
  --color-gray-100: #F5F5F5;
  --color-gray-200: #E5E5E5;
  --color-gray-300: #D4D4D4;
  --color-gray-400: #A3A3A3;
  --color-gray-500: #737373;
  --color-gray-600: #525252;
  --color-gray-700: #404040;
  --color-gray-800: #262626;
  --color-gray-900: #171717;
  --color-black: #0A0A0A;

  /* -- Semantic Colors (Light Theme Default) -- */
  --color-bg: var(--color-white);
  --color-bg-elevated: var(--color-gray-50);
  --color-bg-card: var(--color-white);
  --color-bg-hover: rgba(0, 0, 0, 0.04);
  --color-surface: var(--color-gray-100);
  --color-text: var(--color-gray-900);
  --color-text-secondary: var(--color-gray-500);
  --color-text-muted: #6F6F6F; /* INK-DESIGN-ART27 P0: #A3A3A3 (2.52:1) -> #6F6F6F AA 5.03:1 white / 4.81:1 on #FAFAFA */
  --color-border: var(--color-gray-200);
  --color-border-hover: var(--color-gray-300);
  --color-link: var(--color-brand);
  --color-link-hover: var(--color-brand-accent);

  /* -- Editorial Colors (UNIFIED-VISION editorial register) --
     Default value below = LIGHT theme (matches :root light-default convention).
     Dark theme overrides --color-bg-editorial to #0E0E0E (see .dark-theme block). */
  --color-bg-editorial: #FAFAFA;            /* editorial page background (light theme) */
  --color-editorial-mark: var(--color-brand-accent);   /* gold mark on left-border / pull-quote */

  /* -- Status Colors -- */
  --color-success: #4caf50;
  --color-error: #f44336;
  --color-warning: #ff9800;
  --color-info: #2196f3;

  /* -- Category Colors (8) -- */
  --color-cat-artists: #E63946;
  --color-cat-interview: #457B9D;
  --color-cat-community: #2A9D8F;
  --color-cat-models: #E76F51;
  --color-cat-trends: #9B5DE5;
  --color-cat-knowledge: #00BBF9;
  --color-cat-events: #F15BB5;
  --color-cat-equipment: #06D6A0;

  /* -- Tattoo Style Family Colors (11) -- */
  --color-family-tribal: #d84315;
  --color-family-japanese: #c62828;
  --color-family-american: #1565c0;
  --color-family-chicano: #6a1b9a;
  --color-family-blackwork: #37474f;
  --color-family-realism: #00838f;
  --color-family-modern: #2e7d32;
  --color-family-lettering: #f57c00;
  --color-family-illustrative: #5e35b1;
  --color-family-cultural: #795548;
  --color-family-fineline: #00897b;

  /* -- Glassmorphism -- */
  --glass-bg: rgba(20, 20, 22, 0.85);
  --glass-blur: blur(20px) saturate(1.4);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shine: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);

  /* -- Typography: Canonical Font Roles -- */
  --font-ui: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'DM Serif Display', 'Literata', Georgia, 'Times New Roman', serif;
  /* Prose/editorial = sans (Founder decision, PKG-2 F-10). Retired Source Serif 4. */
  --font-editorial: var(--font-ui);
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Legacy aliases (backward-compat, to be removed in v2.1) */
  --font-family: var(--font-ui);
  --font-heading: var(--font-display);
  --font-body: var(--font-ui);

  /* Type scale — extreme low end (UNIFIED-VISION editorial register) */
  --text-3xs: 0.6875rem;       /* 11px — vertical-label, ruled-col rotated mono */
  --text-2xs: 0.75rem;         /* 12px — section-mast caption, mono caps metadata */

  --text-xs: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.18vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);
  --text-xl: clamp(1.1875rem, 1.1rem + 0.4vw, 1.25rem);
  --text-2xl: clamp(1.375rem, 1.2rem + 0.75vw, 1.5rem);
  --text-3xl: clamp(1.75rem, 1.5rem + 1vw, 1.875rem);
  --text-4xl: clamp(2rem, 1.6rem + 1.5vw, 2.5rem);
  --text-5xl: clamp(2.5rem, 2rem + 2vw, 3.5rem);

  /* Type scale — extreme high end (editorial hero only — gated by §F.11 ceiling on catalog) */
  --text-6xl: clamp(3rem, 5vw, 4rem);     /* 48-64px — editorial section hero */
  --text-7xl: clamp(4rem, 7vw, 5rem);     /* 64-80px — editorial page hero */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-loose: 1.75;
  /* Editorial line-heights — display posture + prose body */
  --line-height-display: 1.05;   /* hero / display-serif headlines (UV §4) */
  --line-height-prose: 1.75;     /* .prose 66ch body — alias of -loose, semantic name */

  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.05em;
  --letter-spacing-caps: 0.1em;

  /* -- Spacing (8px base, rem) -- */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* -- Layout -- */
  /* Set to `none` so all `var(--container-max, 1400px)` references across
     23+ CSS files resolve to `max-width: none` (no cap) instead of falling
     back to the hardcoded 1400px value. */
  --container-max: none;
  --container-max-wide: 100%;
  --gutter: var(--space-4);
  --gutter-lg: var(--space-6);
  --header-h: 56px;

  /* -- Border Radius -- */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* -- Shadows -- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(232, 197, 71, 0.15);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.1);

  /* -- Transitions -- */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* -- Motion: Easing curves (editorial posture — no overshoot per §F.17) -- */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);     /* material standard — UI transitions */
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);   /* CSS default ease — editorial entrance */

  /* -- Motion: Duration semantics (image vs entry vs UI) -- */
  --duration-image: 600ms;     /* hero photo entrance / Ken Burns kick */
  --duration-entry: 400ms;     /* component entry (mast, pull-quote, ruled-col reveal) */

  /* -- Editorial layout — vertical spine column (.col-ruled at desktop ≥1024) -- */
  --ruled-col-w: 40px;
  --ruled-col-pad: var(--space-3);
  --ruled-col-line: 1px solid var(--color-border);

  /* -- Z-Index -- */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-overlay: 30;
  --z-modal: 40;
  --z-toast: 50;

  /* -- Legacy Aliases (bridge from v1 naming conventions) --
     These map old variable names used across subsystems to canonical DS tokens.
     Subsystems should reference these instead of defining their own.
     To be deprecated in v3.0 — use canonical DS names in new code. */

  /* Background */
  --bg-primary: var(--color-bg);
  --bg-secondary: var(--color-bg-elevated);
  --bg-tertiary: var(--color-surface);
  --bg-hover: var(--color-bg-hover);
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --color-overlay-scrim-light: rgba(0, 0, 0, 0.4);
  --color-overlay-scrim-strong: rgba(0, 0, 0, 0.85);

  /* Calendar date-range fill — Afisha v2.1 (Founder 2026-05-11) */
  --color-range-fill: rgba(232, 197, 71, 0.12);
  --color-range-fill-hover: rgba(232, 197, 71, 0.18);

  /* Text */
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-secondary);
  --text-muted: var(--color-text-muted);
  --text-inverse: var(--color-black);

  /* Borders */
  --border-color: var(--color-border);
  --border-color-hover: var(--color-border-hover);
  --border-radius: var(--radius-md);
  --border-radius-sm: var(--radius-sm);
  --border-radius-lg: var(--radius-lg);
  --border-radius-xl: var(--radius-xl);
  --border-radius-pill: var(--radius-full);

  /* Typography sizes */
  --font-size-xs: var(--text-xs);
  --font-size-sm: var(--text-sm);
  --font-size-base: var(--text-base);
  --font-size-lg: var(--text-lg);
  --font-size-xl: var(--text-xl);
  --font-size-2xl: var(--text-2xl);
  --font-size-3xl: var(--text-3xl);
  --line-height-relaxed: var(--line-height-loose);

  /* Spacing aliases */
  --space-xs: var(--space-1);
  --space-sm: var(--space-2);
  --space-md: var(--space-4);
  --space-lg: var(--space-6);
  --space-xl: var(--space-8);
  --space-2xl: var(--space-12);

  /* Brand shortcuts */
  --gold: var(--color-brand-accent);
  --gold-hover: var(--color-brand-accent-hover);
  --gold-dim: rgba(232, 197, 71, 0.15);
  --color-primary: var(--color-brand-accent);
}

/* Responsive header & gutter */
@media (min-width: 768px) {
  :root {
    --header-h: 64px;
    --gutter: 1.5rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --gutter: var(--space-8); /* 2rem */
  }
}

@media (min-width: 1920px) {
  :root {
    --gutter: var(--space-12); /* 3rem */
  }
}

/* Dark Theme */
.dark-theme {
  --color-bg: #0A0A0A;
  --color-bg-elevated: #141414;
  --color-bg-card: #1A1A1A;
  --color-bg-hover: rgba(255, 255, 255, 0.05);
  --color-surface: #262626;
  --color-bg-editorial: #0E0E0E;            /* darker than --color-bg, for editorial pages */
  --color-text: #F5F5F5;
  --color-text-secondary: #A3A3A3;
  --color-text-muted: #8A8A8A; /* INK-DESIGN-MP25 P2(f): #666->#8A8A8A AA 5.74:1 */
  --color-border: #333333;
  --color-border-hover: #444444;
  --color-link: var(--color-brand-accent);
  --color-link-hover: #F0D060;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

  --glass-bg: rgba(20, 20, 22, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);

  /* Legacy alias overrides for dark theme */
  --bg-primary: #0A0A0A;
  --bg-secondary: #141414;
  --bg-tertiary: #262626;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(0, 0, 0, 0.85);
  --text-primary: #F5F5F5;
  --text-secondary: #A3A3A3;
  --text-muted: #8A8A8A; /* INK-DESIGN-MP25 P2(f): #666->#8A8A8A */
  --text-inverse: #F5F5F5;
  --border-color: #333333;
  --border-color-hover: #444444;
}

/* Auto dark theme */
@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) {
    --color-bg: #0A0A0A;
    --color-bg-elevated: #141414;
    --color-bg-card: #1A1A1A;
    --color-bg-hover: rgba(255, 255, 255, 0.05);
    --color-surface: #262626;
    --color-bg-editorial: #0E0E0E;
    --color-text: #F5F5F5;
    --color-text-secondary: #A3A3A3;
    --color-text-muted: #8A8A8A; /* INK-DESIGN-MP25 P2(f): #666->#8A8A8A */
    --color-border: #333333;
    --color-border-hover: #444444;
    --color-link: var(--color-brand-accent);
    --color-link-hover: #F0D060;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

    /* Legacy alias overrides for dark theme */
    --bg-primary: #0A0A0A;
    --bg-secondary: #141414;
    --bg-tertiary: #262626;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --text-primary: #F5F5F5;
    --text-secondary: #A3A3A3;
    --text-muted: #8A8A8A; /* INK-DESIGN-MP25 P2(f): #666->#8A8A8A */
    --text-inverse: #F5F5F5;
    --border-color: #333333;
    --border-color-hover: #444444;
  }
}

/* Dark theme image dimming */
.dark-theme img:not([data-no-dim]) {
  filter: brightness(0.9);
}
.dark-theme img:hover {
  filter: brightness(1);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-normal: 0ms;
    --transition-slow: 0ms;
    --transition-bounce: 0ms;
  }
}
