/* FERXL shared design foundation: primitive → semantic → component tokens. */
:root {
  color-scheme: dark;

  /* Primitive palette */
  --night-950: #121019;
  --night-900: #1b1923;
  --night-800: #252230;
  --night-700: #302b3b;
  --plum-600: #443b4a;
  --pearl-50: #fbf7f4;
  --pearl-0: #fffdfc;
  --blush-100: #f5edf1;
  --blush-200: #eee2e8;
  --ink-900: #2d2430;
  --ink-700: #6d5d6c;
  --orbit-gold: #f1c778;
  --orbit-rose: #e98bb2;
  --orbit-violet: #b29af2;
  --orbit-cyan: #8ac9dc;
  --orbit-mint: #91d2b5;
  --orbit-coral: #f08d80;

  /* Semantic night theme */
  --bg: var(--night-950);
  --panel: var(--night-900);
  --panel-2: var(--night-800);
  --panel-3: var(--night-700);
  --text: #f7f2f3;
  --muted: #c1b6c2;
  --muted-2: #978a9b;
  --line: var(--plum-600);
  --purple: var(--orbit-violet);
  --purple-2: #9278dc;
  --gold: var(--orbit-gold);
  --rose: var(--orbit-rose);
  --red: var(--orbit-rose);
  --pink: var(--orbit-rose);
  --peach: var(--orbit-gold);
  --yellow: var(--orbit-gold);
  --mint: var(--orbit-mint);
  --cyan: var(--orbit-cyan);
  --coral: var(--orbit-coral);
  --shadow: 0 18px 48px rgb(8 5 13 / 42%);
  --shadow-soft: 0 10px 28px rgb(8 5 13 / 28%);

  /* Type and layout */
  --font: 'DM Sans', Manrope, system-ui, sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
  --journey-serif: var(--font-display);
  --content-width: 1320px;
  --radius: 20px;
  --control-radius: 12px;
  --theme-duration: 220ms;
  --theme-ease: cubic-bezier(.2, .7, .2, 1);

  /* Existing journey styles consume these aliases. */
  --journey-ink: #f7f2f3;
  --journey-muted: #c1b6c2;
  --journey-stroke: color-mix(in srgb, var(--peach) 18%, var(--line));
  --journey-wash: color-mix(in srgb, var(--purple) 8%, var(--panel));
  --journey-raised: color-mix(in srgb, var(--pink) 7%, var(--panel-2));
  --journey-glow: color-mix(in srgb, var(--pink) 12%, transparent);
  --cafe-glow: color-mix(in srgb, var(--peach) 8%, transparent);
  --rune-glow: color-mix(in srgb, var(--purple) 10%, transparent);

  /* Component tokens */
  --surface-page: var(--bg);
  --surface-raised: var(--panel);
  --surface-selected: var(--panel-2);
  --surface-control: var(--panel-3);
  --border-subtle: var(--line);
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --text-tertiary: var(--muted-2);
  --accent-primary: var(--rose);
  --accent-focus: var(--gold);
  --focus-ring: var(--gold);
  --button-primary-bg: var(--rose);
  --button-primary-fg: #2d1723;
  --button-secondary-bg: var(--panel-3);
  --button-radius: var(--control-radius);
  --field-bg: var(--panel);
  --field-border: var(--line);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: var(--pearl-50);
  --panel: var(--pearl-0);
  --panel-2: var(--blush-100);
  --panel-3: var(--blush-200);
  --text: var(--ink-900);
  --muted: var(--ink-700);
  --muted-2: #786c79;
  --line: #e5d7de;
  --purple: #6845a0;
  --purple-2: #593786;
  --gold: #93641a;
  --rose: #a43e68;
  --red: #a43e68;
  --pink: #a43e68;
  --peach: #93641a;
  --yellow: #805a16;
  --mint: #286b50;
  --cyan: #28697d;
  --coral: #a4413c;
  --shadow: 0 18px 40px rgb(65 35 74 / 9%);
  --shadow-soft: 0 8px 22px rgb(65 35 74 / 6%);
  --journey-ink: #2d2430;
  --journey-muted: #6d5d6c;
  --journey-stroke: color-mix(in srgb, var(--peach) 22%, var(--line));
  --journey-wash: color-mix(in srgb, var(--purple) 6%, var(--panel));
  --journey-raised: color-mix(in srgb, var(--pink) 5%, var(--panel-2));
  --journey-glow: color-mix(in srgb, var(--pink) 8%, transparent);
  --cafe-glow: color-mix(in srgb, var(--peach) 9%, transparent);
  --rune-glow: color-mix(in srgb, var(--purple) 7%, transparent);
  --button-primary-fg: #fffafd;
}

