/**
 * app.css — layout + components for the Mould Detect IoT dashboard.
 * Consumes ONLY tokens from styles/tokens.css (a trimmed copy of the main
 * site's design tokens — same names/values, plus a dark palette). Mobile-first;
 * light and dark themes (see styles/tokens.css and components/Header.js's
 * toggle). Structure mirrors the site's register: bone/parchment surfaces,
 * hairline rules, mono instrument labels, one serif display voice.
 */

/* ====================================================================== */
/*  RESET + BASE                                                          */
/* ====================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--ink-0);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--track-display);
  line-height: var(--leading-tight);
  color: var(--ink-0);
}

h2 { font-size: var(--text-h2); font-weight: 400; }
h3 { font-size: var(--text-h3); }

a { color: inherit; }

img { display: block; max-width: 100%; }

svg { display: block; }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 200;
  transform: translateY(calc(-100% - var(--sp-5)));
  background: var(--surface-0);
  color: var(--ink-0);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ====================================================================== */
/*  PRIMITIVES                                                            */
/* ====================================================================== */

.shell {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-margin);
}

.section { padding-block: calc(var(--section-pad) * 0.5); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  line-height: 1.5;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--ink-1);
  margin-block-end: var(--sp-3);
}

.section-head { max-width: 40rem; margin-inline: 0; }
.section-head--center { max-width: 34rem; margin-inline: auto; text-align: center; }
.section-head h2 { margin-block-end: var(--sp-3); }

.lede {
  font-size: var(--text-body-lg);
  color: var(--ink-1);
  max-width: 60ch;
}
.section-head--center .lede { margin-inline: auto; }

/* wave divider (design.md §4.1 "wave strata") — ground, not content */
.wave { line-height: 0; pointer-events: none; color: var(--surface-1); }
.wave svg { display: block; width: 100%; height: clamp(2rem, 5vw, 3.5rem); }

/* ====================================================================== */
/*  HEADER                                                                */
/* ====================================================================== */

.site-header {
  border-block-end: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-0) 94%, transparent);
  /* The header is a self-contained, independently-updating region (only its
     status pill re-renders, on a 1-10s cadence — see app.js renderStatusPill)
     — layout+paint containment keeps that from ever triggering a reflow/
     repaint of the rest of the page, and vice versa. Not `size` (the header's
     own height still depends on its content) and not `style` (its custom-
     property usage is inherited from :root, not scoped per-instance). */
  contain: layout paint;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: calc(var(--sp-5) + var(--sp-4));
  flex-wrap: wrap;
  padding-block: var(--sp-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  color: var(--ink-0);
}

.brand__logo { height: 20px; width: auto; }

/* Two logo lockups (ink-on-bone / white), same width/height attrs, swapped
   purely by CSS on [data-theme]/prefers-color-scheme — no JS logo swap (see
   Header.js docblock). Same guard pattern as tokens.css: the toggle's
   explicit data-theme always wins over the system preference. */
.brand__logo--dark { display: none; }
:root[data-theme="dark"] .brand__logo--light { display: none; }
:root[data-theme="dark"] .brand__logo--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__logo--light { display: none; }
  :root:not([data-theme="light"]) .brand__logo--dark { display: block; }
}

.brand__divider {
  width: 1px;
  height: 1.1em;
  background: var(--line);
}

.brand__product {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--ink-1);
}

.site-header__end {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* theme toggle ---------------------------------------------------------- */
.theme-toggle {
  appearance: none;
  cursor: pointer;
  flex: none;
  /* Real tap target, never smaller than 44px regardless of viewport (see
     the 360px header check in the responsive block below). */
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--ink-1);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent-deep);
}

.theme-toggle__icon { width: 20px; height: 20px; }

/* Moon shown in light, sun shown in dark — pure CSS on [data-theme]/
   prefers-color-scheme, same guard pattern as the logo swap above and
   tokens.css: an explicit toggle choice always wins over the system
   preference. */
.theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__icon--moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle__icon--sun { display: block; }
}

