/* Dark research-lab presentation. Layout primitives remain in styles.css. */
:root {
  color-scheme: dark;
  --bg: #111820;
  --bg-soft: #1b2734;
  --surface: #151e28;
  --surface-strong: #151e28;
  --surface-muted: #1b2734;
  --border: #314151;
  --border-strong: #506378;
  --text: #e8edf3;
  --muted: #abb9c7;
  --muted-strong: #c6d1dc;
  --accent: #a5c6e8;
  --accent-deep: #c6ddf3;
  --gold: #a5c6e8;
  --teal: #8ac4ca;
  --blue: #a5c6e8;
  --shadow: none;
  --radius-xl: 4px;
  --radius-lg: 4px;
  --radius-md: 3px;
  --site-width: min(1180px, calc(100% - 3rem));
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body { background: var(--bg); font-family: var(--font-sans); font-size: 15px; line-height: 1.65; }
a { text-underline-offset: 4px; }
:focus-visible { outline: 3px solid #a5c6e8; outline-offset: 4px; }
::selection { background: #34516e; color: #fff; }
h1, h2, h3, .homepage-shell h2, .homepage-shell h3, .hero-page h1,
.homepage-shell .hero-copy h1, .about-hero h1, .about-panel h2 {
  font-family: var(--font-sans); font-weight: 600; line-height: 1.22; letter-spacing: -0.035em;
}
h1 { font-size: clamp(2.4rem, 4.8vw, 4rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
h3 { font-size: 1.1rem; line-height: 1.4; letter-spacing: -0.015em; }
.homepage-shell .hero-copy, .homepage-shell .section-copy, .homepage-shell .feature-card p,
.homepage-shell .taxonomy-card p, .homepage-shell .preview-row p, .homepage-shell .compact-item p,
.homepage-shell .intel-stat p, .homepage-shell .home-abstract-panel p,
.hero-page .hero-copy, .hero-page .hero-panel p, .hero-page .bullet-list { font-family: var(--font-sans); }
.site-header { position: relative; background: #151e28; backdrop-filter: none; border-top: 4px solid var(--accent); border-bottom: 1px solid var(--border); }
.site-header-inner { min-height: 100px; padding: 1.3rem 0; }
.brand-mark { width: 46px; height: 46px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--accent); border-radius: 2px; color: var(--accent); background: transparent; box-shadow: none; font-size: 17px; font-weight: 700; letter-spacing: -1px; }
.brand-mark span { color: #a0b4c8; padding: 0 2px; }
.brand-copy { gap: .5rem; }
.brand-copy strong { font-size: 1rem; letter-spacing: -.025em; }
.brand-copy span { font-size: .72rem; letter-spacing: .025em; }
.site-nav-link { border-radius: 0; padding: .6rem .8rem; font-size: .88rem; }
.site-nav-link:hover, .site-nav-link.is-active { background: transparent; color: var(--accent); border-color: transparent; border-bottom-color: var(--accent); }
.site-nav-caret { color: var(--muted); }
.site-subnav { top: 100%; border-radius: 3px; background: #151e28; border-color: var(--border); box-shadow: 0 8px 22px #00000030; }
.site-subnav-link { border-radius: 2px; }
.site-subnav-link:hover, .site-subnav-link.is-active { color: var(--accent); background: var(--bg-soft); }
.page-shell { padding-top: 2.6rem; }
.hero, .section-block, .stack-card, .control-panel, .message, .summary-card, .paper-card,
.content-card, .post-card, .article-card, .table-panel, .trend-stage,
.homepage-shell .hero-panel, .homepage-shell .stack-card, .homepage-shell .section-block,
.about-shell .hero, .about-shell .stack-card {
  background: #151e28; border-color: var(--border); border-radius: 4px; box-shadow: none;
}
.hero::after, .about-hero::after { display: none; }
.hero-page, .homepage-shell .hero-home, .about-shell .about-hero { padding: 1.4rem 0 2.8rem; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 2rem; background: transparent; }
.homepage-shell .hero-copy h1 { font-size: clamp(2.5rem, 4.8vw, 4rem); line-height: 1.12; white-space: normal; max-width: 25ch; }
.homepage-shell .hero-copy .lede { max-width: 65ch; font-size: 1.08rem; }
.home-purpose { max-width: 70ch; margin: .9rem 0 0; color: var(--muted); font-size: .95rem; }
.homepage-shell .hero-actions { margin-top: 1.7rem; }
.hero-page h1 { font-size: clamp(2.1rem, 3.8vw, 3.2rem); max-width: 26ch; }
.eyebrow, .panel-eyebrow, .control-heading, .card-tag, .feature-eyebrow, .insight-heading, .trend-card-label { color: var(--accent); font-size: .68rem; font-weight: 700; letter-spacing: .13em; }
.button-primary, .button-secondary, button { min-height: 44px; border-radius: 3px; padding: .7rem 1.05rem; font-size: .86rem; font-weight: 600; gap: .7rem; box-shadow: none; }
.button-primary, button { background: var(--accent); color: #111820; border: 1px solid var(--accent); }
.button-primary:hover, button:hover { background: var(--accent-deep); transform: none; }
.button-secondary { border-color: var(--border-strong); color: var(--muted-strong); background: #151e28; }
.button-secondary:hover { background: var(--bg-soft); transform: none; }
button:disabled { cursor: wait; opacity: .65; }
.hero-panel, .control-card, .insight-card, .library-group-card, .feature-card, .taxonomy-card,
.library-bucket-card, .paper-section, .trend-card, .flow-diagram, .flow-step,
.about-detail-card, .about-education-item, .about-credential-item, .about-focus-item {
  background: var(--bg-soft); border-color: var(--border); border-radius: 3px; box-shadow: none;
}
.feature-card:hover, .taxonomy-card:hover, .content-card:hover, .post-card:hover,
.library-bucket-card:hover, .trend-card-link:hover {
  background: #223344; border-color: var(--border-strong); box-shadow: none; transform: none;
}
.library-bucket-card:hover .card-tag, .library-bucket-card:hover h3,
.trend-card-link:hover .trend-card-label, .trend-card-link:hover h3 { color: var(--accent-deep); }
.homepage-shell .section-preview-split { padding: 0; border: 0; gap: 2.5rem; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); background: transparent; }
.homepage-shell .section-preview-split > .stack-card { border: 0; border-radius: 0; padding: 0; background: transparent; }
.homepage-shell .section-preview-split > .stack-card-intel { border-left: 1px solid var(--border); padding-left: 2rem; }
.homepage-shell .section-heading { display: block; }
.homepage-shell h2 { font-size: 1.45rem; }
.homepage-shell h3 { font-size: 1.08rem; line-height: 1.45; }
.homepage-shell .section-heading .inline-link { margin-top: .7rem; }
.preview-row { padding: 1.4rem 0; border-color: var(--border); }
.preview-row p { margin: .55rem 0; }
.preview-row .item-meta { font-family: var(--font-sans); font-size: .75rem; letter-spacing: .02em; }
.inline-link-button, .paper-link, .about-link-pill { border-radius: 2px; background: transparent; color: var(--accent); border-color: var(--border); box-shadow: none; font-size: .85rem; }
.inline-link-button:hover, .paper-link:hover, .about-link-pill:hover { color: var(--accent-deep); background: var(--bg-soft); border-color: var(--border-strong); transform: none; }
.homepage-shell .inline-link-button { border: 0; padding: 0; min-height: 28px; text-decoration: underline; }
.intel-visual { background: var(--bg-soft); border-color: var(--border); box-shadow: none; border-radius: 2px; }
.intel-band { border-radius: 2px 2px 0 0; box-shadow: none; }
.intel-band-high, .trend-line-fill-high { background: #a5c6e8; }
.intel-band-mid, .trend-line-fill-mid { background: #6286a9; }
.intel-band-low, .trend-line-fill-low { background: #46637c; }
.intel-stat, .credibility-strip, .compact-item-inline { border-color: var(--border); }
.intel-label, .flow-caption, .flow-step-meta, .about-detail-label { color: var(--muted); }
.intel-stat { background: #151e28; border-radius: 2px; }
input, select { background: #151e28; border-color: var(--border-strong); border-radius: 3px; padding: .7rem .8rem; }
.pill, .mini-pill, .topic-link-pill, .about-focus-item { border-radius: 3px; background: #1b2938; border-color: var(--border); color: var(--muted-strong); box-shadow: none; }
.topic-link-pill:hover { background: #24384c; border-color: var(--border-strong); box-shadow: none; transform: none; }
.pill-category, .coverage-count-low { background: #1d3337; color: #a3d3d4; }
.pill-type, .coverage-count-mid { background: #263244; color: #b9cce4; }
.pill-source, .coverage-count-high { background: #25394d; color: #a5c6e8; }
.coverage-table-shell, .feed-table-shell { background: #151e28; border-color: var(--border); border-radius: 3px; overflow-x: auto; }
.coverage-table th, .feed-table th { background: var(--bg-soft); border-color: var(--border); font-size: .7rem; }
.coverage-table td, .feed-table td { border-color: var(--border); }
.coverage-row:hover { background: var(--bg-soft); }
.trend-line-track, .trend-card-link:hover .trend-line-track { background: #2c3e50; border-color: transparent; }
.trend-line-node { border-color: var(--surface); box-shadow: none; }
.paper-card, .paper-header > div, .paper-body > div { min-width: 0; overflow-wrap: anywhere; }
.results, .content-stack { grid-template-columns: minmax(0, 1fr); }
.post-link, .flow-step-num { color: var(--accent); }
.flow-step-num { background: #24384c; border-radius: 3px; }
.message-subtle { background: var(--bg-soft); }
.message-error { background: #36271f; border-color: #a47b5f; }
.research-access { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-top: 2.5rem; padding: 2rem; border-top: 2px solid var(--accent); background: var(--bg-soft); }
.research-access p:last-child { margin-bottom: 0; max-width: 60ch; color: var(--muted); }
.research-access .button-primary { flex-shrink: 0; }
.site-footer { background: var(--bg-soft); border-color: var(--border); }
.site-footer-inner { padding: 2.5rem 0; }
.footer-title { color: var(--text); text-transform: none; letter-spacing: -.02em; font-size: .95rem; }
.footer-copy { font-size: .85rem; }
.footer-meta a { color: var(--accent); font-size: .83rem; }
.skip-link { position: absolute; top: -80px; left: 1rem; z-index: 100; padding: .7rem 1rem; background: var(--surface); color: var(--accent); }
.skip-link:focus { top: 1rem; }
.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; }

/* Public API guide */
.api-intro { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 4rem; padding: 1.4rem 0 3rem; border-bottom: 1px solid var(--border); }
.api-intro h1 { max-width: none; font-size: clamp(2.4rem, 4.4vw, 3.65rem); line-height: 1.14; }
.api-intro .lede { max-width: 62ch; font-size: 1rem; }
.api-facts { align-self: center; border-top: 2px solid var(--accent); background: var(--bg-soft); padding: 1.3rem 1.5rem; }
.api-facts dl { margin: .4rem 0 1rem; font-size: .83rem; }
.api-facts dl div { display: flex; justify-content: space-between; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.api-facts dt { color: var(--muted); }
.api-facts dd { margin: 0; text-align: right; font-weight: 500; }
.api-facts a { font-size: .78rem; color: var(--accent); }
.guide-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 4rem; padding-top: 3rem; }
.guide-nav { align-self: start; position: sticky; top: 2rem; display: grid; gap: .1rem; }
.guide-nav a { display: flex; gap: .8rem; padding: .55rem 0; font-size: .83rem; text-decoration: none; color: var(--muted-strong); }
.guide-nav a:hover { color: var(--accent); text-decoration: underline; }
.guide-nav a span { color: #9badbf; font-size: .72rem; padding-top: .1rem; }
.guide-content { min-width: 0; max-width: 830px; }
.guide-section { scroll-margin-top: 2rem; padding-bottom: 2.8rem; margin-bottom: 2.8rem; border-bottom: 1px solid var(--border); }
.guide-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.guide-section h2 { font-size: 1.8rem; margin-bottom: 1rem; }
.guide-section h3 { margin-top: 1.8rem; }
.guide-section p, .guide-errors { color: var(--muted-strong); }
.guide-section a { color: var(--accent); }
.code-example { margin: 1.4rem 0; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.code-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #223040; border-bottom: 1px solid var(--border); padding: .55rem 1.1rem; font-size: .73rem; color: var(--muted); }
.copy-code { min-height: 32px; background: transparent; border: 1px solid #506378; color: var(--accent); padding: .2rem .65rem; font-size: .73rem; }
.copy-code:hover { color: #111820; }
pre { tab-size: 4; }
.code-example pre, .api-response { margin: 0; padding: 1.35rem; overflow-x: auto; background: #101923; color: #c1d4e8; line-height: 1.8; font-size: .82rem; }
.guide-note { padding: 1rem 1.25rem; border-left: 3px solid #7198ba; background: #1b2734; color: var(--muted-strong); font-size: .88rem; }
.endpoint-list { margin: 1.4rem 0; }
.endpoint-list > div { display: flex; align-items: baseline; gap: 1.2rem; border-top: 1px solid var(--border); padding: 1.1rem 0; }
.endpoint-list p { margin: .35rem 0 0; font-size: .88rem; }
.endpoint-list code { overflow-wrap: anywhere; }
.http-method { font-family: monospace; font-weight: 700; font-size: .73rem; color: var(--accent); background: #25394d; padding: .18rem .45rem; border-radius: 2px; }
.guide-table-scroll { overflow-x: auto; margin-top: .9rem; }
.guide-table { width: 100%; border-collapse: collapse; font-size: .86rem; text-align: left; }
.guide-table th, .guide-table td { padding: .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.guide-table thead { background: var(--bg-soft); }
.guide-table tbody th { font-weight: 400; width: 35%; }
.guide-table td { color: var(--muted-strong); }
.api-explorer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .85rem; align-items: end; margin: 1.4rem 0 0; }
.api-explorer label { font-size: .8rem; }
.api-explorer input, .api-explorer select { height: 44px; font-size: .85rem; }
.explorer-status { font-size: .8rem; min-height: 1.5em; }
.request-url { display: block; background: #223040; padding: .7rem 1.1rem; border: 1px solid var(--border); overflow-wrap: anywhere; font-size: .8rem; }
.api-response { border: 1px solid var(--border); border-top: 0; max-height: 420px; min-height: 120px; }
.guide-errors { padding-left: 1.2rem; }
.guide-errors li { margin-bottom: .55rem; }

@media (max-width: 1000px) {
  .api-intro { gap: 2rem; grid-template-columns: minmax(0, 1fr) 275px; }
  .guide-layout { gap: 2rem; grid-template-columns: 180px minmax(0, 1fr); }
  .api-explorer { grid-template-columns: 1fr 1fr; }
  .api-explorer button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 760px) {
  :root { --site-width: calc(100% - 2rem); }
  .site-header-inner { gap: 1rem; min-height: 0; }
  .site-nav { gap: .05rem; }
  .site-nav-link { padding: .5rem .6rem; font-size: .82rem; }
  .page-shell { padding-top: 1.4rem; }
  .hero-page, .homepage-shell .hero-home { padding: 1rem 0 2rem; }
  .homepage-shell .hero-copy h1 { font-size: clamp(2.2rem, 7.5vw, 3rem); }
  .homepage-shell .section-preview-split { grid-template-columns: 1fr; gap: 2rem; }
  .homepage-shell .section-preview-split > .stack-card-intel { border-left: 0; border-top: 1px solid var(--border); padding: 1.6rem 0 0; }
  .api-intro { grid-template-columns: 1fr; gap: 2rem; padding-top: 1rem; }
  .api-facts { max-width: none; }
  .guide-layout { grid-template-columns: 1fr; gap: 2rem; padding-top: 1.8rem; }
  .guide-nav { position: static; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
  .guide-nav > p { grid-column: 1 / -1; }
  .guide-nav a { font-size: .77rem; gap: .5rem; }
  .guide-section h2 { font-size: 1.5rem; }
  .api-explorer { grid-template-columns: 1fr; }
  .api-explorer button { justify-self: stretch; }
  .guide-table { min-width: 480px; }
  .research-access { flex-direction: column; align-items: start; padding: 1.4rem; }
  .hero-actions { gap: .6rem; }
  .footer-meta { align-items: start; }
  .area-filter-controls, .area-export-panel { grid-template-columns: 1fr; }
  .paper-header, .paper-body { grid-template-columns: minmax(0, 1fr); }
  .controls { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Library is the homepage's primary destination. */
.homepage-shell .library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 3rem;
  padding-bottom: 3rem;
}
.library-hero .hero-copy, .library-topics { min-width: 0; }
.homepage-shell .library-hero h1 { max-width: 12ch; font-size: clamp(2.8rem, 5vw, 4.5rem); }
.homepage-shell .library-hero .hero-actions { align-items: center; gap: 1.3rem; }
.library-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.library-topic {
  display: flex; flex-direction: column; gap: .7rem; padding: 1.15rem;
  border: 1px solid var(--border); border-radius: 3px; background: var(--surface);
  color: var(--text); text-decoration: none;
}
.library-topic > span { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; line-height: 1.4; }
.library-topic > span > span { flex-shrink: 0; color: var(--accent); }
.library-topic small { color: var(--muted); font-size: .8rem; line-height: 1.6; }
.library-topic:hover { background: var(--bg-soft); border-color: var(--accent); }

/* Keep long API strings inside the response pane at every viewport width. */
.api-guide, .api-guide .api-section, .api-guide .controls, .api-guide .field { min-width: 0; }
.api-guide pre, .api-response {
  box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal;
  overflow: auto; background: #101923; color: #c1d4e8;
  border: 1px solid var(--border); border-radius: 3px;
  font-size: .82rem; line-height: 1.7;
}
.api-guide pre code { white-space: inherit; overflow-wrap: inherit; }
.api-guide #api-result, .api-response { max-height: min(28rem, 60vh); overscroll-behavior: contain; }
@media (max-width: 900px) {
  .homepage-shell .library-hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .homepage-shell .library-hero h1 { max-width: none; }
}
@media (max-width: 420px) {
  .library-topic { padding: .9rem; }
  .library-topic > span { font-size: .9rem; }
}
