/* Leximo design tokens.
   Loaded first on every page - app, landing, legal and auth.
   Dark is the :root default; light overrides via html[data-theme="light"]. */

:root {
  --bg: #0f1117;
  --bg-inset: #12141c;
  --bg-raised: #14161d;
  --surface: #1a1d27;
  --surface-2: #1e2130;
  --surface-3: #161922;
  --border: #2d3142;
  --border-strong: #3d4358;
  --border-hover: #4a5068;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --text-faint: #5f6368;
  --text-soft: #c4c7c5;
  --accent: #8ab4f8;
  --accent-hover: #aecbfa;
  --accent-strong: #669df6;
  --accent-muted: #8b92a8;
  --green: #81c995;
  --red: #f28b82;
  --yellow: #fdd663;
  --purple: #c58af9;
  --scrollbar: #3d4455;
  --scrollbar-hover: #4b5563;
  --btn-bg: #3c4043;
  --btn-bg-hover: #5f6368;
  --btn-border: #5f6368;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow: rgba(0, 0, 0, 0.35);
  --accent-rgb: 138, 180, 248;
  --red-rgb: 242, 139, 130;
  --green-rgb: 129, 201, 149;
  --yellow-rgb: 253, 214, 99;
  --purple-rgb: 197, 138, 249;

  /* Aurora */
  --accent-gradient: linear-gradient(135deg, #8ab4f8 0%, #c58af9 100%);
  --accent-gradient-soft: linear-gradient(
    135deg,
    rgba(138, 180, 248, 0.16) 0%,
    rgba(197, 138, 249, 0.16) 100%
  );
  --aurora-glow: radial-gradient(
    60% 60% at 50% 0%,
    rgba(138, 180, 248, 0.18) 0%,
    rgba(15, 17, 23, 0) 100%
  );

  --radius-card: 14px;
  --radius-control: 8px;
  --radius-pill: 999px;

  --elev-1: 0 1px 2px var(--shadow);
  --elev-2: 0 4px 12px var(--shadow);
  --elev-3: 0 12px 32px var(--shadow);

  --rail-width: 68px;
  --header-height: 60px;

  --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-inset: #e8eaed;
  --bg-raised: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e8eaee;
  --border: #dadce0;
  --border-strong: #c4c7ce;
  --border-hover: #9aa0a6;
  --text: #202124;
  --text-muted: #5f6368;
  --text-faint: #80868b;
  --text-soft: #3c4043;
  --accent: #1a73e8;
  --accent-hover: #174ea6;
  --accent-strong: #1967d2;
  --accent-muted: #5f6368;
  --green: #1e8e3e;
  --red: #d93025;
  --yellow: #e37400;
  --purple: #7627bb;
  --scrollbar: #bdc1c6;
  --scrollbar-hover: #9aa0a6;
  --btn-bg: #e8eaed;
  --btn-bg-hover: #dadce0;
  --btn-border: #dadce0;
  --overlay: rgba(32, 33, 36, 0.45);
  --shadow: rgba(32, 33, 36, 0.12);
  --accent-rgb: 26, 115, 232;
  --red-rgb: 217, 48, 37;
  --green-rgb: 30, 142, 62;
  --yellow-rgb: 227, 116, 0;
  --purple-rgb: 118, 39, 187;

  --accent-gradient: linear-gradient(135deg, #1a73e8 0%, #7627bb 100%);
  --accent-gradient-soft: linear-gradient(
    135deg,
    rgba(26, 115, 232, 0.1) 0%,
    rgba(118, 39, 187, 0.1) 100%
  );
  --aurora-glow: radial-gradient(
    60% 60% at 50% 0%,
    rgba(26, 115, 232, 0.1) 0%,
    rgba(245, 246, 248, 0) 100%
  );

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--font-sans);
  line-height: 1.5;
}

/* Scrollbars */
html,
.scroll-themed {
  color-scheme: inherit;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) var(--bg-inset);
}

html::-webkit-scrollbar,
.scroll-themed::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

html::-webkit-scrollbar-track,
.scroll-themed::-webkit-scrollbar-track {
  background: var(--bg-inset);
}

html::-webkit-scrollbar-thumb,
.scroll-themed::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

html::-webkit-scrollbar-thumb:hover,
.scroll-themed::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

/* Theme toggle - shared by the app header and the landing nav */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-3);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
