/* Visual system after the Vercel DESIGN.md (VoltAgent/awesome-design-md):
   near-white canvas, ink-black primary, a monospaced voice for technical
   labels, 6/12 px radii, stacked hairline shadows, and the brand mesh gradient
   used once, as the hero's atmosphere. Every colour below is a token; the
   [data-theme] toggle only swaps tokens.

   Series colours are fixed across the whole page: downlink/download is ink,
   uplink/upload is link blue — in both cards, the dials and the charts. */
:root {
  --canvas: #ffffff;
  --canvas-soft: #fafafa;
  --canvas-soft-2: #f5f5f5;
  --ink: #171717;
  --body: #4d4d4d;
  --mute: #888888;
  --hairline: #ebebeb;
  --hairline-strong: #a1a1a1;
  --primary: #171717;
  --on-primary: #ffffff;

  --down: #171717;
  --up: #0070f3;
  --ok: #0070f3;
  --error: #ee0000;
  --error-soft: #fdeced;
  --error-deep: #c50000;
  --warning: #f5a623;
  --warning-soft: #fff6e5;
  --warning-deep: #ab570a;

  --shadow-card: 0 0 0 1px rgb(0 0 0 / 0.08), 0 2px 2px rgb(0 0 0 / 0.04), 0 8px 16px -4px rgb(0 0 0 / 0.04);
  --shadow-raise: 0 0 0 1px rgb(0 0 0 / 0.08), 0 1px 1px rgb(0 0 0 / 0.02), 0 4px 8px -4px rgb(0 0 0 / 0.08);
  --mesh-opacity: 0.55;

  --sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --pill: 100px;
}

[data-theme="dark"] {
  --canvas: #0a0a0a;
  --canvas-soft: #000000;
  --canvas-soft-2: #1a1a1a;
  --ink: #ededed;
  --body: #a1a1a1;
  --mute: #737373;
  --hairline: #262626;
  --hairline-strong: #454545;
  --primary: #ededed;
  --on-primary: #0a0a0a;

  --down: #ededed;
  --up: #3291ff;
  --ok: #3291ff;
  --error: #ff4d4d;
  --error-soft: #2a1213;
  --error-deep: #ff8080;
  --warning: #f5a623;
  --warning-soft: #1f1708;
  --warning-deep: #f5b94d;

  --shadow-card: 0 0 0 1px rgb(255 255 255 / 0.09), 0 8px 16px -4px rgb(0 0 0 / 0.6);
  --shadow-raise: 0 0 0 1px rgb(255 255 255 / 0.12), 0 4px 8px -4px rgb(0 0 0 / 0.6);
  --mesh-opacity: 0.32;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--canvas-soft); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip; /* the hero mesh bleeds past the edges by design */
  background: var(--canvas-soft);
  color: var(--ink);
  font: 400 14px/20px var(--sans);
  letter-spacing: -0.28px;
  font-feature-settings: "ss01", "ss02";
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--canvas-soft); }

.mono { font-family: var(--mono); letter-spacing: 0; }

button { font: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--up); outline-offset: 2px; }

/* --- nav --------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.nav-inner {
  width: min(1200px, 100% - 48px);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--on-primary);
}
.mark svg { width: 16px; height: 16px; }

.wordmark { font-size: 16px; font-weight: 600; letter-spacing: -0.64px; }
.nav-sep { color: var(--hairline-strong); font-weight: 300; font-size: 20px; }
.nav-host { color: var(--body); font-size: 13px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: var(--canvas);
  color: var(--body);
  box-shadow: 0 0 0 1px var(--hairline);
  cursor: pointer;
  transition: color 0.15s, box-shadow 0.15s;
}
.icon-btn:hover { color: var(--ink); box-shadow: 0 0 0 1px var(--hairline-strong); }
.icon-btn svg { width: 16px; height: 16px; }

/* --- layout ------------------------------------------------------------ */
.wrap {
  width: min(1200px, 100% - 48px);
  margin: 0 auto;
  padding-bottom: 96px;
}
@media (max-width: 600px) {
  .wrap, .nav-inner { width: calc(100% - 32px); }
}

