/* =========================================================
   TLFFRA Guide — standalone companion site styles
   Neutral, editorial, data-forward. Red TLFFRA accent.
   ========================================================= */
:root {
  --red: #c41e3a;
  --red-dark: #8c1027;
  --red-soft: #fbe6ea;
  --gold: #c8a84e;
  --gold-soft: #f7eed3;
  --blue: #3b82c4;
  --blue-soft: #e3eef9;
  --green: #34c08c;
  --green-soft: #d8f3e6;
  --ink: #1a1a1a;
  --text: #222;
  --text-light: #5a5a5a;
  --muted: #8a8a8a;
  --bg: #fbf8f2;
  --surface: #ffffff;
  --line: #e6dfd0;
  --line-soft: #f0ebde;
  --max: 1180px;
  --radius: 6px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.4rem; }
.skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  position: fixed; left: 1rem; top: 1rem;
  width: auto; height: auto; padding: .7rem 1rem;
  background: var(--red); color: #fff; font-weight: 700;
  z-index: 1100; border-radius: var(--radius);
}

/* ---------- Top nav ---------- */
.topnav {
  background: #1a1a1a;
  border-bottom: 2px solid var(--red);
  padding: .9rem 0;
  position: sticky; top: 0; z-index: 50;
}
.topnav-inner {
  display: flex; align-items: center; gap: 1.4rem;
  flex-wrap: wrap;
}
.topnav-brand {
  display: inline-flex; align-items: center; gap: .7rem;
  text-decoration: none; color: #fff;
}
.topnav-brand:hover { text-decoration: none; }
.topnav-shield {
  width: 36px; height: 36px; display: inline-flex;
  align-items: center; justify-content: center;
  background: #fff; border-radius: 6px; padding: 4px;
}
.topnav-shield img { width: 28px; height: 28px; object-fit: contain; }
.topnav-text {
  display: flex; flex-direction: column; line-height: 1.1;
}
.topnav-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; font-weight: 700; letter-spacing: 2px;
  color: var(--red); text-transform: uppercase;
}
.topnav-name {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.05rem; font-weight: 700; color: #fff;
}
.topnav-links {
  margin-left: auto; display: flex; gap: 1.2rem;
  align-items: center;
}
.topnav-links a {
  color: #ddd; text-decoration: none;
  font-size: .92rem; font-weight: 500;
}
.topnav-links a:hover { color: #fff; }

/* ---------- Hero ---------- */
.hero {
  padding: 3.4rem 0 2.6rem;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; font-weight: 700; letter-spacing: 2.4px;
  color: var(--red); text-transform: uppercase; margin-bottom: .8rem;
}
.hero h1 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.1; letter-spacing: -.5px;
  color: var(--ink); font-weight: 700;
  margin: 0 0 1rem;
  max-width: 780px;
}
.hero p.lede {
  font-size: 1.15rem; line-height: 1.55;
  color: var(--text); margin: 0 0 1.4rem;
  max-width: 720px;
}
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin-top: 1.4rem; max-width: 720px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); overflow: hidden;
}
.hero-stat {
  padding: 1rem 1.2rem;
  border-left: 1px solid var(--line);
}
.hero-stat:first-child { border-left: none; }
.hero-stat .num {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.6rem; font-weight: 700; color: var(--ink);
  line-height: 1; letter-spacing: -.5px;
}
.hero-stat .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem; font-weight: 700; letter-spacing: 1.4px;
  color: var(--text-light); text-transform: uppercase;
  margin-top: .35rem;
}
@media (max-width: 720px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stat:nth-child(3) { border-left: none; border-top: 1px solid var(--line); }
  .hero-stat:nth-child(4) { border-top: 1px solid var(--line); }
}

/* ---------- Sections ---------- */
.section { padding: 2.4rem 0; }
.section-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: .7rem; font-weight: 700; letter-spacing: 2px;
  color: var(--red); text-transform: uppercase; margin-bottom: .6rem;
}
.section-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.2; color: var(--ink);
  font-weight: 700; margin: 0 0 1rem;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
}

/* ---------- Footer ---------- */
.footer {
  background: #1a1a1a; color: #ddd;
  padding: 2.6rem 0 2rem; margin-top: 3rem;
  border-top: 3px solid var(--red);
}
.footer a { color: #fff; }
.footer-brand {
  display: inline-flex; align-items: center; gap: .8rem;
  margin-bottom: .8rem;
}
.footer-brand img { width: 32px; height: 32px; }
.footer-name {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700; color: #fff; font-size: 1.05rem;
}
.footer-tag {
  font-size: .88rem; line-height: 1.5;
  color: #ccc; max-width: 720px;
  margin: .4rem 0 0;
}
.footer-meta {
  margin-top: 1rem; font-size: .76rem; color: #888;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 1px; text-transform: uppercase;
}

/* =========================================================
   Fund Guide Table (homepage)
   ========================================================= */
.fg-toolbar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  margin-bottom: 1.2rem;
}
.fg-search {
  flex: 1 1 240px; min-width: 200px; max-width: 380px;
  padding: .7rem .95rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
  font-family: inherit; font-size: .95rem; color: var(--text);
}
.fg-search:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.fg-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.fg-chip {
  padding: .48rem .85rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface);
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-light);
  cursor: pointer; transition: all .12s;
}
.fg-chip:hover { border-color: var(--red); color: var(--red); }
.fg-chip.is-active { background: var(--red); border-color: var(--red); color: #fff; }
.fg-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; font-weight: 600; letter-spacing: 1px;
  color: var(--muted); text-transform: uppercase;
  margin-left: auto;
}

