/*
 * Mavelo Metrics. Mavelo's own black, its violet, Outfit for headings and figures and Inter for
 * everything read as text. The charts are the only loud thing on a page.
 */

@font-face {
  font-family: "Mavelo Outfit";
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/outfit-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Mavelo Outfit";
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/outfit-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Mavelo Inter";
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
}

:root {
  --bg: #000;
  --surface: #0a0a0b;
  --surface-2: #121214;
  --surface-3: #1c1c20;
  --line: rgb(255 255 255 / 0.1);
  --line-strong: rgb(255 255 255 / 0.2);
  --text: #f4f4f6;
  --muted: #a6a6b0;
  --subtle: #7f7f8a;
  --violet: #8f78ff;
  --primary: #5b3bff;
  --primary-hover: #6c4bff;
  --lavender: #b9a8ff;
  --ok: #5ee6a8;
  --warn: #fbbf24;
  --bad: #f87171;
  --text-font: "Mavelo Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --head-font: "Mavelo Outfit", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono-font: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --radius: 12px;
  --radius-card: 18px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--text-font);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}
a {
  color: var(--lavender);
  text-decoration: none;
}
a:hover {
  color: #fff;
}
:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
  border-radius: 4px;
}
[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}
.hint,
.sub {
  color: var(--subtle);
  font-size: 12.5px;
}
.sub {
  margin-top: 2px;
}
.mono {
  font-family: var(--mono-font);
  font-size: 12.5px;
}
.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.strong {
  color: var(--text);
  font: 500 14.5px/1.3 var(--head-font);
}

