/* ════════════════════════════════════════════════════════════════════════
   Live page (/live) — one sensor's newest measurement on a phone.
   Sits on base.css for tokens only. Phone-first, single column; on a desk
   it is the same column, centred. Declares no colour of its own except the
   spectrum gradient, which is wavelength → light (a measured mapping, drawn
   in live.js), and the pulse on the live dot.
   ════════════════════════════════════════════════════════════════════════ */

/* Author display values (flex, grid…) would otherwise beat the UA's
   [hidden] { display: none } — every hide/show on this page is the attribute. */
.live-page [hidden], .live-blocked[hidden] { display: none !important; }

/* base.css makes body a 100vh flex column for the viewer's app shell; this
   page is an ordinary scrolling document (conventions.md#ops). */
body.live-page {
  height: auto;
  min-height: 100vh;
  display: block;
  overflow: auto;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

.live-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 12px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.live-logo { width: 36px; height: 36px; flex-shrink: 0; }
.live-header-text { min-width: 0; }
.live-header h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.live-sub { font-size: 0.78rem; color: var(--dim); margin-top: 2px; }

.live-eyebrow {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
}

.live-wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 14px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Status strip ────────────────────────────────────────────────────── */
.live-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8rem;
  color: var(--mid);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
}
.live-status.is-live .live-dot {
  background: var(--good);
  animation: none;
}
.live-status.is-offline .live-dot,
.live-status.is-blocked .live-dot { background: var(--bad); }
.live-status.is-offline { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 125, 79, 0.45); }
  60%      { box-shadow: 0 0 0 7px rgba(46, 125, 79, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-status.is-live .live-dot { animation: none; }
}

.live-hint {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--mid);
  padding: 0 2px;
}

/* ── New-measurement banner ──────────────────────────────────────────── */
.live-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 600;
}
.live-banner-btn {
  font: inherit;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent);
  background: var(--accent-ink, var(--accent-strong));
  color: #fff;
  cursor: pointer;
  min-height: 44px;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.live-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 28px;
}
.live-card.is-fresh { animation: live-fresh 1.8s var(--ease); }
@keyframes live-fresh {
  0%   { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.live-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.live-when {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--ink-strong);
  margin-top: 3px;
}
.live-when .ago { font-family: var(--font-ui); font-size: 0.8rem; color: var(--dim); margin-left: 6px; }
.live-back {
  font-size: 0.8rem;
  color: var(--accent-ink, var(--accent-strong));
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 6px 10px;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.live-empty { padding: 40px 0; max-width: 520px; }
.live-empty-title { font-size: 1.6rem; font-weight: 500; color: var(--ink-strong); margin-bottom: 4px; }
.live-empty-text { font-size: 0.86rem; color: var(--mid); line-height: 1.45; }

/* ── Spectrum ────────────────────────────────────────────────────────── */
.live-spectrum { margin: 0 0 12px; }
.live-spectrum-title { font-size: 0.78rem; color: var(--dim); margin-bottom: 6px; }
.live-spectrum-host svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--font-ui);
}
.live-spectrum-host .axis   { stroke: var(--line-strong); stroke-width: 1; }
.live-spectrum-host .grid   { stroke: var(--chart-grid); stroke-width: 1; }
.live-spectrum-host .zero   { stroke: var(--chart-dim); stroke-width: 1; stroke-dasharray: 3 3; }
.live-spectrum-host .curve  { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.live-spectrum-host .tick   { fill: var(--chart-ink); font-size: 11px; }
.live-spectrum-host .marker { stroke: var(--chart-dim); stroke-width: 1; stroke-dasharray: 2 3; }
.live-spectrum-host .marker-label { fill: var(--mid); font-size: 10.5px; }
.live-spectrum-host .ylabel { fill: var(--dim); font-size: 10px; }
.live-spectrum-note {
  font-size: 0.78rem;
  color: var(--warn);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Index tiles ─────────────────────────────────────────────────────── */
.live-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.live-tile {
  background: var(--panel-alt);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 10px 8px 9px;
  text-align: center;
  min-width: 0;
}
.live-tile-label {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--mid);
  min-height: 2.5em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.live-tile-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--ink-strong);
  margin: 6px 0 2px;
  letter-spacing: -0.01em;
}
.live-tile.is-empty .live-tile-value { color: var(--faint); font-weight: 400; }
.live-tile-sub { font-size: 0.76rem; color: var(--dim); }
.live-metrics-note {
  font-size: 0.8rem;
  color: var(--mid);
  line-height: 1.45;
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* ── Photo ───────────────────────────────────────────────────────────── */
.live-photo { margin: 12px 0 0; }
.live-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--panel-sunken);
}
.live-photo figcaption { font-size: 0.74rem; color: var(--dim); margin-top: 4px; }

