/* ============================================================================
   Base: reset, document defaults, typography, scrollbars, focus, utilities.
   Everything here is unclassed element styling plus a small set of utilities
   that surfaces share. Component styling lives in components.css.
   ========================================================================= */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--t-font);
  font-size: var(--t-base);
  line-height: var(--t-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-variant-ligatures: contextual;
  /* Never let the page itself rubber-band; individual panes scroll instead. */
  overscroll-behavior: none;
}

body {
  /* iOS: stop the whole app sliding under the keyboard or address bar. */
  position: fixed;
  inset: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--t-semibold); line-height: var(--t-tight); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd, samp { font-family: var(--t-mono); font-size: 0.9em; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 5px;
  border: 1px solid var(--c-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  font-size: var(--t-xs);
  font-family: var(--t-font);
  font-weight: var(--t-semibold);
  text-align: center;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ focus
   Visible only for keyboard users. A mouse click should never paint a ring,
   but tabbing must always show exactly where you are. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--c-accent); color: var(--c-accent-text); }

/* ------------------------------------------------------------------ scrollbars
   Thin, and only visible once the pane is hovered, so resting screens stay calm. */
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
*:hover { scrollbar-color: var(--c-border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: transparent;
  border: 3px solid transparent;
  border-radius: var(--r-full);
  background-clip: content-box;
}
*:hover::-webkit-scrollbar-thumb { background: var(--c-border-strong); background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ------------------------------------------------------------------ app shell root */
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }
.sp { flex: 1 1 auto; }

/* ------------------------------------------------------------------ text utilities */
.muted { color: var(--c-text-2); }
.faint { color: var(--c-text-3); }
.tiny { font-size: var(--t-xs); }
.small { font-size: var(--t-sm); }
.strong { font-weight: var(--t-semibold); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nowrap { white-space: nowrap; }
.center-text { text-align: center; }

/* ------------------------------------------------------------------ layout utilities */
.row { display: flex; align-items: center; }
.row.gap { gap: var(--s-4); }
.col { display: flex; flex-direction: column; }
.col.gap { gap: var(--s-4); }
.wrap { flex-wrap: wrap; }
.pad { padding: var(--s-6); }
.pad-sm { padding: var(--s-4); }
.mt { margin-top: var(--s-5); }
.mb { margin-bottom: var(--s-5); }

/* Screen-reader only: present for assistive tech, invisible on screen. */
.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;
}

/* ------------------------------------------------------------------ states */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-10) var(--s-7);
  color: var(--c-text-2);
  font-size: var(--t-sm);
  line-height: var(--t-loose);
  text-align: center;
}
.empty-icon { font-size: 30px; line-height: 1; opacity: 0.75; }
.empty-title { color: var(--c-text); font-weight: var(--t-semibold); font-size: var(--t-base); }

/* Loading placeholder that shimmers instead of flashing empty. */
.skeleton {
  background: var(--c-skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  user-select: none;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--c-border-strong);
  border-top-color: var(--c-accent);
  border-radius: var(--r-full);
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ print
   People do print rosters and message logs. Drop the chrome. */
@media print {
  #spaceRail, #sidebar, #composerBar, #topbar, #voicebar, aside#panel { display: none !important; }
  body { position: static; overflow: visible; }
  #messages { overflow: visible; height: auto; }
}
