/* WeerOm's tokens, from DESIGN.md in the weerom repo. Light and dark follow the device. */
@font-face {
  font-family: Outfit;
  src: url("/assets/outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --background: #f9f2ea;
  --foreground: #181310;
  --card: #fffbf7;
  --muted: #f2e2d3;
  --muted-foreground: #6b5b4e;
  --primary: #eb6d33;
  --primary-foreground: #181310;
  --border: #e4cebc;
  --input: #ddc2ad;
  --success: #17804e;
  --warning: #9a5a06;
  --destructive: #b42318;
  --info: #3f5a8a;
  --line: #b04a19;
  --empty: #e9d9c8;
  --radius: 0.875rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #181310;
    --foreground: #f2e2d3;
    --card: #221b17;
    --muted: #2a221d;
    --muted-foreground: #bca38f;
    --border: rgb(242 226 211 / 12%);
    --input: rgb(242 226 211 / 18%);
    --success: #6ccb98;
    --warning: #f2b45a;
    --destructive: #f97066;
    --info: #9db4e0;
    --line: #eb6d33;
    --empty: #3d322b;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 400 16px/1.5 Outfit, ui-sans-serif, system-ui, sans-serif;
}

a {
  color: inherit;
}

.top,
main,
.foot {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  padding-top: 24px;
  padding-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-height: 44px;
}

.brand img {
  display: block;
  height: 20px;
  width: auto;
}

.tag {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  border-left: 1px solid var(--input);
  padding-left: 10px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
}

h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  margin: 0 0 8px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 6px 0 2px;
}

h3 a {
  text-decoration: none;
}

h3 a:hover {
  text-decoration: underline;
}

p {
  margin: 0;
}

section {
  margin-top: 28px;
}

.icon {
  flex: none;
}

/* The banner at the top says the one thing most readers came for. */
.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
}

.banner p {
  color: var(--muted-foreground);
  font-size: 14px;
}

.banner-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  flex: none;
  color: var(--background);
  background: var(--muted-foreground);
}

.banner-icon .icon {
  width: 20px;
  height: 20px;
}

.banner[data-overall="ok"] .banner-icon {
  background: var(--success);
}

.banner[data-overall="degraded"] .banner-icon,
.banner[data-overall="partial"] .banner-icon {
  background: var(--warning);
}

.banner[data-overall="major"] .banner-icon {
  background: var(--destructive);
}

.banner[data-overall="maintenance"] .banner-icon {
  background: var(--info);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
}

.pad {
  padding: 16px;
}

.row {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.row:last-child {
  border-bottom: 0;
}

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

.page-head {
  margin-top: 12px;
}

.name {
  font-weight: 500;
  text-decoration: none;
}

.name:hover {
  text-decoration: underline;
}

.desc,
.meta {
  color: var(--muted-foreground);
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* A state is always an icon and a word. Colour alone never carries it. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.badge[data-state="up"] {
  color: var(--success);
}

.badge[data-state="degraded"] {
  color: var(--warning);
}

.badge[data-state="down"] {
  color: var(--destructive);
}

.badge[data-state="maintenance"] {
  color: var(--info);
}

/* One bar per day, oldest on the left, 2px of card between bars. */
.bars {
  display: flex;
  gap: 2px;
  height: 32px;
  margin-top: 12px;
}

.bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: var(--empty);
}

.bar[data-level="ok"] {
  background: var(--success);
}

.bar[data-level="partial"] {
  background: var(--warning);
}

.bar[data-level="bad"] {
  background: var(--destructive);
}

.bar:hover,
.bar[data-on] {
  opacity: 0.6;
}

.bars-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.narrow {
  display: none;
}

@media (max-width: 640px) {
  .bar:nth-child(-n + 45) {
    display: none;
  }

  .wide {
    display: none;
  }

  .narrow {
    display: inline;
  }
}

.tip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--foreground);
  color: var(--background);
  font-size: 13px;
  white-space: nowrap;
}

.event {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 16px;
  margin-bottom: 12px;
}

.event > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-foreground);
}

.event[data-kind="incident"][data-open="1"] .kind {
  color: var(--warning);
}

.event[data-kind="incident"][data-open="1"][data-impact="major"] .kind {
  color: var(--destructive);
}

.event[data-kind="maintenance"][data-open="1"] .kind {
  color: var(--info);
}

.status {
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.updates {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.updates.plain {
  margin-top: 0;
}

.updates li {
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.updates p {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.when {
  display: block;
  font-size: 12px;
  color: var(--muted-foreground);
}

.updates strong {
  font-weight: 500;
}

.updates .meta {
  margin-left: 6px;
}

.empty {
  color: var(--muted-foreground);
  font-size: 14px;
}

.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

@media (min-width: 641px) {
  .tiles {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tiles.inline {
  grid-template-columns: repeat(2, 1fr);
  margin: 12px 0 0;
}

.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 12px 14px;
}

.tiles.inline .tile {
  background: var(--background);
}

.tile span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.tile strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;
}

.chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--muted-foreground);
  font-size: 12px;
}

.chart .line {
  stroke: var(--line);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .cross {
  stroke: var(--muted-foreground);
  stroke-width: 1;
}

.chart .dot {
  fill: var(--line);
  stroke: var(--card);
  stroke-width: 2;
}

.foot {
  margin-top: 40px;
  padding-bottom: 40px;
  font-size: 14px;
  color: var(--muted-foreground);
  display: grid;
  gap: 4px;
}

.langs,
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.langs a,
.links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.langs a[aria-current] {
  color: var(--foreground);
  font-weight: 500;
  text-decoration: none;
}

/* Admin */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}

.admin-nav a,
.admin-nav .link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.form label,
fieldset legend {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--input);
  border-radius: 999px;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 16px;
}

textarea {
  border-radius: 1rem;
  resize: vertical;
}

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

.form label.check,
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 400;
  color: var(--foreground);
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.grid2 {
  display: grid;
  gap: 14px;
}

@media (min-width: 641px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
  }

  input:not([type="checkbox"]),
  select {
    min-height: 36px;
    font-size: 14px;
  }

  .btn {
    min-height: 36px;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  justify-self: start;
}

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

.btn.destructive {
  background: var(--destructive);
  color: var(--background);
}

.admin-row form {
  margin-top: 10px;
}

.danger {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

.notice {
  padding: 12px 16px;
  border-radius: 0.875rem;
  background: var(--muted);
  font-size: 14px;
  font-weight: 500;
  margin: 12px 0;
  color: var(--destructive);
}

.notice[data-kind="ok"] {
  color: var(--success);
}

code {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chart [hidden] {
  display: none;
}