/* ── Details ─────────────────────────────────────────────────────────── */
.live-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.78rem;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.live-details:empty { display: none; }
.live-details dt { color: var(--dim); }
.live-details dd { color: var(--ink); font-family: var(--font-mono); overflow-wrap: anywhere; }

/* ── All measurements: day pills + one day's list ───────────────────── */
.live-history-sum { font-size: 0.8rem; color: var(--mid); margin-top: 2px; }
.live-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.live-day-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.live-day-btn:hover { border-color: var(--line-strong); }
.live-day-btn.is-selected {
  background: var(--accent-ink, var(--accent-strong));
  border-color: var(--accent-ink, var(--accent-strong));
  color: #fff;
}
.live-day-n { font-family: var(--font-mono); font-size: 0.7rem; color: var(--dim); }
.live-day-btn.is-selected .live-day-n { color: rgba(255, 255, 255, 0.8); }
.live-list-note { font-size: 0.8rem; color: var(--dim); padding: 10px 6px; }
.live-status.is-done .live-dot { background: var(--accent); }

/* ── One day's rows (the list under the pills) ──────────────────────── */
.live-recent-list { list-style: none; margin-top: 8px; }
.live-recent-list li { border-top: 1px solid var(--line-soft); }
.live-recent-list li:first-child { border-top: 0; }
.live-recent-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
  padding: 10px 6px;
  min-height: 48px;
  background: none;
  border: 0;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-md);
}
.live-recent-btn:hover { background: var(--panel-alt); }
.live-recent-btn.is-current { background: var(--accent-fade); }
.live-recent-when { font-family: var(--font-mono); font-size: 0.86rem; color: var(--ink-strong); }
.live-recent-date { font-size: 0.7rem; color: var(--dim); font-family: var(--font-ui); margin-left: 6px; }
.live-recent-vals {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--mid);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.live-recent-vals b { font-weight: 500; color: var(--ink); }
.live-recent-tag {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-ink, var(--accent-strong));
  margin-left: 8px;
}

