/* status.ki-bo.com. Tokens copied from ki-bo.com (site.css), which mirrors the apps. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --accent: #FF6B5B;
  --accent-ink: #C2382A;
  --paper: #FAF9F7;
  --cream: #FDEEDC;
  --text: #17141A;
  --muted: #6B6560;
  --card: #FFFFFF;
  --line: rgba(60, 35, 28, 0.09);
  --track: #EBE0DA;
  --ok: #1B8864;
  --ok-ink: #117555;
  --ok-soft: #E3F3EC;
  --warn: #E1A23B;
  --warn-ink: #955816;
  --warn-soft: #FBF0DC;
  --down: #D9412F;
  --down-ink: #BA3538;
  --down-soft: #FCE4E0;
  --nodata: #EFE8E3;
  --shadow: 0 1px 2px rgba(60, 35, 28, 0.06), 0 12px 32px rgba(60, 35, 28, 0.08);
  --tip-bg: #17141A;
  --tip-text: #FAF9F7;
  --r-row: 16px; --r-card: 24px;
  --ease-std: cubic-bezier(0.2, 0, 0, 1);
  --font: "Figtree", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, -apple-system, sans-serif;
  --state: var(--muted);
  --state-soft: var(--nodata);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #FF8A7C;
    --accent-ink: #FF8A7C;
    --paper: #110E0E;
    --cream: #241A18;
    --text: #F6F1EE;
    --muted: #A8A09C;
    --card: #1E1B1A;
    --line: rgba(255, 240, 235, 0.08);
    --track: #3A3433;
    --ok: #4FB98E;
    --ok-ink: #66C7A0;
    --ok-soft: #173229;
    --warn: #E5AE52;
    --warn-ink: #EDB161;
    --warn-soft: #362816;
    --down: #F06A5E;
    --down-ink: #F28788;
    --down-soft: #3D1C1A;
    --nodata: #2C2726;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.3);
    --tip-bg: #F6F1EE;
    --tip-text: #17141A;
  }
}

body[data-state="operational"] { --state: var(--ok); --state-soft: var(--ok-soft); }
body[data-state="degraded"] { --state: var(--warn); --state-soft: var(--warn-soft); }
body[data-state="partial"], body[data-state="major"] { --state: var(--down); --state-soft: var(--down-soft); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
h1, h2 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--muted); }

.bloom {
  position: absolute;
  inset: 0 0 auto 0;
  height: 520px;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 50% 0%, color-mix(in srgb, var(--state) 16%, transparent), transparent 70%),
    radial-gradient(45% 40% at 85% 10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  transition: background 600ms var(--ease-std);
}

.wrap {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
}

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 1px 2px rgba(60, 35, 28, 0.15); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; }
.brand-tag { color: var(--muted); font-size: 15px; font-weight: 500; padding-left: 10px; border-left: 1px solid var(--line); }

/* Hero */
.hero { text-align: center; padding: 40px 8px 36px; }
.mascot {
  position: relative; width: 104px; height: 104px; margin: 0 auto 22px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--cream);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}
.mascot > img { width: 64px; height: auto; transform: translateY(2px); }
.badge {
  position: absolute; right: -2px; bottom: -2px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--state);
  box-shadow: 0 0 0 4px var(--paper);
  transition: background 400ms var(--ease-std);
}
.badge svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; display: none; grid-area: 1 / 1; }
body[data-state="operational"] .g-ok,
body[data-state="degraded"] .g-warn,
body[data-state="partial"] .g-warn,
body[data-state="major"] .g-down,
body[data-state="loading"] .g-wait,
body[data-state="error"] .g-wait { display: block; }
body[data-state="loading"] .badge, body[data-state="error"] .badge { background: var(--muted); }

h1 { font-size: clamp(30px, 8vw, 40px); line-height: 1.1; font-weight: 700; text-wrap: balance; }
.subline { margin: 10px auto 0; max-width: 34ch; color: var(--muted); font-size: 17px; text-wrap: pretty; }
.updated { margin: 16px 0 0; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.updated:empty { display: none; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--state); position: relative; }
.live::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--state);
  animation: ping 2.4s var(--ease-std) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.55; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