.fg-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.fg-scroll { overflow-x: auto; max-height: 78vh; }
.fg-table {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
.fg-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: #1a1a1a; color: #fff;
  padding: .85rem .7rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; text-align: left;
  white-space: nowrap; user-select: none;
  border-bottom: 2px solid var(--red);
}
.fg-table thead th.sortable { cursor: pointer; }
.fg-table thead th.sortable:hover { background: #2a2a2a; }
.fg-table thead th.num { text-align: right; }
.fg-table thead th.center { text-align: center; }
.fg-table thead th .arrow {
  display: inline-block; margin-left: 4px; opacity: 0;
  transition: opacity .15s;
}
.fg-table thead th.sort-active .arrow { opacity: 1; color: var(--gold); }
.fg-table thead th.sort-active.sort-desc .arrow::after { content: '\25BC'; }
.fg-table thead th.sort-active.sort-asc .arrow::after { content: '\25B2'; }
.fg-table tbody td {
  padding: .7rem .7rem;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}
.fg-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fg-table tbody td.center { text-align: center; }
.fg-table tbody tr:hover { background: var(--bg); }
.fg-table tbody tr.is-selected { background: var(--red-soft); }
.fg-table tbody tr.is-selected:hover { background: #f7d7df; }

.fg-fund-name { font-weight: 600; color: var(--ink); }
.fg-fund-name a { color: var(--ink); border-bottom: 1px dotted var(--text-light); text-decoration: none; }
.fg-fund-name a:hover { color: var(--red); border-bottom-color: var(--red); }
.fg-city { color: var(--text-light); font-size: .82rem; }

.fg-pill {
  display: inline-block;
  padding: .22rem .55rem; border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.fg-pill.health-good { background: var(--green-soft); color: #1f7a52; }
.fg-pill.health-fair { background: var(--gold-soft); color: #8c6a10; }
.fg-pill.health-poor { background: var(--red-soft); color: var(--red-dark); }
.fg-pill.ss-yes { background: var(--blue-soft); color: #234c7a; }
.fg-pill.ss-no { background: #f0eddc; color: var(--text-light); }

.fg-check-cell { width: 36px; padding-left: .9rem !important; }
.fg-check { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }

.fg-compare-panel {
  margin-top: 1.6rem;
  padding: 1.4rem 1.5rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.fg-compare-panel.is-empty {
  text-align: center; color: var(--muted);
  font-style: italic; font-size: .9rem;
}
.fg-compare-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.fg-compare-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.3rem; font-weight: 700; color: var(--ink);
  margin: 0;
}
.fg-compare-clear {
  background: transparent; border: 1px solid var(--line);
  padding: .35rem .8rem; border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--text-light);
  cursor: pointer; transition: all .12s;
}
.fg-compare-clear:hover { border-color: var(--red); color: var(--red); }
.fg-compare-grid {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.fg-compare-row {
  display: grid;
  grid-template-columns: 180px repeat(var(--cols, 2), 1fr);
}
.fg-compare-row + .fg-compare-row { border-top: 1px solid var(--line-soft); }
.fg-compare-cell { padding: .7rem .9rem; font-size: .92rem; }
.fg-compare-row.head .fg-compare-cell {
  background: #1a1a1a; color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase;
}
.fg-compare-cell.label {
  background: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-light);
}
.fg-compare-cell.val { background: var(--surface); border-left: 1px solid var(--line-soft); }
.fg-compare-cell.val.empty { color: var(--muted); font-style: italic; }
.fg-compare-name {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700; color: var(--ink); font-size: 1rem; line-height: 1.2;
}
.fg-compare-meta { font-size: .76rem; color: var(--text-light); margin-top: .2rem; }

.fg-legend {
  display: flex; flex-wrap: wrap; gap: 1rem;
  margin-top: 1rem; font-size: .78rem; color: var(--text-light);
}
.fg-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.fg-legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* =========================================================
   Distributions strip
   ========================================================= */
.dist-grid {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.dist-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
}
.dist-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .7rem; font-weight: 700; letter-spacing: 1.4px;
  color: var(--red); text-transform: uppercase;
  margin-bottom: .8rem;
}
.dist-bar {
  display: flex; align-items: center; gap: .5rem;
  margin: .35rem 0;
  font-size: .85rem;
}
.dist-bar-label {
  flex: 0 0 110px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; color: var(--text-light);
}
.dist-bar-track {
  flex: 1; height: 18px; background: var(--bg);
  border-radius: 4px; overflow: hidden;
  border: 1px solid var(--line-soft);
}
.dist-bar-fill {
  height: 100%;
  background: var(--red);
}
.dist-bar-fill.good { background: var(--green); }
.dist-bar-fill.fair { background: var(--gold); }
.dist-bar-fill.poor { background: var(--red); }
.dist-bar-count {
  flex: 0 0 28px; text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem; font-weight: 700; color: var(--text);
}

/* =========================================================
   Glossary
   ========================================================= */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .8rem;
}
.glossary-item {
  background: var(--surface);
  border-left: 3px solid var(--red);
  padding: .9rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.glossary-term {
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem; font-weight: 700; color: var(--ink);
  margin-bottom: .25rem;
}
.glossary-def {
  font-size: .88rem; line-height: 1.45; color: var(--text);
}

/* =========================================================
   Per-fund profile pages
   ========================================================= */
.profile-back {
  display: inline-block; margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; font-weight: 700; letter-spacing: 1.2px;
  color: var(--text-light); text-transform: uppercase;
  text-decoration: none;
}
.profile-back:hover { color: var(--red); text-decoration: none; }

.profile-head {
  padding: 2.2rem 0 1.6rem;
  border-bottom: 1px solid var(--line);
}
.profile-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; font-weight: 700; letter-spacing: 2.2px;
  color: var(--red); text-transform: uppercase; margin-bottom: .5rem;
}
.profile-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  line-height: 1.15; color: var(--ink); font-weight: 700;
  margin: 0 0 .5rem;
}
.profile-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: .76rem; color: var(--text-light); letter-spacing: .6px;
}

/* Quick-stats strip — four headline numbers at top of every profile.
   Lets a trustee read the bottom-line (funded ratio, amortization, AUM,
   active members) without scanning a six-card grid first. */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 1.6rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.profile-stat {
  padding: 1.2rem 1rem;
  text-align: center;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  min-width: 0;
}
.profile-stat:first-child { border-left: none; }
.profile-stat .num {
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 700; color: var(--ink);
  line-height: 1.1;
}
.profile-stat .num .fg-pill { font-size: .9rem; }
.profile-stat .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem; font-weight: 700; letter-spacing: 1.4px;
  color: var(--text-light); text-transform: uppercase;
}
@media (max-width: 600px) {
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-stat:nth-child(3) { border-left: none; border-top: 1px solid var(--line); }
  .profile-stat:nth-child(4) { border-top: 1px solid var(--line); }
}

/* Profile cards — 2 column grid on desktop, full-width spans for cards
   with long-form content (Identity = address/website, Benefit Design =
   formula text). Mobile collapses to single column. */
.profile-grid {
  display: grid; gap: 1.2rem;
  grid-template-columns: 1fr 1fr;
  margin-top: 1.2rem;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
  min-width: 0;
}
.profile-card.span-2 { grid-column: span 2; }
@media (max-width: 720px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-card.span-2 { grid-column: span 1; }
}
.profile-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; font-weight: 700; letter-spacing: 1.6px;
  color: var(--red); text-transform: uppercase; margin-bottom: .8rem;
}
.profile-dl {
  display: grid;
  grid-template-columns: minmax(130px, 28%) 1fr;
  gap: .65rem 1rem;
  font-size: .92rem; margin: 0;
}
.profile-dl dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; font-weight: 600; letter-spacing: .8px;
  color: var(--text-light); text-transform: uppercase;
  align-self: start; padding-top: .15rem;
  word-break: break-word;
}
.profile-dl dd {
  margin: 0; color: var(--ink); align-self: start;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.profile-dl dd a { word-break: break-all; }
.profile-dl dd.address { white-space: pre-line; }
.profile-dl dd.formula { line-height: 1.55; }

@media (max-width: 720px) {
  .fg-toolbar { gap: .6rem; }
  .fg-meta { width: 100%; margin-left: 0; }
  .fg-table thead th, .fg-table tbody td { padding: .55rem .5rem; font-size: .85rem; }
  .topnav-links { gap: .8rem; }
  .topnav-links a { font-size: .85rem; }
  .profile-card { padding: 1.1rem 1.1rem; }
  .profile-dl {
    grid-template-columns: 1fr;
    gap: .15rem .9rem;
  }
  .profile-dl dt { padding-top: .6rem; padding-bottom: .1rem; }
  .profile-dl dt:first-child { padding-top: 0; }
  .profile-dl dd { padding-bottom: .1rem; }
}
