/* Day overview with its spectrum timelapse (js/day_timelapse.js, ui.js
   showDayOverview). No card: the page is a header, the timelapse and the Water
   strip, and it fills the chart area's height without scrolling.

   Type scale, used nowhere else on this view:
     2.5rem   the frame's time, the one live value and the largest text
     1.25rem  parameter values
     1.125rem the page title (device and date)
     0.875rem the plot's title
     0.75rem  captions, facts, notes
     0.6875rem labels (uppercase) and hour marks
   Mono only for identifiers (device id, experiment id) and the chips the
   sidebar shares. Small text sits on the grey page, so it uses --mid: --dim
   there is under 3:1. */

.day-overview.has-timelapse {
  align-items: stretch; justify-content: flex-start; text-align: left;
  width: 100%; max-width: 1280px; margin: 0 auto; min-height: 0;
  padding: 10px 16px 6px; gap: 16px; color: var(--mid);
}

/* ── Page header ──────────────────────────────────────────────────────── */
.ov-day {
  flex: none; display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px 24px; flex-wrap: wrap;
}
.ov-day-title {
  margin: 0; display: flex; align-items: baseline; gap: 12px;
  font-size: 1.125rem; line-height: 1.3; font-weight: 400;
}
.ov-day-dev { font-family: var(--font-mono); font-weight: 600; color: var(--ink-strong); letter-spacing: -0.01em; }
.ov-day-date { font-family: var(--font-ui); color: var(--mid); }
.ov-day-stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-day-facts { font-size: 0.75rem; color: var(--mid); font-variant-numeric: tabular-nums; }
.ov-day-stats .ov-legend { display: inline-flex; gap: 6px; }
.ov-day-stats .ov-chip { padding: 2px 9px; font-size: 0.6875rem; }

/* ── Timelapse ────────────────────────────────────────────────────────── */
.ov-timelapse { flex: 1 1 auto; min-height: 240px; display: flex; }