.notice {
  margin: 16px auto 0; max-width: 40ch; padding: 10px 14px; border-radius: var(--r-row);
  background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; font-weight: 500;
}

/* Services card */
.card {
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 6px 20px 8px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 0 6px; }
h2 { font-size: 20px; font-weight: 700; }
.card-head .muted { font-size: 14px; }
.components { list-style: none; margin: 0; padding: 0; }
.row { padding: 16px 0 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.row-name { font-weight: 600; font-size: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--nodata); color: var(--muted);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.row[data-status="operational"] .pill { background: var(--ok-soft); color: var(--ok-ink); }
.row[data-status="degraded"] .pill { background: var(--warn-soft); color: var(--warn-ink); }
.row[data-status="down"] .pill { background: var(--down-soft); color: var(--down-ink); }

.bars { display: flex; gap: 2px; height: 34px; align-items: stretch; touch-action: pan-y; border-radius: 4px; }
.bar { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--nodata); transition: transform 150ms var(--ease-std), opacity 150ms; transform-origin: bottom; }
.bar[data-level="ok"] { background: var(--ok); }
.bar[data-level="slow"] { background: color-mix(in srgb, var(--ok) 55%, var(--warn)); }
.bar[data-level="minor"] { background: var(--warn); }
.bar[data-level="major"] { background: var(--down); }
.bar.is-active { transform: scaleY(1.12); }
.bars.has-active .bar:not(.is-active) { opacity: 0.55; }
.axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.axis-uptime { color: var(--text); font-weight: 600; }
.footnote { color: var(--muted); font-size: 13.5px; margin: 4px 0 12px; }
.card .footnote { border-top: 1px solid var(--line); padding-top: 12px; }

/* Tooltip */
.tip {
  position: fixed; z-index: 10; pointer-events: none; width: max-content; max-width: 220px;
  padding: 10px 12px; border-radius: 14px; background: var(--tip-bg); color: var(--tip-text);
  font-size: 13px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, calc(-100% - 10px));
}
.tip strong { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }

/* Incidents */
.incidents { margin-top: 36px; }
.incidents h2 { padding: 0 4px 12px; }
.incident-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.incident {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.incident-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.incident h3 { margin: 0; font-size: 17px; font-weight: 700; font-family: var(--font); line-height: 1.3; }
.incident .when { margin: 4px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.incident p.body { margin: 12px 0 0; font-size: 15px; line-height: 1.55; text-wrap: pretty; }
.incident .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 12.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--nodata); color: var(--muted); }
.incident .pill { flex-shrink: 0; }
.incident[data-status="resolved"] .pill { background: var(--ok-soft); color: var(--ok-ink); }
.incident:not([data-status="resolved"]) { border-color: color-mix(in srgb, var(--down) 40%, var(--line)); }
.incident:not([data-status="resolved"]) .pill { background: var(--down-soft); color: var(--down-ink); }
.incidents > .footnote { padding: 12px 4px 0; margin: 0; }

/* Footer */
.foot { margin-top: 48px; padding: 20px 4px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.foot p { margin: 0 0 8px; }

.noscript { text-align: center; padding: 16px; }

/* Entrance */
@media (prefers-reduced-motion: no-preference) {
  .hero, .card, .incidents { animation: rise 500ms var(--ease-std) both; }
  .card { animation-delay: 60ms; }
  .incidents { animation-delay: 120ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .live::after { animation: none; }
  * { transition-duration: 0s !important; }
}

@media (min-width: 640px) {
  .wrap { padding-top: 24px; }
  .hero { padding: 64px 8px 48px; }
  .card { padding: 8px 28px 10px; }
  .incident { padding: 20px 24px; }
}
@media (max-width: 380px) {
    .brand-tag { display: none; }
}
.nowrap { white-space: nowrap; }
