@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500&display=swap");

/* Touch feedback comes from component states; retain keyboard focus outlines. */
html {
  -webkit-tap-highlight-color: transparent;
}

/* Hireed: warm editorial surfaces, precise royal-blue actions. */

:root {
  /* ── Typography — optical hierarchy ───────────────── */
  --font-heading: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 32px;
  --text-3xl: 44px;

  /* ── 8px Spacing System ─────────────────────────────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* ── Neutral Primitives — Editorial neutrals ────────────── */
  --ink-950: #09090b;
  --ink-900: #0e0e10;
  --ink-800: #1c1c1f;
  --ink-700: #303034;
  --ink-600: #444449;
  --ink-500: #74747c;
  --ink-400: #9999a2;
  --ink-300: #d4d4d8;
  --ink-200: #e4e4e7;
  --ink-150: #eeeee6;
  --ink-100: #f5f5ef;
  --ink-50: #fafaf5;
  --ink-25: #fffffc;

  /* ── Light Palette (Semantic) — warm cream and ink ── */
  --color-bg: #f5f5ef;
  --color-surface: #ffffff;
  --color-surface-soft: #eeeee6;
  --color-surface-raised: #ffffff;
  --color-text: #18181b;
  --color-text-soft: #43505f;
  --color-muted: #626d79;
  --color-border: #dedfd7;
  --color-border-soft: #eeeee6;
  --color-border-strong: #bec4ca;
  --color-focus: #2864e8;

  /* Accent — Royal blue actions */
  --color-accent: #2864e8;
  --color-accent-text: #1d4ed8;
  --color-accent-hover: #1d53c9;
  --color-accent-active: #1643a8;
  --color-accent-bg: rgba(40, 100, 232, 0.09);
  --color-accent-subtle: rgba(40, 100, 232, 0.15);
  --color-on-accent: #ffffff;
  --color-text-on-accent: #ffffff;

  /* Functional Feedback — distinct semantic feedback */
  --color-success: #187055;
  --color-success-bg: rgba(0, 145, 107, 0.10);
  --color-warning: #8a5a06;
  --color-warning-bg: rgba(193, 122, 10, 0.10);
  --color-danger: #be3434;
  --color-danger-bg: rgba(220, 38, 38, 0.08);
  --color-info: #2864e8;
  --color-info-bg: rgba(40, 100, 232, 0.08);

  /* Status Ladder — neutral data ladder */
  --status-1: #9999a2;
  --status-2: #74747c;
  --status-3: #444449;
  --status-4: #2864e8;

  /* ── Plan identity + source-tier provenance ─────────────────────────
     One hue per paid tier (explicit product requirement): Pro reads cool
     and precise, Max reads warm amber (reward cue). Tinted washes stay
     subtle; small text always uses the darker *-text variant for AA. */
  --plan-free: var(--color-muted);
  --plan-pro: #7c3aed;
  --plan-pro-on: #ffffff;
  --plan-max: var(--color-warning);
  --tier-pro: #7c3aed;
  --tier-pro-text: #6d28d9;
  --tier-pro-bg: rgba(124, 58, 237, 0.08);
  --tier-max: var(--color-warning);
  --tier-max-text: #7c4a03;
  --tier-max-bg: var(--color-warning-bg);
  --tier-max-on: #ffffff;

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.06), 0 0 0 1px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 4px 12px -1px rgba(24, 24, 27, 0.08), 0 2px 6px -2px rgba(24, 24, 27, 0.05);
  --shadow-lg: 0 16px 32px -8px rgba(24, 24, 27, 0.14), 0 4px 12px -4px rgba(24, 24, 27, 0.06);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  /* Motion */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 240ms;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shared Header Component Scale */
  --header-height: 72px;
  --header-touch-target: 44px;
  --header-logo-size: 34px;
  --header-dropdown-width: 430px;
  --header-resource-icon-size: 48px;
  --header-press-offset: 1px;
  --header-drawer-width: 360px;
  --header-z-index: 100;
  --header-overlay-z-index: 101;
  --header-drawer-z-index: 102;
  --header-dropdown-z-index: 103;
}

/* ── Dark Palette — neutral black, blue actions ─ */
:root[data-theme="dark"] {
  --color-bg: #09090b;
  --color-surface: #141416;
  --color-surface-soft: #1c1c1f;
  --color-surface-raised: #232326;
  --color-text: #f7f7f4;
  --color-text-soft: #c1c1c8;
  --color-muted: #a2a2ab;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-soft: rgba(255, 255, 255, 0.05);
  --color-border-strong: rgba(255, 255, 255, 0.14);
  --color-focus: #8dabff;

  --color-accent: #8dabff;
  --color-accent-text: #b4c7ff;
  --color-accent-hover: #a6bdff;
  --color-accent-active: #c0ceff;
  --color-accent-bg: rgba(141, 171, 255, 0.11);
  --color-accent-subtle: rgba(141, 171, 255, 0.18);
  --color-on-accent: #18181b;
  --color-text-on-accent: #18181b;

  --color-success: #7bd6b7;
  --color-success-bg: rgba(123, 214, 183, 0.13);
  --color-warning: #f0b429;
  --color-warning-bg: rgba(240, 180, 41, 0.13);
  --color-danger: #f87171;
  --color-danger-bg: rgba(248, 113, 113, 0.14);
  --color-info: #8dabff;
  --color-info-bg: rgba(141, 171, 255, 0.11);

  --status-1: #444449;
  --status-2: #74747c;
  --status-3: #9999a2;
  --status-4: #8dabff;

  /* Plan identity + source-tier provenance (dark variants stay luminous). */
  --plan-pro: #a78bfa;
  --plan-pro-on: #18181b;
  --tier-pro: #a78bfa;
  --tier-pro-text: #c4b5fd;
  --tier-pro-bg: rgba(167, 139, 250, 0.13);
  --tier-max-text: #fbbf24;
  --tier-max-on: #18181b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .04);
  --shadow-md: 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 48px -20px rgba(0, 0, 0, .68);
}

