/* Half-hourly data viewer (section#hh). Every rule is scoped under #hh.
   Built from the shared classes in tools.css (.tool-head .btn .seg .field .label .note .alerts); the rules below are only this tool's own layout.
   Tokens fall back to the site palette, so the tool also stands on a page without tools.css. */
#hh { --hh-rule: var(--rule, rgba(31, 29, 26, .16)); --hh-strong: var(--rule-strong, rgba(31, 29, 26, .34)); --hh-soft: var(--ink-soft, rgba(31, 29, 26, .74)); --hh-faint: var(--ink-faint, rgba(31, 29, 26, .5));
  --hh-serif: var(--serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif); }
#hh .hh-hide { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- the way in ---------- */
#hh .hh-in { display: grid; gap: 18px; margin-top: 24px; }
#hh .hh-drop {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 44px 20px 36px; border: 1px dashed var(--hh-strong); border-radius: 4px; background: rgba(239, 235, 226, .5);
  transition: border-color .2s, background-color .2s;
}
#hh .hh-drop.is-over { border-style: solid; border-color: var(--clay-deep, #A85538); background: rgba(201, 111, 78, .1); }
#hh .hh-glyph { width: 150px; height: auto; overflow: visible; }
#hh .hh-glyph rect { fill: var(--clay, #C96F4E); }
#hh .hh-glyph rect:nth-child(-n+6), #hh .hh-glyph rect:nth-child(n+20) { fill: var(--hh-strong); }
#hh .hh-glyph path { fill: none; stroke: var(--ink, #1F1D1A); stroke-width: 1; }
#hh .hh-drop-title { margin-top: 18px; font-family: var(--hh-serif); font-size: 26px; line-height: 1.2; }
#hh .hh-drop-sub { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; color: var(--hh-soft); }
#hh .hh-drop-sub .btn { min-width: 190px; min-height: 46px; font-size: 15px; }
#hh .hh-sample { background: var(--cream, #F7F4EC); border-width: 1.5px; font-weight: 600; }
#hh .hh-sample:hover { background: var(--ink, #1F1D1A); }
#hh .hh-kinds { margin-top: 18px; font-size: 13.5px; color: var(--hh-soft); }
#hh .hh-private { display: flex; align-items: center; gap: 9px; margin-top: 8px; font-size: 13.5px; color: var(--hh-soft); }
#hh .hh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--clay, #C96F4E); box-shadow: 0 0 0 4px rgba(201, 111, 78, .1); }
#hh .hh-units { align-items: flex-start; }
#hh .hh-units .note { margin-top: 2px; }
#hh .hh-error strong { font-weight: 600; }
#hh .alerts li.hh-error { display: block; }

/* once a report is showing, the way in folds down to a strip */
#hh.hh-has .hh-in { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 28px; }
#hh.hh-has .hh-drop { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 8px 16px; padding: 12px 16px; text-align: left; }
#hh.hh-has .hh-glyph, #hh.hh-has .hh-kinds, #hh.hh-has .hh-or, #hh.hh-has .hh-private { display: none; }
#hh.hh-has .hh-drop-title { margin: 0; font-size: 17px; }
#hh.hh-has .hh-drop-sub { margin: 0; gap: 8px; }
#hh.hh-has .hh-drop-sub .btn { min-width: 0; min-height: 36px; font-size: 14px; }
#hh.hh-has .hh-units .note { display: none; }

/* ---------- the report ---------- */
#hh .hh-report { margin-top: 26px; }
#hh .hh-found { font-size: 13.5px; line-height: 1.5; color: var(--hh-soft); padding: 10px 14px; border-left: 2px solid var(--clay, #C96F4E); background: rgba(239, 235, 226, .55); }
#hh .hh-rep-head { margin-top: 30px; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink, #1F1D1A); }
#hh .hh-rep-title { margin-top: 4px; font-family: var(--hh-serif); font-weight: 700; font-size: 26px; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: lining-nums; }

