/**
 * Technical Resource static site stylesheet.
 * Deliberately minimal and shared across the whole resource. One shared
 * stylesheet, no per-article overrides. Shell stays dark so the CSMBAC logo
 * reads legibly in header and footer.
 */
:root {
  --tr-bg: #0e1116;
  --tr-bg-elevated: #151a22;
  --tr-border: #2a3340;
  --tr-text: #e8ecf1;
  --tr-muted: #9aa7b5;
  --tr-accent: #e8c06a;
  --tr-link: #7fb2e5;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--tr-bg);
  color: var(--tr-text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.6;
}

a { color: var(--tr-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.tr-container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.tr-topbar,
.tr-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--tr-bg-elevated);
  border-bottom: 1px solid var(--tr-border);
}

.tr-site-header .tr-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.tr-brand, .tr-logo {
  font-weight: 700;
  color: var(--tr-text);
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}

.tr-logo__image {
  width: auto;
  height: 2.2em;
  max-width: 120px;
  max-height: 46px;
  vertical-align: middle;
  display: block;
  object-fit: contain;
}

.tr-logo__text { color: var(--tr-text); }

.tr-logo--footer {
  margin-bottom: 10px;
  justify-content: center;
}

.tr-nav { display: flex; gap: 18px; align-items: center; }

.tr-main { max-width: 900px; margin: 0 auto; padding: 24px 20px 48px; }

.tr-home-hero, .tr-hub-hero, .tr-article-hero, .tr-search-hero {
  padding: 32px 0 20px;
}

.tr-kicker {
  color: var(--tr-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.tr-home-hero h1,
.tr-hub-hero h1,
.tr-search-hero h1,
.tr-search-page h1,
.tr-article-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--tr-text);
}

.tr-lede { font-size: 1.1rem; color: var(--tr-muted); max-width: 60ch; }

.tr-intro-note {
  background: var(--tr-bg-elevated);
  border: 1px solid var(--tr-border);
  border-left: 3px solid var(--tr-accent);
  padding: 10px 14px;
  color: var(--tr-muted);
}

.tr-category-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tr-category-card,
.tr-article-card {
  background: var(--tr-bg-elevated);
  border: 1px solid var(--tr-border);
  border-radius: 10px;
  padding: 16px 18px;
}

.tr-category-card h2,
.tr-article-card h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--tr-text);
}

.tr-category-card p, .tr-article-card p { color: var(--tr-muted); margin: 0 0 8px; }

.tr-card-meta { font-size: 0.85rem; color: var(--tr-accent); margin-top: 8px; }

.tr-topic-menu,
.tr-related__list,
.tr-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tr-topic-menu li { margin-bottom: 8px; }

.tr-related {
  margin-top: 40px;
  border-top: 1px solid var(--tr-border);
  padding-top: 20px;
}

.tr-related__item { margin-bottom: 16px; }

.tr-related__link { font-weight: 600; }

.tr-related__summary { color: var(--tr-muted); margin: 4px 0 0; }

.tr-article-hero .tr-lede { font-size: 1.05rem; }

/* Article images: hero + mid-body figure */
.tr-article-figure {
  margin: 20px 0;
  border: 1px solid var(--tr-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--tr-bg-elevated);
}
.tr-article-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.tr-article-figure--mid {
  margin: 28px 0;
}
.tr-article-figure figcaption {
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--tr-muted);
  border-top: 1px solid var(--tr-border);
}

.tr-body { margin-top: 16px; }

.tr-body h2, .tr-body h3 {
  color: var(--tr-text);
  scroll-margin-top: 90px;
}

.tr-body p { color: #d7dee6; }

.tr-toc,
.tr-toc__list { margin: 0; }

.tr-toc {
  background: var(--tr-bg-elevated);
  border: 1px solid var(--tr-border);
  padding: 14px 18px;
  border-radius: 8px;
}

.tr-toc__title { margin: 0 0 8px; font-size: 1rem; color: var(--tr-accent); }

.tr-toc__list { padding: 0; list-style: none; }
.tr-toc__list li { margin-bottom: 4px; }

.tr-next,
.tr-bridge {
  background: var(--tr-bg-elevated);
  border: 1px solid var(--tr-border);
  padding: 16px 18px;
  border-radius: 8px;
  margin-top: 32px;
}

.tr-next h2, .tr-bridge h2 { margin-top: 0; font-size: 1.1rem; }

.tr-breadcrumbs {
  margin: 12px 0 8px;
  color: var(--tr-muted);
  font-size: 0.9rem;
}

.tr-breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.tr-breadcrumbs li + li::before { content: "/"; color: var(--tr-muted); margin-right: 8px; }

/* Buttons */
.tr-btn {
  display: inline-block;
  background: var(--tr-accent);
  color: #14181f;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--tr-accent);
  text-decoration: none;
}
.tr-btn:hover {
  background: #f0cf7e;
  color: #14181f;
  text-decoration: none;
}

/* Search */
.tr-searchbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.tr-input, .tr-select {
  background: var(--tr-bg-elevated);
  color: var(--tr-text);
  border: 1px solid var(--tr-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 1rem;
}
.tr-input { flex: 1 1 360px; }
.tr-results { margin-top: 16px; list-style: none; padding: 0; }
.tr-result { background: var(--tr-bg-elevated); border: 1px solid var(--tr-border); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.tr-result h3 { margin: 0 0 6px; font-size: 1.05rem; }
.tr-result p { margin: 0; color: var(--tr-muted); }
.tr-hint { color: var(--tr-muted); }

/* Exit banner: full-width commercial band above the footer */
.tr-exit-banner {
  background: var(--tr-bg-elevated);
  border-top: 1px solid var(--tr-border);
  border-bottom: 1px solid var(--tr-border);
  padding: 28px 0;
}

.tr-exit-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.tr-exit-banner__title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: var(--tr-text);
}

.tr-exit-banner__body {
  margin: 0;
  color: var(--tr-muted);
  max-width: 62ch;
}

.tr-exit-banner__cta {
  flex: 0 0 auto;
}

.tr-site-footer, .tr-footer {
  border-top: 1px solid var(--tr-border);
  padding: 18px 20px;
  color: var(--tr-muted);
  font-size: 0.9rem;
  background: var(--tr-bg-elevated);
}

.tr-site-footer .tr-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.tr-footer-note {
  margin: 0;
  color: var(--tr-muted);
  font-size: 0.9rem;
}

/* Reopen analytics-consent choices (mirrors the main site's footer pill).
 * The shared <button> carries .footer-pill[data-consent-reopen]; it uses TR
 * tokens so it reads correctly in the TR dark shell. */
.tr-site-footer .footer-pill,
.tr-footer .footer-pill {
  margin-top: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--tr-text);
  background: var(--tr-bg-elevated);
  border: 1px solid var(--tr-border);
  border-radius: 6px;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.tr-site-footer .footer-pill:hover,
.tr-footer .footer-pill:hover,
.tr-site-footer .footer-pill:focus-visible,
.tr-footer .footer-pill:focus-visible {
  border-color: var(--tr-accent);
  color: var(--tr-text);
  outline: none;
}

@media (max-width: 640px) {
  .tr-exit-banner__inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .tr-logo__image { max-height: 40px; }
  .tr-logo { font-size: 0.95rem; }
}