/* =========================================================================
   The Weekly Dividend — 2026-12 redesign layer
   Newsprint paper, ink rules, deep green + gold. Newsreader for display,
   Inter for text, IBM Plex Mono for every number. Loaded after styles.css
   so legacy (admin) rules keep working underneath.
   ========================================================================= */

:root {
  --paper: #F6F1E7;
  --panel: #FBF8F1;
  --ink: #1A1A17;
  --ink-2: #3A3730;
  --muted: #5C574C;
  --rule: #D9D0BD;
  --rule-2: #BFB59E;
  --track: #E6DECB;
  --green: #1F4D3A;
  --green-2: #2F6650;
  --green-dark: #123226;
  --gold: #E3C77A;
  --gold-bar: #B8892B;
  --kicker: #7A5A14;
  --red: #8F3418;
  --on-green: #FBF8F1;
  --on-green-muted: #D9D0BD;

  --serif: Newsreader, Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* legacy aliases used by older rules */
  --font-sans: var(--sans);
  --font-serif: var(--serif);
  --text: var(--ink);
  --text-soft: var(--muted);
  --line: var(--rule);
  --line-strong: var(--rule-2);
  --surface: var(--panel);
  --surface-2: var(--paper);
  --maxw: 1180px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--green); }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- Masthead (one header on every route) ---------- */
.mast { background: var(--paper); color: var(--ink); position: relative; z-index: 40; }
.mast-dateline {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 12px 0; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--rule);
}
.mast-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px 32px; padding: 22px 0 18px;
}
.mast-brand {
  font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; line-height: 1;
}
.mast-brand:hover { color: var(--ink); }
.mast-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mast-nav {
  display: flex; flex-wrap: wrap; gap: 4px 28px;
  border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink);
}
.mast-nav a {
  padding: 12px 0; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none;
}
.mast-nav a:hover { box-shadow: inset 0 -3px 0 var(--rule-2); color: var(--ink); }
.mast-nav a[aria-current="page"], .mast-nav a.is-active { font-weight: 600; box-shadow: inset 0 -3px 0 var(--green); }
@media (max-width: 640px) {
  .mast-brand { font-size: 28px; }
  .mast-row { padding: 16px 0 14px; }
  .mast-tools { width: 100%; }
  .mast-tools .search { flex: 1 1 auto; }
  .mast-nav { gap: 2px 20px; }
}