html { color-scheme: dark; scroll-behavior: smooth; }
html[data-theme='light'] { color-scheme: light; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  transition: background-color var(--theme-duration) var(--theme-ease), color var(--theme-duration) var(--theme-ease);
}

/* Shared shell and surface material */
.app-shell {
  background:
    radial-gradient(ellipse at 74% 0%, var(--cafe-glow), transparent 38%),
    radial-gradient(ellipse at 14% 70%, var(--rune-glow), transparent 42%),
    var(--bg);
}
.sidebar {
  background: linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 72%, var(--bg)) 100%);
  border-right-color: color-mix(in srgb, var(--peach) 18%, var(--line));
  transition: background-color var(--theme-duration) var(--theme-ease), border-color var(--theme-duration) var(--theme-ease), transform 220ms var(--theme-ease);
}
.topbar {
  background-color: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom-color: color-mix(in srgb, var(--peach) 15%, var(--line));
  transition: background-color var(--theme-duration) var(--theme-ease), border-color var(--theme-duration) var(--theme-ease);
}
.section-card,
.continue-card,
.profile-connect,
.today-focus-card,
.daily-practice-progress {
  border-color: var(--line);
  transition: background-color var(--theme-duration) var(--theme-ease), border-color var(--theme-duration) var(--theme-ease), color var(--theme-duration) var(--theme-ease), box-shadow var(--theme-duration) var(--theme-ease);
}

/* Navigation state and touch targets */
.nav-link {
  position: relative;
  min-height: 44px;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.nav-link.active {
  background: color-mix(in srgb, var(--pink) 13%, var(--panel-2));
  color: var(--pink);
}
.nav-link.active::before {
  position: absolute;
  inset-block: 9px;
  inset-inline-start: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 42%, transparent);
  content: '';
}
.nav-link.active > .nav-icon { color: var(--pink); }
.mobile-menu {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
}

/* Consistent controls; visual states still communicate their action. */
.button {
  border-radius: var(--button-radius);
  transition: transform 150ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.button.primary {
  background: var(--button-primary-bg);
  border-color: color-mix(in srgb, var(--pink) 72%, white 10%);
  color: var(--button-primary-fg);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--pink) 20%, transparent);
}
.button.primary:hover { box-shadow: 0 9px 22px color-mix(in srgb, var(--pink) 27%, transparent); }
.button.secondary { background: var(--button-secondary-bg); border-color: var(--line); }
.button:active { transform: translateY(1px) scale(.99); }
:where(input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='submit']):not([type='button']), select, textarea, .search-box, .connect-field input) {
  border-color: var(--field-border);
  border-radius: var(--control-radius);
  background-color: var(--field-bg);
  color: var(--text);
}
:where(input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='submit']):not([type='button']), textarea, .search-box, .connect-field input)::placeholder { color: var(--muted-2); opacity: 1; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

@media (max-width: 800px) {
  .mobile-menu { display: grid; flex: 0 0 44px; }
  .sidebar { width: min(300px, calc(100vw - 52px)); }
  .topbar { gap: 10px; }
  .crumb { margin-left: 0; }
}


