/* ==========================================================================
   Nexus — design tokens, reset, and theming
   ========================================================================== */

:root {
  /* Brand */
  --brand: #5865f2;
  --brand-hover: #4752c4;
  --brand-active: #3c45a5;
  --brand-soft: rgba(88, 101, 242, 0.16);
  --green: #23a55a;
  --yellow: #f0b232;
  --red: #da373c;
  --red-hover: #a12828;

  /* Surfaces (dark is the default theme) */
  --bg-deep: #1e1f22;
  --bg-base: #2b2d31;
  --bg-raised: #313338;
  --bg-overlay: #111214;
  --bg-mod: #232428;
  --bg-float: #111214;
  --bg-input: #383a40;
  --bg-hover: rgba(79, 84, 92, 0.32);
  --bg-active: rgba(79, 84, 92, 0.48);
  --bg-selected: rgba(79, 84, 92, 0.6);

  /* Text */
  --text-normal: #f2f3f5;
  --text-muted: #b5bac1;
  --text-faint: #949ba4;
  --text-link: #00a8fc;
  --text-on-brand: #fff;
  --text-danger: #f23f43;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --divider: rgba(255, 255, 255, 0.06);

  /* Status dots */
  --status-online: #3ba55d;
  --status-idle: #faa61a;
  --status-dnd: #f23f43;
  --status-offline: #80848e;

  /* Layout metrics */
  --rail-w: 72px;
  --sidebar-w: 240px;
  --members-w: 240px;
  --header-h: 48px;
  --userpanel-h: 52px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;

  /* Type */
  --font: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Consolas", "Andale Mono", "Courier New", monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --dur: 120ms;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
}

/* Light theme */
[data-theme="light"] {
  --bg-deep: #ffffff;
  --bg-base: #f2f3f5;
  --bg-raised: #ffffff;
  --bg-overlay: #ffffff;
  --bg-mod: #ffffff;
  --bg-float: #ffffff;
  --bg-input: #ebedef;
  --bg-hover: rgba(116, 127, 141, 0.16);
  --bg-active: rgba(116, 127, 141, 0.24);
  --bg-selected: rgba(116, 127, 141, 0.32);

  --text-normal: #060607;
  --text-muted: #4e5058;
  --text-faint: #747f8d;
  --text-link: #006ce7;
  --text-on-brand: #fff;
  --text-danger: #c93b3e;

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --divider: rgba(0, 0, 0, 0.08);

  --status-offline: #a3a6aa;
}

[data-theme="midnight"] {
  --bg-deep: #050509;
  --bg-base: #0a0a0f;
  --bg-raised: #12121a;
  --bg-overlay: #05050a;
  --bg-mod: #0f0f17;
  --bg-float: #0a0a12;
  --bg-input: #1a1a24;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-active: rgba(255, 255, 255, 0.07);
  --bg-selected: rgba(255, 255, 255, 0.1);
}

/* Compact mode shrinks message spacing globally. */
[data-compact="true"] .messages { --msg-gap: 2px; }
[data-compact="true"] .msg { --msg-pad: 2px 48px; }

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

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-deep);
  color: var(--text-normal);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.375;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

a {
  color: var(--text-link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--brand-soft);
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-active) transparent;
}
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border: 4px solid transparent;
  background-clip: content-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-selected);
  background-clip: content-box;
}

/* Utility */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ==========================================================================
   Boot screen
   ========================================================================== */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  background: var(--bg-base);
  z-index: 200;
}

.boot__mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand);
  animation: boot-pulse 1.4s var(--ease) infinite;
}

.boot__text {
  color: var(--text-muted);
  font-size: var(--fs-md);
  margin: 0;
}

@keyframes boot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.92); }
}
