/* Pi status. The page is a strip of chart-recorder paper: pale sage paper,
   blue-black ink, and the recorder's grid behind the main trace. */

:root {
  --paper: #edf0ea;
  --paper-sunk: #e2e7df;      /* empty strip tracks */
  --ink: #172030;
  --ink-2: #47515f;           /* secondary text */
  --ink-3: #5d6673;           /* axis labels, small print */
  --grid: #d3dbd1;
  --grid-minor: #e2e7de;
  --rule: #bcc6ba;

  --s1: #2a78d6;              /* series slots, in this fixed order */
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --heat: var(--s2);

  --good: #0ca30c;
  --good-text: #006300;
  --serious: #ec835a;
  --serious-text: #a2401a;
  --critical: #d03b3b;
  --critical-text: #b02a2a;

  --gutter: 16px;
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161a19;
    --paper-sunk: #212826;
    --ink: #e7ece6;
    --ink-2: #b6bfb9;
    --ink-3: #939e98;
    --grid: #2a3330;
    --grid-minor: #1f2624;
    --rule: #3b4642;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --good-text: #3fbf3f;
    --serious-text: #ef9a77;
    --critical-text: #ec7272;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161a19;
  --paper-sunk: #212826;
  --ink: #e7ece6;
  --ink-2: #b6bfb9;
  --ink-3: #939e98;
  --grid: #2a3330;
  --grid-minor: #1f2624;
  --rule: #3b4642;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --good-text: #3fbf3f;
  --serious-text: #ef9a77;
  --critical-text: #ec7272;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.wrap, .top, .ranges__inner, main, .foot {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ------------------------------------------------------------ header */
.top { padding-top: calc(env(safe-area-inset-top) + 1.25rem); padding-bottom: 1.5rem; }
.home {
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--ink-2);
}
.home:hover { text-decoration: underline; }
.verdict {
  margin: 1.5rem 0 0;
  max-width: 16ch;
  font-size: clamp(2.6rem, 12.5vw, 6.25rem);
  font-weight: 760;
  font-stretch: 75%;
  font-variation-settings: "opsz" 96, "wdth" 75;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.summary {
  margin: 1rem 0 0;
  max-width: 38rem;
  font-size: 1.125rem;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ------------------------------------------------------------ range picker */
.ranges {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.ranges__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.625rem;
}
.ranges__buttons { display: flex; gap: 0.25rem; }
.ranges button {
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.375rem 0.625rem;
  min-height: 2.5rem;
  cursor: pointer;
  white-space: nowrap;
}
.ranges button:hover { border-color: var(--rule); }
.ranges button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.ranges__updated { margin: 0; font-size: 0.8125rem; color: var(--ink-3); }

/* ------------------------------------------------------------ sections */
main { padding-bottom: 2rem; transition: opacity 0.2s; }
main.is-loading { opacity: 0.55; }
.section {
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--rule);
}
.section:first-child { border-top: 0; }
.section__head h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 760;
  font-variation-settings: "opsz" 48, "wdth" 75;
  font-stretch: 75%;
  line-height: 1.05;
}
.section__head p {
  margin: 0.5rem 0 0;
  max-width: 36rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.section__body {
  display: grid;
  gap: 2.25rem 2.5rem;
  margin-top: 1.5rem;
}
.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 1rem 2rem;
}
.facts div { min-width: 0; }
.facts dd { overflow-wrap: anywhere; }
.facts dt { font-size: 0.875rem; color: var(--ink-2); }
.facts dd {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 650;
  font-variation-settings: "wdth" 80;
  font-stretch: 80%;
  line-height: 1.2;
}
.note { margin: 0; color: var(--ink-2); font-size: 0.9375rem; max-width: 40rem; }