/* ---------- Fund search combobox (header + portfolio) ---------- */
.search { position: relative; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--rule-2); border-radius: 4px;
}
.search-box:focus-within { border-color: var(--ink); }
.search-box svg { flex: 0 0 auto; }
.search-box input {
  border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink);
  width: 190px; min-width: 0; outline: none; flex: 1 1 auto;
}
.search-list {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(460px, 92vw);
  background: var(--panel); border: 1px solid var(--ink); border-radius: 4px;
  box-shadow: 0 10px 30px rgba(26, 26, 23, 0.14); padding: 4px 0; margin: 0; list-style: none; z-index: 60;
}
.search-list[hidden] { display: none; }
.search-opt {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  min-height: 44px; padding: 6px 14px; cursor: pointer; font-size: 14px;
}
.search-opt .t { font-family: var(--mono); font-weight: 600; color: var(--green); }
.search-opt .n { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-opt .s { font-family: var(--mono); font-weight: 600; color: var(--muted); }
.search-opt[aria-selected="true"], .search-opt:hover { background: var(--track); }
.search-empty { padding: 10px 14px; font-size: 13px; color: var(--muted); }
.search-all { display: block; padding: 10px 14px; font-size: 13px; font-weight: 600; border-top: 1px solid var(--rule); }

/* ---------- Buttons, chips ---------- */
.btn-g, .btn-o, .btn-ink {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 4px; font: inherit; font-size: 14px;
  font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.btn-g { background: var(--green); color: var(--on-green); }
.btn-g:hover { background: var(--green-dark); color: var(--on-green); }
.btn-o { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-o:hover { background: var(--panel); color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--on-green); }
.btn-ink:hover { background: #000; color: var(--on-green); }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 15px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--ink); border-radius: 22px; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--panel); color: var(--ink); }
.chip.is-on, .chip[aria-pressed="true"] { background: var(--ink); color: var(--on-green); font-weight: 600; }
.tick-chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--green); border-radius: 4px; background: var(--panel);
  font-family: var(--mono); font-size: 14px; font-weight: 600; text-decoration: none; color: var(--green);
}
.more { font-size: 14px; font-weight: 600; text-decoration: none; display: inline-block; padding: 10px 0; }
.more:hover { text-decoration: underline; }

/* ---------- Type ---------- */
.kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--kicker); }
.kicker-gold { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.label-caps { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin: 0; }
.h-display { margin: 0; font-family: var(--serif); font-size: clamp(36px, 5vw, 56px); font-weight: 500; line-height: 1.04; letter-spacing: -0.02em; text-wrap: balance; }
.h-1 { margin: 0; font-family: var(--serif); font-size: clamp(32px, 4vw, 44px); font-weight: 500; line-height: 1.08; letter-spacing: -0.015em; text-wrap: balance; }
.h-2 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 3.2vw, 36px); font-weight: 500; line-height: 1.1; text-wrap: balance; }
.h-3 { margin: 0; font-family: var(--serif); font-size: clamp(24px, 2.6vw, 32px); font-weight: 500; line-height: 1.12; }
.h-4 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.15; }
.h-5 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1.18; }
.h-5 a, .h-4 a, .h-display a { color: var(--ink); text-decoration: none; }
.h-5 a:hover, .h-4 a:hover, .h-display a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.dek { margin: 0; font-family: var(--serif); font-size: 21px; line-height: 1.45; color: var(--ink-2); max-width: 640px; }
.meta { font-size: 13px; color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }
.body-2 { color: var(--ink-2); margin: 0; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---------- Layout blocks ---------- */
.grid-lead { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 40px; }
.span-2 { grid-column: span 2; min-width: 0; }
@media (max-width: 1000px) { .span-2 { grid-column: auto; } }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 32px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; }
.sec { padding: 36px 0 48px; border-top: 1px solid var(--ink); }
.sec-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px;
  padding-bottom: 16px; border-bottom: 3px double var(--ink);
}
.rule-title { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.panel { padding: 32px; background: var(--panel); border: 1px solid var(--ink); border-radius: 4px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--panel); border: 1px solid var(--rule-2); border-radius: 4px; color: var(--ink); text-decoration: none; }
a.card:hover { border-color: var(--ink); color: var(--ink); }
@media (max-width: 640px) { .panel { padding: 20px; } .card { padding: 18px; } }

/* Green Score panel */
.gpanel { background: var(--green); color: var(--on-green); padding: 24px; border-radius: 4px; min-width: 0; align-self: start; }
.gpanel a { color: var(--on-green); }
.gpanel .gp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px;
  padding: 8px 0; border-top: 1px solid rgba(251, 248, 241, 0.22); color: var(--on-green); text-decoration: none;
}
.gpanel .gp-row:hover { background: rgba(251, 248, 241, 0.06); }
.gp-sub { display: block; font-size: 12px; color: var(--on-green-muted); }
.gp-big { font-family: var(--mono); font-size: 72px; font-weight: 600; line-height: 1; }
.gp-in { display: flex; align-items: center; gap: 12px; min-height: 30px; font-size: 13px; }
.gp-in .l { flex: 0 0 132px; }
.gp-in .tr { flex: 1; height: 5px; background: rgba(251, 248, 241, 0.22); border-radius: 3px; }
.gp-in .tr > span { display: block; height: 5px; background: var(--gold); border-radius: 3px; }
.gp-in .v { font-family: var(--mono); width: 30px; text-align: right; }