/* status pill --------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-1);
}

.status-pill__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-2);
  flex: none;
}

.status-pill--online .status-pill__dot {
  background: var(--accent);
  animation: md-pulse 2.6s var(--ease-out) infinite;
}

.status-pill--offline .status-pill__dot { background: var(--risk-high); }

/* Demo fallback (see app.js evaluateSource / services/demoData.js): a
   deliberately neutral/ochre dot, not red — demo isn't a fault state, it's a
   sales-page stand-in while the real sensor is unavailable. */
.status-pill--demo .status-pill__dot { background: var(--risk-watch); }
.status-pill--demo .status-pill__label { color: var(--risk-watch); }

@keyframes md-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .status-pill__dot { animation: none !important; }
}

.status-pill__label {
  font-size: var(--text-small);
  font-weight: 500;
}

.status-pill--online .status-pill__label { color: var(--accent-deep); }
.status-pill--offline .status-pill__label { color: var(--ink-1); }

.status-pill__age { color: var(--ink-2); font-size: 0.7rem; }

.status-pill__divider {
  width: 1px; height: 1.1em;
  background: var(--line);
}

.status-pill__device {
  color: var(--ink-1);
  font-size: 0.7rem;
}

/* ====================================================================== */
/*  HERO + GAUGE                                                          */
/* ====================================================================== */

.hero { padding-block: var(--sp-6) var(--sp-5); }

.hero__grid {
  display: grid;
  gap: var(--sp-6);
  align-items: center;
}

.hero__text { display: grid; gap: var(--sp-3); max-width: 34rem; }

.hero__title {
  font-size: var(--text-display);
  margin: 0;
}

/* One italic accent word per display heading (design.md §3.1). */
.hero__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.hero__instrument { display: flex; justify-content: center; }

/* the aperture dial ---------------------------------------------------- */
.gauge {
  display: grid;
  padding: var(--sp-4);
  width: min(100%, 340px);
  /* Independent, frequently-patched section (see app.js renderGauge /
     HeroGauge.js updateHeroGauge) — `content` (layout+paint+style
     containment, not `size`: its box still sizes from width + aspect-ratio)
     keeps its per-tick attribute/text writes from being able to affect
     layout outside this box, and vice versa. */
  contain: content;
}

/* .gauge__dial and .gauge__readout stack on the same implicit grid cell so
   the number/label readout sits centred over the SVG dial. */
.gauge__dial, .gauge__readout { grid-area: 1 / 1; }

.gauge__dial { width: 100%; aspect-ratio: 1; }
.gauge__dial svg { width: 100%; height: 100%; }

.gauge__track { stroke: var(--line); }
.gauge__value {
  stroke: var(--accent);
  stroke-linecap: round;
  /* updateHeroGauge (HeroGauge.js) now mutates this attribute on an
     already-painted circle instead of a fresh remount, so this transition
     actually has a "from" value to interpolate from — it was a dead rule
     before (each poll rebuilt the whole SVG, so the browser only ever saw
     the arc's *final* value, never an intermediate one to animate from). */
  transition: stroke-dasharray var(--dur-base) var(--ease-out);
  will-change: stroke-dasharray;
}
.gauge__ticks line { stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.gauge__readout {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  text-align: center;
  pointer-events: none;
}

.gauge__eyebrow { color: var(--ink-2); }

.gauge__value-text {
  font-family: var(--font-display);
  color: var(--ink-0);
  line-height: 1;
}
.gauge__number { font-size: clamp(2.75rem, 2rem + 3vw, 4.25rem); }
.gauge__unit { font-size: 1.5rem; color: var(--ink-1); }

.gauge__band {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-1);
  margin-block-start: 2px;
}
.gauge__band-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-2);
}
.gauge--bright .gauge__band-dot { background: var(--accent); }
.gauge--dim .gauge__band-dot { background: var(--ink-1); }
.gauge--dark .gauge__band-dot { background: var(--ink-2); }

.gauge__raw, .gauge__age { color: var(--ink-2); }
.gauge__age { margin-block-start: var(--sp-2); }
.gauge__age--demo { color: var(--risk-watch); letter-spacing: var(--track-mono); }
/* "Cached" (see app.js evaluateSource / HeroGauge.js): a stale/failed
   `latest` shown alongside real cached history — offline-red, not demo's
   ochre, so it reads as a fault-free but genuinely offline device. */
