/* ipblame.com
   Palette borrowed from network hardware: cool ABS-plastic greys,
   link-light amber and green, fault red. */

:root {
  --ground:   #DFE3E7;
  --panel:    #F6F7F8;
  --ink:      #171D24;
  --ink-mid:  #55606B;
  --ink-soft: #8A939C;
  --rule:     #C2C8CE;

  --ok:    #1B7A4B;
  --warn:  #B9740A;
  --bad:   #A82B22;
  --idle:  #A9B2BA;

  --shadow: 0 1px 0 #FFFFFF inset, 0 1px 2px rgba(23,29,36,.10);

  --display: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --body:    "IBM Plex Sans", system-ui, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, monospace;

  --gutter: 1.25rem;
  --maxw: 60rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
}

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Masthead ─────────────────────────────────────────────── */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.logotype {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}
.logotype span { color: var(--warn); }

.btn {
  font-family: var(--body);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .4rem .75rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn:hover { background: #fff; }
.btn:active { box-shadow: none; transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }

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

/* ── Verdict band ─────────────────────────────────────────── */

.verdict-band {
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  padding-block: 2.5rem 2rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 .5rem;
}

.verdict {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
  max-width: 20ch;
}

.verdict-note {
  margin: 0 0 2rem;
  color: var(--ink-mid);
  max-width: 52ch;
  font-size: .9375rem;
}

/* ── Signature: the blame chain ───────────────────────────── */

.chain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.chain .link {
  position: relative;
  padding: .625rem .5rem .6875rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}

/* the lamp is the link light */
.lamp {
  width: 100%;
  height: 5px;
  border-radius: 2px;
  background: var(--idle);
  transition: background .45s ease;
}

.link-name {
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.link-state {
  font-family: var(--mono);
  font-size: .625rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.3;
}

.link.is-ok   .lamp { background: var(--ok); }
.link.is-warn .lamp { background: var(--warn); }
.link.is-bad  .lamp { background: var(--bad); }

.link.is-ok   .link-state { color: var(--ok); }
.link.is-warn .link-state { color: var(--warn); }
.link.is-bad  .link-state { color: var(--bad); }

/* the culprit gets called out */
.link.is-bad, .link.is-warn {
  border-color: currentColor;
}
.link.is-bad  { border-color: var(--bad); }
.link.is-warn { border-color: var(--warn); }

.link.is-testing .lamp {
  animation: blink 1.1s steps(2, jump-none) infinite;
}

@keyframes blink {
  0%, 49%  { background: var(--idle); }
  50%,100% { background: #CBD2D8; }
}

/* ── Panels ───────────────────────────────────────────────── */

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-block: 1.75rem;
}

section.wrap { margin-block: 1.75rem; }
.panels.wrap { margin-block: 1.75rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.125rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
}

.panel-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: .01em;
  margin: 0 0 .25rem;
}

.panel-sub {
  margin: 0 0 1.125rem;
  font-size: .8125rem;
  color: var(--ink-mid);
  max-width: 62ch;
}

.fineprint {
  margin: 1rem 0 0;
  font-size: .75rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

/* ── Readouts ─────────────────────────────────────────────── */

.readout { margin: .75rem 0 0; }

.readout .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .4375rem 0;
  border-bottom: 1px solid var(--rule);
}
.readout .row:last-child { border-bottom: 0; }

.readout dt {
  font-size: .75rem;
  color: var(--ink-mid);
  flex: none;
}

.readout dd {
  margin: 0;
  font-size: .875rem;
  text-align: right;
  word-break: break-all;
  min-width: 0;
}

.readout dd.big { font-size: 1.0625rem; font-weight: 500; }

.tag-ok   { color: var(--ok);   font-weight: 500; }
.tag-warn { color: var(--warn); font-weight: 500; }
.tag-bad  { color: var(--bad);  font-weight: 500; }

/* ── Stage bars ───────────────────────────────────────────── */

.stages { display: grid; gap: .5rem; margin-bottom: 1.5rem; }

.stage {
  display: grid;
  grid-template-columns: 7rem 1fr 4.5rem;
  align-items: center;
  gap: .75rem;
}

.stage .stage-name {
  order: -1;
  font-size: .8125rem;
  color: var(--ink-mid);
}

.stage .bar {
  height: 10px;
  border-radius: 2px;
  background: var(--idle);
  width: 2%;
  transition: width .6s cubic-bezier(.2,.7,.3,1), background .3s;
}

.stage.is-slow .bar { background: var(--warn); }
.stage.is-fine .bar { background: var(--ok); }

.stage .stage-val {
  font-size: .8125rem;
  text-align: right;
  color: var(--ink);
}

/* ── Metric grid ──────────────────────────────────────────── */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.metric {
  background: #fff;
  padding: .75rem .75rem .8125rem;
  display: flex;
  flex-direction: column;
  gap: .1875rem;
}

.metric-val {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.1;
}

.metric-label {
  font-size: .6875rem;
  color: var(--ink-soft);
  letter-spacing: .02em;
}

/* ── Regions ──────────────────────────────────────────────── */

.regions { display: grid; gap: .5rem; }

.region {
  display: grid;
  grid-template-columns: 9rem 1fr 4.5rem;
  align-items: center;
  gap: .75rem;
}

.region .region-name { font-size: .8125rem; color: var(--ink-mid); }

.region .bar {
  height: 10px;
  border-radius: 2px;
  background: var(--ok);
  width: 2%;
  transition: width .6s cubic-bezier(.2,.7,.3,1);
}
.region.is-slow .bar { background: var(--warn); }
.region.is-dead .bar { background: var(--bad); width: 100%; }

.region .region-val { font-size: .8125rem; text-align: right; }

/* ── Provider status ──────────────────────────────────────── */

.providers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.provider {
  background: #fff;
  padding: .625rem .75rem .6875rem;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  min-width: 0;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--idle);
  transform: translateY(-1px);
}
.provider.s-ok    .dot { background: var(--ok); }
.provider.s-minor .dot { background: var(--warn); }
.provider.s-major .dot { background: var(--bad); }
.provider.s-none  .dot { background: var(--idle); }

.provider-name {
  font-size: .8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-state {
  font-family: var(--mono);
  font-size: .625rem;
  color: var(--ink-soft);
  margin-left: auto;
  flex: none;
}
.provider.s-minor .provider-state { color: var(--warn); }
.provider.s-major .provider-state { color: var(--bad); }

.empty { color: var(--ink-soft); font-size: .8125rem; margin: 0; }

/* ── Raw + footer ─────────────────────────────────────────── */

.raw { margin-block: 1.75rem; }

.raw summary {
  cursor: pointer;
  font-size: .8125rem;
  color: var(--ink-mid);
  padding: .5rem 0;
}

.raw pre {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem;
  font-size: .75rem;
  line-height: 1.5;
  overflow-x: auto;
  margin: .5rem 0 0;
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 1.25rem 2.5rem;
  margin-top: 2.5rem;
}
.site-footer p {
  margin: 0;
  font-size: .75rem;
  color: var(--ink-soft);
}

/* ── Narrow screens ───────────────────────────────────────── */

@media (max-width: 44rem) {
  .panels { grid-template-columns: 1fr; }

  .chain { grid-template-columns: 1fr; gap: 2px; }
  .chain .link {
    flex-direction: row;
    align-items: center;
    gap: .625rem;
    padding: .5rem .625rem;
  }
  .lamp { width: 5px; height: 22px; flex: none; }
  .link-state { margin-left: auto; }

  .stage, .region { grid-template-columns: 5.5rem 1fr 3.75rem; gap: .5rem; }
  .stage .stage-name, .region .region-name { font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