/* ---------- The bar across the top ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgb(0 0 0 / 0.86);
  backdrop-filter: blur(10px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1280px;
  height: 60px;
  margin: 0 auto;
  padding: 0 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font: 600 18px/1 var(--head-font);
  letter-spacing: -0.01em;
}
.brand img {
  display: block;
}
.nav {
  display: flex;
  gap: 4px;
}
.nav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
}
.nav a:hover {
  color: var(--text);
}
.nav a.is-current {
  background: var(--surface-3);
  color: var(--text);
}
.topbar-end {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.beat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.beat i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.beat-stale i {
  background: var(--warn);
}

/* ---------- Page ---------- */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1,
.signin h1 {
  font: 600 26px/1.15 var(--head-font);
  letter-spacing: -0.02em;
}
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.crumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--subtle);
  font-size: 13px;
}
.crumbs a {
  color: var(--muted);
}
.meta {
  margin: -10px 0 18px;
  color: var(--subtle);
  white-space: pre-wrap;
}
.meta .update {
  margin-left: 14px;
  font-family: var(--text-font);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.thirds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.halves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.card h2 {
  font: 600 16px/1.3 var(--head-font);
  letter-spacing: -0.005em;
}
.card > h2 {
  margin-bottom: 14px;
}
.card h3 {
  margin: 22px 0 6px;
  font: 500 15px/1.3 var(--head-font);
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.card-head a {
  font-size: 13px;
}
.card-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.notice {
  padding: 12px 16px;
  border: 1px solid rgb(251 191 36 / 0.3);
  border-radius: var(--radius);
  background: rgb(251 191 36 / 0.07);
  color: #f3dca0;
  font-size: 13.5px;
}
.page > .notice {
  margin-bottom: 16px;
}
.empty {
  padding: 64px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  text-align: center;
}
.empty h2 {
  font: 600 20px/1.2 var(--head-font);
}
.empty p {
  max-width: 46ch;
  margin: 8px auto 20px;
  color: var(--muted);
}

/* ---------- Figures ---------- */

.tiles {
  display: grid;
  gap: 12px;
}
.tiles-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tiles-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tiles-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.tile {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.tile-label {
  color: var(--muted);
  font-size: 13px;
}
.tile-figure {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
  white-space: nowrap;
}
.tile-value {
  font: 600 26px/1.1 var(--head-font);
  letter-spacing: -0.02em;
}
.tile-unit {
  color: var(--muted);
  font: 500 14px/1 var(--head-font);
}
.tile-note {
  min-height: 18px;
  margin-top: 6px;
  overflow: hidden;
  color: var(--subtle);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile[data-tone="warn"] .tile-value {
  color: var(--warn);
}
.tile[data-tone="bad"] .tile-value,
.tile[data-tone="bad"] .tile-note {
  color: var(--bad);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--subtle);
}
.pill-success {
  border-color: rgb(94 230 168 / 0.3);
  background: rgb(94 230 168 / 0.1);
  color: var(--ok);
}
.pill-success i {
  background: var(--ok);
}
.pill-warning {
  border-color: rgb(251 191 36 / 0.3);
  background: rgb(251 191 36 / 0.1);
  color: var(--warn);
}
.pill-warning i {
  background: var(--warn);
}
.pill-danger {
  border-color: rgb(248 113 113 / 0.35);
  background: rgb(248 113 113 / 0.1);
  color: var(--bad);
}
.pill-danger i {
  background: var(--bad);
}
@media (prefers-reduced-motion: no-preference) {
  .pill-live i {
    animation: pulse 1.4s ease-in-out infinite;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.meter-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.meter {
  display: block;
  width: 72px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: rgb(143 120 255 / 0.18);
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--violet);
}
.meter-warn {
  background: rgb(251 191 36 / 0.18);
}
.meter-warn i {
  background: var(--warn);
}
.meter-bad {
  background: rgb(248 113 113 / 0.18);
}
.meter-bad i {
  background: var(--bad);
}

.spark {
  display: block;
  width: 120px;
  height: 28px;
}
.spark path {
  fill: none;
  stroke: #9887ef;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- Charts ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.choice {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.choice button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.choice button:hover {
  color: var(--text);
}
.choice button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
}
select {
  height: 34px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.chart {
  transition: opacity 0.15s;
}
.chart.is-stale {
  opacity: 0.45;
}
.chart-frame {
  position: relative;
  height: 240px;
}
.chart-tall .chart-frame {
  height: 300px;
}
.chart-short .chart-frame {
  height: 180px;
}
.chart-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  cursor: crosshair;
  touch-action: pan-y;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  min-height: 20px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
}
.legend-item,
.readout-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.key {
  width: 12px;
  height: 2px;
  border-radius: 1px;
}
.readout {
  position: absolute;
  z-index: 2;
  min-width: 150px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: 0 12px 30px -10px rgb(0 0 0 / 0.9);
  font-size: 12.5px;
  pointer-events: none;
}
.readout-time {
  margin-bottom: 5px;
  color: var(--muted);
}
.readout-row b {
  font: 500 13px/1.5 var(--head-font);
  font-variant-numeric: tabular-nums;
}
.readout-row span {
  color: var(--muted);
}

.segments {
  display: flex;
  gap: 2px;
  height: 8px;
}
.segments i {
  min-width: 3px;
  border-radius: 4px;
}
.segments-empty {
  flex: 1;
  background: var(--surface-3);
}
.proto-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin: 16px 0;
}
.proto-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.proto-row .num {
  margin-left: auto;
}
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(40px, 1fr) 52px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.rank-row:first-of-type {
  border-top: 0;
}
.rank-row .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: rgb(143 120 255 / 0.14);
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: #9887ef;
}
.ranked h4 {
  margin-bottom: 4px;
  color: var(--muted);
  font: 500 13px/1.4 var(--head-font);
}

/* ---------- Tables and facts ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
}
.card > div > .table,
.card > .table {
  margin: -4px 0;
}
.table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-weight: 400;
  font-size: 12.5px;
  text-align: left;
  white-space: nowrap;
}
.table th.num {
  text-align: right;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table th:first-child,
.table td:first-child {
  padding-left: 0;
}
.table th:last-child,
.table td:last-child {
  padding-right: 0;
}
.row-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.row-toggle::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 10px 2px 2px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.12s;
}
.row-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
}
.detail-row td {
  padding: 4px 0 20px 18px;
}
.attack-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 24px;
  align-items: center;
}
.facts dt {
  color: var(--muted);
}

/* ---------- Node cards ---------- */

.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.node-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.15s,
    background 0.15s;
}
.node-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}
.node-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.node-card .spark {
  width: 100%;
  height: 44px;
}
.node-card-facts {
  display: grid;
  grid-template-columns: repeat(5, auto);
  justify-content: space-between;
  gap: 8px;
}
.node-card-facts dt {
  color: var(--subtle);
  font-size: 12px;
}
.node-card-facts dd {
  font: 500 13.5px/1.4 var(--head-font);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 20px;
  /* The rule under the tabs is a shadow, so the current tab's underline can sit on top of it
     without the row growing a scrollbar. */
  box-shadow: inset 0 -1px 0 var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabs a {
  padding: 10px 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}
.tabs a:hover {
  color: var(--text);
}
.tabs a.is-current {
  border-bottom-color: var(--violet);
  color: var(--text);
}

/* ---------- Buttons and forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 14px/1 var(--head-font);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn-sm {
  height: 32px;
  padding: 0 13px;
  font-size: 13px;
}
.btn-wide {
  width: 100%;
}
.btn-primary,
a.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  color: #fff;
}
.btn-outline,
a.btn-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}
.btn-danger {
  border-color: rgb(248 113 113 / 0.45);
  background: rgb(248 113 113 / 0.1);
  color: var(--bad);
}
.btn-danger:hover:not(:disabled) {
  background: rgb(248 113 113 / 0.2);
}
.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}
input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
input:focus-visible {
  outline-offset: 0;
  border-radius: 10px;
}
.form {
  max-width: 720px;
}
.field {
  margin-bottom: 14px;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.form .facts {
  margin: 6px 0 4px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}
.form-note {
  color: var(--ok);
  font-size: 13px;
}
.form-problem {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--bad);
  font-size: 13px;
}
.card > .hint,
.card > .facts {
  max-width: 78ch;
}
.card > .facts + .hint {
  margin-top: 16px;
}

.command {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #050506;
}
.command code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  color: var(--text);
  font: 12.5px/1.6 var(--mono-font);
  white-space: nowrap;
  user-select: all;
}
.command + .hint {
  margin-top: 10px;
}
.waiting {
  margin-top: 16px;
}

/* ---------- Dialog ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 0.7);
  backdrop-filter: blur(3px);
}
.dialog {
  width: min(600px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  box-shadow: 0 30px 80px -20px #000;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.dialog-head h2 {
  font: 600 19px/1.2 var(--head-font);
}
.dialog-body label {
  margin-top: 16px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- Sign-in ---------- */

.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.signin-card {
  width: min(380px, 100%);
  text-align: center;
}
.signin-card img {
  margin-bottom: 6px;
}
.signin-card .muted {
  margin-top: 8px;
}
.signin-form {
  margin-top: 28px;
  text-align: left;
}
.signin-form label {
  margin-top: 14px;
}
.signin-form .btn {
  margin-top: 14px;
}

/* ---------- Narrower screens ---------- */

@media (max-width: 1100px) {
  .tiles-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tiles-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .thirds,
  .attack-detail {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .topbar-inner {
    gap: 8px;
    padding: 0 12px;
  }
  .brand span,
  .beat {
    display: none;
  }
  .nav {
    gap: 0;
  }
  .nav a {
    padding: 7px 9px;
  }
  .topbar-end .btn {
    padding: 0 10px;
  }
  .choice {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .page {
    padding: 20px 16px 56px;
  }
  .tiles-4,
  .tiles-5,
  .tiles-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .halves,
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .card {
    padding: 16px;
    overflow-x: auto;
  }
  .command {
    flex-direction: column;
    align-items: stretch;
  }
}
