/* The History page (history.html, history.js): a grid of outlets by month, then the same months as a curve.
   Everything sits under .hist so the shared classes of pages.css (.hero, .row, .more) stay untouched. */
.hist { --labw: 150px; padding-bottom: 24px; }
.hist .h-intro { padding: 32px 0 40px; }
/* On wide screens the live figure sits beside the title instead of under it. */
@media (min-width: 901px) {
  .hist .h-top { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 clamp(32px, 5vw, 72px); align-items: end; padding: 32px 0 36px; }
  .hist .h-top .h-intro { padding: 0; }
  .hist .h-top .h-hero { border-top: 0; padding: 0; flex-direction: column; align-items: stretch; gap: 18px; }
  .hist .h-top .h-lead { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hist .h-top .h-facts { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--rule); }
}
.hist h1 { margin: 0; max-width: 16em; font-size: clamp(34px, 5.2vw, 60px); line-height: 1.04; font-weight: 500; letter-spacing: -0.035em; text-wrap: balance; }
.hist .h-dek { margin: 18px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.5; max-width: 40em; text-wrap: pretty; }
.hist .h-cov { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-3); max-width: 46em; text-wrap: pretty; }
.hist .h-cov b { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.hist .h-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 16px clamp(24px, 4vw, 56px); padding: 22px 0; border-top: 1px solid var(--rule); }
.hist .h-lead { display: flex; align-items: center; gap: 20px; min-width: 0; flex: 0 1 auto; }
.hist .h-big { display: flex; align-items: baseline; font-size: clamp(60px, 9vw, 92px); line-height: 1; font-weight: 500; letter-spacing: -0.04em; color: var(--block); font-variant-numeric: tabular-nums; flex: none; }
.hist .h-big small { font-size: .46em; letter-spacing: 0; margin-left: .06em; font-weight: 500; }
.hist .h-ht { flex: 1 1 auto; min-width: 0; }
.hist .h-month { font-family: var(--mono); font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.hist .h-sub { color: var(--ink); font-size: 18px; line-height: 1.3; max-width: 22em; text-wrap: balance; }
.hist .h-facts { display: flex; gap: 32px; flex: none; padding-left: clamp(24px, 4vw, 56px); border-left: 1px solid var(--rule); }
.hist .h-fact { text-align: left; }
.hist .h-fact b { display: block; font-size: 40px; line-height: 1.1; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hist .h-fact b.nm { color: var(--block); }
.hist .h-fact span { display: block; font-size: 13px; color: var(--ink-2); }

.hist .h-controls { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; padding: 14px 0; border-top: 1px solid var(--rule); }
.hist .h-player { flex: 1 1 320px; display: flex; align-items: center; gap: 18px; min-width: 0; }
.hist .h-filters { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.hist .h-ctl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.hist .h-ctl.off { opacity: .35; pointer-events: none; }
.hist select { font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 8px; height: 34px; padding: 0 28px 0 10px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23777' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.hist select:focus-visible, .hist button:focus-visible, .hist input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hist .h-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; height: 34px; }
.hist .h-seg button { font: inherit; font-size: 14px; background: #fff; color: var(--ink-2); border: 0; padding: 0 12px; cursor: pointer; }
.hist .h-seg button + button { border-left: 1px solid var(--rule); }
.hist .h-seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
.hist .h-play { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 500; background: var(--ink); color: #fff; border: 0; border-radius: 999px; height: 34px; padding: 0 16px 0 13px; cursor: pointer; width: 96px; flex: none; }
.hist .h-play svg { width: 13px; height: 13px; fill: #fff; }
.hist .h-scrub { flex: 1 1 auto; display: flex; align-items: center; min-width: 80px; }
.hist input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; margin: 0; height: 24px; background: transparent; cursor: pointer; --p: 0%; }
.hist input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--ink) var(--p), var(--rule) var(--p)); }
.hist input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rule); }
.hist input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
.hist input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
.hist input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }

