/* FPRates bridge: restyles the older Bootstrap pages to match the new look
   until each page is properly converted. Loaded only by those pages (via
   _fp_nav.html), after their own styles, so it wins on equal footing.
   :where() keeps these rules weak enough that the new header/footer
   (fp-shell.css) always win over them. */

/* page background, text and fonts (Bootstrap's bg-dark/text-* are !important) */
body.bg-dark { background-color: var(--bg) !important; }
:where(body.bg-dark) { font-family: var(--sans); color: var(--soft); }
:where(body.bg-dark) .text-light, :where(body.bg-dark) .text-white { color: var(--soft) !important; }
:where(body.bg-dark) .text-muted { color: var(--muted) !important; }
:where(body.bg-dark) .container { max-width: 1200px; }

/* headings */
:where(body.bg-dark) h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.5px; color: var(--text); margin-top: 24px; }
:where(body.bg-dark) h2, :where(body.bg-dark) h3, :where(body.bg-dark) h4, :where(body.bg-dark) h5 { color: var(--text); font-weight: 600; }
:where(body.bg-dark) .h5.section-title, :where(body.bg-dark) .section-title { font-size: 20px; }
:where(body.bg-dark) .tl-rule { height: 3px; margin: 10px 0 24px; max-width: 160px; opacity: 0.9; }

/* links and rules */
:where(body.bg-dark) a { color: var(--accent); }
:where(body.bg-dark) a:hover { color: var(--text); }
:where(body.bg-dark) a.text-info { color: var(--accent) !important; }
:where(body.bg-dark) hr { border-color: var(--line); opacity: 1; }
:where(body.bg-dark) p, :where(body.bg-dark) li { line-height: 1.6; }

/* the .section boxes used on FAQ, terms, about and friends */
:where(body.bg-dark) .section { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 14px; }
:where(body.bg-dark) .section > :last-child { margin-bottom: 0; }
:where(body.bg-dark) .question { color: var(--text); font-weight: 600; font-size: 18px; margin-bottom: 10px; }

/* Bootstrap cards, including the forecast page's readout tiles */
:where(body.bg-dark) .card {
  --bs-card-bg: var(--card); --bs-card-border-color: var(--line); --bs-card-color: var(--soft);
  background-color: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--soft);
}
:where(body.bg-dark) .card.bg-secondary { background-color: var(--card) !important; }
:where(body.bg-dark) .readout .card { background-color: var(--inset); border-color: var(--line); border-radius: 12px; }
:where(body.bg-dark) .readout .label, :where(body.bg-dark) .chart-note, :where(body.bg-dark) .sub { color: var(--muted); }
:where(body.bg-dark) .readout .value, :where(body.bg-dark) .value { color: var(--text); font-family: var(--mono); }

/* tables */
:where(body.bg-dark) .table {
  --bs-table-bg: transparent; --bs-table-color: var(--soft); --bs-table-border-color: var(--line);
  --bs-table-striped-bg: rgba(255,255,255,0.03); --bs-table-striped-color: var(--soft);
  --bs-table-hover-bg: rgba(255,255,255,0.05); --bs-table-hover-color: var(--text);
  color: var(--soft); border-color: var(--line);
}
:where(body.bg-dark) .table-dark { --bs-table-bg: transparent; --bs-table-color: var(--soft); --bs-table-border-color: var(--line); }
:where(body.bg-dark) .table thead th, :where(body.bg-dark) thead { color: var(--muted); font-weight: 500; }
:where(body.bg-dark) table { font-variant-numeric: tabular-nums; }
:where(body.bg-dark) .table-responsive { border-radius: 12px; }

/* forms and buttons */
:where(body.bg-dark) .form-control, :where(body.bg-dark) .form-select, :where(body.bg-dark) select {
  background-color: var(--inset) !important; color: var(--text) !important;
  border: 1px solid var(--line-2); border-radius: 10px; min-height: 44px;
}
:where(body.bg-dark) .form-control:focus, :where(body.bg-dark) .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61,220,132,0.25);
}
:where(body.bg-dark) .form-label { color: var(--muted); font-size: 14px; }
:where(body.bg-dark) .btn { border-radius: 999px; min-height: 44px; padding-left: 20px; padding-right: 20px; font-weight: 600; }
:where(body.bg-dark) .btn-success, :where(body.bg-dark) .btn-primary { background-color: var(--accent); border-color: var(--accent); color: var(--bg); }
:where(body.bg-dark) .btn-success:hover, :where(body.bg-dark) .btn-primary:hover { background-color: #5ee08f; border-color: #5ee08f; color: var(--bg); }
:where(body.bg-dark) .btn-outline-light, :where(body.bg-dark) .btn-secondary { background: transparent; border-color: var(--line-2); color: var(--text); }

/* numbers and code */
:where(body.bg-dark) .num, :where(body.bg-dark) .mono, :where(body.bg-dark) code, :where(body.bg-dark) .url, :where(body.bg-dark) .param { font-family: var(--mono); }
:where(body.bg-dark) code { color: var(--text); background: var(--inset); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
:where(body.bg-dark) pre { background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 16px; color: #b9e6b0; }
:where(body.bg-dark) pre code { border: none; padding: 0; background: none; }
:where(body.bg-dark) .endpoint { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
:where(body.bg-dark) .method { background: var(--accent); color: var(--bg); border-radius: 6px; font-family: var(--mono); font-size: 12px; }

/* the old full-width coloured rate rows: keep the colours, soften the edges */
:where(body.bg-dark) .row-green, :where(body.bg-dark) .row-amber, :where(body.bg-dark) .row-red { border-radius: 0; }

/* header sits inside the old .container; give it the same breathing room */
:where(body.bg-dark) .site-header { margin-bottom: 8px; }
