/* StratRadar research shell — design tokens and component-neutral base rules.
 *
 * Owner: ux_revamp_spec_astra.md section 4 (tokens, verbatim) and section 2.2 (shell
 * geometry). This file is the ONE shared stylesheet for the rebuilt shell; route-specific
 * CSS may only add geometry for that route's own content, never new typography or colors.
 * Served by api.py at /assets/research.css the same way logo.svg is served at /logo.svg.
 */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --bg: #f7f8fa; --surface: #ffffff; --surface-subtle: #eef2f6;
  --text: #182230; --muted: #526173; --border: #d4dce5;
  --link: #174ea6; --link-hover: #103a7c; --selected: #e8effa;
  --positive: #19643c; --positive-bg: #edf6ef;
  --negative: #a32936; --negative-bg: #fceff0;
  --caution: #795300; --caution-bg: #fff6df;
  --focus: #174ea6;
  --text-xs: .8125rem; --text-sm: .875rem; --text-base: 1rem;
  --text-lead: 1.125rem; --text-h3: 1.25rem;
  --text-h2: 1.5rem; --text-h1: 2rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px;
  --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --space-7: 48px; --space-8: 64px;
  --radius: 8px; --radius-small: 4px;
}
html { font-size: 16px; }
body { font-family: var(--font-sans); font-size: var(--text-base);
  line-height: 1.65; color: var(--text); background: var(--bg); }