.hist .h-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 0 18px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); }
.hist .h-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
@media (max-width: 420px) { .hist .h-legend em { display: none; } }
.hist .sw { width: 14px; height: 14px; border-radius: 2px; display: inline-block; flex: none; }
.hist .sw.block { background: var(--block); }
.hist .sw.wild { background: repeating-linear-gradient(135deg, var(--block) 0 1.5px, oklch(0.58 0.19 33 / .14) 1.5px 4px); }
.hist .sw.partial { background: var(--partial); }
.hist .sw.allow { background: oklch(0.64 0.14 155 / .3); }
.hist .sw.none { background: var(--soft); box-shadow: inset 0 0 0 1px oklch(0.84 0.006 80); }
.hist .sw.ramp { width: 90px; background: linear-gradient(90deg, oklch(0.58 0.19 33 / .06), var(--block)); }
.hist .h-legend em { font-style: normal; color: var(--ink-3); }

.hist .h-chart { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.hist .h-grid { display: flex; width: max-content; min-width: 100%; }
.hist .h-lab { position: sticky; left: 0; z-index: 3; background: #fff; flex: none; width: var(--labw); padding-right: 10px; }
.hist .h-lab .r { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; }
.hist .h-lab .r a { text-decoration: none; }
.hist .h-lab .r a:hover { color: var(--ink); text-decoration: underline; }
.hist .h-lab .r.k { font-family: var(--sans); font-size: 13px; }
.hist .h-lab .r.k.first { color: var(--ink); font-weight: 500; }
.hist .h-lab .hd { height: 22px; }
.hist .h-lab .sp { position: relative; margin-bottom: 8px; font-size: 11px; color: var(--ink-3); }
.hist .h-lab .sp b { position: absolute; left: 0; top: 0; font-weight: 400; line-height: 14px; color: var(--ink-2); }
.hist .h-lab .sp i { position: absolute; right: 10px; font-style: normal; font-family: var(--mono); font-size: 10px; line-height: 10px; margin-top: -5px; color: var(--ink-3); }
.hist .h-plot { position: relative; flex: none; }
.hist .h-axis { position: relative; height: 22px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.hist .h-axis span { position: absolute; top: 4px; border-left: 1px solid oklch(0.8 0.006 80); padding-left: 4px; height: 18px; line-height: 14px; }
.hist canvas { display: block; }
.hist #spark { margin-bottom: 8px; }
.hist #heat { position: relative; touch-action: pan-x pan-y; }
.hist #hl { position: absolute; pointer-events: none; border: 1.5px solid var(--ink); border-radius: 2px; display: none; }
.hist .h-more { display: flex; gap: 12px; align-items: center; padding: 16px 0; font-size: 14px; color: var(--ink-3); flex-wrap: wrap; }
.hist .h-more button { font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.hist .h-more button:hover { border-color: var(--ink-3); }
.hist .h-note { color: var(--ink-3); font-size: 13px; max-width: 52em; margin: 0; padding: 4px 0 0; }
.hist .h-err { color: var(--block); padding: 40px 0; display: none; }

/* The curve. */
.hist .h-curve { border-top: 1px solid var(--rule); margin-top: 48px; padding-top: 40px; }
.hist h2 { margin: 0 0 10px; font-size: 26px; line-height: 1.2; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
.hist h2 em { font-style: normal; color: var(--block); }
.hist .h-lede { color: var(--ink-2); max-width: 62ch; margin: 0 0 20px; font-size: 15px; }
.hist .c-key { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; font-size: 13px; color: var(--ink-2); margin: 6px 0 12px; }
.hist .c-key span { display: inline-flex; align-items: center; gap: 7px; }
.hist .c-key s { display: inline-block; width: 14px; height: 10px; text-decoration: none; }
.hist .c-ctl { margin-left: auto; display: flex; gap: 8px; }
.hist .c-ctl button { font: inherit; font-size: 13.5px; font-weight: 500; color: #fff; background: var(--ink); border: 1px solid var(--ink); border-radius: 6px; padding: 4px 14px; cursor: pointer; min-width: 78px; }
.hist .c-ctl button.ghost { background: #fff; color: var(--ink); border-color: var(--rule); }
.hist .c-ctl button:disabled { opacity: .45; cursor: default; }
.hist #curve { position: relative; touch-action: pan-y; }
.hist #curve svg { display: block; width: 100%; overflow: visible; }
.hist #curve svg text { font-family: var(--sans); }
.hist .tick { font-size: 11.5px; fill: var(--ink-3); font-family: var(--mono) !important; }
.hist .evt { font-size: 11px; fill: var(--ink-2); }
.hist .seam { font-size: 11px; fill: var(--ink-3); }
.hist .lab { transition: opacity .9s ease; }
.hist .lab text { font-family: var(--mono) !important; font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; }
.hist .lab text.more { fill: var(--ink-3); }
.hist .lab line { stroke: var(--block); stroke-width: 1; opacity: .5; }
.hist .lab.out { opacity: 0; }
.hist .c-read { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 40px; border-top: 1px solid var(--rule); padding: 18px 0 8px; margin-top: 6px; min-height: 150px; }
.hist .c-read .mo { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.hist .c-read .big { font-size: 46px; line-height: 1.05; font-weight: 500; letter-spacing: -0.02em; margin: 2px 0 4px; font-variant-numeric: tabular-nums; color: var(--block); }
.hist .c-read p { margin: 0; color: var(--ink-2); font-size: 14px; }
.hist .c-split { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.hist .c-split b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.hist .c-sw h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.hist .c-sw ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px 6px; }
.hist .c-sw li { font-family: var(--mono); font-size: 12.5px; border: 1px solid var(--rule); border-radius: 4px; padding: 1px 8px; }
.hist .c-sw li a { text-decoration: none; }
.hist .c-sw li.more { border-color: transparent; color: var(--ink-3); }
.hist .h-src { margin: 32px 0 0; padding-top: 18px; border-top: 1px solid var(--rule); }
.hist .h-src p { color: var(--ink-3); font-size: 13px; max-width: 62em; margin: 0; }

#h-tip { position: fixed; z-index: 20; pointer-events: none; background: #fff; border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 8px 28px oklch(0.22 0.01 60 / .14); padding: 10px 12px; font-size: 13px; max-width: 260px; display: none; line-height: 1.4; }
#h-tip .d { font-family: var(--mono); font-weight: 500; font-size: 13px; }
#h-tip .m { color: var(--ink-3); font-size: 12px; margin-bottom: 4px; }
#h-tip .s { font-weight: 500; } #h-tip .s.b { color: var(--block); } #h-tip .s.a { color: var(--allow-text); } #h-tip .s.p { color: oklch(0.55 0.13 65); } #h-tip .s.n { color: var(--ink-3); }
#h-tip ul { margin: 4px 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 12px; }
#h-tip li i { font-style: normal; color: var(--ink-3); }

@media (max-width: 900px) {
  .hist .h-facts { flex-basis: 100%; padding-left: 0; border-left: 0; }
}
@media (max-width: 640px) {
  .hist { --labw: 142px; }
  .hist .h-lab .r { font-size: 10.5px; }
  .hist .h-lab .r.k { font-size: 11.5px; }
  .hist .h-player { flex-basis: 100%; }
  .hist .h-filters { width: 100%; }
  .hist .h-filters .h-ctl { flex: 1 1 100%; }
  .hist .h-filters .h-ctl select { flex: 1; min-width: 0; }
  .hist .h-big { min-width: 0; }
  .hist .c-read { grid-template-columns: 1fr; min-height: 0; }
  .hist .c-read .big { font-size: 38px; }
  .hist .c-ctl { margin-left: 0; width: 100%; }
}