.tl {
  flex: 1; min-width: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) 224px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 40px; row-gap: 6px;
}
.tl-label { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; gap: 2px 10px; flex-wrap: wrap; }
.tl-title { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.tl-caption { font-size: 0.75rem; color: var(--mid); }

/* The spectrum: a bare shape on the page, the whole field opens the experiment. */
.tl-stage { grid-column: 1; grid-row: 2; position: relative; min-height: 140px; cursor: pointer; }
.tl-plot { position: absolute; inset: 0; }
.tl-open-hint {
  position: absolute; top: 6px; right: 0; pointer-events: none;
  padding: 3px 10px; border-radius: 999px; background: var(--ink); color: var(--panel);
  font-size: 0.6875rem; font-weight: 600; opacity: 0; transform: translateY(-2px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.tl-stage:hover .tl-open-hint { opacity: 0.9; transform: none; }
.tl-empty {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 0.875rem; font-weight: 600; color: var(--ink);
}
.tl-empty[hidden] { display: none; }
.tl-empty small { font-size: 0.75rem; font-weight: 400; color: var(--mid); }

/* ── Readout ──────────────────────────────────────────────────────────── */
.tl-side {
  grid-column: 2; grid-row: 1 / 4; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.tl-when { display: flex; align-items: baseline; gap: 6px; }
.tl-time {
  font-family: var(--font-ui); font-size: 2.5rem; font-weight: 600; line-height: 0.95;
  letter-spacing: -0.03em; color: var(--ink-strong); font-variant-numeric: tabular-nums;
}
.tl-utc { font-size: 0.75rem; font-weight: 600; color: var(--mid); }
.tl-id { display: flex; align-items: center; gap: 8px; margin-top: -8px; }
.tl-id .ov-chip { padding: 2px 9px; font-size: 0.6875rem; }
.tl-exp { font-family: var(--font-mono); font-size: 0.75rem; color: var(--mid); }

.tl-readout { display: flex; flex-direction: column; gap: 14px; }
.tl-params { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.tl-param { min-width: 0; }
.tl-param dt {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--mid);
}
.tl-param dd, .tl-v {
  margin: 2px 0 0; font-family: var(--font-ui); font-size: 1.25rem; font-weight: 500; line-height: 1.2;
  color: var(--ink-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.tl-sym { text-transform: none; letter-spacing: 0; font-size: 0.8125rem; }
.tl-u { margin-left: 3px; font-size: 0.75rem; font-weight: 500; color: var(--mid); letter-spacing: 0; }

.tl-water { display: flex; align-items: center; gap: 12px; }
.tl-swatch {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--line-soft);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  transition: background-color 200ms var(--ease);
}
.tl-water-text { display: flex; flex-direction: column; }
.tl-water .tl-v { margin: 0; }
.tl-sub { font-size: 0.75rem; color: var(--mid); }

.tl-note {
  margin: 0; padding-left: 10px; border-left: 2px solid var(--warn);
  font-size: 0.75rem; line-height: 1.45; color: var(--ink);
}
.tl-facts { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.75rem; line-height: 1.4; color: var(--mid); }

.tl-open {
  margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 0.8125rem; font-weight: 600; text-decoration: none;
  transition: background var(--t-fast) var(--ease);
}
.tl-open:hover { background: var(--accent-strong); }
.tl-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Scrubber: the day as a time axis, one tick per experiment ────────── */
.tl-scrub { grid-column: 1; grid-row: 3; display: flex; align-items: flex-start; gap: 14px; padding-top: 10px; }
.tl-play {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tl-play:hover { background: var(--panel); }
.tl-play.is-playing { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.tl-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tl-track { position: relative; flex: 1; min-width: 0; height: 44px; cursor: pointer; touch-action: none; outline: none; }
.tl-rail { position: absolute; left: 0; right: 0; top: 14px; height: 1px; background: var(--line-strong); }
.tl-tick {
  position: absolute; top: 7px; width: 3px; height: 15px; margin-left: -1.5px; border-radius: 2px;
  background: var(--line-strong); pointer-events: none;
}
.tl-tick.s-good { background: var(--good); }
.tl-tick.s-warn { background: var(--warn); }
.tl-tick.s-bad  { background: var(--bad); }
.tl-tick.s-test { background: #8a929e; }
.tl-tick.is-empty { top: 12px; height: 5px; opacity: 0.55; }
.tl-thumb {
  position: absolute; top: 1px; width: 11px; height: 27px; margin-left: -5.5px; border-radius: 6px;
  border: 2px solid var(--ink-strong); background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none; transition: left 140ms var(--ease);
}
.tl-track:focus-visible .tl-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.tl-hours { position: absolute; left: 0; right: 0; top: 30px; height: 14px; pointer-events: none; }
.tl-hours span {
  position: absolute; transform: translateX(-50%);
  font-size: 0.6875rem; color: var(--mid); font-variant-numeric: tabular-nums;
}
.tl-hours span.is-start { transform: none; }
.tl-hours span.is-end { transform: translateX(-100%); }
.tl-hover {
  position: absolute; bottom: calc(100% - 4px); transform: translateX(-50%); pointer-events: none;
  padding: 2px 8px; border-radius: var(--r-md); background: var(--ink); color: var(--panel);
  font-size: 0.6875rem; white-space: nowrap; z-index: 2; font-variant-numeric: tabular-nums;
}
.tl-hover[hidden] { display: none; }

/* ── States ───────────────────────────────────────────────────────────── */
.tl-msg {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px;
  font-size: 0.875rem; color: var(--mid);
}
.tl-error { color: var(--bad); }
.tl-retry {
  padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--ink); font: inherit; font-size: 0.75rem; cursor: pointer;
}

/* ── Water strip under the scrubber ───────────────────────────────────── */
.has-timelapse .ov-water {
  flex: none; max-width: none; margin: 0; padding-top: 10px; border-top: 1px solid var(--line);
}
.has-timelapse .ov-water-head { margin-bottom: 2px; }
.has-timelapse .ov-water-row, .has-timelapse .ov-water-site { font-size: 0.75rem; }
.has-timelapse .ov-water-when { font-size: 0.6875rem; color: var(--mid); letter-spacing: 0.07em; }
.has-timelapse .ov-water-deg { font-family: var(--font-ui); font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* The list row of the frame on show. Hidden while an experiment is open, when
   the list's .active row is the one that counts. */
.exp-item.is-previewed { box-shadow: inset 0 0 0 1px var(--accent); }
.exp-item.is-previewed::before { background: var(--accent); opacity: 0.55; }
#expList:has(.exp-item.active) .exp-item.is-previewed:not(.active) { box-shadow: none; }
#expList:has(.exp-item.active) .exp-item.is-previewed:not(.active)::before { background: transparent; }

@media (max-width: 760px) {
  .ov-timelapse { min-height: 0; flex: none; }
  .tl { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 220px auto auto; }
  .tl-side { grid-column: 1; grid-row: 4; padding-top: 12px; }
  .tl-scrub { grid-row: 3; }
}


.ov-online { flex: none; width: 100%; min-width: 0; text-align: left; }
.ov-online h2 { font-size: 0.875rem; color: var(--ink); margin: 0 0 6px; }
.ov-online h2 small { font-size: 0.75rem; font-weight: 400; color: var(--mid); }
.ov-online p { font-size: 0.75rem; margin: 6px 0; }
.ov-online-list { max-height: 240px; overflow: auto; }
.ov-online table { border-collapse: collapse; width: 100%; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.ov-online th, .ov-online td { text-align: left; padding: 8px 12px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.ov-online th { font-size: 0.75rem; color: var(--mid); }
