/* Page layout for direction A "Krant". Colours, type and spacing come from tokens.css. */

* { box-sizing: border-box; }
a { color: inherit; }
p { margin: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-7); padding-block: 10px; }
.logo { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none;
  font: 600 clamp(20px, 1.8vw, 23px) var(--font-serif); letter-spacing: -0.01em; }
/* Flag keeps its own colours in both themes; a hairline in --border keeps the white stripes from
   melting into the light background and gives it a clean edge on the dark one. */
.logo .flag { flex: none; border-radius: var(--radius-xs); overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
@media (min-width: 761px) { .site-nav { display: flex; gap: 28px; } }
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: var(--s-2); }
.icon-btn { display: flex; align-items: center; justify-content: center; }
.header-actions .segmented button { min-width: 46px; min-height: 42px; letter-spacing: .04em; }

/* Sections */
.section { padding-bottom: clamp(40px, 4.4vw, 56px); }
.section--hero { padding-top: clamp(20px, 3.4vw, 44px); }
.section-title--gap { margin-bottom: var(--s-5); }
.section-sub { margin: var(--s-1) 0 var(--s-4); font-size: 15px; color: var(--text-muted); }

.kicker { margin-bottom: 6px; font-size: clamp(13px, 1.1vw, 14px); font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); }
.page-title { margin: 0 0 clamp(16px, 2.5vw, 28px); font: 500 var(--fs-h1)/1.15 var(--font-serif);
  letter-spacing: -0.015em; text-wrap: balance; }

.source-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin-bottom: clamp(20px, 2.5vw, 28px); }
.source-row .field-label { margin: 0; }

/* Rate cards */
.rate-card__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.rate-card__code { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: .06em; }
.rate-card__name { font-weight: 400; letter-spacing: 0; color: var(--text-muted); }
.rate-card__date { font-size: 14px; color: var(--text-muted); }
.rate-card__value-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; font-family: var(--font-serif); }
.rate-card__unit { font-size: clamp(17px, 1.75vw, 22px); color: var(--text-muted); }
.rate-card__srd { font-size: clamp(19px, 1.9vw, 24px); font-weight: 600; }
.rate-card__change { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: clamp(15px, 1.25vw, 16px); color: var(--text-2); }
.rate-card__change .muted { color: var(--text-muted); }
.change { color: var(--text-2); }
.buy-sell { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; margin: 4px 0 0; padding-top: 10px;
  border-top: 1px solid var(--border); font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.buy-sell dt { font-weight: 600; }
.buy-sell dd { margin: 0; }

/* Skeleton and error states */
.rate-card--skeleton { border-top-color: var(--border); gap: 14px; }
.rate-card--skeleton .rate-card__code { color: var(--text-muted); }
.skel { display: block; background: var(--skeleton); border-radius: 4px; }
.skel--date { width: 96px; height: 14px; }
.skel--value { width: min(100%, 300px); height: clamp(52px, 6.6vw, 84px); border-radius: var(--radius); }
.skel--badge { width: 220px; max-width: 80%; height: 22px; border-radius: var(--radius-pill); }
.status-line { display: flex; align-items: center; gap: var(--s-2); font-size: 15px; color: var(--text-muted); }
.error-block { border-top: 2px solid var(--text); padding: 20px 0 4px; display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-start; }
.error-block > svg { flex: none; margin-top: 2px; stroke: var(--text); }
.error-block__body { flex: 1 1 260px; min-width: 0; }
.error-block h2 { margin: 0 0 6px; font: 500 clamp(22px, 2.4vw, 28px)/1.2 var(--font-serif); }
.error-block p { margin-bottom: var(--s-4); color: var(--text-2); max-width: 60ch; }
.btn { display: inline-flex; align-items: center; gap: var(--s-2); }

/* Source notice */
.notice { margin-top: clamp(24px, 2.8vw, 36px); font-size: clamp(15px, 1.25vw, 16px); }
.notice > svg { flex: none; margin-top: 2px; stroke: var(--accent); }
.notice strong { font-weight: 700; }
.notice-coverage { margin-top: 6px; font-size: 14px; color: var(--text-muted); }
.notice-coverage:empty { display: none; }

/* Converter */
.conv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 24px 56px; align-items: start; }
.conv-inputs { display: flex; flex-direction: column; gap: 14px; }
.field--amount { height: 52px; font-size: 20px; }
.conv-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); gap: var(--s-2); align-items: end; }
.select-wrap { position: relative; }
.select { cursor: pointer; }
.select-wrap svg { position: absolute; right: 14px; top: 17px; pointer-events: none; stroke: var(--text-2); }
.swap-btn { width: 48px; height: 48px; border: 1px solid var(--control); border-radius: var(--radius); background: transparent;
  color: var(--text); display: flex; align-items: center; justify-content: center; }
