/* Snapwake status. Plain white by day, the site's ink by night; monochrome, colour only for status
   (always next to an icon and a word). Geist for text, Michroma only for the wordmark. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Michroma";
  src: url("/fonts/michroma.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #0b0b10;
  --fg-2: #4b4b58;
  --fg-3: #7c7c8e;
  --line: #ebebf0;
  --line-2: #dcdce3;
  --surface: #f7f7f9;
  --none: #e4e4ea;
  --tip-bg: #0b0b10;
  --tip-fg: #f4f4f7;
  /* the mark on light: dark faces, light eye (web/brand/snapwake-mark-awake-on-light.svg) */
  --m-r: #0b0b10;
  --m-l: #16161d;
  --m-t: #2a2a35;
  --m-eye: #f4f4f7;

  /* status: the admin panel's dataviz palette, the same in both themes */
  --ok: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;

  --r-s: 4px;
  --r-m: 6px;
  --r-l: 10px;
  --wrap: 760px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #060609;
    --fg: #f4f4f7;
    --fg-2: #a9a9b8;
    --fg-3: #7c7c8e;
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.14);
    --surface: #0b0b10;
    --none: #1d1d26;
    --tip-bg: #f4f4f7;
    --tip-fg: #0b0b10;
    --m-r: #8e8e9e;
    --m-l: #c2c2ce;
    --m-t: #f4f4f7;
    --m-eye: #0b0b10;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060609;
  --fg: #f4f4f7;
  --fg-2: #a9a9b8;
  --fg-3: #7c7c8e;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --surface: #0b0b10;
  --none: #1d1d26;
  --tip-bg: #f4f4f7;
  --tip-fg: #0b0b10;
  --m-r: #8e8e9e;
  --m-l: #c2c2ce;
  --m-t: #f4f4f7;
  --m-eye: #0b0b10;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: currentColor;
}
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-radius: var(--r-s);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

