/* Currencies pages (/currencies/, /currencies/<pair>/), on top of the shared «Бенто,
   графит» classes in style.css. A currency is not one of the site's assets, so the
   rate line is c1 (blue) and candles are green/red (style.css .cdl). Big numbers and
   changes stay in ink: a stronger dollar is not "good". Colors come from the theme
   variables, so light, paper, graphite and black all work. */

/* what currencies.js runs stays hidden until it runs it; what it hides stays hidden
   (.legend sets display, which would beat the hidden attribute) */
.cur-wait { visibility: hidden; }
#cur [hidden] { display: none; }

/* tiles */
.cur-top-s { margin-top: 8px; }
.cur-top-m { margin-top: 12px; }
p.cur-flat { margin-bottom: 0; }
.cur-head { flex-wrap: nowrap; align-items: center; }
.cur-head .label { line-height: 1.35; }
.cur-spark { height: 72px; }
.cur-lead .cur-spark { height: 80px; }
/* a pair page: the latest rate spans two rows, the record high and low and the
   rates a year and five years ago fill the 2 x 2 cells next to it */
@media (min-width: 921px) { .bento .cur-lead2 { grid-row: span 2; display: flex; flex-direction: column; } .cur-lead2 .cur-spark { flex: 1 1 auto; min-height: 80px; } }
a.cur-lead, a.cur-tile { display: block; }
.mid.cur-range-v { font-size: 23px; letter-spacing: -0.04em; }
/* small tiles: the value, then its change below it (the same in every tile) */
.cur-keys .card:not(.cur-lead):not(.cur-usd) > .row.cur-top-m { flex-direction: column; align-items: flex-start; gap: 8px; }
.cur-usd { display: flex; flex-direction: column; }
.cur-usd-text { margin: 14px 0 0; font: 600 clamp(19px, 2vw, 23px)/1.4 var(--font); letter-spacing: -0.015em; color: var(--ink); }
.cur-usd-text b { font: 600 1.25em/1 var(--mono); letter-spacing: -0.05em; }
.cur-usd .cur-flat { margin-top: auto; padding-top: 10px; }
.cur-usd-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 16px 0 0; }
.cur-usd-lists ul { list-style: none; margin: 6px 0 0; padding: 0; }
.cur-usd-lists li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); font-size: 14px; color: var(--ink-2); }
.cur-usd-lists li b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .cur-usd-lists { grid-template-columns: minmax(0, 1fr); } }

/* notes next to charts and tables */
.cur-note { margin: -4px 0 12px; max-width: 82ch; }
.cur-foot { margin: 10px 0 0; max-width: 86ch; }
.cur-findings { margin: 0 0 4px; }
.cur-more { margin: 12px 0 0; font-size: 15px; font-weight: 600; }
.cur-more a { text-decoration: none; }
.cur-more a:hover { text-decoration: underline; }

/* chart controls: period chips, two year pickers, chart type and scale */
.cur-segs { display: flex; flex-wrap: wrap; gap: 8px; }
.cur-period { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.cur-period select { font: 600 14px var(--font); color: var(--ink); background: var(--track); border: 0; border-radius: 999px; padding: 8px 12px; cursor: pointer; }
.cur-period select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the chart: legend inside the card (room for the full-screen button), room kept before the JS draws */
#cur .chart .legend { padding: 2px 40px 0 10px; margin: 0 0 4px; }
.cur-plot { min-height: 300px; }
.cur-plot.cur-fail { min-height: 0; padding: 28px 12px; font-size: 14px; color: var(--muted); }
.cur-tip-note span:nth-child(2) { color: var(--muted); }

/* tables: numbers right-aligned in tabular figures, changes in ink (neutral) */
.cur-table td, .cur-table th { font-variant-numeric: tabular-nums; vertical-align: top; }
.cur-table th[scope="row"] { text-align: left; font-weight: 600; }
.cur-table th[scope="row"] a { color: var(--ink); text-decoration: none; }
.cur-table th[scope="row"] a:hover { color: var(--accent-ink); text-decoration: underline; }
.cur-table .cur-sub { display: block; font-size: 11px; line-height: 1.4; font-weight: 500; color: var(--muted); }
.cur-table .cur-chg { color: var(--ink); font-weight: 600; }
.cur-code { font: 600 10px/1 var(--font); letter-spacing: 0.08em; color: var(--muted); background: var(--track); border-radius: 999px; padding: 3px 6px; margin-left: 4px; vertical-align: 2px; }
.cur-table tr.cur-group:hover { background: transparent; }
.cur-table tr.cur-group th { padding-top: 16px; font-size: 13px; font-weight: 650; color: var(--ink-2); text-align: left; }
.cur-majors .cur-rate { font-weight: 600; }
.cur-majors td.cur-spark-cell { padding-top: 8px; padding-bottom: 6px; }
.cur-majors .cur-spark-cell .spark { width: 120px; height: 30px; margin: 0 0 0 auto; }
.cur-th-spark { min-width: 120px; }
.cur-details summary { color: var(--accent-ink); }

/* pair cards and links */
.cur-cards { margin-top: 4px; }
.cur-card .card-title { font-family: var(--mono); letter-spacing: -0.03em; }
.cur-card .card-meta { margin-top: 6px; }
.cur-card .card-value { margin-top: 0; }
.cur-card .cur-top-s { flex-direction: column; align-items: flex-start; gap: 8px; }
.cur-h-links { font-size: clamp(20px, 2.4vw, 26px); }
.cur-pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cur-pairs a { display: inline-block; font: 600 13px/1 var(--mono); letter-spacing: -0.02em; color: var(--ink-2); background: var(--track); border-radius: 999px; padding: 9px 13px; text-decoration: none; }
.cur-pairs a:hover { color: var(--ink); background: var(--hover); box-shadow: inset 0 0 0 1px var(--border); }
.cur-links { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 15px; font-weight: 600; }

@media (max-width: 560px) {
  /* phones: the small tiles and the pair cards two by two (style.css stacks .bento in one column) */
  .bento.cur-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .bento.cur-keys > .w2 { grid-column: 1 / -1; }
  .cur-keys .card:not(.cur-lead):not(.cur-usd) { padding: 16px; }
  .cur-keys .card:not(.cur-lead):not(.cur-usd) .mid { font-size: 23px; }
  .cur-keys .card:not(.cur-lead):not(.cur-usd) .pill { padding: 6px 9px; font-size: 12px; }
  .cur-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cur-card { padding: 16px; }
  .cur-card .card-value { font-size: 20px; }
  .cur-card .pill { padding: 6px 9px; font-size: 12px; }
}
@media (max-width: 640px) {
  /* wide tables scroll sideways; the first column stays in view */
  .cur-table th:first-child, .cur-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .cur-table thead th:first-child { z-index: 2; }
  .cur-table tr.cur-group th { position: static; box-shadow: none; }
  .cur-majors .cur-spark-cell .spark { width: 84px; }
  .cur-th-spark { min-width: 84px; }
  .cur-spark { height: 64px; }
  .cur-period select { padding: 8px 10px; }
}