/* ── Backward-compatible Aliases Used by Existing Pages ───────────────── */
:root {
  --bg: var(--color-bg);
  --surface: var(--color-surface);
  --surface-1: var(--color-surface);
  --surface-2: var(--color-surface-soft);
  --surface-3: var(--color-surface-raised);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-soft);
  --text-tertiary: var(--color-muted);
  --border-subtle: var(--color-border-soft);
  --border-strong: var(--color-border-strong);
  --accent-color: var(--color-accent);
  --font-display: var(--font-heading);
  --ink: var(--color-text);
  --on-ink: var(--color-bg);
  --ink-soft: var(--color-text-soft);
  --muted: var(--color-muted);
  --line: var(--color-border);
  --line-soft: var(--color-border-soft);
  --t1: var(--color-text);
  --t2: var(--color-text-soft);
  --t3: var(--color-muted);
  --s1: var(--color-surface);
  --s2: var(--color-surface-soft);
  --s3: var(--color-bg);
  --b1: var(--color-border);
  --b2: var(--color-border-soft);

  /* Functional */
  --green: var(--color-success);
  --gd: var(--color-success-bg);
  --yellow: var(--color-warning);
  --yd: var(--color-warning-bg);
  --red: var(--color-danger);
  --rd: var(--color-danger-bg);

  --blue: var(--color-accent);
  --bd: var(--color-accent-bg);
  --purple: #8b5cf6;
  --pd: rgba(139, 92, 246, 0.10);
  --orange: var(--color-warning);
  --od: var(--color-warning-bg);
}

/* Theme snapshots cross-fade as one surface, avoiding mixed-color intermediate states. */
:root.theme-switching *, :root.theme-switching *::before, :root.theme-switching *::after { transition: none !important; }
::view-transition { pointer-events:none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration:180ms; animation-timing-function:ease-out; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation:none; }
}
:root[data-pref-motion="reduced"]::view-transition-old(root), :root[data-pref-motion="reduced"]::view-transition-new(root) { animation:none; }

/* Colorful editorial panels use themed surfaces, never light pastel text. */
:root {
  color-scheme: light;
  --color-butter: #f3db83;
  --color-peach: #f4c8b6;
  --color-lavender: #d8d4f5;
  --color-sky: #c9e4f2;
  --color-on-secondary: #18181b;
  --color-surface-inset: #eeeee6;
  --color-border-subtle: var(--color-border-soft);
  --accent: var(--color-accent);
  --accent-hover: var(--color-accent-hover);
  --accent-soft: var(--color-accent-bg);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --glass-surface: rgba(255, 255, 252, .78);
  --glass-edge: rgba(255, 255, 255, .9);
  --glass-shadow: 0 8px 30px -18px rgba(24, 24, 27, .24);
  --shadow-card: 0 2px 3px -1px rgba(24,24,27,.035), 0 8px 18px -16px rgba(24,24,27,.16);
  --control-highlight: inset 0 1px 0 rgba(255,255,255,.6);
  --surface-highlight: rgba(255,255,255,.8);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-butter: #302b20;
  --color-peach: #312724;
  --color-lavender: #292734;
  --color-sky: #232c31;
  --color-on-secondary: #f7f7f4;
  --color-surface-inset: #0e0e10;
  --glass-surface: rgba(24, 24, 27, .82);
  --glass-edge: rgba(255, 255, 255, .17);
  --glass-shadow: 0 8px 30px -18px rgba(0, 0, 0, .6);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.035), 0 4px 14px -10px rgba(0,0,0,.4);
  --control-highlight: inset 0 1px 0 rgba(255,255,255,.035);
  --surface-highlight: rgba(255,255,255,.045);
}
html { font-optical-sizing: auto; }
.ui-icon { display: inline-block; flex-shrink: 0; vertical-align: middle; overflow: visible; }
::selection { color: var(--color-on-secondary); background: var(--color-lavender); }
:where(button, a, input, textarea, select) { -webkit-tap-highlight-color: transparent; }
:where(button, a, summary, [role="button"]):focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
:where(input, textarea, select) { outline: none; }
:where(input, textarea, select):focus,
:where(input, textarea, select):focus-visible { outline: none; }
/* Keep pointer focus within the field; keyboard focus remains visible in its border. */
input:focus,
textarea:focus,select:focus {outline:none!important;box-shadow:inset 0 0 0 2px var(--color-text-soft, #59616b)!important;border-color:var(--color-text-soft, #59616b)!important;}
.field-input-wrap:focus-within,.profile-tags-wrapper:focus-within {outline:none!important;box-shadow:none!important;border-color:var(--color-text-soft, #59616b)!important;}
@media (forced-colors:active){input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid Highlight!important;outline-offset:-2px!important;}}
/* Keyboard controls resolve immediately; pointer feedback retains its brief ease. */
html[data-input-modality="keyboard"] :where(button, a, [role="button"], [role="dialog"], [role="menu"], .global-settings-modal, .site-header__mobile-sidebar, .profile-dropdown__menu) { transition-duration: 0s !important; animation: none !important; }
@media (forced-colors: active) { :where(button, input, textarea, select, [role="dialog"]) { border-color: ButtonText; } }
