/* Hearthmist module styles: stats — the Records tab.
   A chart here draws one resource in that resource's own colour (--c), and nothing else is tinted with it. */

/* ---------- income: one ruled row per resource ---------- */

.stats-list { margin-top: var(--s2); }
.stats-res {
  display: grid;
  grid-template-columns: 20px 68px minmax(0, 1fr) 72px;
  align-items: center;
  column-gap: var(--s2);
  min-height: 40px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.stats-res:first-child { border-top: 0; }
.stats-res > .ic { width: 19px; height: 19px; }
.stats-name {
  overflow: hidden;
  font-family: var(--serif);
  font-size: var(--fs-name);
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.12s;
}
.stats-res:hover .stats-name, .stats-res.on .stats-name { color: var(--gold); }
.stats-net { text-align: right; font-size: var(--fs-text); font-weight: 700; white-space: nowrap; }

.stats-spark { display: block; width: 100%; height: 24px; overflow: visible; pointer-events: none; }
.stats-line {
  fill: none;
  stroke: var(--c);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.stats-spark .stats-line { stroke-width: 1.5; }
.stats-zero { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.stats-spark .stats-zero { stroke: var(--line); }
.stats-area { fill: var(--c); fill-opacity: 0.08; stroke: none; }

/* ---------- the open resource ---------- */

.stats-detail {
  margin: 0 0 var(--s4);
  padding: 0 0 2px var(--s3);
  border-left: 2px solid var(--gold);
}
.stats-detail .sec { margin-top: 18px; }
.stats-none { margin-top: var(--s2); font-size: var(--fs-text); }

.stats-range { display: flex; gap: var(--s4); }
.stats-tog {
  padding: 5px 0 3px;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
}
.stats-tog:hover { color: var(--text); }
.stats-tog[aria-pressed="true"] { border-bottom-color: var(--gold); color: var(--text); }

.stats-chart { margin: var(--s2) 0 0; }
.stats-chart + .stats-chart { margin-top: var(--s3); }
.stats-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
  font-size: var(--fs-small);
  color: var(--muted);
}
.stats-cap b { color: var(--text); white-space: nowrap; }
.stats-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  column-gap: var(--s2);
  margin-top: var(--s1);
}
.stats-plot { position: relative; height: 104px; cursor: crosshair; touch-action: pan-y; }
.stats-stock .stats-plot { height: 52px; }
.stats-plot svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
/* The stockpile is the quieter of the two: a thinner line, no wash. */
.stats-stock .stats-line { stroke-width: 1.5; stroke-opacity: 0.8; }

.stats-dot {
  position: absolute;
  right: -4px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px var(--panel);
  pointer-events: none;
}
.stats-pt { right: auto; margin-left: -4px; background: var(--text); }
.stats-cross {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--muted);
  pointer-events: none;
}

.stats-ax { position: relative; font-size: var(--fs-micro); color: var(--muted); }
.stats-ax span { position: absolute; right: 0; line-height: 1; white-space: nowrap; transform: translateY(-50%); }
.stats-x {
  display: flex;
  justify-content: space-between;
  grid-column: 1;
  margin-top: var(--s1);
  font-size: var(--fs-micro);
  color: var(--muted);
}

/* ---------- where it comes from, where it goes ---------- */

.stats-src { padding: 3px 0 5px; }
.sec + .stats-src { margin-top: 5px; }
.stats-src .stat { padding-bottom: 2px; }
.stats-src .stat > span .ic { width: 17px; height: 17px; margin-right: 7px; align-self: center; color: var(--gold); }
.stats-src .stat > span { color: var(--text); white-space: nowrap; }
.stats-src .stat > b small { display: inline-block; min-width: 44px; margin-left: var(--s2); color: var(--muted); font-size: var(--fs-small); font-weight: 400; text-align: right; }
.stats-meter { height: 4px; background: var(--ink); border-radius: 2px; overflow: hidden; }
.stats-meter i { display: block; height: 100%; min-width: 2px; background: var(--c); border-radius: 0 2px 2px 0; }
/* What is used is drawn hollow, so the two lists differ by more than their headings. */
.stats-meter.used i { background: none; border: 1px solid var(--c); }
.stats-note { margin-top: 3px; font-size: var(--fs-small); line-height: 1.35; }
.stats-left { margin-top: var(--s1); }

/* ---------- figures in columns: the forecast, and what was made and used ---------- */

.stats-table { width: 100%; margin-top: var(--s2); border-collapse: collapse; font-size: var(--fs-text); }
.stats-table caption { margin-bottom: 2px; text-align: left; caption-side: top; }
.stats-table th, .stats-table td { padding: 3px 0; font-weight: 400; text-align: right; white-space: nowrap; }
.stats-table th[scope="row"] { width: 100%; color: var(--muted); text-align: left; }
.stats-table th[scope="row"] .ic { width: 17px; height: 17px; margin-right: 7px; }
.stats-table thead th { padding-bottom: 1px; color: var(--muted); font-size: var(--fs-small); }
.stats-table td { min-width: 62px; padding-left: var(--s4); font-weight: 700; }
.stats-table td.good { color: var(--good); }
.stats-table td.bad { color: var(--bad); }
.stats-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- the fire, tier by tier ---------- */

.stats-tiers { display: flex; gap: 2px; height: 6px; margin: 10px 0 6px; }
.stats-tiers i { flex: 1 1 0; min-width: 3px; background: var(--ember-2); border-radius: 1px; }
.stats-tiers i:first-child { border-radius: 2px 1px 1px 2px; }
.stats-tiers i:last-child { border-radius: 1px 2px 2px 1px; }

@media (max-width: 820px) {
  .stats-res { grid-template-columns: 20px 72px minmax(0, 1fr) 76px; min-height: 44px; }
  .stats-plot { height: 96px; }
  .stats-tog { min-height: 36px; }
}
