/* Written by Thomas Conway */
/* cognira status — dark thinking notebook. Tokens follow design-system/cognira/MASTER.md. */
:root {
  color-scheme: dark;
  --background: #111111;
  --card: #181c20;
  --raised: #202428;
  --foreground: #f4f0ea;
  --cream: #ede7df;
  --cream-display: #e6d8c3;
  --muted: #aba298;
  --primary: #e8a8a0;
  --note-pink: #f9c0b8;
  --note-ink: #1d1b19;
  --grid-line: #24282c;
  --hairline: rgb(244 240 234 / 8%);
  --operational: #9bd6b8;
  --degraded: #f0b37e;
  --outage: #f07f6e;
  --maintenance: #e8a8a0;
  --unknown: #4a4f54;
  --radius-card: 28px;
  --font-body: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --font-hand: Caveat, "Segoe Print", "Bradley Hand", cursive;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  color: var(--foreground);
  background: var(--background);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a {
  color: inherit;
}

button,
a {
  cursor: pointer;
}

.grid-wash {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.55;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 72%);
}

.page {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 24px;
}

.header {
  display: flex;
  min-height: 96px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-decoration: none;
  border-radius: 12px;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
}

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

.brand-status {
  margin-left: 2px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.header-button,
.refresh-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
}

.header-button {
  padding: 0 18px;
  border: 1px solid rgb(244 240 234 / 16%);
  color: var(--foreground);
  background: transparent;
  font-weight: 500;
}

.header-button:hover {
  border-color: rgb(244 240 234 / 36%);
  background: var(--raised);
}

.refresh-button {
  align-self: end;
  padding: 0 18px;
  border: 0;
  color: #111111;
  background: var(--primary);
  font-weight: 600;
}

