/* ============================================================
   RocketServe Intelligence Design System — v1 (RIDS)
   Canonical distributable. Spec: design/rocketserve-intelligence-design-system.md
   Products consume semantic tokens + .rs-* components; primitives are
   theme plumbing. Product accent is overridable; semantic meanings are not.
   ============================================================ */

/* ---- Typography (self-hosted, OFL, CSP-safe) ---- */
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/static/fonts/IBMPlexMono-Regular.woff2") format("woff2");
}
/* Brand + display faces. These are *variable* fonts (one file spans the whole
   weight axis), latin subset — the family wordmark and display type render in
   the real RocketServe faces instead of silently falling back to Inter/Georgia.
   Only the latin cuts are vendored: the sibling-product manifest that shipped
   these mislabels the cyrillic subsets as the bold weights, which would fall
   back for every Latin glyph. Self-hosted because the CSP forbids font CDNs. */
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 100 900;
  font-display: swap; src: url("/static/fonts/Montserrat-Latin-Variable.woff2") format("woff2");
  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;
}
@font-face {
  font-family: "Merriweather"; font-style: normal; font-weight: 300 900;
  font-display: swap; src: url("/static/fonts/Merriweather-Latin-Variable.woff2") format("woff2");
  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;
}

/* ---- product layer -------------------------------------------------------
   Everything below is what makes this DifficultResearch rather than any
   other RocketServe product. The family DNA — neutrals, scales, motion,
   focus, semantic status colors, and the product accent — is inherited from
   rocketserve-tokens.css, which MUST be loaded first. Do not redeclare a
   family token here; if a value needs to change for the whole family, change
   it in ~/dev/rocketserve/brand_system/tokens/ and re-vendor.

   The dark theme is navy-derived (family), not neutral slate: that is the
   strongest "same company" cue a dark product can carry. The accent is gold
   (#C9A24B dark / #8A6A1F light) via the [data-product] preset — Rocket Red
   stays a brand-placement color here, because in an evidence platform red
   already means destructive.
   -------------------------------------------------------------------------- */

:root {
  /* Display size above the family scale — DR sets case titles larger. */
  --rs-text-2xl: 1.9rem;

  /* DR-specific semantics with no family equivalent. */
  --rs-citation: #8ab4d8;     /* links, sources, citations */
  --rs-intel: #8b7fd4;        /* intelligence (Athena) surfaces only */

  /* ---- Depth primitives (reusable) ------------------------------------
     The production version of the mockup's depth/glow language. Elevation is
     composed from the family shadow tokens (which are already theme-aware,
     light vs dark) plus a faint top-light; the sheen is a hairline surface
     gradient. Consume these anywhere a surface should read raised, so depth is
     one decision, not per-screen copy. */
  --rs-elevation-1: var(--rs-shadow-1), inset 0 1px 0 rgba(255,255,255,.05);
  --rs-elevation-2: var(--rs-shadow-2), inset 0 1px 0 rgba(255,255,255,.07);
  --rs-surface-sheen: linear-gradient(180deg, rgba(255,255,255,.022), transparent 42%);
}

:root[data-theme="light"] {
  --rs-citation: #2f6c9e;
  --rs-intel: #5d4fb3;
}

/* ---- base ---- */
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--rs-bg); color: var(--rs-ink);
  font-family: var(--rs-font-ui); font-size: var(--rs-text-md);
  line-height: var(--rs-leading);
}
h1, h2, h3 { line-height: var(--rs-leading-tight); font-weight: 600; }
h1 { font-size: var(--rs-text-xl); }
h2 { font-size: var(--rs-text-lg); }
h3 { font-size: var(--rs-text-md); }
a { color: var(--rs-citation); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .rs-mono { font-family: var(--rs-font-mono); font-size: .92em; }

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

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

.rs-skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--rs-surface); color: var(--rs-ink);
  padding: var(--rs-space-2) var(--rs-space-4); border-radius: var(--rs-radius-sm);
}
.rs-skip-link:focus-visible { left: var(--rs-space-2); top: var(--rs-space-2); }

/* ---- components ---- */
.rs-btn {
  min-height: var(--rs-target-min);
  display: inline-flex; align-items: center; justify-content: center;
  padding: var(--rs-space-2) var(--rs-space-4);
  border: 1px solid transparent; border-radius: var(--rs-radius-sm);
  font: 500 var(--rs-text-sm) var(--rs-font-ui); cursor: pointer;
  transition: background var(--rs-dur-fast) var(--rs-ease),
              border-color var(--rs-dur-fast) var(--rs-ease);
}
.rs-btn-primary { background: var(--rs-accent); color: var(--rs-accent-ink); }
.rs-btn-primary:hover { filter: brightness(1.06); }
.rs-btn-secondary {
  background: var(--rs-surface-2); color: var(--rs-ink); border-color: var(--rs-line);
}
.rs-btn-quiet { background: none; color: var(--rs-muted); }
.rs-btn-quiet:hover { color: var(--rs-ink); }
.rs-btn-danger { background: none; color: var(--rs-danger); border-color: var(--rs-danger); }
.rs-btn[disabled] { opacity: .55; cursor: default; }