.gauge__age--cached { color: var(--risk-high); letter-spacing: var(--track-mono); }

@media (min-width: 860px) {
  .hero__grid { grid-template-columns: 1.1fr 0.9fr; }
  .hero__instrument { justify-content: flex-end; }
}

/* ====================================================================== */
/*  HISTORY / CHART                                                       */
/* ====================================================================== */

.section--history { padding-block-start: 0; }

.history__controls { margin-block: var(--sp-4) var(--sp-3); }

.range-selector {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface-1);
}

.range-selector__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-1);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.range-selector__btn:hover { background: var(--surface-2); }
.range-selector__btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.chart {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface-1);
  padding: var(--sp-4);
  position: relative;
  /* Independent section, patched up to 1/s while live (see app.js
     renderChartImpl / HistoryChart.js updateHistoryChart) — `content`
     (layout+paint+style containment; not `size`, its height is intrinsic to
     the SVG + stats/table below) scopes that work to this box. */
  contain: content;
}

.chart--empty {
  display: grid;
  place-items: center;
  min-height: 220px;
}
.chart__placeholder { color: var(--ink-2); text-align: center; max-width: 30ch; }

/* Demo fallback (see app.js evaluateSource / services/demoData.js) — a
   subtle corner specimen tag, same treatment as the mono labels elsewhere on
   the page. The stats strip below is never hidden in demo mode; it's just
   computed from demo rows like any other. */
.chart__demo-tag {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  padding: 3px 8px;
  border: 1px solid var(--risk-watch);
  border-radius: var(--r-1);
  color: var(--risk-watch);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  background: var(--surface-0);
  z-index: 1;
}

/* Live chart (see app.js `series` / README "Live history chart") — a subtle
   accent-toned corner tag, mirroring the demo tag's treatment but never
   shown together with it (app.js only ever sets one of `demo`/`live`). */
.chart__live-tag {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  padding: 3px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--r-1);
  color: var(--accent-deep);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  background: var(--surface-0);
  z-index: 1;
}

.chart__frame { width: 100%; color: var(--accent); }
.chart__frame svg { width: 100%; height: auto; display: block; }

.chart__live-dot {
  fill: var(--accent);
  stroke: var(--surface-0);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  /* Without this, `transform: scale()` in md-pulse uses the default SVG
     transform-box (the chart's whole viewBox, origin top-left) as its
     reference box, so the circle's *center* isn't (cx,cy) — the pulse
     scales it toward the viewBox's center/origin instead of its own
     position, making the dot visibly swim toward the chart's top-left on
     every animation cycle instead of pulsing in place on the line. */
  transform-box: fill-box;
  transform-origin: center;
  animation: md-pulse 1.6s var(--ease-out) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .chart__live-dot { animation: none !important; }
}

.chart__night { fill: var(--chart-night); }
.chart__grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__axis-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  fill: var(--ink-2);
}

.chart__area { color: var(--accent); }
.chart__line {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart__crosshair-line {
  stroke: var(--ink-1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 3 3;
}
.chart__crosshair-dot {
  fill: var(--surface-0);
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.chart__capture { cursor: crosshair; touch-action: pan-y; }

.chart__tooltip {
  position: absolute;
  top: var(--sp-4);
  left: var(--sp-4);
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface-0);
  box-shadow: var(--shadow-1);
  pointer-events: none;
  white-space: nowrap;
}
.chart__tooltip-time { color: var(--ink-2); }
.chart__tooltip-value { font-weight: 700; color: var(--ink-0); }
.chart__tooltip-pct { color: var(--ink-2); font-size: var(--text-small); }

.chart__stats {
  display: flex;
  gap: var(--sp-5);
  margin-block-start: var(--sp-4);
  padding-block-start: var(--sp-3);
  border-block-start: 1px solid var(--line);
}
.chart__stat { display: flex; flex-direction: column; gap: 2px; }
.chart__stat-label { color: var(--ink-2); }
.chart__stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink-0);
}

