/* Shared by every page of the site: type, theme, header, cards, tiles, tables, charts. */

/* Onest (OFL, fonts/OFL.txt), variable 400–700, served from this site: no third-party requests from the pages.
   Loaded ahead (preload) and kept by the browser; `optional` — never swapped in after the text is drawn */
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: optional;
  src: url(/static/fonts/Onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: optional;
  src: url(/static/fonts/Onest-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.04);
  --accent: #2a78d6;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #6250d6;
  --s8: #e34948;
  --good: #006300;
  --bad: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10); --wash: rgba(255, 255, 255, 0.05);
    --accent: #3987e5; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good: #0ca30c; --bad: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10); --wash: rgba(255, 255, 255, 0.05);
  --accent: #3987e5; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good: #0ca30c; --bad: #e66767;
}
* { box-sizing: border-box; }
/* the scrollbar is always there: a long page has one and a short one not, and the whole layout jumped sideways on
   going from one to the other (a kept empty gutter instead cut the header's line short of the edge) */
html { overflow-y: scroll; }
/* page changes cross-fade instead of blinking (Chrome, Edge, Safari; elsewhere a plain load), the header stays put;
   the opt-in itself (@view-transition) comes inline in each page's head — server.py, VIEW_TRANSITIONS */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif; }
:root { --page-max: 1480px; }  /* wide: the charts get the room, text keeps its own measure */
main { max-width: var(--page-max); margin: 0 auto; padding: 32px 24px 64px; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 650; letter-spacing: -0.012em; margin: 0 0 8px; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 600; margin: 0 0 4px; }
.lead { color: var(--ink-2); margin: 0 0 24px; max-width: 110ch; }
input, button, select { font: inherit; }

/* site header: brand, pages, server status */
.site-head { view-transition-name: site-head; position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--ring); }
.site-head .bar { max-width: var(--page-max); margin: 0 auto; padding: 0 24px; display: flex; flex-wrap: wrap; align-items: center;
  column-gap: 24px; min-height: 52px; }
.site-head .brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a { color: var(--ink-2); text-decoration: none; padding: 14px 10px 12px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.site-nav a:focus-visible, .site-head .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.site-status { margin-left: auto; color: var(--muted); font-size: 13px; padding: 6px 0; }

/* controls */
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 8px 14px; cursor: pointer; white-space: nowrap; }
@media (max-width: 480px) { .seg button { padding: 8px 8px; } }  /* the five presets fit a phone's card */
.seg button + button { border-left: 1px solid var(--axis); }
.seg button[aria-pressed="true"] { color: var(--ink); font-weight: 600; background: var(--wash); }
.seg button:hover { color: var(--ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.status { color: var(--ink-2); font-size: 14px; min-height: 20px; }

/* cards and stat tiles */
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 12px 14px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 26px; line-height: 1.2; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .sub { color: var(--ink-2); font-size: 13px; }

/* charts */
.chart-card .hint { color: var(--ink-2); font-size: 13px; margin: 0 0 8px; max-width: 110ch; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key-line { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--ring); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; font-variant-numeric: tabular-nums; }
.chart:focus { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.tip { font-variant-numeric: tabular-nums; position: absolute; z-index: 4; pointer-events: none; background: var(--surface); border: 1px solid var(--ring);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.14); min-width: 170px; max-width: 360px; }
.tip .t-date { color: var(--ink-2); margin-bottom: 4px; }
.tip .t-row { display: flex; align-items: center; gap: 8px; }
.tip .t-row b { font-variant-numeric: tabular-nums; min-width: 56px; }
.tip .t-row span.l, .tip .t-row.l { color: var(--ink-2); }

/* tables and text */
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); }
th { color: var(--ink-2); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.notes { color: var(--ink-2); font-size: 13px; padding-left: 18px; margin: 8px 0 0; }
details summary { cursor: pointer; color: var(--ink-2); }
.empty { color: var(--ink-2); }

/* page parts: the bond search, a bond's card, the period with its ruler */
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.search { position: relative; flex: 1 1 360px; max-width: 560px; }
.search input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--axis);
  background: var(--surface); color: var(--ink); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 360px; overflow: auto; }
.results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: var(--wash); }
.results .r-name { font-weight: 600; }
.results .r-meta { color: var(--ink-2); font-size: 13px; }
.bond-name { font-size: 20px; line-height: 1.25; font-weight: 650; margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; row-gap: 4px; color: var(--ink-2); font-size: 14px; }
.chips span + span::before { content: "|"; color: var(--axis); margin: 0 10px; }
.warning { color: var(--ink-2); background: var(--wash); border-radius: 8px; padding: 8px 12px; margin: 0 0 16px; font-size: 14px; }
.table-note { color: var(--ink-2); font-size: 13px; margin: 8px 0 4px; }
.loading #content { opacity: .5; transition: opacity .15s; }

/* period: presets, dates, and the ruler with the whole history */
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 10px; }
.dates { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.dates input { color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 6px 8px;
  font-variant-numeric: tabular-nums; }
.dates input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.period-days { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.ruler { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.ruler svg { display: block; width: 100%; font-variant-numeric: tabular-nums; }
.ruler .win { cursor: grab; }
.ruler.dragging .win { cursor: grabbing; }
.ruler .grip { cursor: ew-resize; }

/* a bond's card: the link to the comparison */
.card-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.to-compare { color: var(--accent); text-decoration: none; font-size: 14px; white-space: nowrap; }
.to-compare:hover { text-decoration: underline; }
.to-compare:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* the comparison: a tile per bond with its colour, a link to its page, "base" and "remove" */
.picked { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile-head { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.tile-head .key-line { width: 14px; height: 3px; flex: none; }
.tile-head a { color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-head a:hover { text-decoration: underline; }
.tile-tools { display: flex; gap: 4px; margin-left: auto; flex: none; }
.chip-btn { border: 1px solid var(--axis); background: var(--surface); color: var(--ink-2); border-radius: 6px; padding: 1px 8px;
  font-size: 12px; line-height: 20px; cursor: pointer; }
.chip-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.chip-btn[aria-pressed="true"] { color: var(--ink); background: var(--wash); border-color: var(--ink-2); font-weight: 600; }
.chip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tile .value.muted { color: var(--muted); }
th.group { text-align: center; border-bottom: 0; color: var(--ink); font-weight: 600; }