.rs-card {
  background: var(--rs-surface); background-image: var(--rs-surface-sheen);
  border: 1px solid var(--rs-line);
  border-radius: var(--rs-radius-md); box-shadow: var(--rs-elevation-1);
  padding: var(--rs-space-4) var(--rs-space-5); margin: var(--rs-space-4) 0;
  transition: box-shadow var(--rs-dur) var(--rs-ease),
              transform var(--rs-dur) var(--rs-ease),
              border-color var(--rs-dur) var(--rs-ease);
}
/* An interactive card (a whole row/link) lifts on hover. */
.rs-card--interactive:hover, .cardlist .card:hover, .cardlist .rs-card:hover {
  box-shadow: var(--rs-elevation-2); transform: translateY(-1px);
  border-color: var(--rs-line-strong);
}

.rs-badge {
  display: inline-block; padding: 1px var(--rs-space-2);
  border: 1px solid var(--rs-line); border-radius: var(--rs-radius-full);
  font-size: var(--rs-text-xs); color: var(--rs-muted); white-space: nowrap;
}
.rs-badge-success { border-color: var(--rs-success); color: var(--rs-success); }
.rs-badge-warning { border-color: var(--rs-warning); color: var(--rs-warning); }
.rs-badge-danger  { border-color: var(--rs-danger);  color: var(--rs-danger); }
.rs-badge-info    { border-color: var(--rs-info);    color: var(--rs-info); }
.rs-badge-intel   { border-color: var(--rs-intel);   color: var(--rs-intel); }
.rs-badge-accent  { border-color: var(--rs-accent);  color: var(--rs-accent); }

.rs-field { display: block; margin: var(--rs-space-3) 0; }
.rs-field > span { display: block; font-size: var(--rs-text-sm); color: var(--rs-muted); margin-bottom: var(--rs-space-1); }
.rs-input, .rs-field input, .rs-field textarea, .rs-field select {
  width: 100%; padding: var(--rs-space-2) var(--rs-space-3);
  background: var(--rs-bg); color: var(--rs-ink);
  border: 1px solid var(--rs-line-strong); border-radius: var(--rs-radius-sm);
  font: inherit;
}
/* Visible required marker; `required` is already exposed to AT. */
.rs-field:has(:required) > span::after {
  content: " *"; content: " *" / ""; color: var(--rs-warning);
}
.rs-field-error { color: var(--rs-danger); font-size: var(--rs-text-sm); }

.rs-table { width: 100%; border-collapse: collapse; font-size: var(--rs-text-sm); }
.rs-table th { text-align: left; color: var(--rs-muted); font-weight: 500;
  border-bottom: 1px solid var(--rs-line); padding: var(--rs-space-2) var(--rs-space-3); }
.rs-table td { border-bottom: 1px solid var(--rs-line); padding: var(--rs-space-2) var(--rs-space-3); }
.rs-table-wrap { overflow-x: auto; }  /* tables scroll, pages never do */

.rs-empty {
  color: var(--rs-muted); padding: var(--rs-space-5);
  border: 1px dashed var(--rs-line); border-radius: var(--rs-radius-md);
  text-align: center;
}
.rs-empty strong { color: var(--rs-ink); display: block; margin-bottom: var(--rs-space-1); }

.rs-banner {
  padding: var(--rs-space-3) var(--rs-space-4); border-radius: var(--rs-radius-sm);
  border: 1px solid var(--rs-line); background: var(--rs-surface-2);
  font-size: var(--rs-text-sm);
}
.rs-banner-danger { border-color: var(--rs-danger); }

.rs-tabs { display: flex; gap: var(--rs-space-4); border-bottom: 1px solid var(--rs-line);
  margin: var(--rs-space-4) 0; flex-wrap: wrap; }
.rs-tabs a { color: var(--rs-muted);
  display: inline-flex; align-items: center;
  min-height: var(--rs-target-min); padding: var(--rs-space-2);
  border-bottom: 2px solid transparent; }
.rs-tabs a:hover { color: var(--rs-ink); text-decoration: none; }
.rs-tabs a[aria-current="page"] { color: var(--rs-ink); border-bottom-color: var(--rs-accent); }