h1 { font-size: var(--text-h1); line-height: 1.2; font-weight: 650; }
h2 { font-size: var(--text-h2); line-height: 1.3; font-weight: 650; }
h3 { font-size: var(--text-h3); line-height: 1.4; font-weight: 600; }
.lede { font-size: var(--text-lead); line-height: 1.6; max-width: 68ch; }
.prose { max-width: 68ch; overflow-wrap: anywhere; }
.meta { font-size: var(--text-sm); line-height: 1.5; color: var(--muted); }
.number { font-variant-numeric: tabular-nums; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[id] { scroll-margin-top: 24px; }
@media (max-width: 767px) { h1 { font-size: 1.75rem; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---- box model & general prose rhythm (spec section 4, paragraph 2) ---- */
*, *::before, *::after { box-sizing: border-box; }
img, svg, table, pre { max-width: 100%; }
pre { overflow-x: auto; }
main { display: block; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
h1 { margin: 0 0 12px; }
h2 { margin: 40px 0 16px; }
h3 { margin: 24px 0 12px; }
.lede { margin: 0 0 16px; font-weight: 400; }
blockquote { font-weight: 400; font-style: normal; margin: 0; }
code, pre { font-family: var(--font-mono); }

/* table type scale: cells/summaries 15px/1.55, headers 14px/1.4 semibold, meta 14px */
table { font-size: .9375rem; line-height: 1.55; }
th { font-size: .875rem; line-height: 1.4; font-weight: 600; text-transform: none; }
.field-label { font-size: var(--text-xs); }

/* ---- links ---- */
.prose a, .sr-prose a { text-decoration: underline; }
a.nav-link, a.card-title, .sr-cardtitle { text-decoration: none; }
a.nav-link:hover, a.nav-link:focus-visible,
a.card-title:hover, a.card-title:focus-visible,
.sr-cardtitle:hover, .sr-cardtitle:focus-visible { text-decoration: underline; }

/* ---- surface cards ---- */
.card, .sr-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: none;
}
@media (max-width: 767px) { .card, .sr-card { padding: 16px; } }

/* ---- tables ---- */
table.sr-table { width: 100%; background: var(--surface); border-collapse: collapse; }
table.sr-table th, table.sr-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top;
  text-align: left;
}
table.sr-table th { text-transform: none; }
table.sr-table td.number, table.sr-table th.number { text-align: right; }
table.sr-table tr { height: auto; }

/* ---- forms: inputs, buttons, selects ---- */
input, select, textarea, button {
  font: inherit; font-size: 1rem; min-height: 44px; padding: 10px 12px;
  border-radius: var(--radius-small); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
label { display: block; font-size: var(--text-sm); margin-bottom: 4px; }
button, .btn { cursor: pointer; font-weight: 600; }
.btn-primary, button[type="submit"] {
  background: var(--link); color: #fff; border-color: var(--link);
}
.btn-primary:hover, button[type="submit"]:hover { background: var(--link-hover); }
.btn-secondary { background: var(--surface); color: var(--link); border: 1px solid var(--link); }
.btn-destructive { background: transparent; color: var(--negative); border-color: var(--negative); }
a.hit-inline { display: inline-block; min-height: 24px; }
[role="alert"] { color: var(--negative); font-size: var(--text-sm); }
[role="status"] { color: var(--positive); font-size: var(--text-sm); }

/* ---- shell: skip link ---- */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
  background: var(--text); color: #fff; padding: 10px 16px; z-index: 1000;
  border-radius: 0 0 6px 0; font-size: var(--text-sm); font-weight: 600;
}
.skip-link:focus { left: 0; top: 0; width: auto; height: auto; overflow: visible; }

/* ---- shell: layout shared by all page families ---- */
.shell { min-height: 100vh; }
.shell-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 216px; padding: 24px;
  overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.shell-sidebar .sidebar-brand,
.shell-compactbar .sidebar-brand {
  margin-bottom: 16px; padding: 4px 2px; border-left: none; display: flex;
}
.shell-sidebar .sidebar-brand:hover,
.shell-compactbar .sidebar-brand:hover { background: none; }
.shell-sidebar a {
  display: block; padding: 8px 10px; border-radius: var(--radius-small);
  color: var(--text); text-decoration: none; font-size: var(--text-sm);
  border-left: 3px solid transparent;
}
.shell-sidebar a:hover { background: var(--surface-subtle); }
.shell-sidebar a[aria-current] {
  background: var(--selected); font-weight: 650; border-left-color: var(--link);
}
.shell-sidebar .navgroup {
  font-size: var(--text-xs); color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 650; margin: 16px 0 2px; padding: 0 10px;
}
.shell-sidebar .navgroup:first-of-type { margin-top: 8px; }
.shell-utilities { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.shell-compactbar {
  display: none; align-items: center; gap: var(--space-5); height: 64px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.shell-compactbar .sidebar-brand { margin-bottom: 0 !important; }
.shell-compactbar details.menu { position: relative; margin-left: auto; }
.shell-compactbar details.menu summary {
  cursor: pointer; list-style: none; font-size: var(--text-sm); font-weight: 600;
  padding: 8px 10px; border-radius: var(--radius-small);
}
.shell-compactbar details.menu summary::-webkit-details-marker { display: none; }
.shell-compactbar details.menu[open] .menu-panel {
  display: flex; flex-direction: column; gap: 2px; padding: 12px; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.shell-compactbar details.menu .menu-panel a {
  padding: 8px 10px; border-radius: var(--radius-small); text-decoration: none; color: var(--text);
}
.shell-compactbar details.menu .menu-panel a[aria-current] {
  background: var(--selected); font-weight: 650;
}
.shell-compactbar details.menu .menu-panel .navgroup {
  font-size: var(--text-xs); color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 650; margin: 10px 0 2px; padding: 0 10px;
}

.shell-main-wrap { margin-left: 216px; padding: 40px 40px 64px; max-width: 1160px; }
.shell-content-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.shell-content-grid.has-rail { grid-template-columns: minmax(0, 1fr) 176px; }
.shell-rail { position: sticky; top: 32px; align-self: start; font-size: var(--text-sm); }
.shell-rail-heading {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 650; margin: 0 0 8px;
}
.shell-rail ul { list-style: none; margin: 0; padding: 0; }
.shell-rail li { margin: 0 0 6px; }
.shell-toc-disclosure { display: none; }

@media (max-width: 1119px) {
  .shell-sidebar { display: none; }
  .shell-compactbar { display: flex; flex-wrap: wrap; height: auto; min-height: 64px; padding: 12px 24px; }
  .shell-main-wrap { margin-left: 0; padding: 32px 24px 48px; }
  .shell-content-grid.has-rail { grid-template-columns: minmax(0, 1fr); }
  .shell-rail { display: none; }
  .shell-toc-disclosure { display: block; margin: 0 0 24px; }
  .shell-toc-disclosure summary { cursor: pointer; font-weight: 600; color: var(--link); }
}
@media (max-width: 767px) {
  .shell-main-wrap { padding: 24px 16px 40px; }
  .shell-compactbar { padding: 12px 16px; }
  form.sr-form { display: flex; flex-direction: column; }
}

/* breadcrumb */
nav.crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 16px; padding: 0; }
nav.crumb ol { font-size: var(--text-sm); color: var(--muted); }
nav.crumb li { display: flex; align-items: center; }
nav.crumb li + li::before { content: "/"; margin: 0 7px; color: var(--border); }
nav.crumb a { color: var(--muted); text-decoration: none; }
nav.crumb a:hover { color: var(--link); text-decoration: underline; }

/* shared footer */
.shell-footer {
  margin-top: 64px; padding: 24px 0; border-top: 1px solid var(--border);
  font-size: var(--text-sm); color: var(--muted); display: flex; gap: 24px; flex-wrap: wrap;
}
.shell-footer a { color: var(--muted); }
.shell-footer a:hover { color: var(--link); }

/* public compact header (landing/sign-in) */
.shell-publicbar {
  display: flex; align-items: center; justify-content: space-between; height: 64px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.shell-public-wrap { max-width: 1160px; margin: 0 auto; padding: 40px 24px 64px; }

/* :target orientation for evidence wrappers, used across pages */
[id]:target { outline: 2px solid var(--focus); outline-offset: 3px; background: var(--selected); }

/* visually-hidden but still in the accessibility tree (e.g. "No summary available" beside
 * a plain em dash in a roster/theme Finding cell) */
.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;
}

/* ==========================================================================================
 * Stage 3 components (ux_revamp_spec_astra.md section 5.1-5.7). Geometry only — every color
 * and type-scale token used below is already defined above.
 * ========================================================================================== */

/* ---- 5.1 company card ---- */
.company-card { display: flex; flex-direction: column; gap: 8px; }
.company-card-identity { margin: 0; }
.company-card-summary { margin: 0; font-size: var(--text-sm); line-height: 1.55; }
.company-card-coverage { margin: 0; }

/* ---- 5.2/5.5 data table: real inline mobile field labels, not CSS-generated content ---- */
.cell-label { display: none; }
table.stack-table td { vertical-align: top; }
@media (max-width: 767px) {
  table.stack-table, table.stack-table thead, table.stack-table tbody,
  table.stack-table tr, table.stack-table th, table.stack-table td { display: block; }
  table.stack-table thead { position: absolute; left: -9999px; top: -9999px; }
  table.stack-table tr {
    border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px;
    padding: 8px 16px;
  }
  table.stack-table td { border-bottom: none; padding: 6px 0; }
  table.stack-table .cell-label {
    display: block; font-size: var(--text-xs); color: var(--muted); font-weight: 600;
  }
}

.kn-table td.number, .kn-table .cell-value.number { text-align: right; }
details.kn-more summary, details.timeline-more summary, details.theme-more summary,
details.theme-analysis summary, details.section-sources summary {
  cursor: pointer; font-weight: 600; color: var(--link);
}
details.kn-more { margin-top: 16px; }

/* ---- 5.4 timeline ---- */
ul.timeline { list-style: none; margin: 0; padding: 0; }
ul.timeline .timeline-item {
  position: relative; padding: 0 0 24px 20px; border-left: 1px solid var(--border);
}
ul.timeline .timeline-item:last-child { border-left-color: transparent; }
ul.timeline .timeline-item::before {
  content: ""; position: absolute; left: -4.5px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--muted);
}
.timeline-period { font-size: var(--text-sm); font-weight: 650; margin: 0 0 2px; }
.timeline-finding { font-size: 1rem; margin: 0; }
details.timeline-more ul.timeline { margin-top: 16px; }

/* ---- 5.5 roster ---- */
.roster-table .meta { font-size: var(--text-xs); }

/* ---- 5.6 theme card / section ---- */
.theme-card-meta { margin: 0; }
.theme-card-summary { margin: 8px 0; font-size: var(--text-sm); line-height: 1.55; }
.theme-card-companies { margin: 0 0 8px; font-size: var(--text-sm); }
.theme-section { margin: 0 0 var(--space-6); }
.theme-section-summary { max-width: 68ch; }
ul.theme-points { list-style: none; margin: 0 0 16px; padding: 0; }
.theme-point { padding: 0 0 16px; border-bottom: 1px solid var(--border); margin: 0 0 16px; }
.theme-point:last-child { border-bottom: none; }
.theme-point-text { margin: 0 0 4px; }
.theme-point-companies { margin: 0; font-size: var(--text-sm); color: var(--muted); }
details.theme-analysis p { max-width: 68ch; margin: 0 0 16px; }
.theme-section-roster { font-size: var(--text-sm); }

/* ---- 5.7 relationship row ---- */
.rel-row { padding: 16px 0; border-bottom: 1px solid var(--border); }
.rel-row:last-child { border-bottom: none; }
.rel-line1 { margin: 0 0 6px; font-weight: 600; }
.rel-label { font-weight: 400; color: var(--muted); }
.rel-summary { margin: 0 0 6px; max-width: 68ch; }
.rel-meta { margin: 0; }

/* ==========================================================================================
 * Stage 4C (ux_revamp_spec_astra.md 9.1-9.3): themes/sectors page composition. Geometry only.
 * ========================================================================================== */
.note { background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; }
.sr-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin: 0 0 24px; }
.sr-form > div { display: flex; flex-direction: column; }
.sr-form button { align-self: flex-end; }
nav.contents { margin: 0 0 24px; }
nav.contents ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
nav.contents li { font-size: var(--text-sm); margin: 0 0 4px; break-inside: avoid; }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 24px 0; }
.pagination a, .pagination span { padding: 4px 8px; }
.pagination [aria-current="page"] { font-weight: 650; }
details.market-overview, details.sector-market-overview { margin: 24px 0; }
.theme-share { margin: 8px 0 0; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0 0 24px; }
@media (min-width: 900px) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { nav.contents ul { columns: 1; } }

/* ==========================================================================================
 * Stage 4E (ux_revamp_spec_astra.md section 6): dashboard composition. Geometry only.
 * ========================================================================================== */
.dash-search input { font-size: var(--text-lead); max-width: 32rem; }
.dev-rows { display: flex; flex-direction: column; gap: 16px; margin: 0 0 8px; }
.dev-row { display: flex; flex-direction: column; gap: 4px; }
.dev-row h3 { margin: 0; }
.dev-meta, .dev-count { margin: 0; }
.dev-preview { margin: 4px 0 0; max-width: 68ch; }
.dev-details { margin-top: 8px; }
.dev-details summary { cursor: pointer; font-weight: 600; color: var(--link); }
.dev-subhead { font-weight: 600; margin: 12px 0 4px; }
ul.dev-callouts, .dev-questions ul, .dev-dodges ul { list-style: none; margin: 0; padding: 0; }
.dev-callout { padding: 8px 0; border-bottom: 1px solid var(--border); }
.dev-callout:last-child { border-bottom: none; }
.dev-cat { font-weight: 600; }
.dev-quote { margin: 4px 0 0; padding-left: 12px; border-left: 2px solid var(--border); max-width: 68ch; }
.dev-dodge-quote { margin-top: 4px; }
.dev-empty { margin: 0; }
.oi-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin: 0 0 24px; }
@media (min-width: 900px) { .oi-grid { grid-template-columns: 1fr 1fr; } }
.oi-section h3 { margin-top: 0; }
.fin-context-sector { margin: 16px 0; }
.fin-context-sector h4 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); margin: 20px 0 8px; }
details.guidance-more summary { cursor: pointer; font-weight: 600; color: var(--link); }
details.guidance-more { margin-top: 16px; }
details.guidance-source summary { cursor: pointer; }