/* top bar */
.top {
  border-bottom: 1px solid var(--line);
}
.top-in {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.mark {
  width: 26px;
  height: 26px;
  display: block;
}
.m-r {
  fill: var(--m-r);
  stroke: var(--m-r);
}
.m-l {
  fill: var(--m-l);
  stroke: var(--m-l);
}
.m-t {
  fill: var(--m-t);
  stroke: var(--m-t);
}
.m-eye {
  fill: var(--m-eye);
}
.word {
  font-family: "Michroma", "Geist", sans-serif;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.crumb {
  color: var(--fg-3);
  text-decoration: none;
  padding-left: 14px;
  border-left: 1px solid var(--line-2);
  line-height: 18px;
}
.top-links {
  margin-left: auto;
  display: flex;
  gap: 4px;
  font-size: 14px;
}
.top-links a {
  color: var(--fg-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-s);
}
.top-links a:hover {
  color: var(--fg);
  background: var(--surface);
}

/* status colour, used for dots, bars, pills and icons */
.s-operational {
  --s: var(--ok);
}
.s-degraded {
  --s: var(--warn);
}
.s-partial {
  --s: var(--serious);
}
.s-outage {
  --s: var(--crit);
}
.s-unknown,
.s-none {
  --s: var(--fg-3);
}

.ico {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico circle {
  fill: var(--s);
  stroke: none;
}
.ico path {
  stroke: #fff;
  stroke-width: 1.8;
}
.s-degraded .ico path {
  stroke: #0b0b10;
}

/* headline */
.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 44px 0 36px;
}
.ico-l {
  width: 40px;
  height: 40px;
}
.ico-l path {
  stroke-width: 1.5;
}
.hero h1 {
  font-size: 28px;
  line-height: 1.2;
}
.meta {
  margin: 4px 0 0;
  color: var(--fg-2);
  font-size: 14px;
}

/* sections */
section + section {
  margin-top: 40px;
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}
.sec-head h2 {
  font-size: 17px;
}
.sec-head span {
  color: var(--fg-3);
  font-size: 13px;
}
.card {
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  background: var(--bg);
}

/* components */
.comp {
  padding: 18px 20px 16px;
}
.comp + .comp {
  border-top: 1px solid var(--line);
}
.comp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.comp-name h3 {
  font-size: 15px;
}
.about {
  margin: 2px 0 0;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.45;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px 3px 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  white-space: nowrap;
}

.bars {
  display: grid;
  grid-template-columns: repeat(90, 1fr);
  gap: 2px;
  height: 32px;
  margin-top: 14px;
}
.bar {
  background: var(--s);
  border-radius: 4px;
  min-width: 0;
  transition: opacity 0.1s ease;
}
.bar.s-none {
  background: var(--none);
}
.bars:hover .bar {
  opacity: 0.55;
}
.bars:hover .bar:hover {
  opacity: 1;
}
.bars-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--fg-3);
  font-size: 12px;
}
.bars-foot .up {
  color: var(--fg-2);
  font-family: "Geist Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.ago .d60,
.ago .d30 {
  display: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0 0;
  color: var(--fg-3);
  font-size: 12px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sw {
  width: 8px;
  height: 14px;
  border-radius: 4px;
  background: var(--s);
}
.sw.s-none {
  background: var(--none);
}

/* wake */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.stat {
  padding: 16px 20px;
  display: grid;
  gap: 2px;
}
.stat + .stat {
  border-left: 1px solid var(--line);
}
.stat .k {
  color: var(--fg-3);
  font-size: 13px;
}
.stat .v {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.stat small {
  font-size: 14px;
  color: var(--fg-3);
  margin-left: 3px;
  letter-spacing: 0;
}
.charts {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
}
.chart {
  margin: 0;
  padding: 14px 16px 10px;
}
.chart + .chart {
  border-left: 1px solid var(--line);
}
.chart figcaption {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.chart figcaption span {
  color: var(--fg-3);
  font-weight: 400;
}
.plot {
  position: relative;
  height: 112px;
  margin-left: 30px;
}
.plot svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.yax {
  position: absolute;
  inset: 0 auto 0 -30px;
  width: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}
.yax span,
.xax span {
  color: var(--fg-3);
  font-size: 10px;
  line-height: 1;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.yax span:first-child {
  transform: translateY(-50%);
}
.yax span:nth-child(2) {
  transform: translateY(0);
}
.yax span:last-child {
  transform: translateY(50%);
}
.xax {
  display: flex;
  justify-content: space-between;
  margin: 8px 0 0 30px;
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart .line {
  fill: none;
  stroke: var(--fg);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.chart .cross {
  stroke: var(--fg-3);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  visibility: hidden;
}
.charts.hover .cross {
  visibility: visible;
}
.table {
  margin-top: 10px;
  font-size: 13px;
  color: var(--fg-2);
}
.table summary {
  cursor: pointer;
  width: max-content;
}
.table table {
  margin-top: 10px;
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.table th:first-child,
.table td:first-child {
  text-align: left;
}
.table th {
  font-weight: 500;
  color: var(--fg-3);
}
.note {
  margin: 12px 0 0;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.5;
}

/* incidents */
.active {
  display: grid;
  gap: 12px;
}
.inc {
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  padding: 18px 20px 6px;
}
.active .inc {
  border-left: 4px solid var(--s, var(--line-2));
}
.inc.i-degraded {
  --s: var(--warn);
}
.inc.i-partial {
  --s: var(--serious);
}
.inc.i-outage {
  --s: var(--crit);
}
.history .inc + .inc {
  margin-top: 12px;
}
.inc header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inc h3 {
  font-size: 16px;
}
.inc h3 a {
  text-decoration: none;
}
.inc h3 a:hover {
  text-decoration: underline;
}
.tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  color: var(--fg-2);
}
.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--s);
}
.inc-when {
  margin: 6px 0 0;
  color: var(--fg-3);
  font-size: 13px;
}
.updates {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.updates li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.u-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
}
.u-head b {
  font-weight: 600;
}
.u-head time {
  color: var(--fg-3);
}
.u-body p {
  margin: 4px 0 0;
  color: var(--fg-2);
}
.empty {
  margin: 0;
  padding: 18px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-l);
  color: var(--fg-3);
}
.back {
  margin: 32px 0 16px;
  font-size: 14px;
}
.back a {
  color: var(--fg-2);
  text-decoration: none;
}
.nf {
  font-size: 24px;
  margin-bottom: 12px;
}

/* footer */
.foot {
  margin-top: 56px;
  padding-top: 20px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  color: var(--fg-3);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
}
.foot p {
  margin: 0;
  display: flex;
  gap: 16px;
}
.foot a {
  color: var(--fg-2);
  text-decoration: none;
}
.foot a:hover {
  color: var(--fg);
}

/* the one tooltip, moved by status.js */
.tip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: var(--r-m);
  background: var(--tip-bg);
  color: var(--tip-fg);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.tip b {
  font-weight: 600;
}

@media (max-width: 720px) {
  .bars {
    grid-template-columns: repeat(60, 1fr);
  }
  .bars .bar:nth-child(-n + 30) {
    display: none;
  }
  .ago .d90 {
    display: none;
  }
  .ago .d60 {
    display: inline;
  }
  .charts {
    grid-template-columns: 1fr;
  }
  .chart + .chart {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .wrap {
    padding: 0 16px;
  }
  .crumb,
  .top-links a:last-child {
    display: none;
  }
  .hero {
    padding: 32px 0 28px;
  }
  .hero h1 {
    font-size: 22px;
  }
  .ico-l {
    width: 32px;
    height: 32px;
  }
  .comp {
    padding: 16px;
  }
  .comp-head {
    flex-direction: column;
    gap: 8px;
  }
  .bars {
    grid-template-columns: repeat(30, 1fr);
  }
  .bars .bar:nth-child(-n + 60) {
    display: none;
  }
  .ago .d60 {
    display: none;
  }
  .ago .d30 {
    display: inline;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat:last-child {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .stat .v {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bar {
    transition: none;
  }
}
