/* ───────────────────────────────────────────────
   OverlayThing · Status page
   Self-contained theme (mirrors the error pages /
   admin.css / Landing.html design language).
   State accent driven by [data-state] on key nodes.
   ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack.css');

:root {
  --bg: #0d0e10;
  --bg-elev: #181a1e;
  --surface: #1f2228;
  --surface-2: #292d34;
  --surface-3: #353a43;
  --border: #4a5160;
  --border-strong: #66708a;
  --text: #ffffff;
  --text-dim: #c8cfdb;
  --text-faint: #9ea7b6;

  /* state palette */
  --ok:    #00E5A8;
  --degr:  #ffd166;
  --part:  #ff9d4d;
  --major: #ff6b8a;
  --maint: #6aa9ff;
  --ok-ink: #00141a;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max: 880px;

  /* current global accent -- set by JS from `overall` */
  --st: var(--ok);
}

/* state color helpers (applied via [data-state]) */
[data-state="ok"]          { --sc: var(--ok); }
[data-state="degraded"]    { --sc: var(--degr); }
[data-state="partial"]     { --sc: var(--part); }
[data-state="major"],
[data-state="down"]        { --sc: var(--major); }
[data-state="maintenance"] { --sc: var(--maint); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
.mono { font-family: 'Hack', ui-monospace, "SF Mono", Menlo, monospace; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ── ambient background ─────────────────────────── */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient::before {
  content: ""; position: absolute; top: -28%; left: 50%;
  width: 1100px; height: 760px; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%,
    color-mix(in oklab, var(--st) 15%, transparent) 0%, transparent 70%);
  filter: blur(26px); opacity: .8; transition: background .6s ease;
}
.ambient::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 64px 64px; background-position: -1px -1px;
  mask-image: radial-gradient(70% 42% at 50% 0%, #000 30%, transparent 82%);
  -webkit-mask-image: radial-gradient(70% 42% at 50% 0%, #000 30%, transparent 82%);
  opacity: .45;
}
.grain { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ── top bar ────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 74%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 16px;
}
.lockup { display: inline-flex; align-items: center; gap: 10px; }
.lockup .sub {
  margin-left: 2px; padding: 3px 8px; border-radius: 999px;
  font-family: 'Hack', monospace; font-size: 9.5px; letter-spacing: .12em;
  color: var(--text-dim); background: var(--surface); border: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.btn.primary { background: var(--st); color: #061015; border-color: transparent; font-weight: 600; transition: filter .16s, transform .16s; }
.btn.primary:hover { filter: brightness(1.06); }

/* ── layout ─────────────────────────────────────── */
.page { position: relative; z-index: 10; max-width: var(--max); margin: 0 auto; padding: 40px 24px 80px; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 14px; font-weight: 600; letter-spacing: .01em; margin: 0; }
.section-head .hint { font-family: 'Hack', monospace; font-size: 10.5px; color: var(--text-faint); letter-spacing: .04em; margin-left: auto; }

/* ── hero / global state ────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--sc) 38%, var(--border));
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in oklab, var(--sc) 12%, transparent), transparent 60%),
    var(--bg-elev);
  padding: 26px 26px 24px;
  display: flex; align-items: center; gap: 20px;
}
.hero .beacon { position: relative; width: 66px; height: 40px; flex: none; }
.hero .beacon .ecg { width: 100%; height: 100%; display: block; overflow: visible; }
.hero .beacon .ecg-base {
  fill: none; stroke: color-mix(in oklab, var(--sc) 24%, transparent);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.hero .beacon .ecg-live {
  fill: none; stroke: var(--sc); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 15 100; stroke-dashoffset: 115;
  filter: drop-shadow(0 0 4px color-mix(in oklab, var(--sc) 70%, transparent));
  animation: ecg-sweep 2.4s linear infinite;
}
@keyframes ecg-sweep { from { stroke-dashoffset: 115; } to { stroke-dashoffset: 0; } }
/* tempo reacts to severity */
.hero[data-state="degraded"] .ecg-live { animation-duration: 3s; }
.hero[data-state="partial"] .ecg-live,
.hero[data-state="major"] .ecg-live,
.hero[data-state="down"] .ecg-live { animation-duration: 1.35s; }
.hero[data-state="maintenance"] .ecg-live { animation-duration: 3.6s; }
.hero .htext { min-width: 0; }
.hero .state-line { font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.hero .state-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 3px; }
.hero .checked {
  margin-left: auto; text-align: right; flex: none;
  font-family: 'Hack', monospace; font-size: 10.5px; color: var(--text-faint); letter-spacing: .03em;
}
.hero .checked b { display: block; color: var(--text-dim); font-weight: 400; font-size: 11px; margin-top: 3px; }
.hero .checked .live { color: var(--sc); }

/* ── unavailable state ──────────────────────────── */
.unavailable-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 28px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}
.unavailable-card .uv-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* ── pills ──────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-family: 'Hack', monospace; font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--sc); background: color-mix(in oklab, var(--sc) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--sc) 36%, transparent);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sc); }
.pill.solid { color: #06121a; background: var(--sc); border-color: transparent; font-weight: 600; }

/* ── incident banner ────────────────────────────── */
.incident-banner {
  border: 1px solid color-mix(in oklab, var(--sc) 40%, var(--border));
  border-left: 3px solid var(--sc);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--sc) 7%, var(--bg-elev));
  padding: 18px 20px; margin-top: 16px;
}
.incident-banner .ib-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.incident-banner .ib-title { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.incident-banner .ib-meta { margin-left: auto; font-family: 'Hack', monospace; font-size: 10.5px; color: var(--text-faint); }
.incident-banner .ib-affected { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-family: 'Hack', monospace; font-size: 10px; color: var(--text-dim);
  padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.incident-banner .ib-update { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; }
.incident-banner .ib-update .when { font-family: 'Hack', monospace; font-size: 10px; color: var(--text-faint); white-space: nowrap; padding-top: 2px; min-width: 64px; }
.incident-banner .ib-update .body { font-size: 13.5px; color: var(--text-dim); }
.incident-banner .ib-update .body b { color: var(--sc); font-weight: 600; }

/* ── capability grid ────────────────────────────── */
.cap-grid { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); overflow: hidden; }
.cap-row {
  display: grid; grid-template-columns: 1fr auto;
  grid-template-areas: "label pill" "bar bar";
  gap: 10px 14px; align-items: center;
  padding: 16px 18px;
}
.cap-row + .cap-row { border-top: 1px solid var(--border); }
.cap-label { grid-area: label; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cap-label .nub { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); flex: none; box-shadow: 0 0 8px -1px color-mix(in oklab, var(--sc) 80%, transparent); }
.cap-label .name { font-size: 14px; font-weight: 500; white-space: nowrap; }
.cap-label .tip { color: var(--text-faint); display: inline-flex; cursor: help; flex: none; }
.cap-label .tip svg { width: 13px; height: 13px; }
.cap-row .pill { grid-area: pill; justify-self: end; }
.cap-bar { grid-area: bar; }

/* ── 90-day uptime bar ──────────────────────────── */
.uptime { display: flex; flex-direction: column; gap: 6px; }
.uptime-cells { display: flex; gap: 2px; height: 30px; align-items: stretch; }
.uptime-cells .cell {
  flex: 1 1 0; min-width: 0; border-radius: 2px;
  background: color-mix(in oklab, var(--cc, var(--ok)) 70%, transparent);
  transition: transform .1s ease, filter .1s ease;
}
.uptime-cells .cell[data-cc="ok"]          { --cc: var(--ok); background: color-mix(in oklab, var(--ok) 32%, var(--surface)); }
.uptime-cells .cell[data-cc="degraded"]    { --cc: var(--degr); }
.uptime-cells .cell[data-cc="down"]        { --cc: var(--major); }
.uptime-cells .cell[data-cc="maintenance"] { --cc: var(--maint); }
.uptime-cells .cell:hover { transform: scaleY(1.12); filter: brightness(1.2); }
.uptime-legend { display: flex; align-items: center; gap: 8px; font-family: 'Hack', monospace; font-size: 10px; color: var(--text-faint); }
.uptime-legend .pct { color: var(--text-dim); }
.uptime-legend .rule { flex: 1; height: 1px; background: var(--border); opacity: .6; }

/* hover tooltip for day cells */
.tt {
  position: fixed; z-index: 80; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; box-shadow: 0 16px 40px -16px rgba(0,0,0,.8);
  font-size: 11.5px; white-space: nowrap; max-width: 240px;
}
.tt.show { opacity: 1; transform: translateY(0); }
.tt .tt-date { font-family: 'Hack', monospace; font-size: 10px; color: var(--text-faint); }
.tt .tt-state { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 500; }
.tt .tt-state .d { width: 7px; height: 7px; border-radius: 50%; }

/* ── maintenance cards ──────────────────────────── */
.maint-card {
  border: 1px solid color-mix(in oklab, var(--maint) 32%, var(--border));
  border-left: 3px solid var(--maint);
  border-radius: var(--radius); background: color-mix(in oklab, var(--maint) 6%, var(--bg-elev));
  padding: 16px 18px;
}
.maint-card + .maint-card { margin-top: 10px; }
.maint-card .mc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.maint-card .mc-title { font-size: 14.5px; font-weight: 600; }
.maint-card .mc-window { margin-left: auto; font-family: 'Hack', monospace; font-size: 10.5px; color: var(--maint); }
.maint-card .mc-body { font-size: 13px; color: var(--text-dim); margin-top: 8px; }

/* ── incident history ───────────────────────────── */
.history { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); overflow: hidden; }
.hist-item { border-top: 1px solid var(--border); }
.hist-item:first-child { border-top: 0; }
.hist-item > summary {
  list-style: none; cursor: pointer; padding: 15px 18px;
  display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center;
  transition: background .14s ease;
}
.hist-item > summary::-webkit-details-marker { display: none; }
.hist-item > summary:hover { background: var(--surface); }
.hist-item .h-date { font-family: 'Hack', monospace; font-size: 11px; color: var(--text-faint); }
.hist-item .h-title { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 9px; min-width: 0; }
.hist-item .h-right { display: flex; align-items: center; gap: 12px; }
.hist-item .h-dur { font-family: 'Hack', monospace; font-size: 10.5px; color: var(--text-faint); }
.hist-item .chev { color: var(--text-faint); transition: transform .18s ease; }
.hist-item .chev svg { width: 15px; height: 15px; display: block; }
.hist-item[open] .chev { transform: rotate(90deg); }
.hist-body { padding: 0 18px 16px 124px; }
.hist-body .upd { display: flex; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--border); }
.hist-body .upd:first-child { border-top: 0; }
.hist-body .upd .when { font-family: 'Hack', monospace; font-size: 10px; color: var(--text-faint); min-width: 88px; white-space: nowrap; padding-top: 2px; }
.hist-body .upd .ub { font-size: 13px; color: var(--text-dim); }
.hist-body .upd .ub b { color: var(--text); font-weight: 600; }
.hist-empty { padding: 22px 18px; text-align: center; color: var(--text-faint); font-size: 13px; }
.hist-empty .mono { color: var(--ok); }

