/* Troubadour web UI - design tokens and base.
   The one place a colour, a space, a radius or a type size is decided.
   Every other stylesheet reads these and never invents a value.
   Light is the default; the .dark class on <html> swaps the palette.
   Contrast was computed, not eyeballed (WCAG 2.2): body text 18.5:1,
   muted text 6.3:1, white on the primary 6.0:1, status text >= 5:1
   (light); dark: body 15.8:1, muted 8.2:1, white on the primary 4.95:1. */

:root {
  /* surfaces */
  --bg: #ffffff;
  --surface: #f6f7f9;        /* sidebar, quiet panels */
  --surface-2: #eceef2;      /* hover, chips, code */
  --card: #ffffff;
  --border: #e3e6eb;
  --border-strong: #c9cfd8;
  --overlay: rgba(15, 20, 25, 0.45);

  /* text */
  --text: #0f1419;
  --muted: #566170;
  --muted-2: #7a8493;        /* tertiary only: timestamps, hints */

  /* accent + status; *-soft are tinted backgrounds for chips and alerts */
  --primary: #2554e8;
  --primary-hover: #1d46c9;
  --primary-ink: #ffffff;
  --primary-soft: rgba(37, 84, 232, 0.10);
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.12);
  --danger: #c4281c;
  --danger-soft: rgba(196, 40, 28, 0.10);
  --warn: #a85a00;
  --warn-soft: rgba(168, 90, 0, 0.13);
  --violet: #6a4fd6;
  --violet-soft: rgba(106, 79, 214, 0.12);
  --topic-new: #1d46c9;

  /* shape */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --pill: 999px;

  /* elevation */
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 1px rgba(16, 24, 40, 0.04);
  --shadow-2: 0 6px 18px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.06);
  --shadow-3: 0 18px 48px rgba(16, 24, 40, 0.22);

  /* space: a 4 px scale, used as var(--s3) etc. */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --s8: 32px; --s10: 40px;

  /* type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-base: 15px;
  --fs-lg: 17px; --fs-xl: 21px; --fs-2xl: 26px;

  /* layout */
  --sidebar-w: 272px;
  --pane-w: 392px;
  --header-h: 56px;
  --content-w: 880px;
  --chat-w: 780px;
  --focus: 2px solid var(--primary);
  --focus-offset: 2px;
  /* mask icons for controls whose text must stay a glyph (see chat.css) */
  --ico-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E");
  --ico-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' rx='3' fill='black'/%3E%3C/svg%3E");
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566170' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

html.dark {
  --bg: #0f1115;
  --surface: #14171c;
  --surface-2: #1c2027;
  --card: #171a20;
  --border: #272c34;
  --border-strong: #3a414c;
  --overlay: rgba(0, 0, 0, 0.6);
  --text: #e9ebef;
  --muted: #a3acb9;
  --muted-2: #7d8795;
  --primary: #3a66e8;
  --primary-hover: #4f78ee;
  --primary-ink: #ffffff;
  --primary-soft: rgba(122, 162, 255, 0.16);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --danger: #ff7b72;
  --danger-soft: rgba(255, 123, 114, 0.14);
  --warn: #f2b24c;
  --warn-soft: rgba(242, 178, 76, 0.15);
  --violet: #b8a4ff;
  --violet-soft: rgba(184, 164, 255, 0.16);
  --topic-new: #8fb0ff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 8px 22px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 20px 56px rgba(0, 0, 0, 0.65);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa5b5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}
/* links and focus use a lighter blue on dark so they clear 4.5:1 */
html.dark a, html.dark .linkbtn { color: #7aa2ff; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  /* gh #44 backstop: an escaping token must pan nothing. */
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

#app, .app { height: 100%; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { margin: 0 0 var(--s2); font-weight: 650; letter-spacing: -0.012em; }
p { margin: 0 0 var(--s2); }
a { color: var(--primary); }

/* keyboard focus is always visible and never clipped by overflow:hidden
   parents (offset ring); mouse clicks do not draw it. */
:focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); }
:focus:not(:focus-visible) { outline: none; }

.icon { flex: 0 0 auto; display: inline-block; vertical-align: -0.2em; }

.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;
}

[hidden] { display: none !important; }

/* the brand tile: a rounded gradient square holding a note glyph */
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; color: #fff; flex: 0 0 auto;
  background: linear-gradient(135deg, #4a78ff 0%, #2554e8 55%, #1b3fb8 100%);
  box-shadow: 0 1px 2px rgba(37, 84, 232, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand__name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.wordmark { font-weight: 800; font-style: italic; font-size: 22px; line-height: 1;
  letter-spacing: -0.03em; }

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

/* forced-colors (Windows high contrast): keep controls findable */
@media (forced-colors: active) {
  .btn, .tab, .composer__box, .card, .feed-row, .approval, .toast {
    border: 1px solid CanvasText;
  }
  .tab.is-active { border-color: Highlight; forced-color-adjust: none;
    background: Highlight; color: HighlightText; }
}