.refresh-button:hover {
  background: var(--cream);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.refresh-button:disabled svg {
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(-360deg);
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 22px;
  align-items: start;
}

.status-banner,
.services-card,
.incidents {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background-color: var(--card);
  background-image:
    linear-gradient(rgb(36 40 44 / 65%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(36 40 44 / 65%) 1px, transparent 1px);
  background-size: 32px 32px;
  box-shadow: 0 24px 60px -36px rgb(0 0 0 / 70%);
}

.status-banner {
  display: flex;
  min-height: 168px;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  transition: box-shadow 200ms ease;
}

.status-banner.is-operational {
  box-shadow: inset 0 0 0 1px rgb(155 214 184 / 28%), 0 24px 60px -36px rgb(0 0 0 / 70%);
}

.status-banner.is-degraded {
  box-shadow: inset 0 0 0 1px rgb(240 179 126 / 40%), 0 24px 60px -36px rgb(0 0 0 / 70%);
}

.status-banner.is-outage {
  box-shadow: inset 0 0 0 1px rgb(240 127 110 / 45%), 0 24px 60px -36px rgb(0 0 0 / 70%);
}

.status-banner.is-maintenance {
  box-shadow: inset 0 0 0 1px rgb(232 168 160 / 45%), 0 24px 60px -36px rgb(0 0 0 / 70%);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.banner-dot,
.state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.banner-dot {
  color: var(--muted);
  box-shadow: 0 0 0 4px rgb(244 240 234 / 6%);
}

.is-operational .banner-dot,
.service-state.is-operational .state-dot {
  color: var(--operational);
}

.is-degraded .banner-dot,
.service-state.is-degraded .state-dot {
  color: var(--degraded);
}

.is-outage .banner-dot,
.service-state.is-outage .state-dot {
  color: var(--outage);
}

.is-maintenance .banner-dot,
.service-state.is-maintenance .state-dot {
  color: var(--maintenance);
}

h1 {
  margin: 0;
  color: var(--cream-display);
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.banner-summary {
  margin: 10px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgb(244 240 234 / 5%);
  color: var(--foreground);
  font-size: 0.78rem;
  font-weight: 500;
}

.count-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.count-pill.is-operational { color: var(--operational); }
.count-pill.is-degraded { color: var(--degraded); }
.count-pill.is-outage { color: var(--outage); }
.count-pill.is-maintenance { color: var(--maintenance); }
.count-pill.is-unknown { color: var(--muted); }

.sticky-note {
  position: relative;
  margin: 18px 0 0;
  padding: 18px 16px 16px;
  background: var(--note-pink);
  color: var(--note-ink);
  font-family: var(--font-hand);
  font-size: 1.28rem;
  line-height: 1.2;
  box-shadow: 0 14px 24px -12px rgb(0 0 0 / 55%);
  rotate: -2.4deg;
}

.sticky-note p {
  margin: 0;
}

.sticky-note p + p {
  margin-top: 10px;
}

.tape {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 58px;
  height: 18px;
  background: rgb(255 255 255 / 35%);
  translate: -50% 0;
  rotate: -4deg;
}

.service-groups {
  display: grid;
  gap: 28px;
  margin-top: 36px;
}

.group-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 4px 12px;
}

.group-heading h2,
.incidents > h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.group-heading p,
.group-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.group-count {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.services-card {
  overflow: hidden;
}

.service {
  padding: 18px 20px 16px;
  transition: background 200ms ease;
}

.service + .service {
  border-top: 1px solid var(--hairline);
}

.service:hover {
  background: rgb(244 240 234 / 3%);
}

.service-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 18px;
}

.service h3,
.incident-entry h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 500;
}

.service p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.service-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

.latency {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.service-state.is-operational { color: var(--operational); }
.service-state.is-degraded { color: var(--degraded); }
.service-state.is-outage { color: var(--outage); }
.service-state.is-maintenance { color: var(--maintenance); }

.uptime-bars {
  display: grid;
  grid-template-columns: repeat(90, minmax(0, 1fr));
  gap: 2px;
  height: 28px;
  margin-top: 12px;
}

.uptime-bar {
  min-width: 0;
  border-radius: 2px;
  background: rgb(244 240 234 / 12%);
}

.uptime-bar.is-operational { background: var(--operational); }
.uptime-bar.is-degraded { background: var(--degraded); }
.uptime-bar.is-outage { background: var(--outage); }
.uptime-bar.is-maintenance { background: var(--maintenance); }

.uptime-scale {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.uptime-scale::before {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: rgb(244 240 234 / 12%);
}

.uptime-scale span {
  position: relative;
  z-index: 1;
  background: var(--card);
}

.uptime-scale .uptime-number {
  padding: 0 8px;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.75rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgb(244 240 234 / 22%);
}

.legend-swatch.is-operational { background: var(--operational); }
.legend-swatch.is-degraded { background: var(--degraded); }
.legend-swatch.is-outage { background: var(--outage); }
.legend-swatch.is-maintenance { background: var(--maintenance); }

.last-checked,
.empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.incidents {
  margin-top: 48px;
  padding: 8px 24px 4px;
  background-image: none;
}

.incidents > h2 {
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--hairline);
}

.incident-entry {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 24px;
  padding: 20px 0;
}

.incident-entry + .incident-entry {
  border-top: 1px solid var(--hairline);
}

.incident-date {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.incident-entry p,
.incident-entry li {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.incident-entry h3 {
  margin-bottom: 6px;
}

.incident-entry ul {
  margin: 10px 0 0;
  padding-left: 1.1rem;
}

.incident-entry li + li {
  margin-top: 4px;
}

.incident-entry.has-maintenance h3 { color: var(--maintenance); }
.incident-entry.has-warning h3 { color: var(--degraded); }
.incident-entry.has-outage h3 { color: var(--outage); }

footer {
  display: flex;
  min-height: 96px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

footer p {
  margin: 0;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

footer a {
  text-underline-offset: 3px;
}

.closing-wordmark {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 12px;
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
}

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

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 60;
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 14px 40px rgb(0 0 0 / 45%);
  text-align: center;
}

.brand-mark {
  animation: mascot-float 6s ease-in-out infinite;
}

.mascot-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: mascot-blink 6.5s ease-in-out infinite;
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes mascot-blink {
  0%, 86%, 100% { transform: scaleY(1); }
  93% { transform: scaleY(0.08); }
}

@media (max-width: 800px) {
  .page {
    width: min(100% - 28px, 1080px);
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .sticky-note {
    margin-top: 0;
    rotate: 0deg;
  }

  .status-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .refresh-button {
    align-self: flex-start;
  }

  .uptime-bars {
    grid-template-columns: repeat(45, minmax(0, 1fr));
  }

  .uptime-bar:nth-child(-n + 45) {
    display: none;
  }

  .incident-entry {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
