/*
  Lootcamp design tokens.
  Identity: "ink and sea-buckthorn" — cool blue-green ink surfaces (not neutral grey, not near-black) with one warm
  sea-buckthorn (облепиха) accent. Type: Onest, a Cyrillic-first variable sans. Radii and elevation follow hierarchy:
  flat rows in lists, 8px controls, 16px squircles for server icons, 14px floating layers, pills only for chips.
*/

@font-face {
  font-family: 'Onest Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/onest/onest-cyrillic-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Onest Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/onest/onest-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Onest Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/onest/onest-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Onest Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/onest/onest-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Type */
  --font-sans: 'Onest Variable', 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  --fs-xs: 0.75rem;     /* 12: timestamps, counters */
  --fs-sm: 0.8125rem;   /* 13: secondary lines, group labels */
  --fs-md: 0.875rem;    /* 14: sidebars, controls */
  --fs-base: 0.9375rem; /* 15: message text */
  --fs-lg: 1.0625rem;   /* 17: panel titles */
  --fs-xl: 1.375rem;    /* 22: modal titles */
  --fs-2xl: 1.875rem;   /* 30: auth + welcome headings */
  --lh-tight: 1.2;
  --lh-base: 1.4;
  --tracking-tight: -0.012em;

  /* Layout */
  --rail-w: 72px;
  --sidebar-w: 240px;
  --members-w: 240px;
  --header-h: 48px;
  --gutter: 16px;
  --thread-indent: 22px;   /* thread rows nested under their channel (ThreadRow) */
  --titlebar-h: 0px;       /* own window title bar (desktop on Windows: html[data-frame=custom] below; docs/NOTIFICATIONS.md §5.7) */

  /* Stage 2/3: badges, video tiles (voice stage), lock mark */
  --badge-h: 18px;
  --badge-min-w: 18px;
  --lock-size: 10px;
  --tile-gap: 8px;
  --tile-radius: var(--r-lg);
  --tile-min: 220px;         /* min tile width in the auto-fill video grid */
  --tile-ratio: 16 / 9;
  --stage-max-tiles: 9;      /* visible video subscriptions; the rest show avatars */

  /* Shape — by hierarchy, not one radius for everything */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-icon: 16px;
  --r-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;

  /* Layers */
  --z-drawer: 40;
  --z-popover: 60;
  --z-modal: 80;
  --z-toast: 100;
  --z-titlebar: 110;         /* above toasts, below tooltips */
  --z-tooltip: 120;

  /* ── Dark theme (default) ── */
  color-scheme: dark;
  --bg-rail: #0e1517;
  --bg-sidebar: #141d20;
  --bg-chat: #1a2528;
  --bg-raised: #212e32;
  --bg-input: #263539;
  --bg-hover: rgba(160, 205, 200, 0.07);
  --bg-active: rgba(160, 205, 200, 0.13);
  --bg-overlay: rgba(6, 12, 13, 0.72);
  --border: #2a393d;
  --border-strong: #3a4d52;

  --text: #e8eeec;
  --text-muted: #9fb0ae;
  --text-faint: #7f9295;
  --text-on-accent: #1a1206;

  --accent: #f4a43b;          /* sea-buckthorn */
  --accent-hover: #f8b75f;
  --accent-text: #f7b65e;     /* links, accent text on surfaces */
  --accent-soft: rgba(244, 164, 59, 0.12);
  --accent-line: rgba(244, 164, 59, 0.55);

  --danger: #f0605d;
  --danger-text: #ff8784;
  --danger-bg: #c93c38;
  --danger-soft: rgba(240, 96, 93, 0.12);
  --success: #3cc47c;

  --status-online: #3cc47c;
  --status-idle: #e9c341;
  --status-dnd: #f0605d;
  --status-offline: #7d8c90;

  --mention-bg: rgba(244, 164, 59, 0.16);
  --mention-hover: rgba(244, 164, 59, 0.28);
  --mentioned-row: rgba(244, 164, 59, 0.07);
  --code-bg: #111a1c;
  --code-border: #26353a;
  --spoiler: #2f3f43;

  --shadow-float: 0 12px 32px rgba(3, 9, 10, 0.5), 0 2px 6px rgba(3, 9, 10, 0.35);
  --focus-ring: 0 0 0 2px var(--bg-chat), 0 0 0 4px #7fd3c5;
  --focus-color: #7fd3c5;
  --skeleton-a: rgba(160, 205, 200, 0.06);
  --skeleton-b: rgba(160, 205, 200, 0.13);
  --scrollbar: rgba(160, 205, 200, 0.18);

  --badge-bg: #e0523f;        /* mentions: the one place a second loud colour is allowed */
  --badge-fg: #ffffff;
  --live-bg: #e0523f;         /* 'В ЭФИРЕ' tag */
  --live-fg: #ffffff;
  --tile-bg: #0e1517;
  --tile-fg: #e8eeec;
  --tile-border: rgba(160, 205, 200, 0.12);
  --tile-speaking: #3cc47c;

  /* Voice tabs (docs/MULTI-VOICE.md §5.4): a background tab, connected but silent both ways.
     Blue, so it never reads as the teal focus ring or the green "online". */
  --voice-away: #6aaeff;
  --voice-away-soft: rgba(106, 174, 255, 0.14);
  --voice-away-on-dark: #8ec2ff; /* tile labels sit on a dark scrim in both themes */

  /* Window title bar (docs/NOTIFICATIONS.md §5.5): continues the server rail and the boot screen (both on --bg-rail).
     Everything but the border refers to tokens the light theme already overrides. */
  --titlebar-bg: var(--bg-rail);
  --titlebar-fg: var(--text-muted);
  --titlebar-fg-inactive: var(--text-faint);
  --titlebar-hover: var(--bg-hover);
  --titlebar-pressed: var(--bg-active);
  --titlebar-close-hover: var(--danger-bg);     /* glyph: #fff */
  --titlebar-border: rgba(255, 255, 255, 0.08); /* Win10 top line, close to the grey DWM border on dark */
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg-rail: #d7e1df;
  --bg-sidebar: #e8eeec;
  --bg-chat: #f8faf9;
  --bg-raised: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: rgba(19, 50, 47, 0.06);
  --bg-active: rgba(19, 50, 47, 0.11);
  --bg-overlay: rgba(14, 30, 28, 0.45);
  --border: #cfdad7;
  --border-strong: #b3c3bf;

  --text: #13201f;
  --text-muted: #4d5f5e;
  --text-faint: #5b6c6e;
  --text-on-accent: #1a1206;

  --accent: #f4a43b;
  --accent-hover: #e9932a;
  --accent-text: #9a5300;
  --accent-soft: rgba(244, 164, 59, 0.16);
  --accent-line: rgba(196, 116, 16, 0.6);

  --danger: #c93c38;
  --danger-text: #b4261f;
  --danger-bg: #c93c38;
  --danger-soft: rgba(201, 60, 56, 0.1);
  --success: #1f8f55;

  --status-online: #23a463;
  --status-idle: #c99a12;
  --status-dnd: #d64541;
  --status-offline: #84959a;

  --mention-bg: rgba(244, 164, 59, 0.22);
  --mention-hover: rgba(244, 164, 59, 0.36);
  --mentioned-row: rgba(244, 164, 59, 0.1);
  --code-bg: #eef3f2;
  --code-border: #d5dfdc;
  --spoiler: #c3cfcc;

  --shadow-float: 0 12px 32px rgba(18, 40, 37, 0.16), 0 2px 6px rgba(18, 40, 37, 0.1);
  --focus-ring: 0 0 0 2px var(--bg-chat), 0 0 0 4px #13806f;
  --focus-color: #13806f;
  --skeleton-a: rgba(19, 50, 47, 0.06);
  --skeleton-b: rgba(19, 50, 47, 0.12);
  --scrollbar: rgba(19, 50, 47, 0.2);

  --badge-bg: #d2432f;
  --badge-fg: #ffffff;
  --live-bg: #d2432f;
  --live-fg: #ffffff;
  --tile-bg: #1a2528;
  --tile-fg: #e8eeec;
  --tile-border: rgba(19, 50, 47, 0.18);
  --tile-speaking: #23a463;

  --voice-away: #1f6fd6;
  --voice-away-soft: rgba(31, 111, 214, 0.12);
  --voice-away-on-dark: #8ec2ff;

  --titlebar-border: rgba(0, 0, 0, 0.12);
}

/* Desktop window without the system caption: the host marks <html> before the first frame (docs/NOTIFICATIONS.md §5.6).
   In full screen the title bar leaves the layout (§5.9). */
html[data-frame='custom'] { --titlebar-h: 32px; }
html[data-frame='custom'][data-fullscreen] { --titlebar-h: 0px; }
