/*
 * status.asphaltos.io: the Asphalt OS look of the site and the wiki (apps/site/src/wiki/wiki.css): a true black
 * canvas, white type, Asphalt amber (#FDB821) as the accent, titles in Barlow Condensed capitals, square corners.
 * Light when the visitor's system is light. Green, amber and red say the state, always with words beside them.
 */
@font-face {
  font-family: 'Barlow';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/barlow-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/barlow-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/barlow-condensed-800.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --bg: #000000;
  --raised: #111111;
  --line: #222222;
  --line-strong: #3d3d3d;
  --ink: #ffffff;
  --text: #b3b3b3;
  --faint: #8f8f8f;
  --accent: #fdb821;
  --on-accent: #000000;
  --focus: #fdb821;
  --up: #30a46c;
  --on-up: #000000;
  --warn: #fdb821;
  --on-warn: #000000;
  --down: #e5484d;
  --on-down: #000000;
  --none: #2b2b2b;
  --on-none: #ffffff;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --head: 'Barlow Condensed', 'Arial Narrow', var(--font);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --raised: #f5f5f5;
    --line: #e5e5e5;
    --line-strong: #c9c9c9;
    --ink: #000000;
    --text: #4d4d4d;
    --faint: #666666;
    --accent: #8a5d00;
    --on-accent: #ffffff;
    --focus: #8a5d00;
    --up: #18794e;
    --on-up: #ffffff;
    --warn: #b07800;
    --on-warn: #000000;
    --down: #cd2b31;
    --on-down: #ffffff;
    --none: #d9d9d9;
    --on-none: #000000;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
}

a {
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
  padding-inline: 16px;
}

@media (min-width: 640px) {
  .wrap {
    padding-inline: 32px;
  }
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  z-index: 2;
}

.skip:focus {
  top: 8px;
}

/* Heard by screen readers, not seen: the headline, said again when it changes. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The top bar: the icon, the name and a STATUS tag, then three links. */
.top {
  border-bottom: 1px solid var(--line);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font: 800 1.375rem/1 var(--head);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand img {
  display: block;
}

.brand-tag {
  padding: 3px 6px 2px;
  background: #fdb821;
  color: #000000;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
}

.top nav {
  display: flex;
  gap: 16px;
  font-size: 0.9375rem;
}

.top nav a {
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.top nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 400px) {
  .top nav {
    gap: 12px;
    font-size: 0.875rem;
  }
  .top nav a:first-child {
    display: none;
  }
}

/* The headline: the worst state now, in words. */
.summary {
  --state: var(--none);
  --on-state: var(--on-none);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 32px;
  padding: 24px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-left: 6px solid var(--state);
}

.summary-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--state);
  color: var(--on-state);
  font: 800 1.75rem/1 var(--font);
}

.summary h1 {
  margin: 0;
  color: var(--ink);
  font: 800 clamp(2rem, 6.5vw, 3.25rem) / 0.95 var(--head);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}

.summary .lead {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 1.125rem;
}

.summary .checked {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 0.875rem;
}

@media (max-width: 480px) {
  .summary {
    grid-template-columns: 1fr;
    padding: 20px 16px;
  }
}

h2 {
  margin: 40px 0 12px;
  color: var(--ink);
  font: 800 1.5rem/1 var(--head);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* One card per service. */
.services,
.incidents {
  list-style: none;
  margin: 0;
  padding: 0;
}

.service {
  padding: 16px 20px 14px;
  margin-bottom: 12px;
  background: var(--raised);
  border: 1px solid var(--line);
}

@media (max-width: 480px) {
  .service {
    padding: 14px 14px 12px;
  }
}

.service-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-name {
  min-width: 0;
}

.service h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.service-name a {
  color: var(--faint);
  font-size: 0.875rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.service-name a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.s-up {
  --state: var(--up);
  --on-state: var(--on-up);
}

.s-slow,
.s-degraded {
  --state: var(--warn);
  --on-state: var(--on-warn);
}

.s-down {
  --state: var(--down);
  --on-state: var(--on-down);
}

.s-none {
  --state: var(--none);
  --on-state: var(--on-none);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--state);
  color: var(--ink);
  font: 800 1rem/1 var(--head);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge .icon,
.incident .icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: var(--state);
  color: var(--on-state);
  font: 700 0.8125rem/1 var(--font);
}

.detail {
  margin: 8px 0 0;
  font-size: 0.9375rem;
}

.dot {
  color: var(--faint);
}

/* The last 24 hours: 48 half hours, oldest on the left. */
.bars {
  display: grid;
  grid-template-columns: repeat(48, minmax(0, 1fr));
  gap: 2px;
  height: 30px;
  margin-top: 14px;
}

.bar {
  background: var(--state);
}

.bar.s-none {
  background: var(--none);
}

@media (hover: hover) {
  .bar:hover {
    outline: 1px solid var(--ink);
  }
}

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--faint);
  font-size: 0.75rem;
}

.uptime {
  display: flex;
  gap: 24px;
  margin: 10px 0 0;
}

.uptime div {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.uptime dt {
  color: var(--faint);
  font-size: 0.8125rem;
}

.uptime dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
}

/* Past problems. */
.incident {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.incident:last-child {
  border-bottom: 1px solid var(--line);
}

.incident strong {
  color: var(--ink);
  font-weight: 600;
}

.quiet {
  margin: 0;
}

.foot {
  margin-top: 48px;
  padding-bottom: 40px;
  color: var(--faint);
  font-size: 0.875rem;
}

.foot-in {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.foot p {
  margin: 0 0 8px;
  max-width: 68ch;
}

@media (prefers-reduced-motion: no-preference) {
  .summary,
  .service {
    transition: border-color 0.3s;
  }
}