/* ── About + links ───────────────────────────────────────────────────── */
.live-about p { font-size: 0.86rem; line-height: 1.5; color: var(--ink); margin-top: 8px; }
.live-about .live-about-fine { font-size: 0.88rem; color: var(--dim); }
.live-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.live-links a {
  font-size: 0.82rem;
  color: var(--accent-ink, var(--accent-strong));
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.live-links a:hover { text-decoration: underline; }

/* ── Blocked (no or invalid code) ────────────────────────────────────── */
.live-blocked {
  max-width: 440px;
  margin: 48px auto;
}
.live-blocked h2 { font-size: 1.05rem; color: var(--ink-strong); margin: 6px 0 8px; }
.live-blocked p { font-size: 0.88rem; color: var(--mid); line-height: 1.5; }

@media (min-width: 640px) {
  .live-header { padding: 18px 24px 14px; }
  .live-wrap { padding: 18px 16px 48px; gap: 14px; }
  .live-tile-value { font-size: 1.7rem; }
}

/* Event identity precedes the instrument readout; all data stays in one column. */
.live-header { padding: 32px max(24px, calc((100vw - 764px) / 2)); gap: 20px; }
.live-header h1 { font-size: clamp(1.6rem, 4vw, 2.25rem); font-weight: 500; margin-top: 10px; letter-spacing: -0.035em; }
.live-logo { width: 48px; height: 48px; }
.live-brand { color: var(--accent-strong); font-size: 0.9rem; text-decoration: none; }
.live-sub { font-size: 0.9rem; margin-top: 8px; line-height: 1.5; }
.live-wrap { padding-top: 24px; gap: 18px; }
.live-status { border: 0; background: transparent; padding: 0 2px; font-size: 0.88rem; }
.live-hint { font-size: 0.95rem; line-height: 1.6; max-width: 640px; }
.live-empty-text { font-size: 1rem; line-height: 1.6; margin-top: 12px; }
.live-about { border: 0; background: transparent; padding: 16px 4px; }
.live-about h2 { font-size: 1.05rem; font-weight: 600; color: var(--ink-strong); }
.live-about p { font-size: 0.95rem; line-height: 1.65; max-width: 680px; }
.live-when { font-size: 1.3rem; margin-top: 8px; }
.live-spectrum-title { margin: 20px 0 12px; font-size: 0.9rem; }
.live-details { font-size: 0.85rem; gap: 8px 16px; padding-top: 20px; margin-top: 24px; }
@media (max-width: 600px) {
  .live-header { padding: 24px 18px; gap: 14px; align-items: flex-start; }
  .live-logo { width: 36px; height: 36px; }
  .live-wrap { padding: 20px 16px 32px; }
  .live-card { padding: 20px 16px; }
  .live-empty { padding: 24px 0; }
  .live-empty-title { font-size: 1.35rem; }
  .live-tile-label { font-size: 0.75rem; }
  .live-tile-sub { font-size: 0.7rem; }
  .live-about { padding: 12px 2px; }
}

/* The sample name leads; time and derived indices are supporting information. */
.live-measurement-title { margin: 8px 0 0; font-size: clamp(26px, 4vw, 38px); line-height: 1.2; font-weight: 500; color: var(--text-strong, #15383e); overflow-wrap: anywhere; }
.live-card-head > div:first-child { min-width: 0; flex: 1; }
.live-card-meta { text-align: right; flex-shrink: 0; }
.live-card-meta .live-when { font-size: 13px; margin: 0 0 10px; }
.live-card-meta .ago { display: block; margin: 5px 0 0; font-size: 12px; }
.live-tiles { gap: 8px; }
.live-tile { padding: 12px 10px; }
.live-tile-label, .live-tile-sub { font-size: 11px; }
.live-tile-value { font-size: 24px; margin: 4px 0; }
.live-recent-btn { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 16px; }
.live-recent-name { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.live-recent-when { font-size: 12px; text-align: right; }
.live-recent-vals { grid-column: 1 / -1; font-size: 11px; opacity: .8; }
@media(max-width: 480px) {
  .live-card-head { gap: 12px; align-items: flex-start; }
  .live-card-meta { max-width: 110px; }
  .live-measurement-title { font-size: 25px; }
}

/* One compact header holds the brand, event identity and live status. */
.live-header { display: block; padding: 0 24px; background: #fff; border-bottom: 1px solid #d4e2e3; }
.live-header-inner { max-width: 788px; margin: 0 auto; display: grid; grid-template-columns: 174px minmax(0, 1fr); gap: 28px; align-items: center; padding: 24px 0; }
.live-header .live-brand { display: block; padding: 0; border: 0; }
.live-wordmark { display: block; width: 174px; height: auto; }
.live-header .live-logo { width: 30px; height: 30px; }
.live-brand b { font-weight: 600; }
.live-event-heading { padding: 0; min-width: 0; }
.live-event-heading > .live-eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }
.live-header h1 { margin: 0 0 8px; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; }
.live-header .live-status { margin-top: 8px; font-size: 12px; line-height: 1.5; padding: 0; }
.live-sub { display: flex; flex-wrap: wrap; gap: 8px 0; margin: 0; font-size: 13px; }
.live-sub span + span { border-left: 1px solid #c4d9da; margin-left: 14px; padding-left: 14px; }
.live-about { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 32px; padding: 30px 0 8px; border-top: 1px solid #c4d9da; margin-top: 12px; border-radius: 0; }
.live-about h2 { font-size: 24px; font-weight: 500; margin: 8px 0 14px; }
.live-about p { font-size: 14px; line-height: 1.65; margin: 0 0 14px; }
.live-about .live-about-fine { font-size: 12px; line-height: 1.65; }
.live-about .live-eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.live-links { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.live-links a { display: flex; justify-content: space-between; gap: 15px; padding: 10px 12px; border: 1px solid #c4d9da; border-radius: 6px; font-size: 14px; line-height: 1.4; background: #e4efef; }
.live-links small { display: block; font-size: 10px; margin-bottom: 5px; opacity: .75; }
.live-links a.live-explore { background: #055057; border-color: #055057; color: #fff; }
.live-links a:hover { text-decoration: none; border-color: #055057; box-shadow: 0 3px 12px #15383e12; }
@media(max-width: 600px) {
  .live-header { padding: 0 20px; }
  .live-header-inner { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 20px 0; align-items: start; }
  .live-wordmark { width: 120px; }
  .live-header h1 { font-size: 20px; }
  .live-sub { font-size: 12px; }
  .live-sub span + span { margin-left: 10px; padding-left: 10px; }
  .live-about { grid-template-columns: 1fr; gap: 10px; padding: 26px 0 0; }
  .live-links { display: grid; grid-template-columns: 1fr 1fr; }
  .live-links a { padding: 10px 12px; font-size: 13px; }
}
.live-header h1 { white-space: normal; }
@media (max-width: 600px) {
  .live-header-inner { gap: 10px 16px; align-items: center; }
  .live-event-heading { display: contents; }
  .live-header h1 { margin: 0; }
  .live-sub, .live-header .live-status { grid-column: 1 / -1; }
  .live-header .live-status { margin-top: 0; }
}
