/* The status page, styled after OpenStatus's: square corners, a mono face for data, thin
   borders, and solid daily bars. */

:root {
  color-scheme: light;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --border: oklch(0.922 0 0);
  --popover: oklch(1 0 0);
  --ring: oklch(0.708 0 0);
  --up: oklch(0.72 0.19 150);
  --degraded: oklch(0.77 0.16 70);
  --down: oklch(0.577 0.245 27.325);
  --empty: oklch(0.922 0 0);
  --tint: 20%;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Commit Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --border: oklch(1 0 0 / 10%);
    --popover: oklch(0.205 0 0);
    --ring: oklch(0.556 0 0);
    --down: oklch(0.704 0.191 22.216);
    --empty: oklch(0.269 0 0);
    --tint: 10%;
  }
}

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

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

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

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 0.75rem;
}

.muted {
  color: var(--muted-foreground);
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 600;
}

.brand-logo {
  display: block;
  width: 2rem;
  height: 2rem;
}

/* rift.trade draws its wordmark at 86 by 22. */
.brand-wordmark {
  display: flex;
}

.brand-wordmark svg {
  width: 86px;
  height: 22px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

.header-link svg {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--muted-foreground);
}

.header-link:hover {
  background: var(--muted);
}

/* Page */

main.container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* Banner */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
}

.banner.up {
  border-color: var(--up);
  background: oklch(from var(--up) l c h / var(--tint));
}

.banner.degraded {
  border-color: var(--degraded);
  background: oklch(from var(--degraded) l c h / var(--tint));
}

.banner.down {
  border-color: var(--down);
  background: oklch(from var(--down) l c h / var(--tint));
}

.banner-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--muted-foreground);
  color: var(--background);
}

.banner.up .banner-icon {
  background: var(--up);
}

.banner.degraded .banner-icon {
  background: var(--degraded);
}

.banner.down .banner-icon {
  background: var(--down);
}

.banner-icon svg {
  width: 1rem;
  height: 1rem;
}

.banner h1 {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.75rem;
}

.banner-time {
  color: var(--muted-foreground);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: underline dashed oklch(from var(--muted-foreground) l c h / 30%);
  text-underline-offset: 4px;
}

/* Checks */

.checks {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.check {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.check-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
}

.check-title h3 {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint {
  position: relative;
  display: inline-flex;
  color: var(--muted-foreground);
  cursor: help;
}

.hint > svg {
  width: 1rem;
  height: 1rem;
}

.badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
}

.badge .muted:first-child {
  opacity: 0.7;
}

.check-uptime {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.75rem;
  color: oklch(from var(--foreground) l c h / 80%);
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1;
}

.square {
  display: grid;
  place-items: center;
  width: 12.5px;
  height: 12.5px;
  background: var(--muted-foreground);
  color: var(--background);
}

.square svg {
  width: 9px;
  height: 9px;
  stroke-width: 3;
}

.square.up {
  background: var(--up);
}

.square.degraded {
  background: var(--degraded);
}

.square.down {
  background: var(--down);
}

/* Daily bars */

.bars {
  display: flex;
  gap: 1px;
  height: 50px;
}

/* The colour sits on a pseudo-element so dimming it on hover leaves the tooltip opaque. */
.bar {
  --bar: var(--empty);
  position: relative;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.bar::before {
  position: absolute;
  inset: 0;
  background: var(--bar);
  content: "";
}

.bar.up {
  --bar: var(--up);
}

.bar.degraded {
  --bar: var(--degraded);
}

.bar.down {
  --bar: var(--down);
}

.bar:hover::before,
.bar:focus-visible::before {
  opacity: 0.8;
}

.bar:focus-visible {
  outline-offset: 1px;
}

.bars-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted-foreground);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1;
}

/* Tooltips: shown while the bar or hint is hovered or focused. */

.tip {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.5rem);
  display: none;
  min-width: 12rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border);
  background: var(--popover);
  box-shadow: 0 4px 12px oklch(0 0 0 / 8%);
  color: var(--foreground);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  cursor: default;
}

.hint .tip {
  min-width: 16rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.tip-start {
  left: 0;
}

.tip-end {
  right: 0;
}

.bar:hover .tip,
.bar:focus .tip,
.hint:hover .tip,
.hint:focus .tip {
  display: block;
}

.tip-date {
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.tip-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tip-value {
  margin-left: auto;
  padding-left: 1rem;
}

.tip-meta {
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
}

.dot {
  display: inline-block;
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--empty);
}

.dot.up {
  background: var(--up);
}

.dot.degraded {
  background: var(--degraded);
}

.dot.down {
  background: var(--down);
}

/* Regions */

.regions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0;
  list-style: none;
}

.region {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.25;
}

/* Footer */

.page-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-family: var(--mono);
  font-size: 0.75rem;
}

@media (max-width: 30rem) {
  .badge .muted {
    display: none;
  }

  .banner h1 {
    font-size: 1.125rem;
  }
}
