/* Màn Tổng quan (ov-), Theo tuần (wk-), biểu đồ (chart-), bản đồ (map-). Mọi giá trị lấy từ tokens.css. */

/* ---------- Tổng quan ---------- */
.ov-hero { display: grid; gap: var(--s-2); padding-block: var(--s-4) var(--s-2); }
.ov-hero-lead { font-size: var(--fs-lg); color: var(--ink-soft); }
.ov-hero-figure {
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: var(--lh-tight);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--s-4);
}
.ov-hero-num {
  font-size: var(--fs-hero);
  font-weight: 700;
  color: var(--blue-deep);
  font-variant-numeric: proportional-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.ov-hero-meta { color: var(--ink-soft); max-width: 80ch; }

.ov-prov {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-5);
  display: grid;
  gap: var(--s-5);
}
.ov-prov-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3) var(--s-5); }
.ov-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); padding: 2px; background: var(--paper); }
.ov-switch-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--s-2) var(--s-4);
  border-radius: calc(var(--r-md) - 2px);
  cursor: pointer;
}
.ov-switch-btn:hover { color: var(--ink); }
.ov-switch-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.ov-prov-body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  gap: var(--s-6);
  align-items: start;
  transition: opacity .15s;
}
.ov-prov-body.is-loading { opacity: .55; }
.ov-map { position: relative; margin: 0; }
.ov-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
.ov-side h3 { margin-bottom: var(--s-2); }
.ov-rank-no { color: var(--ink-soft); width: 3.5em; }
.ov-rank tbody tr.is-on td { background: var(--amber-wash); }
.ov-rank-share { display: inline-flex; align-items: center; gap: var(--s-2); }
.ov-rank-bar { display: inline-block; width: 44px; height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.ov-rank-bar > span { display: block; height: 100%; background: var(--seq-4); border-radius: 999px; }
.ov-more {
  margin-top: var(--s-3);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s-1) var(--s-3);
  color: var(--blue);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.ov-more:hover { border-color: var(--blue); }
.ov-unknown { font-size: var(--fs-sm); color: var(--ink-soft); border-top: 1px solid var(--line-soft); padding-top: var(--s-3); }
.ov-unknown strong { color: var(--ink); }

.ov-grid, .wk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--s-6) var(--s-7); }
.ov-block, .wk-block { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); align-content: start; }
.ov-note { max-width: 70ch; }

/* ---------- Bản đồ ---------- */
.map-stage { position: relative; }
.map-svg { display: block; width: 100%; height: auto; }
.map-prov { fill: var(--tone); stroke: var(--surface); stroke-width: 0.6; stroke-linejoin: round; cursor: pointer; outline: none; }
.map-prov path { vector-effect: non-scaling-stroke; }
/* Đảo nhỏ dưới một điểm ảnh: viền cùng màu tỉnh để hiện thành chấm thấy được. */
.map-prov .map-tiny { stroke: var(--tone); stroke-width: 2.5; }
.map-prov.is-on { fill: var(--amber-bright); --tone: var(--amber-bright); }
.map-prov:focus-visible { stroke: var(--ink); stroke-width: 1.5; }
.map-place {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  white-space: nowrap;
  pointer-events: none;
}
/* Ô đọc số nổi trên vùng biển phía đông bắc, nơi bản đồ không có hình nào. */
.map-readout {
  position: absolute;
  top: 0;
  right: 0;
  width: 44%;
  display: grid;
  gap: var(--s-1);
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--amber-bright);
  background: var(--surface);
}
.map-readout-name { font-weight: 600; line-height: var(--lh-tight); }
.map-readout-num { font-size: var(--fs-xl); font-weight: 700; line-height: var(--lh-tight); font-variant-numeric: proportional-nums; }
.map-readout-num span { font-size: var(--fs-sm); font-weight: 400; color: var(--ink-soft); }
.map-readout-sub, .map-readout-hint { font-size: var(--fs-sm); color: var(--ink-soft); }
.map-readout-sub strong { color: var(--ink); font-weight: 500; }

.map-legend { display: grid; gap: var(--s-1); font-size: var(--fs-sm); }
.map-legend li { display: flex; align-items: center; gap: var(--s-2); }
.map-swatch { width: 28px; height: 14px; border-radius: var(--r-sm); background: var(--tone); flex: none; box-shadow: inset 0 0 0 1px var(--line-soft); }

