/* Time Machine in rubles (pipeline/pages/tmrub.py, js/tmrub.js). Builds on style.css
   (.card, .sentence + .dd, .chips/.seg, .table-wrap) and timemachine.css (.tm-form, .tm-sentence). */

/* a color per place; the site's own asset colors where it has one */
:root { --tr-btc: var(--btc); --tr-moex: var(--spx); --tr-gold: var(--gold); --tr-usd: #2f9e5a; --tr-eur: #5e5ce6;
  --tr-dep: var(--bond); --tr-ofz: #af52de; --tr-home: var(--home); --tr-rub: var(--muted); }
:root[data-theme="dark"], :root[data-theme="black"] { --tr-usd: #3ccf74; --tr-eur: #8e8cff; --tr-ofz: #d08cff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --tr-usd: #3ccf74; --tr-eur: #8e8cff; --tr-ofz: #d08cff; } }

/* the form */
.tr-form { gap: 16px; }
.tr-opts { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; }
.tr-opt { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
#tr-ago .chip:focus-visible, .tr-opt .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* E: the sentence, a card that reads like a picture */
.tr-story { margin: 26px 0 0; padding: 28px 30px; border-radius: 22px; background: var(--solid); color: var(--solid-ink); }
.tr-story p { margin: 0; }
.tr-lead { font-size: 18px; opacity: 0.82; }
.tr-big { font: 700 clamp(30px, 4.6vw, 46px)/1.08 var(--display); letter-spacing: -0.03em; margin: 8px 0 16px !important; overflow-wrap: anywhere; }
.tr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 18px; line-height: 1.35; }
.tr-list b { font: 700 1em var(--mono); letter-spacing: -0.02em; }
.tr-foot { margin-top: 18px !important; font-size: 15.5px; opacity: 0.78; }
.tr-mark { margin-top: 14px !important; font: 700 15px var(--display); opacity: 0.55; }

/* A: bars against the inflation line */
.tr-bars { margin: 26px 0 0; }
.tr-bars-h { font-size: 16px; color: var(--muted); margin: 0 0 14px; }
.tr-rows { display: grid; gap: 10px; }
.tr-row { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) minmax(140px, auto); gap: 16px; align-items: center; }
.tr-row.is-off { opacity: 0.5; }
.tr-name { display: flex; gap: 10px; align-items: center; min-width: 0; }
.tr-name div { min-width: 0; }
.tr-name b { display: block; font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-name span:not(.tr-ic) { display: block; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--c); color: #fff;
  color: lch(from var(--c) clamp(14, calc((50 - l) * infinity), 100) 0 0); font: 700 12.5px/1 var(--display); letter-spacing: -0.02em; }
.tr-track { position: relative; height: 26px; }
.tr-bar { position: absolute; left: 0; top: 3px; bottom: 3px; min-width: 3px; border-radius: 0 7px 7px 0; background: var(--c); transition: width 0.35s ease; }
.tr-infl { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px dashed var(--ink); opacity: 0.55; transition: left 0.35s ease; }
.tr-val { text-align: right; }
.tr-val b { display: block; font: 700 18.5px var(--mono); letter-spacing: -0.02em; }
.tr-val span { font-size: 14.5px; color: var(--muted); }
.tr-val span.up { color: var(--good); }
.tr-val span.down { color: var(--bad); }
.tr-key { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 16px; color: var(--ink-2); }
.tr-dash { display: inline-block; width: 18px; border-top: 2px dashed var(--ink); opacity: 0.6; vertical-align: middle; margin-right: 7px; }
.tr-bars .chart-foot { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .tr-bar, .tr-infl { transition: none; } }

/* D: the map by start year */
.tr-map table { border-collapse: separate; border-spacing: 3px; min-width: 760px; width: 100%; font-size: 14px; }
.tr-map th { font-weight: 600; color: var(--muted); text-align: center; padding: 2px; background: none; position: static; }
.tr-map tbody th { text-align: left; color: var(--ink); white-space: nowrap; padding-right: 10px; font-size: 15px; }
.tr-map td { text-align: center; border-radius: 6px; padding: 8px 2px; font: 600 13.5px var(--mono); letter-spacing: -0.03em; color: var(--ink); cursor: pointer; border: 0; }
.tr-map td.na { color: var(--muted); cursor: default; font-weight: 400; }
.tr-map td.sel, .tr-map th.sel { outline: 2px solid var(--ink); outline-offset: -1px; }
.tr-map td:hover:not(.na) { outline: 2px solid var(--muted); outline-offset: -1px; }
.tr-map td.g0 { background: color-mix(in srgb, var(--good) 10%, transparent); }
.tr-map td.g1 { background: color-mix(in srgb, var(--good) 17%, transparent); }
.tr-map td.g2 { background: color-mix(in srgb, var(--good) 24%, transparent); }
.tr-map td.g3 { background: color-mix(in srgb, var(--good) 31%, transparent); }
.tr-map td.g4 { background: color-mix(in srgb, var(--good) 38%, transparent); }
.tr-map td.g5 { background: color-mix(in srgb, var(--good) 46%, transparent); }
.tr-map td.g6 { background: color-mix(in srgb, var(--good) 54%, transparent); }
.tr-map td.g7 { background: color-mix(in srgb, var(--good) 62%, transparent); }
.tr-map td.g8 { background: color-mix(in srgb, var(--good) 71%, transparent); }
.tr-map td.g9 { background: color-mix(in srgb, var(--good) 80%, transparent); }
.tr-map td.r0 { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.tr-map td.r1 { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.tr-map td.r2 { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.tr-map td.r3 { background: color-mix(in srgb, var(--bad) 28%, transparent); }
.tr-map td.r4 { background: color-mix(in srgb, var(--bad) 34%, transparent); }
.tr-map td.r5 { background: color-mix(in srgb, var(--bad) 41%, transparent); }
.tr-map td.r6 { background: color-mix(in srgb, var(--bad) 48%, transparent); }
.tr-map td.r7 { background: color-mix(in srgb, var(--bad) 55%, transparent); }
.tr-map td.r8 { background: color-mix(in srgb, var(--bad) 62%, transparent); }
.tr-map td.r9 { background: color-mix(in srgb, var(--bad) 70%, transparent); }
.tr-map td.g8, .tr-map td.g9, .tr-map td.r8, .tr-map td.r9 { color: #fff; }

@media (max-width: 720px) {
  .tr-row { grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense; row-gap: 6px; }
  .tr-track { grid-column: 1 / -1; margin-top: -4px; }
  .tr-val span { display: block; max-width: 12ch; margin-left: auto; }
  .tr-story { padding: 22px; }
}