#hh .hh-figs { display: grid; }
#hh .hh-figs-big { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#hh .hh-figs-small { grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--hh-rule); }
#hh .hh-fig { padding: 16px 18px 16px 0; min-width: 0; }
#hh .hh-fig + .hh-fig { padding-left: 18px; border-left: 1px solid var(--hh-rule); }
#hh .hh-figs-small .hh-fig { border-top: 1px solid var(--hh-rule); padding-top: 13px; padding-bottom: 14px; }
#hh .hh-val { margin-top: 5px; white-space: nowrap; }
#hh .hh-num { font-family: var(--hh-serif); font-size: 24px; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em; }
#hh .hh-fig-big .hh-num { font-size: 42px; }
#hh .hh-unit { font-family: var(--hh-serif); font-size: 16px; color: var(--hh-soft); }
#hh .hh-fig-big .hh-unit { font-size: 19px; }
#hh .hh-sub { margin-top: 5px; font-size: 12.5px; line-height: 1.4; color: var(--hh-soft); font-variant-numeric: lining-nums tabular-nums; text-wrap: pretty; }

#hh .hh-top { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 0 40px; align-items: start; }
#hh .hh-top > .hh-shows { grid-column: 2; grid-row: 1; }
#hh .hh-top > .hh-slot { grid-column: 1; grid-row: 1; min-width: 0; }
#hh .hh-chart { margin: 34px 0 0; min-width: 0; }
#hh .hh-chart-title { margin-top: 3px; font-family: var(--hh-serif); font-weight: 700; font-size: 23px; line-height: 1.15; letter-spacing: -.008em; }
#hh .hh-cap { margin-top: 5px; font-size: 13.5px; color: var(--hh-soft); max-width: 46em; }
#hh .hh-plot { position: relative; margin-top: 14px; }
#hh .hh-plot canvas { display: block; width: 100%; touch-action: pan-y; cursor: crosshair; outline-offset: 4px; }
#hh .hh-tip {
  position: absolute; z-index: 3; pointer-events: none; min-width: 150px; max-width: 260px; padding: 8px 11px 9px;
  background: var(--cream, #F7F4EC); border: 1px solid var(--ink, #1F1D1A); border-radius: 2px; box-shadow: 0 8px 22px -10px rgba(31, 29, 26, .45);
  font-size: 12.5px; line-height: 1.45; font-variant-numeric: lining-nums tabular-nums;
}
#hh .hh-tip p { display: flex; justify-content: space-between; gap: 14px; }
#hh .hh-tip p span { color: var(--hh-soft); }
#hh .hh-tip p b { font-weight: 600; text-align: right; }
#hh .hh-tip .hh-tip-head { display: block; margin-bottom: 3px; padding-bottom: 4px; border-bottom: 1px solid var(--hh-rule); font-weight: 600; }
#hh .hh-chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; margin-top: 10px; }
#hh .hh-details { flex: 1 1 260px; min-width: 0; font-size: 13.5px; }
#hh .hh-details summary { display: inline-block; cursor: pointer; padding: 6px 0; color: var(--hh-soft); text-decoration: underline; text-decoration-color: var(--hh-strong); text-underline-offset: 4px; list-style: none; }
#hh .hh-details summary::-webkit-details-marker { display: none; }
#hh .hh-details summary::before { content: "+"; display: inline-block; width: 1em; text-decoration: none; color: var(--clay-deep, #A85538); font-weight: 600; }
#hh .hh-details[open] summary::before { content: "\2212"; }
#hh .hh-details summary:hover { color: var(--clay-deep, #A85538); }
#hh .hh-details[open] { flex-basis: 100%; }
#hh .hh-scroll { margin-top: 8px; max-height: 340px; overflow: auto; border: 1px solid var(--hh-rule); background: rgba(239, 235, 226, .4); }
#hh .hh-table { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: lining-nums tabular-nums; }
#hh .hh-table caption { text-align: left; padding: 8px 10px; color: var(--hh-soft); caption-side: top; }
#hh .hh-table th, #hh .hh-table td { padding: 5px 10px; text-align: right; white-space: nowrap; border-top: 1px solid var(--hh-rule); }
#hh .hh-table th:first-child { text-align: left; }
#hh .hh-table thead th { position: sticky; top: 0; background: var(--cream, #F7F4EC); font-weight: 600; border-top: 0; box-shadow: 0 1px 0 var(--hh-strong); }
#hh .hh-table tbody th { font-weight: 400; }
#hh .hh-table-wide tbody th, #hh .hh-table-wide thead th:first-child { position: sticky; left: 0; background: var(--cream, #F7F4EC); }
#hh .hh-table-wide thead th:first-child { z-index: 2; }

