@font-face {
  font-family: "Jakarta";
  src: url("fonts/jakarta-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: url("fonts/jakarta-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: url("fonts/jakarta-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #181818;
  --mute: #666666;
  --line: #e9e9e9;
  --grid: #f1f1f1;
  --alarm: #b42318;
  --sans: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
p,
dl,
dt,
dd,
ul,
li,
figure {
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

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

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 9vh 22px 6vh;
}

/* ---------------------------------------------------------------- head */

.head h1 {
  font-size: clamp(2.3rem, 8vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.head .sub {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  color: var(--mute);
}

.head .stamp {
  margin-top: 1.1rem;
  font-size: 0.8rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.head .sep {
  margin: 0 0.5rem;
}

.notice {
  margin-top: 1.6rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--alarm);
  color: var(--alarm);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------- readout */

.readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.metric {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric .label {
  font-size: 0.8rem;
  color: var(--mute);
}

.metric .value {
  margin-top: 0.35rem;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.metric .num {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.metric .unit {
  font-size: 0.85rem;
  color: var(--mute);
}

.spark {
  display: block;
  width: 100%;
  height: 22px;
  margin-top: 0.55rem;
  overflow: visible;
}

.spark path {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  opacity: 0.3;
}

/* ---------------------------------------------------------------- recorder */

.recorder {
  margin-top: 2.8rem;
}

.recorder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ranges {
  display: flex;
  gap: 18px;
}

.ranges button,
.pause {
  min-height: 44px;
  padding: 0;
  font-size: 0.82rem;
  color: var(--mute);
  transition: color 120ms linear;
}

.ranges button:hover,
.pause:hover {
  color: var(--fg);
}

.ranges button[aria-pressed="true"] {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.pause[aria-pressed="true"] {
  color: var(--fg);
}

.chart {
  position: relative;
  margin-top: 0.4rem;
}

#trace-svg {
  display: block;
  width: 100%;
  height: 260px;
  border-bottom: 1px solid var(--line);
  touch-action: pan-y;
}

#trace-svg:focus-visible {
  outline-offset: 2px;
}

.grid line {
  stroke: var(--grid);
  stroke-width: 1;
}

.line {
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-cpu {
  stroke: var(--fg);
}

.line-temp {
  stroke: #a8a8a8;
  stroke-dasharray: 4 3;
}

#trace-axis-y text,
#trace-axis-y2 text,
#trace-axis-x text {
  font-family: var(--sans);
  font-size: 10.5px;
  fill: var(--mute);
}

.axis-caption {
  font-size: 10px;
  fill: var(--mute);
}

.cursor-line {
  stroke: #b8b8b8;
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.cursor-dot {
  stroke: var(--bg);
  stroke-width: 1.5;
}

.dot-cpu {
  fill: var(--fg);
}

.dot-temp {
  fill: #a8a8a8;
}

.chart-empty {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--mute);
}

.chart-empty:not([hidden]) {
  display: flex;
}

.read {
  min-height: 1.4em;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- facts */

.facts {
  margin-top: 2.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.facts dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0.34rem 0;
}

.facts dt {
  font-size: 0.85rem;
  color: var(--mute);
}

.facts dd {
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------------------------------------------------------------- services */

.channels {
  margin-top: 2.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

#services {
  list-style: none;
}

.service {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0.34rem 0;
  font-size: 0.85rem;
}

.service .age {
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.service[data-state="down"] .name,
.service[data-state="down"] .age {
  color: var(--alarm);
  font-weight: 500;
}

.placeholder {
  color: var(--mute);
}

/* ---------------------------------------------------------------- foot */

.foot {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--mute);
}

.foot p + p {
  margin-top: 0.35rem;
}

.foot code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--fg);
}

/* ---------------------------------------------------------------- small */

@media (max-width: 640px) {
  .page {
    padding: 7vh 18px 5vh;
  }

  .readout {
    grid-template-columns: 1fr 1fr;
    gap: 22px 18px;
    margin-top: 2.2rem;
  }

  .metric .num {
    font-size: 1.75rem;
  }

  #trace-svg {
    height: 200px;
  }

  .ranges {
    gap: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