/* ---- Athena layer: ambient intelligence, never a chatbot (spec §9) ---- */
.rs-layout-with-rail { display: grid; grid-template-columns: 1fr; gap: var(--rs-space-5); }
@media (min-width: 1024px) {
  .rs-layout-with-rail:has(.rs-athena-rail) { grid-template-columns: 1fr 320px; }
}
.rs-athena-rail { border-left: 2px solid var(--rs-intel); padding-left: var(--rs-space-4); }
.rs-athena-rail h2 { color: var(--rs-intel); font-size: var(--rs-text-sm);
  text-transform: uppercase; letter-spacing: .06em; }
.rs-suggestion {
  display: inline-flex; align-items: center; gap: var(--rs-space-1);
  padding: 1px var(--rs-space-2); border: 1px solid var(--rs-intel);
  border-radius: var(--rs-radius-full); color: var(--rs-intel);
  font-size: var(--rs-text-xs);
}
/* Athena's evidentiary receipt: the record — or its absence — that raised the
   question. Transparency over black-box AI, rendered under every prompt. */
.rs-athena-basis {
  display: block; margin-top: var(--rs-space-1);
  padding-left: var(--rs-space-2); border-left: 2px solid var(--rs-line);
  color: var(--rs-muted); font-size: var(--rs-text-xs);
  font-style: italic;
}

/* ---- brand emblem / lockup / theme toggle ---- */
.rs-emblem {
  position: relative; display: inline-grid; place-items: center; flex: none;
  background: var(--rs-chrome); border-radius: 24%;
  /* Visible edge that does not rely on the faint inset highlight: the navy
     tile (--rs-chrome) sits ~1.1:1 on the dark page, so it needs a real
     border to read. --rs-line-strong clears ~3:1 against the tile in both themes. */
  border: 1px solid var(--rs-line-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
/* The mark is drawn tight to its bounds; 82% of the tile reads balanced. */
.rs-emblem__img { display: block; width: 82%; height: 82%; }
.rs-emblem--sm { width: 30px; height: 30px; }
.rs-emblem--md { width: 38px; height: 38px; }
.rs-emblem--lg { width: 52px; height: 52px; }
.rs-emblem--xl { width: 64px; height: 64px; }

/* Sparingly-used breathing glow. prefers-reduced-motion freezes it globally. */
.rs-emblem--breathe::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: radial-gradient(closest-side, rgba(211, 59, 58, .55), rgba(211, 59, 58, 0) 72%);
  animation: rs-breathe 3.8s var(--rs-ease) infinite;
}
@keyframes rs-breathe {
  0%, 100% { opacity: .35; transform: scale(1); }
  50%      { opacity: .85; transform: scale(1.18); }
}

.rs-lockup { display: flex; align-items: center; gap: var(--rs-space-3); }
.rs-lockup__txt { display: flex; flex-direction: column; line-height: 1.15; }
.rs-lockup__name {
  font-family: var(--rs-font-brand); font-weight: 700; color: var(--rs-ink);
}
.rs-lockup__desc {
  font-family: var(--rs-font-brand); text-transform: uppercase;
  letter-spacing: .16em; color: var(--rs-muted);
}
.rs-lockup--sm .rs-lockup__name { font-size: .92rem; }
.rs-lockup--sm .rs-lockup__desc { font-size: .54rem; }
.rs-lockup--md .rs-lockup__name { font-size: 1.06rem; }
.rs-lockup--md .rs-lockup__desc { font-size: .6rem; }
.rs-lockup--lg .rs-lockup__name { font-size: 1.4rem; }
.rs-lockup--lg .rs-lockup__desc { font-size: .66rem; }

.rs-theme-toggle {
  min-height: var(--rs-target-min);
  display: inline-flex; align-items: center; gap: var(--rs-space-2);
  padding: var(--rs-space-2) var(--rs-space-3);
  background: var(--rs-surface); color: var(--rs-ink);
  border: 1px solid var(--rs-line-strong); border-radius: var(--rs-radius-full);
  cursor: pointer; font: 500 var(--rs-text-sm) var(--rs-font-brand);
  transition: border-color var(--rs-dur-fast) var(--rs-ease);
}
.rs-theme-toggle:hover { border-color: var(--rs-accent); }
.rs-theme-toggle__icon { display: inline-flex; align-items: center; line-height: 1; }

/* ---- parent brand (three placements only — spec §11) ---- */
.rs-parent-brand { color: var(--rs-muted); font-size: var(--rs-text-xs); }
.rs-parent-brand strong { color: var(--rs-ink); font-weight: 600; }