#hh .hh-shows { margin-top: 34px; padding: 20px 22px 22px; background: rgba(239, 235, 226, .55); border: 1px solid var(--hh-rule); border-top: 1.5px solid var(--clay, #C96F4E); }
#hh .hh-shows ul { margin-top: 10px; display: grid; gap: 11px; }
#hh .hh-shows li { position: relative; padding-left: 16px; font-family: var(--hh-serif); font-size: 16.5px; line-height: 1.42; font-variant-numeric: lining-nums; text-wrap: pretty; }
#hh .hh-shows li::before { content: ""; position: absolute; left: 0; top: .62em; width: 7px; height: 1.5px; background: var(--clay-deep, #A85538); }

#hh .hh-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--hh-rule); }
#hh .hh-foot { margin-top: 18px; }

/* ---------- narrower screens ---------- */
@media (max-width: 1000px) {
  #hh .hh-top { grid-template-columns: minmax(0, 1fr); }
  #hh .hh-top > .hh-shows, #hh .hh-top > .hh-slot { grid-column: 1; grid-row: auto; }
  #hh .hh-figs-big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #hh .hh-figs-big .hh-fig:nth-child(3) { padding-left: 0; border-left: 0; }
  #hh .hh-figs-big .hh-fig:nth-child(n+3) { border-top: 1px solid var(--hh-rule); }
  #hh .hh-figs-small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #hh .hh-figs-small .hh-fig:nth-child(4) { padding-left: 0; border-left: 0; }
}
@media (max-width: 720px) {
  #hh .hh-in { margin-top: 18px; }
  #hh .hh-drop { padding: 30px 14px 26px; }
  #hh .hh-glyph { width: 128px; }
  #hh .hh-drop-title { font-size: 23px; }
  #hh .hh-drop-sub { flex-direction: column; align-self: stretch; gap: 8px; }
  #hh .hh-drop-sub .btn { width: 100%; min-height: 50px; font-size: 16px; }
  #hh .hh-or { font-size: 13px; }
  #hh .hh-units, #hh .hh-units .seg { width: 100%; }
  #hh .hh-units .seg { display: flex; }
  #hh .hh-units .seg label, #hh .hh-units .seg span { flex: 1; }
  #hh .hh-units .seg span { padding-inline: 6px; white-space: normal; text-align: center; }
  #hh.hh-has .hh-in { grid-template-columns: minmax(0, 1fr); }
  #hh.hh-has .hh-drop { padding: 10px; }
  #hh.hh-has .hh-drop-title { display: none; }
  #hh.hh-has .hh-drop-sub { flex-direction: row; flex-wrap: nowrap; width: 100%; }
  #hh.hh-has .hh-drop-sub .btn { flex: 1; min-height: 44px; font-size: 14px; padding-inline: 8px; }
  #hh .hh-report { margin-top: 20px; }
  #hh .hh-rep-title { font-size: 22px; }
  #hh .hh-fig { padding: 13px 10px 13px 0; }
  #hh .hh-fig + .hh-fig { padding-left: 12px; }
  #hh .hh-fig-big .hh-num { font-size: 31px; }
  #hh .hh-fig-big .hh-unit { font-size: 16px; }
  #hh .hh-num { font-size: 22px; }
  #hh .hh-figs-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #hh .hh-figs-small .hh-fig:nth-child(4) { padding-left: 12px; border-left: 1px solid var(--hh-rule); }
  #hh .hh-figs-small .hh-fig:nth-child(odd) { padding-left: 0; border-left: 0; }
  #hh .hh-chart { margin-top: 28px; }
  #hh .hh-chart-title { font-size: 21px; }
  #hh .hh-shows { margin-top: 26px; padding: 16px 14px 18px; }
  #hh .hh-shows li { font-size: 16px; }
  #hh .hh-chart-foot .btn { width: 100%; }
  #hh .hh-details summary { padding: 12px 0; }
  #hh .hh-actions .btn { width: 100%; min-height: 50px; }
  #hh .hh-tip { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) { #hh .hh-drop { transition: none; } }
@media print { #hh .hh-in, #hh .hh-chart-foot, #hh .hh-actions { display: none; } }