/* ==========================================================================================
 * Stage 4D (ux_revamp_spec_astra.md section 10): Compare and Dependencies. Geometry only —
 * `links_pages.py`'s own `LINKS_CSS` is retired in favor of these additions.
 * ========================================================================================== */
.cmp-select-form fieldset { border: none; padding: 0; margin: 0 0 16px; display: flex;
  flex-wrap: wrap; gap: 12px 20px; }
.cmp-select-form legend { font-size: var(--text-sm); font-weight: 650; margin-bottom: 8px;
  width: 100%; }
.cmp-select-form label { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm);
  min-height: auto; }
.cmp-select-form input[type="checkbox"] { min-height: auto; width: auto; }
table.cmp-table { width: 100%; margin: 0 0 32px; }
table.cmp-table th[scope="row"] { font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
.cmp-mobile { display: none; }
.cmp-mobile-company { border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 0 0 16px; }
.cmp-mobile-company h4 { margin: 0 0 8px; }
@media (max-width: 899px) {
  .cmp-desktop { display: none; }
  .cmp-mobile { display: block; }
}
.dep-graph { margin: 24px 0; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; }
.dep-graph summary { cursor: pointer; font-weight: 600; color: var(--link); }
.dep-graph-scroll { overflow-x: auto; margin-top: 12px; }
.dep-graph-svg { min-width: 480px; height: auto; }
.src-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.src-item:last-child { border-bottom: none; }
.src-item-head { margin: 0 0 4px; font-size: var(--text-sm); }
.src-ord { color: var(--muted); }
.quote-body { padding: 8px 0 0; max-width: 68ch; }
.src-unavailable { color: var(--muted); font-style: italic; }

/* ---- print ---- */
@media print {
  .shell-sidebar, .shell-compactbar, .shell-footer, form, .skip-link, .shell-rail,
  .shell-toc-disclosure { display: none !important; }
  .shell-main-wrap { margin: 0; padding: 0; max-width: none; }
  details { display: block !important; }
  details > summary { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}
