@font-face {
  font-family: 'Fustat';
  src: url('/fonts/Fustat.ttf') format('truetype');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #fafbf8;
  --surface: #ffffff;
  --text: #12150f;
  --muted: #5d6357;
  --line: rgb(18 21 15 / 0.1);
  --ok: #4fae1f;
  --ok-soft: #e7f9d9;
  --warn: #b98a00;
  --warn-soft: #fbf3cf;
  --bad: #d43d3d;
  --bad-soft: #fde4e4;
  --empty: rgb(18 21 15 / 0.08);
  --accent: #99f061;
  --radius: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12150f;
    --surface: #1a1e16;
    --text: #f3f5ef;
    --muted: #a3aa9b;
    --line: rgb(243 245 239 / 0.12);
    --ok: #99f061;
    --ok-soft: #1f3312;
    --warn: #eeda56;
    --warn-soft: #2e2a0f;
    --bad: #ff7a7a;
    --bad-soft: #3a1717;
    --empty: rgb(243 245 239 / 0.1);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Fustat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.top,
main,
.bottom {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.lang {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.lang button {
  min-width: 44px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 120ms var(--ease-out);
}

.lang button[aria-pressed='true'] {
  background: var(--text);
  color: var(--bg);
}

.lang button:active {
  transform: scale(0.97);
}

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

main {
  flex: 1;
  padding-block: 28px 56px;
}

.summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 26px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.summary .mark {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--empty);
}

.summary[data-state='operational'] {
  background: var(--ok-soft);
  border-color: transparent;
}
.summary[data-state='operational'] .mark {
  background: var(--ok);
}
.summary[data-state='degraded'] {
  background: var(--warn-soft);
  border-color: transparent;
}
.summary[data-state='degraded'] .mark {
  background: var(--warn);
}
.summary[data-state='outage'],
.summary[data-state='error'] {
  background: var(--bad-soft);
  border-color: transparent;
}
.summary[data-state='outage'] .mark,
.summary[data-state='error'] .mark {
  background: var(--bad);
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4.6vw, 34px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  margin: 44px 0 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

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

.summary .muted {
  margin-top: 6px;
  color: color-mix(in srgb, var(--text) 68%, transparent);
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.services ul {
  display: grid;
  gap: 12px;
}

.service {
  padding: 20px 24px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.service-name {
  font-size: 17px;
  font-weight: 700;
}

.service-about {
  margin-top: 2px;
}

.state {
  flex: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.state[data-state='operational'] {
  color: var(--ok);
}
.state[data-state='degraded'] {
  color: var(--warn);
}
.state[data-state='outage'] {
  color: var(--bad);
}
.state[data-state='unknown'] {
  color: var(--muted);
}

.days {
  display: grid;
  grid-template-columns: repeat(var(--count, 90), minmax(0, 1fr));
  gap: 2px;
  height: 30px;
  margin-top: 16px;
}

.days i {
  border-radius: 2px;
  background: var(--empty);
}
.days i[data-s='ok'] {
  background: var(--ok);
}
.days i[data-s='warn'] {
  background: var(--warn);
}
.days i[data-s='bad'] {
  background: var(--bad);
}

@media (hover: hover) and (pointer: fine) {
  .days i {
    transition: transform 120ms var(--ease-out);
    transform-origin: bottom;
  }
  .days i:hover {
    transform: scaleY(1.2);
  }
}

.days-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.notices {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.notices h2 {
  margin-bottom: 2px;
}

.notice {
  padding: 18px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.notice h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.notice time {
  display: block;
  margin-top: 8px;
}

.skeleton {
  display: inline-block;
  height: 1em;
  border-radius: 8px;
  background: var(--empty);
  vertical-align: middle;
}

.bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.bottom a {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  .summary {
    padding: 20px 18px;
    gap: 14px;
  }
  .service,
  .notice {
    padding-inline: 18px;
  }
  .service-head {
    flex-direction: column;
    gap: 2px;
  }
  /* 90 bars are too thin on a phone: the last 45 days. */
  .days i:nth-child(-n + 45) {
    display: none;
  }
  .days {
    --count: 45 !important;
  }
  .days-foot [data-full] {
    display: none;
  }
}

@media (min-width: 561px) {
  .days-foot [data-short] {
    display: none;
  }
}