.swap-btn:disabled { border-style: dashed; color: var(--text-muted); }
.result-box { min-width: 0; padding: clamp(16px, 2vw, 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.result-label { margin-bottom: 4px; font-size: var(--fs-small); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.result-lhs { min-height: 1.5em; font-size: clamp(16px, 1.5vw, 18px); color: var(--text-2); }
.result-rhs { margin: 2px 0 10px; font: 500 var(--fs-result)/1.1 var(--font-serif); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.result-unit { padding-top: 10px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-muted); }

/* Chart controls */
.chart-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-bottom: var(--s-3); }
.chart-controls__right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s-4); font-size: 14px; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: var(--s-2); }
.legend strong { letter-spacing: .04em; }
.btn-secondary { display: inline-flex; align-items: center; gap: var(--s-2); }
.btn-secondary[aria-pressed="true"] { background: var(--surface-2); }

/* Chart */
.chart { margin: 0; position: relative; height: clamp(250px, 28vw, 340px); user-select: none; }
.plot { position: absolute; left: 44px; right: clamp(80px, 8vw, 96px); top: 12px; bottom: 30px; touch-action: pan-y; cursor: crosshair; }
.grid-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--chart-grid); }
.y-label { position: absolute; right: calc(100% + 8px); top: -10px; font-size: var(--fs-small); line-height: 20px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.baseline { position: absolute; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--control); }
.x-label { position: absolute; top: calc(100% + 8px); font-size: var(--fs-small); color: var(--text-muted); white-space: nowrap; }
.plot svg { position: absolute; inset: 0; overflow: visible; }
.plot polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line--usd { stroke: var(--series-usd); }
.line--eur { stroke: var(--series-eur); }
.end-dot { position: absolute; left: 100%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); }
.end-label { position: absolute; left: calc(100% + 12px); transform: translateY(-50%); font-size: var(--fs-small); line-height: 1.2;
  font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.end-label span { display: block; font-weight: 600; color: var(--text); }
.bg-usd { background: var(--series-usd); }
.bg-eur { background: var(--series-eur); }
.fg-usd { color: var(--series-usd); }
.fg-eur { color: var(--series-eur); }
.hover-line { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--text-2); pointer-events: none; }
.hover-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.tooltip { position: absolute; top: 4px; min-width: 156px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; line-height: 1.4; pointer-events: none; z-index: 1; }
.tooltip__date { margin-bottom: 6px; font-weight: 700; }
.tooltip__row { display: flex; align-items: center; gap: var(--s-2); }
.tooltip__row + .tooltip__row { margin-top: 2px; }
.tooltip__row .series-swatch { width: 12px; }
.tooltip__code { font-weight: 600; letter-spacing: .04em; }
.tooltip__value { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-blocked { height: clamp(250px, 28vw, 340px); display: flex; align-items: center; justify-content: center; padding: var(--s-4);
  text-align: center; border: 1px dashed var(--control); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 15px; }

/* History table (table mode) */
.table { font-size: 15px; }
.table thead th { font-weight: 700; text-align: right; }
.table thead th:first-child { text-align: left; text-transform: uppercase; }
.table tbody th { text-align: left; font-weight: 400; white-space: nowrap; }

/* Statistics */
.stats-scroll { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table thead th { padding: 10px 12px; text-align: right; font-size: 14px; font-weight: 700; letter-spacing: .06em; border-bottom: 1px solid var(--text); }
.stats-table thead th:first-child { padding-left: 0; text-align: left; }
.stats-table thead th:last-child { padding-right: 0; }
.stats-table .head-code { display: inline-flex; align-items: center; gap: var(--s-2); }
.stats-table .head-code .series-swatch { width: 16px; }
.stats-table tbody th { padding: 12px 12px 12px 0; text-align: left; vertical-align: top; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border); }
.stats-table td { padding: 12px; text-align: right; vertical-align: top; border-bottom: 1px solid var(--border); }
.stats-table td:last-child { padding-right: 0; }
.stats-main { display: inline-flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 600; }
.stats-sub, .row-hint { display: block; font-size: var(--fs-small); font-weight: 400; color: var(--text-muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface-2); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 48px; padding-block: 28px 36px; font-size: 15px; color: var(--text-2); }
.footer-about { flex: 1 1 280px; min-width: 0; }
.footer-about p:last-child { max-width: 52ch; }
.footer-name { margin-bottom: 6px; font: 600 19px var(--font-serif); color: var(--text); }
.footer-meta { flex: 1 1 280px; margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.footer-meta dt { font-weight: 600; color: var(--text); }
.footer-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Touch targets of at least 44px on phones */
@media (max-width: 760px) {
  .header-actions .segmented button, .btn-secondary { min-height: 44px; }
}