/* ---------- Biểu đồ ---------- */
.chart-bars { container-type: inline-size; display: grid; gap: var(--s-2); }
.chart-bar {
  display: grid;
  grid-template-columns: minmax(7em, 40%) minmax(0, 1fr) calc(var(--chart-value-w) + 1ch);
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-sm);
}
.chart-bar-label { line-height: var(--lh-tight); }
.chart-bar-track { height: 12px; background: var(--line-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.chart-bar-fill { display: block; height: 100%; background: var(--seq-5); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.chart-bar-value { text-align: right; white-space: nowrap; font-weight: 500; }
.chart-bar-note { color: var(--ink-soft); font-weight: 400; margin-left: var(--s-2); }
@container (max-width: 380px) {
  .chart-bar { grid-template-columns: minmax(0, 1fr) calc(var(--chart-value-w) + 1ch); row-gap: var(--s-1); }
  .chart-bar-label { grid-column: 1 / -1; }
}

.chart-seg-wrap { display: grid; gap: var(--s-3); }
.chart-seg { display: flex; gap: 2px; height: 28px; }
.chart-seg-part { min-width: 2px; flex-basis: 0; border-radius: var(--r-sm); display: flex; align-items: center; padding-inline: var(--s-2); overflow: visible; }
.chart-seg-text { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.chart-seg-part.is-tight .chart-seg-text { visibility: hidden; }
.chart-tone-strong { background: var(--seq-5); color: var(--surface); }
.chart-tone-mid { background: var(--seq-3); color: var(--ink); }
.chart-tone-none { background: var(--no-data); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.chart-legend { display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s-1) var(--s-3); font-size: var(--fs-sm); align-items: center; }
.chart-legend li { display: contents; }
.chart-swatch { width: 12px; height: 12px; border-radius: var(--r-sm); }
.chart-legend-value, .chart-legend-share { text-align: right; }

.chart-line-fig { margin: 0; display: grid; gap: var(--s-2); }
.chart-readout { font-size: var(--fs-sm); min-height: calc(var(--fs-sm) * var(--lh-body) * 2); }
.chart-line-box { width: 100%; min-width: 0; }
.chart-line { display: block; overflow: visible; }
.chart-line:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: 4px; }
.chart-axis { fill: var(--ink-soft); font-size: var(--fs-xs); }
.chart-end { fill: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-baseline { stroke: var(--line); stroke-width: 1; }
.chart-path { fill: none; stroke: var(--seq-5); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--seq-5); fill-opacity: .1; }
.chart-dot { fill: var(--seq-5); stroke: var(--surface); stroke-width: 2; }
.chart-dot.is-active { fill: var(--amber-bright); }
.chart-cross { stroke: var(--line); stroke-width: 1; }
.chart-hit { fill: transparent; }

.chart-table summary { cursor: pointer; color: var(--blue); font-size: var(--fs-sm); width: fit-content; }
.chart-table table { margin-top: var(--s-2); }

/* ---------- Theo tuần ---------- */
.wk-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--s-4) var(--s-6); }
.wk-title { display: grid; gap: var(--s-2); }
.wk-title h1 { font-size: var(--fs-2xl); }
.wk-picker { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.wk-step, .wk-select select {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.wk-step:hover:not(:disabled), .wk-select select:hover { border-color: var(--blue); }
.wk-step:disabled { color: var(--ink-soft); background: var(--paper); cursor: default; }

.wk-tiles { display: grid; gap: var(--s-3); }
.wk-tile-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.wk-tile { padding: var(--s-4) var(--s-5); display: grid; gap: var(--s-1); align-content: start; border-left: 1px solid var(--line-soft); margin-left: -1px; }
.wk-tile dt { color: var(--ink-soft); font-size: var(--fs-sm); }
.wk-tile-num { font-size: var(--fs-2xl); font-weight: 600; line-height: var(--lh-tight); font-variant-numeric: proportional-nums; }
.wk-tile-delta { font-size: var(--fs-sm); color: var(--ink-soft); }
.wk-first { max-width: 70ch; }

.wk-changes { display: grid; gap: var(--s-5) var(--s-7); align-items: start; }
.wk-changes td:nth-child(-n+2) { white-space: nowrap; }
@media (min-width: 1100px) { .wk-changes { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.wk-changes-share { display: grid; gap: var(--s-3); }
.wk-empty { color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: var(--s-5); max-width: 70ch; }
.wk-better { color: var(--good); }
.wk-worse { color: var(--bad); }
.wk-dq td:first-child { min-width: 16em; }

/* ---------- Màn hẹp ---------- */
@media (max-width: 900px) {
  .ov-prov-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .ov-prov { padding: var(--s-4); }
  .map-readout { position: static; width: auto; margin-top: var(--s-3); }
  .ov-rank-bar { display: none; }
  .ov-rank th, .ov-rank td { padding-inline: var(--s-1); }
  .ov-rank-no { width: auto; }
  .wk-title h1 { font-size: var(--fs-xl); }
  .wk-tile { padding: var(--s-3) var(--s-4); }
}