.chart__table-toggle { margin-block-start: var(--sp-3); }
.chart__table-toggle summary {
  cursor: pointer;
  color: var(--ink-1);
  width: fit-content;
}
.chart__table-wrap { overflow-x: auto; margin-block-start: var(--sp-2); }
.chart__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-small);
}
.chart__table th, .chart__table td {
  text-align: left;
  padding: 4px var(--sp-2);
  border-block-end: 1px solid var(--line);
}
.chart__table th { color: var(--ink-2); font-weight: 500; }

/* ====================================================================== */
/*  SENSOR GRID (coming soon)                                             */
/* ====================================================================== */

.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
  margin-block-start: var(--sp-4);
}

.sensor-tile {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface-1);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.sensor-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) { .sensor-tile:hover { transform: none; } }

.sensor-tile__icon {
  width: 28px; height: 28px;
  color: var(--accent-deep);
}
.sensor-tile__icon svg { width: 100%; height: 100%; }

.sensor-tile__label { font-weight: 700; color: var(--ink-0); }
.sensor-tile__benefit { color: var(--ink-1); font-size: var(--text-small); flex: 1; }

.sensor-tile__tag {
  color: var(--accent-deep);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 999px;
  padding: 2px 10px;
  width: fit-content;
}

/* ====================================================================== */
/*  HOW IT WORKS                                                         */
/* ====================================================================== */

.section--how { background: var(--surface-1); border-block: 1px solid var(--line); }