/* ------------------------------------------------------------ charts */
.chart { margin: 0; min-width: 0; }
.chart__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.chart__title { font-weight: 650; font-size: 1rem; line-height: 1.3; }
.chart__now {
  font-size: 1.75rem;
  font-weight: 700;
  font-variation-settings: "opsz" 48, "wdth" 75;
  font-stretch: 75%;
  line-height: 1;
  white-space: nowrap;
}
.chart--hero .chart__now { font-size: clamp(2.5rem, 10vw, 4rem); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem 1rem;
  margin: 0.375rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.legend li { display: flex; align-items: center; gap: 0.375rem; }
.legend b { color: var(--ink); font-weight: 650; }
.key {
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  flex: none;
}
.plot {
  position: relative;
  margin-top: 0.5rem;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.plot svg { display: block; width: 100%; overflow: visible; }
.plot:focus-visible { outline-offset: 4px; }
.plot text {
  font-family: var(--font);
  font-size: 11px;
  fill: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.plot .ylab { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.plot .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.plot .grid-minor { stroke: var(--grid-minor); stroke-width: 1; shape-rendering: crispEdges; }
.plot .base { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.plot .ref { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.plot .reflab { fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .area { stroke: none; opacity: 0.1; }
.plot .dot { stroke: var(--paper); stroke-width: 2; }
.plot .cross { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.plot .empty { fill: var(--ink-3); font-size: 13px; }
.c1 { color: var(--s1); } .c2 { color: var(--s2); } .c3 { color: var(--s3); } .c4 { color: var(--s4); }
.plot .c1 { stroke: var(--s1); fill: var(--s1); }
.plot .c2 { stroke: var(--s2); fill: var(--s2); }
.plot .c3 { stroke: var(--s3); fill: var(--s3); }
.plot .c4 { stroke: var(--s4); fill: var(--s4); }
.plot .line.c1, .plot .line.c2, .plot .line.c3, .plot .line.c4 { fill: none; }

/* The recorder pen: the newest point of the main trace breathes while readings are fresh */
.pen { transform-box: fill-box; transform-origin: center; }
.is-live .pen { animation: pen 2.4s ease-in-out infinite; }
@keyframes pen { 50% { transform: scale(1.6); opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .is-live .pen { animation: none; } main { transition: none; } }

.stats {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.tip {
  position: absolute;
  top: 0;
  z-index: 3;
  pointer-events: none;
  min-width: 8rem;
  max-width: 15rem;
  padding: 0.5rem 0.625rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 6px 18px -8px rgba(23, 32, 48, 0.35);
  font-size: 0.8125rem;
  line-height: 1.35;
}
.tip[hidden] { display: none; }
.tip__time { color: var(--ink-2); margin-bottom: 0.25rem; }
.tip__row { display: flex; align-items: center; gap: 0.4rem; }
.tip__row b { font-weight: 700; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.tip__row span:last-child { color: var(--ink-2); }

/* Per-core small multiples */
.cores { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; margin-top: 0.5rem; }
.cores .chart__title { font-weight: 500; font-size: 0.875rem; color: var(--ink-2); }
.cores .chart__now { font-size: 1.125rem; }
.cores .plot { margin-top: 0.25rem; }

/* ------------------------------------------------------------ strips (state over time) */
.strip { position: relative; touch-action: pan-y; }
.strip svg { display: block; width: 100%; height: 12px; }
.strip .track { fill: var(--paper-sunk); }
.strip .ok { fill: var(--good); }
.strip .part { fill: var(--serious); }
.strip .bad { fill: var(--critical); }
.strip .on { fill: var(--s1); }
.strip .onpart { fill: var(--s1); opacity: 0.45; }
.events { display: grid; gap: 0.625rem; margin-top: 0.75rem; }
.events__row { display: grid; gap: 0.25rem; }
.events__label { font-size: 0.875rem; color: var(--ink-2); display: flex; justify-content: space-between; gap: 1rem; }
.events__label b { font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------ services */
.services { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem 2.5rem; }
.svc { display: grid; gap: 0.375rem; min-width: 0; }
.svc__top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.svc__name { font-weight: 650; font-size: 1.0625rem; }
.svc__state { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.svc__state svg { width: 14px; height: 14px; flex: none; }
.svc__state.is-up { color: var(--good-text); }
.svc__state.is-warn { color: var(--serious-text); }
.svc__state.is-down { color: var(--critical-text); }
.svc__meta { display: flex; flex-wrap: wrap; gap: 0.125rem 1rem; font-size: 0.8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ bars (visits by site) */
.bars { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.bars li { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center; gap: 0.75rem; font-size: 0.875rem; }
.bars .bar { height: 12px; display: flex; }
.bars .bar i { display: block; height: 100%; min-width: 2px; background: var(--s1); border-radius: 0 4px 4px 0; }
.bars b { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ footer */
.foot {
  padding-top: 1.5rem;
  padding-bottom: calc(env(safe-area-inset-bottom) + 2.5rem);
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.875rem;
}
.foot p { margin: 0 0 0.5rem; max-width: 44rem; }
.noscript { padding: 2rem 0; }

/* ------------------------------------------------------------ wider screens */
@media (min-width: 700px) {
  .section__body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section__body > .chart--hero, .section__body > .wide { grid-column: 1 / -1; }
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cores { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1000px) {
  .section { display: grid; grid-template-columns: 13rem minmax(0, 1fr); column-gap: 3rem; padding-block: 2.75rem 3rem; }
  .section__head { position: sticky; top: 4.5rem; align-self: start; }
  .section__body { margin-top: 0; }
  .cores { grid-template-columns: 1fr 1fr; }
}