/* Key numbers band */
.keynums {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 24px;
  padding: 24px 0; border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink);
}
.keynum .k { font-size: 12px; color: var(--muted); }
.keynum .v { font-family: var(--mono); font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.keynum .s { font-size: 12px; color: var(--muted); }

/* Ranking table */
.tscroll { overflow-x: auto; }
.rtable { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; }
.rtable th { padding: 12px 8px; font-size: 12px; font-weight: 500; color: var(--muted); text-align: right; white-space: nowrap; }
.rtable th:first-child, .rtable td:first-child { text-align: left; }
.rtable th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.rtable th[aria-sort] button { color: var(--ink); font-weight: 600; }
.rtable td { padding: 14px 8px; border-top: 1px solid var(--rule); text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; vertical-align: middle; }
.rtable td .tk { font-weight: 600; font-size: 15px; text-decoration: none; }
.rtable td .tk:hover { text-decoration: underline; }
.rtable td .nm { font-family: var(--sans); font-size: 13px; color: var(--muted); max-width: 420px; }
.rtable .num-col { white-space: nowrap; }
.sbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.sbar .tr { flex: 1; min-width: 60px; height: 6px; background: var(--track); border-radius: 3px; }
.sbar .tr > span { display: block; height: 6px; border-radius: 3px; background: var(--green); }
.sbar .tr > span.fair { background: var(--gold-bar); }
.sbar .tr > span.low { background: var(--red); }
.sbar .n { font-size: 18px; font-weight: 600; color: var(--green); min-width: 2ch; }
.sbar .n.fair { color: var(--kicker); }
.sbar .n.low { color: var(--red); }
.sbar .tl { font-family: var(--sans); font-size: 12px; color: var(--muted); min-width: 44px; text-align: left; }

/* Score weights strip */
.weights { display: flex; gap: 3px; min-width: 0; }
.weights > div { min-width: 0; padding: 14px 10px; background: var(--green-2); color: var(--on-green); }
.weights > div:first-child { background: var(--green); }
.weights > div:last-child { background: var(--gold); color: var(--ink); }
.weights .p { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.weights .l { font-size: 12px; }

/* Facts list */
.facts .row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.facts .row > span:first-child { color: var(--muted); }
.facts .row > span:last-child { font-family: var(--mono); text-align: right; }

/* Forms */
.field-l { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.field-l.sub { font-size: 13px; font-weight: 400; color: var(--muted); }
.money {
  display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 14px; background: var(--paper);
  border: 1px solid var(--ink); border-radius: 4px; font-family: var(--mono); font-size: 20px; font-weight: 400; color: var(--ink);
}
.money input { border: 0; background: transparent; font: inherit; color: inherit; width: 100%; min-width: 0; outline: none; }
.money:focus-within { box-shadow: 0 0 0 2px var(--green); }
.money.sm { height: 48px; font-size: 18px; }
.txt {
  height: 48px; padding: 0 14px; background: var(--paper); border: 1px solid var(--ink); border-radius: 4px;
  font: inherit; font-size: 15px; color: var(--ink); width: 100%;
}
.form-err { color: var(--red); font-size: 13px; margin: 8px 0 0; }

/* Equation (calculator results) */
.eqn { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px; font-family: var(--mono); }
.eqn .big { font-size: 26px; }
.eqn .lbl { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); }
.eqn .op { font-size: 22px; color: var(--muted); }
.eqn .res { font-size: 34px; font-weight: 600; color: var(--green); }

/* Bar chart (what it has paid) */
.paybars { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.paybars > div { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.paybars .v { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.paybars .b { display: block; width: 100%; background: var(--gold-bar); }
.paybars-x { display: flex; gap: 10px; padding-top: 8px; }
.paybars-x > span { flex: 1; min-width: 0; text-align: center; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
@media (max-width: 640px) { .paybars .v { font-size: 10px; } .paybars { gap: 4px; } .paybars-x { gap: 4px; } }

/* FAQ / details */
.qa { padding: 16px 0; border-top: 1px solid var(--rule); }
.qa h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.25; }
.qa p { margin: 0; color: var(--ink-2); }
details.more-box { border-top: 1px solid var(--rule); padding: 12px 0; }
details.more-box > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* Footer */
.twd-footer { background: var(--ink); color: var(--on-green-muted); margin-top: 48px; }
.twd-footer .in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; padding: 32px 0; font-size: 13px; }
.twd-footer .nm { font-family: var(--serif); font-size: 20px; color: var(--on-green); margin-bottom: 6px; }
.twd-footer a { color: var(--on-green); }
.twd-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* Skeleton (shown while a route loads; never longer than the data fetch) */
.skel-page { padding: 40px 0 56px; }
.skel { background: linear-gradient(90deg, var(--track) 0%, #EFE8D8 50%, var(--track) 100%); background-size: 200% 100%; border-radius: 4px; animation: skel 1.2s ease-in-out infinite; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.skel-line { height: 14px; margin: 10px 0; }
.skel-h { height: 44px; width: 70%; margin: 12px 0 18px; }
.skel-row { height: 52px; margin: 2px 0; }

/* ---------- Legacy views, re-skinned to the new palette ---------- */
.mock-page { max-width: 1180px; background: transparent; color: var(--ink); box-shadow: none; }
.mock-pad { padding-left: 32px; padding-right: 32px; }
@media (max-width: 640px) { .mock-pad { padding-left: 16px; padding-right: 16px; } }
.mock-page h1, .mock-page h2, .mock-page .serif-h { font-family: var(--serif); font-weight: 500; }
.mock-page h3 { font-family: var(--serif); }
body.on-front .site-header { display: block; }
.site-footer { display: none; }