.how-it-works {
  list-style: none;
  margin: var(--sp-5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(3, 1fr);
  position: relative;
}

.how-it-works__step {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  position: relative;
}

.how-it-works__icon {
  width: 40px; height: 40px;
  color: var(--accent-deep);
  margin-block-end: var(--sp-1);
}
.how-it-works__icon svg { width: 100%; height: 100%; }

.how-it-works__number { color: var(--ink-2); }
.how-it-works__label { font-weight: 700; }
.how-it-works__detail { color: var(--ink-1); font-size: var(--text-small); max-width: 22ch; }

.how-it-works__arrow {
  position: absolute;
  top: 18px;
  right: calc(-1 * var(--sp-5) + 4px);
  color: var(--line);
  font-size: 1.25rem;
}

@media (max-width: 720px) {
  .how-it-works { grid-template-columns: 1fr; gap: var(--sp-4); }
  .how-it-works__arrow { display: none; }
}

/* ====================================================================== */
/*  FOOTER                                                                */
/* ====================================================================== */

.site-footer {
  border-block-start: 1px solid var(--line);
  background: var(--surface-1);
}

.site-footer__inner {
  padding-block: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.site-footer__note { color: var(--ink-2); }

.site-footer__link {
  color: var(--accent-deep);
  text-decoration: none;
}
.site-footer__link:hover { text-decoration: underline; }

/* ====================================================================== */
/*  INFRA PANEL ("The data collection foundation")                       */
/* ====================================================================== */

.section--infra { background: var(--surface-1); border-block: 1px solid var(--line); }

.infra-diagram { margin-block-start: var(--sp-5); }
.infra-diagram svg { display: block; width: 100%; height: auto; }

/* mobile-first: stacked SVG by default, swapped for the row layout at 640px */
.infra-diagram__mobile { display: block; }
.infra-diagram__desktop { display: none; }

@media (min-width: 640px) {
  .infra-diagram__mobile { display: none; }
  .infra-diagram__desktop { display: block; }
}

/* Diagram element styles live here, not as inline <style> inside the SVGs
   (same convention as HistoryChart.js's chart__* classes) — two identically-
   named inline <style> blocks (one per SVG) would collide globally, since
   SVG <style> isn't scoped to its own document fragment. Shared rules are
   unscoped; the few that differ in size between the row and stacked layouts
   are scoped by ancestor so each SVG gets its own value. */
.infra-node { fill: var(--surface-1); stroke: var(--line); stroke-width: 1.5; }
.infra-icon { color: var(--accent-deep); }
.infra-wire { stroke: var(--accent); stroke-width: 2; fill: none; }
.infra-pill { fill: var(--surface-0); stroke: var(--accent); stroke-width: 1.2; }
.infra-band {
  fill: color-mix(in srgb, var(--accent) 9%, var(--surface-1));
  stroke: color-mix(in srgb, var(--accent) 32%, var(--line));
  stroke-width: 1;
}

.infra-diagram__desktop .infra-wire { marker-end: url(#infraArrow); }
.infra-diagram__mobile .infra-wire { marker-end: url(#infraArrowM); }

.infra-diagram__desktop .infra-h { font: 700 13px var(--font-body), sans-serif; fill: var(--ink-0); }
.infra-diagram__mobile .infra-h { font: 700 15px var(--font-body), sans-serif; fill: var(--ink-0); }

.infra-diagram__desktop .infra-s { font: 400 10.5px var(--font-body), sans-serif; fill: var(--ink-1); }
.infra-diagram__mobile .infra-s { font: 400 12px var(--font-body), sans-serif; fill: var(--ink-1); }

.infra-diagram__desktop .infra-pill-text,
.infra-diagram__mobile .infra-pill-text {
  font: 700 8px var(--font-mono), monospace;
  letter-spacing: 0.05em;
  fill: var(--accent-deep);
  text-transform: uppercase;
}
.infra-diagram__mobile .infra-pill-text { font-size: 9px; }

.infra-diagram__desktop .infra-band-text,
.infra-diagram__mobile .infra-band-text {
  font: 600 9px var(--font-mono), monospace;
  letter-spacing: 0.05em;
  fill: var(--ink-1);
  text-transform: uppercase;
}
.infra-diagram__mobile .infra-band-text { font-size: 10px; }

.infra-meaning {
  list-style: none;
  margin: var(--sp-5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-3) var(--sp-5);
  grid-template-columns: 1fr;
}

.infra-meaning__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  color: var(--ink-1);
}

.infra-meaning__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-block-start: 8px;
  flex: none;
}

.infra-footnote {
  margin-block-start: var(--sp-4);
  padding-block-start: var(--sp-3);
  border-block-start: 1px solid var(--line);
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sp-2);
}

@media (min-width: 720px) {
  .infra-meaning { grid-template-columns: repeat(2, 1fr); }
}

/* ====================================================================== */
/*  RESPONSIVE                                                            */
/* ====================================================================== */

@media (max-width: 560px) {
  .site-header__inner {
    padding-block: var(--sp-2);
    /* Keep logo / pill / toggle on ONE row down to a 360px viewport — the
       group that used to wrap below the logo now shrinks instead (see
       .site-header__end / .status-pill below), so nothing drops to a
       second line and the toggle never has to compete with the logo for
       space. */
    flex-wrap: nowrap;
    gap: var(--sp-2);
  }
  .brand { flex: none; }
  .site-header__end {
    /* Absorbs whatever width the brand doesn't need; the pill inside it is
       what actually gives, by wrapping its own label text (see below) —
       deliberately no min-width: 0 here, so it can't shrink past the pill's
       wrapped min-content size and start clipping. */
    flex: 1 1 auto;
    gap: var(--sp-2);
  }
  .status-pill {
    flex: 1 1 auto;
    /* Let the label wrap onto further lines as the pill narrows, rather
       than force the header row itself to wrap (see .site-header__inner
       above) or overflow — no overflow-wrap:anywhere, so it only ever
       breaks at the label's existing word/dot boundaries, never mid-word. */
    padding-inline: var(--sp-2);
  }
  .status-pill__label { white-space: normal; }
  .status-pill__device { display: none; }
  .status-pill__divider { display: none; }
  .theme-toggle { flex: none; } /* never shrinks below its 44px tap target */
  .chart { padding: var(--sp-3); }
  .chart__stats { gap: var(--sp-4); }
}

@media (max-width: 400px) {
  /* Below ~400px even a wrapped pill needs the room back: the "IoT"
     sub-wordmark is secondary to the logo itself, so it's what gives. */
  .brand__divider,
  .brand__product {
    display: none;
  }
}

.chart__lake-note {
  margin-block-start: var(--sp-3);
  color: var(--ink-2);
}

/* The wave divider is filled with --surface-1, so the section it leads into must
   sit on the same surface or the wave reads as a smear with a hard edge. */
.section--history { background: var(--surface-1); }
