/* HostTenant Status - public page.
   Light and dark come from light-dark(); [data-theme] only flips color-scheme. */

:root {
  color-scheme: light dark;
  --font: "Plex", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: light-dark(#f4f5f8, #0a0c11);
  --panel: light-dark(#ffffff, #10131b);
  --ink: light-dark(#0e1118, #eceef4);
  --ink-2: light-dark(#454c5e, #adb4c4);
  --ink-3: light-dark(#5d6577, #8089a0);
  --line: light-dark(#e0e3eb, #1e2330);
  --line-2: light-dark(#c9cedb, #2d3446);
  --accent: light-dark(#4a4de0, #9a9dff);
  --accent-ink: light-dark(#fff, #0a0c11);

  --ok: light-dark(#0f8a5c, #34d395);
  --maintenance: light-dark(#3b55d6, #8196ff);
  --degraded: light-dark(#a8690a, #f2b543);
  --partial: light-dark(#c24d17, #ff8c55);
  --major: light-dark(#c42d3d, #ff6b78);
  --none: light-dark(#d5d9e3, #262c3b);

  --radius: 16px;
  --wrap: 1120px;
  --pad: clamp(16px, 4vw, 32px);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font); font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 60; transition: top .15s; }
.skip:focus { top: 12px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.boot { padding: 64px var(--pad); color: var(--ink-3); text-align: center; }
.muted { color: var(--ink-3); }

/* the colour of the overall state runs across the very top of the page */
.stateline { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 40; background: var(--lv, var(--ok)); }
[data-level="nodata"] { --lv: var(--none); }
[data-level="operational"] { --lv: var(--ok); }
[data-level="maintenance"] { --lv: var(--maintenance); }
[data-level="degraded"] { --lv: var(--degraded); }
[data-level="partial"] { --lv: var(--partial); }
[data-level="major"] { --lv: var(--major); }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.top { display: flex; align-items: center; gap: 12px 20px; padding: 14px 0; flex-wrap: wrap; row-gap: 2px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand span { white-space: nowrap; }
.brand small { font-weight: 400; color: var(--ink-3); font-size: .9rem; margin-left: 2px; }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 500; padding: 4px 12px 4px 10px; border-radius: 99px; background: color-mix(in srgb, var(--lv) 14%, transparent); border: 1px solid color-mix(in srgb, var(--lv) 38%, transparent); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a, .nav button {
  background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--ink-2);
  text-decoration: none; cursor: pointer; font-size: .94rem; min-height: 40px; display: inline-flex; align-items: center; gap: 7px;
}
.nav a:hover, .nav button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
@media (max-width: 680px) {
  .brand small { display: none; }
  .pill { max-width: calc(100vw - 190px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav { order: 3; width: 100%; margin: 0 -10px; flex-wrap: wrap; }
  .nav .icon-btn { margin-left: auto; }
}
@media (max-width: 480px) { .nav .lbl { display: none; } }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 500; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.icon-btn { width: 40px; padding: 0; justify-content: center; }

/* ---------- hero ---------- */
main { isolation: isolate; }
.hero { padding: clamp(28px, 6vw, 60px) 0 8px; position: relative; }
.hero::before {
  content: ""; position: absolute; z-index: -1; left: -6%; top: -30px; width: min(720px, 90%); height: 320px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--lv) 24%, transparent), transparent);
  opacity: .55; pointer-events: none;
}
.hero h1 { font-size: clamp(2.2rem, 5.6vw, 3.9rem); line-height: 1.04; letter-spacing: -.03em; font-weight: 600; max-width: 18ch; text-wrap: balance; }
.hero p.sub { margin-top: 16px; color: var(--ink-2); font-size: 1.1rem; max-width: 58ch; text-wrap: pretty; }
.hero .meta { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-3); font-size: .9rem; }
.hero .meta span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lv, var(--ok)); flex: none; }
.pill .dot { width: 8px; height: 8px; }

/* the pulse: response time of the last 24 hours with the state of each hour underneath */
.band { margin-top: clamp(26px, 5vw, 42px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; padding: 18px 20px 14px; }
.band-head { font-weight: 600; font-size: .95rem; margin-bottom: 10px; }
.pulse-wrap { outline-offset: 6px; border-radius: 8px; }
.pulse, .lat-box { position: relative; }
.pulse { height: 168px; }
.chart { display: block; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.chart-line.draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.ylab { position: absolute; left: 0; font-size: .74rem; color: var(--ink-3); z-index: 1; line-height: 1; }
.ylab.top { top: 2px; } .ylab.bot { bottom: 4px; }
.cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--ink-3); pointer-events: none; }
.cursor i { position: absolute; left: -5px; width: 9px; height: 9px; border-radius: 50%; margin-top: -4px; background: var(--lv, var(--accent)); border: 2px solid var(--panel); box-sizing: content-box; transform: translate(-1px, 0); }
.band-bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 14px; margin-top: 10px; }
.band-bars span { border-radius: 3px; transform-origin: bottom; }
.band-bars span.on { outline: 2px solid var(--ink); outline-offset: 2px; }
.band-scale { display: flex; justify-content: space-between; margin-top: 8px; color: var(--ink-3); font-size: .82rem; }
@media (prefers-reduced-motion: no-preference) {
  .band-bars.enter span { animation: rise .5s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i) * 18ms + 300ms); }
  .chart-line.draw { animation: draw 1s cubic-bezier(.3, .6, .2, 1) backwards; }
  .pulse .chart-area { animation: fade .9s ease-out backwards .3s; }
  @keyframes rise { from { transform: scaleY(.1); opacity: 0; } }
  @keyframes draw { from { stroke-dashoffset: 1; } }
  @keyframes fade { from { opacity: 0; } }
}

.stats { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.stats > div { padding: 16px 20px 18px; border-left: 1px solid var(--line); min-width: 0; }
.stats > div:first-child { border-left: 0; }
.stats dt { color: var(--ink-3); font-size: .84rem; }
.stats dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.stats p { color: var(--ink-3); font-size: .8rem; margin-top: 2px; }
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- sections ---------- */
main > section { margin-top: clamp(36px, 6vw, 64px); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.sec-head h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.015em; }
.sec-head .aside { color: var(--ink-3); font-size: .9rem; }
.sec-head a { font-size: .92rem; }

/* incidents and maintenance: a bar on the left carries the severity */
.notice { margin-top: 18px; padding: 4px 0 6px 20px; border-left: 4px solid var(--lv, var(--ink-3)); border-radius: 2px; }
.notice h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -.01em; }
.notice h3 a { color: inherit; text-decoration: none; }
.notice h3 a:hover { text-decoration: underline; }
.notice .facts { margin-top: 5px; color: var(--ink-3); font-size: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.notice .body { margin-top: 8px; color: var(--ink-2); max-width: 70ch; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .8rem; padding: 1px 9px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--ink-2); font-weight: 500; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lv); }
.hist .tag, .svc .tag { margin-left: 10px; font-weight: 400; color: var(--ink-3); }

/* updates sit on a rail, the dot says where the incident stood */
.timeline { list-style: none; margin: 16px 0 0; padding: 0 0 0 22px; position: relative; display: grid; gap: 18px; max-width: 74ch; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: var(--line-2); border-radius: 1px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--lv, var(--ink-3)); box-shadow: 0 0 0 4px var(--bg); }
.timeline li[data-status="resolved"]::before { background: var(--ok); }
.timeline .what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.timeline b { font-weight: 600; }
.timeline time { color: var(--ink-3); font-size: .86rem; }
.timeline p { color: var(--ink-2); margin-top: 2px; }

/* ---------- services ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 16px; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-size: .9rem; color: var(--ink-2); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.toolbar input[type="search"] { flex: 1 1 200px; max-width: 300px; min-height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); }

.group { margin-top: 26px; }
.group h3 { font-size: .95rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
details.svc { border-top: 1px solid var(--line); }
.group h3 + details.svc { border-top: 0; }
details.svc summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(220px, 2.6fr) 84px 22px;
  gap: 6px 24px; align-items: center; padding: 15px 0; border-radius: 8px;
}
details.svc summary::-webkit-details-marker { display: none; }
details.svc summary:hover .name { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.svc .id { min-width: 0; }
.svc .name { font-weight: 600; display: flex; align-items: center; gap: 9px; letter-spacing: -.005em; }
.svc .note { color: var(--ink-3); font-size: .88rem; margin-top: 1px; padding-left: 18px; }
.svc .uptime { text-align: right; font-weight: 500; }
.svc .uptime small { display: block; color: var(--ink-3); font-weight: 400; font-size: .78rem; }
.chev { color: var(--ink-3); display: grid; place-items: center; transition: transform .2s; grid-column: 4; grid-row: 1; }
.svc .id { grid-column: 1; grid-row: 1; }
.svc .strip-wrap { grid-column: 2; grid-row: 1; }
.svc .uptime { grid-column: 3; grid-row: 1; }
details[open] > summary .chev { transform: rotate(180deg); }
.fam { grid-column: 1 / 4; grid-row: 2; display: flex; flex-wrap: wrap; gap: 4px 20px; padding-left: 18px; font-size: .86rem; color: var(--ink-3); }
.fam span { display: inline-flex; align-items: center; gap: 6px; }
.fam i { width: 7px; height: 7px; border-radius: 50%; background: var(--none); }
.fam [data-s="ok"] i { background: var(--ok); }
.fam [data-s="degraded"] i { background: var(--degraded); }
.fam [data-s="down"] i { background: var(--major); }
.fam [data-s="down"] { color: var(--major); }
.fam [data-s="degraded"] { color: var(--degraded); }
.fam [data-s="none"] { opacity: .8; }

.strip { display: flex; gap: 1.5px; height: 30px; cursor: crosshair; touch-action: pan-y; border-radius: 3px; }
.strip i { flex: 1; min-width: 1px; border-radius: 1.5px; background: var(--ok); opacity: .92; }
.strip i[data-level="nodata"] { background: var(--none); opacity: .7; }
.strip i[data-level="maintenance"] { background: var(--maintenance); }
.strip i[data-level="degraded"] { background: var(--degraded); }
.strip i[data-level="partial"] { background: var(--partial); }
.strip i[data-level="major"] { background: var(--major); }
.toolbar .seg.range { margin-left: auto; }
/* few days get wider bars, many days get thinner ones and no gaps so that they still fit */
.strip[data-n="14"] { gap: 4px; }
.strip[data-n="30"] { gap: 3px; }
.strip[data-n="180"] { gap: .5px; }
.strip[data-n="360"] { gap: 0; }
.strip[data-n="180"] i, .strip[data-n="360"] i { min-width: 0; border-radius: 0; }
.strip i.on { outline: 2px solid var(--ink); outline-offset: 1px; opacity: 1; }
.strip-wrap small { display: flex; justify-content: space-between; color: var(--ink-3); font-size: .76rem; margin-top: 4px; }
@media (max-width: 760px) {
  details.svc summary { grid-template-columns: 1fr auto 20px; }
  .svc .uptime { grid-column: 2; }
  .chev { grid-column: 3; }
  .svc .strip-wrap { grid-column: 1 / -1; grid-row: 2; }
  .fam { grid-column: 1 / -1; grid-row: 3; }
}

.svc-body { display: grid; grid-template-columns: 1.7fr 1fr; gap: 28px 40px; padding: 4px 0 26px 18px; }
.svc-body h4 { font-size: .86rem; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.svc-body .lat-box { height: 120px; }
.lat-wrap { outline-offset: 6px; border-radius: 6px; }
.legend { display: flex; gap: 18px; margin-top: 8px; font-size: .82rem; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend span::before { content: ""; width: 18px; height: 0; border-top: 2px solid var(--accent); }
.legend .k6::before { border-top: 2px dashed var(--ink-2); }
.facts2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 20px; }
.facts2 dt { color: var(--ink-3); font-size: .82rem; }
.facts2 dd { margin: 0; font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; }
.mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .92rem; }
.mini li { display: flex; justify-content: space-between; gap: 12px; }
.mini small { color: var(--ink-3); white-space: nowrap; }
@media (max-width: 760px) { .svc-body { grid-template-columns: 1fr; padding-left: 0; } }

/* ---------- probes ---------- */
.probes { width: 100%; border-collapse: collapse; margin-top: 4px; }
.probes th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: .86rem; padding: 12px 8px 8px 0; border-bottom: 1px solid var(--line); }
.probes td { padding: 11px 8px 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.probes td:first-child { font-weight: 500; }
.probes td small { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.lat { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.lat s { display: block; height: 6px; border-radius: 3px; background: var(--accent); opacity: .75; text-decoration: none; min-width: 3px; }
.lat s.slow { background: var(--degraded); opacity: 1; }
.lat span { font-size: .9rem; min-width: 52px; }
.probes .bad { color: var(--major); font-weight: 500; }

/* ---------- history ---------- */
.month { margin-top: 22px; }
.month h3 { font-size: .9rem; font-weight: 600; color: var(--ink-3); }
.hist { list-style: none; margin: 6px 0 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 92px 1fr auto; gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--line); align-items: baseline; }
.hist li:first-child { border-top: 0; }
.hist .d { color: var(--ink-3); font-size: .9rem; }
.hist a { color: var(--ink); text-decoration: none; font-weight: 500; }
.hist a:hover { text-decoration: underline; }
.hist .len { color: var(--ink-3); font-size: .9rem; }
.empty { padding: 28px 0; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
@media (max-width: 560px) { .hist li { grid-template-columns: 1fr; } }

/* ---------- footer, banners, tooltip, dialog ---------- */
.foot { margin-top: clamp(48px, 8vw, 88px); padding: 22px 0 40px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.foot .grow { flex: 1 1 320px; display: grid; gap: 4px; }
.foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot a { color: var(--ink-2); }
.nodes { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--ink-2); }
.nodes span { display: inline-flex; align-items: center; gap: 7px; }
.nodes i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.nodes .down i { background: var(--major); }
.nodes small { color: var(--ink-3); }
.foot .demo { width: 100%; font-size: .84rem; }
.foot .demo a { margin-right: 12px; }
.foot .demo a[aria-current="true"] { color: var(--ink); font-weight: 600; text-decoration: none; }
.banner { background: color-mix(in srgb, var(--degraded) 14%, var(--bg)); border-bottom: 1px solid color-mix(in srgb, var(--degraded) 40%, transparent); font-size: .92rem; position: relative; z-index: 31; }
.banner .wrap { padding-top: 10px; padding-bottom: 10px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .84rem; line-height: 1.35;
  padding: 7px 10px; border-radius: 8px; max-width: 260px; box-shadow: 0 6px 24px -8px rgba(0, 0, 0, .35);
}
.tip b { font-weight: 600; display: block; }

dialog { border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(8, 10, 16, .55); }
dialog form { padding: 24px; display: grid; gap: 14px; }
dialog h2 { font-size: 1.2rem; letter-spacing: -.01em; }
dialog p { color: var(--ink-2); font-size: .95rem; }
dialog label { display: grid; gap: 6px; font-weight: 500; font-size: .92rem; }
dialog input[type="email"] { min-height: 44px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); }
dialog .row { display: flex; gap: 10px; justify-content: flex-end; }
dialog .err { color: var(--major); font-size: .9rem; min-height: 1.2em; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