/* ── history pager ──────────────────────────────── */
.hist-pager {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-top: 1px solid var(--border);
  background: var(--bg);
}
.hist-pager .hp-count { font-family: 'Hack', monospace; font-size: 10.5px; color: var(--text-faint); letter-spacing: .03em; }
.hist-pager .hp-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.hist-pager button {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); font-family: 'Hack', monospace; font-size: 11px;
  transition: border-color .14s, color .14s, background .14s;
}
.hist-pager button:hover:not([disabled]) { border-color: var(--border-strong); color: var(--text); }
.hist-pager button[disabled] { opacity: .35; cursor: default; }
.hist-pager .hp-arrow svg { width: 14px; height: 14px; display: block; }
.hist-pager .hp-num.on { background: color-mix(in oklab, var(--ok) 16%, var(--surface)); border-color: color-mix(in oklab, var(--ok) 45%, transparent); color: var(--ok); font-weight: 700; }

/* ── footer ─────────────────────────────────────── */
.foot { max-width: var(--max); margin: 0 auto; padding: 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: 'Hack', monospace; font-size: 10.5px; color: var(--text-faint); }
.foot a { color: var(--text-dim); } .foot a:hover { color: var(--ok); }
.foot .spacer { flex: 1; }

/* ── responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .hero { flex-wrap: wrap; }
  .hero .checked { margin-left: 0; width: 100%; text-align: left; order: 3; padding-top: 8px; border-top: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .page { padding: 28px 16px 72px; }
  .hero { padding: 20px; gap: 14px; }
  .hero .state-line { font-size: 18px; }
  .cap-row { grid-template-areas: "label pill" "bar bar"; }
  .hist-item > summary { grid-template-columns: 1fr auto; }
  .hist-item .h-date { grid-column: 1 / -1; }
  .hist-body { padding-left: 18px; }
  .topbar .sub { display: none; }
}
@media (max-width: 480px) {
  .uptime-cells { height: 26px; }
  .topbar-inner { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