/* --- hero -------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  padding: 64px 0 32px;
  text-align: center;
}

/* The brand mesh gradient: one atmospheric object at hero scale, never
   miniaturised. Develop (blue→teal), preview (violet→pink), ship (coral→amber). */
.mesh {
  position: absolute;
  inset: 0 -10% auto;
  height: 420px;
  z-index: -1;
  pointer-events: none;
  opacity: var(--mesh-opacity);
  filter: blur(64px);
  background:
    radial-gradient(28% 50% at 22% 38%, #007cf0, transparent 70%),
    radial-gradient(24% 46% at 38% 62%, #00dfd8, transparent 70%),
    radial-gradient(26% 50% at 55% 34%, #7928ca, transparent 70%),
    radial-gradient(24% 44% at 70% 60%, #ff0080, transparent 70%),
    radial-gradient(22% 40% at 84% 38%, #f9cb28, transparent 70%);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
}

.eyebrow {
  display: inline-block;
  color: var(--body);
  font-size: 12px;
  line-height: 16px;
}

.hero .eyebrow {
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--canvas);
  box-shadow: 0 0 0 1px var(--hairline);
}

h1 {
  margin: 20px 0 12px;
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.05em;
}

.lead {
  max-width: 560px;
  margin: 0 auto;
  color: var(--body);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

/* Tab-ghost pills inside a hairline track; the thumb is a raised white pill. */
.segmented {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: var(--pill);
  background: var(--canvas-soft-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.segmented button {
  position: relative;
  z-index: 1;
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] { color: var(--ink); }

.segmented-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  height: 32px;
  border-radius: var(--pill);
  background: var(--canvas);
  box-shadow: var(--shadow-raise);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Datagram size: a pill the height of the segmented track, label in mono. */
.select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 32px 0 16px;
  border-radius: var(--pill);
  background: var(--canvas);
  box-shadow: 0 0 0 1px var(--hairline);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.select:hover { box-shadow: 0 0 0 1px var(--hairline-strong); }
.select[hidden] { display: none; }
.select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--body);
  border-bottom: 1.5px solid var(--body);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select-label { color: var(--mute); font-size: 12px; }
.select select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: 500 14px/20px var(--sans);
  letter-spacing: -0.28px;
  cursor: pointer;
}
.select select:focus-visible { outline: none; }
.select:focus-within { box-shadow: 0 0 0 2px var(--up); }
.select select:disabled { color: var(--mute); cursor: not-allowed; }
.select select option { background: var(--canvas); color: var(--ink); }

.actions { display: flex; gap: 8px; }

.btn {
  height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--pill);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary { background: var(--primary); color: var(--on-primary); min-width: 120px; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 85%, var(--canvas)); }

.btn.secondary { background: var(--canvas); color: var(--ink); box-shadow: 0 0 0 1px var(--hairline); }
.btn.secondary:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--hairline-strong); }

.btn.toggle[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.btn.toggle[aria-pressed="true"]::before { content: "✓ "; }

.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--body);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hairline-strong);
}
.status.running .dot { background: var(--up); box-shadow: 0 0 0 4px color-mix(in srgb, var(--up) 20%, transparent); animation: pulse 1.2s ease-in-out infinite; }
.status.ok .dot { background: var(--ok); }
.status.bad .dot { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* --- banner ------------------------------------------------------------ */
.banner {
  max-width: 720px;
  margin: 0 auto 24px;
  padding: 8px 16px;
  border-radius: var(--pill);
  background: var(--warning-soft);
  color: var(--warning-deep);
  font-size: 13px;
  text-align: center;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 30%, transparent);
}
.banner strong { font-weight: 600; }
.banner[hidden] { display: none; }
@media (max-width: 600px) { .banner { border-radius: var(--r-lg); } }

/* --- cards ------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 960px) {
  .grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  border-radius: var(--r-lg);
  background: var(--canvas);
  box-shadow: var(--shadow-card);
  transition: opacity 0.2s;
}
.card.disabled { opacity: 0.45; }
@media (max-width: 600px) { .card { padding: 20px; } }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card h2 {
  margin: 6px 0 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.6px;
}

.badge {
  flex: none;
  height: 24px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background: var(--canvas-soft-2);
  color: var(--body);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}
.badge.ok { background: color-mix(in srgb, var(--ok) 12%, var(--canvas)); color: var(--ok); }
.badge.run { background: color-mix(in srgb, var(--warning) 16%, var(--canvas)); color: var(--warning-deep); }
.badge.bad { background: var(--error-soft); color: var(--error-deep); }

/* --- dials ------------------------------------------------------------- */
.gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.gauge {
  position: relative;
  min-width: 0;
  --g: var(--down);
}
.gauge.up { --g: var(--up); }
.gauge svg { display: block; width: 100%; height: auto; overflow: visible; }

.g-bg, .g-fg {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.g-bg { stroke: var(--hairline); }
.g-fg {
  stroke: var(--g);
  stroke-dasharray: 0 200; /* period > path length, so no stray cap dot at the far end */
  transition: stroke-dasharray 0.3s ease-out;
}

.g-read {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.g-read span {
  font-size: clamp(28px, 4.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.05em;
}
.g-read span.empty { color: var(--hairline-strong); font-weight: 400; }
.g-read em {
  margin-top: 6px;
  font-style: normal;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0;
}

.g-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--body);
  font-size: 13px;
  font-weight: 500;
}
.g-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--g);
}

.bar {
  height: 2px;
  margin-top: -8px;
  border-radius: 2px;
  background: var(--hairline);
  overflow: hidden;
}
.bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ink);
  transition: width 0.4s ease;
}

/* --- stats: data-table cells, mono eyebrow over a display number --------- */
.stats {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--hairline);
  overflow: hidden;
}
.stats.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 480px) { .stats.three { grid-template-columns: repeat(2, 1fr); } }

.stat {
  padding: 12px 16px;
  box-shadow: 1px 0 0 var(--hairline), 0 1px 0 var(--hairline);
}
.stat dt {
  color: var(--mute);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stat dd { margin: 4px 0 0; display: flex; align-items: baseline; gap: 4px; }
.stat b { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.6px; }
.stat em { font-style: normal; color: var(--mute); font-family: var(--mono); font-size: 12px; letter-spacing: 0; }

/* --- charts ------------------------------------------------------------ */
.chart-frame {
  margin: 0;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--canvas-soft);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.chart-title {
  display: block;
  margin-bottom: 12px;
  color: var(--mute);
  font-size: 11px;
  line-height: 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chart { display: block; width: 100%; height: auto; overflow: visible; }
#tcp-chart { min-height: 96px; }

.ramp figcaption {
  margin-top: 12px;
  color: var(--mute);
  font-size: 12px;
  line-height: 18px;
  letter-spacing: 0;
}
.ramp figcaption strong { color: var(--body); font-weight: 500; }

.ramp-grid { stroke: var(--hairline); stroke-width: 1; }
.ramp-axis, .ramp-legend, .ramp-empty {
  fill: var(--mute);
  font-family: var(--mono);
  font-size: 11px;
}
.ramp-legend { fill: var(--body); }
.spark-area { opacity: 0.08; }
.spark-line { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-empty { fill: var(--mute); font-family: var(--mono); font-size: 12px; }

/* --- notes, caveats, errors ------------------------------------------- */
.caveat, .detail { margin: 0; font-size: 12px; line-height: 18px; }
.caveat {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--warning-soft);
  color: var(--warning-deep);
  letter-spacing: 0;
}
.detail { color: var(--mute); word-break: break-word; }

.notes {
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--body);
  font-size: 13px;
  line-height: 20px;
}
.notes summary {
  cursor: pointer;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
  list-style: none;
}
.notes summary::before { content: "+ "; }
.notes[open] summary::before { content: "− "; }
.notes summary::-webkit-details-marker { display: none; }
.notes p { margin: 8px 0 0; }
.notes strong { color: var(--ink); font-weight: 600; }

.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--error-soft);
  color: var(--error-deep);
  font-size: 13px;
  line-height: 20px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--error) 25%, transparent);
}
.error[hidden] { display: none; }

/* --- footer & debug ---------------------------------------------------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.summary { color: var(--mute); font-size: 12px; }

.json {
  margin: 16px 0 0;
  max-height: 420px;
  overflow: auto;
  padding: 24px;
  border-radius: var(--r-md);
  background: #171717;
  color: #ededed;
  font: 13px/20px var(--mono);
  letter-spacing: 0;
}
.json[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
