/* Calmido status page.
 *
 * One stylesheet, no build step, no framework. The page is three bars and a
 * list; anything heavier than this would be a bigger dependency than the thing
 * it renders. It also has to be the last page standing during an outage, so it
 * loads nothing from anywhere else — no fonts, no CDN, no analytics.
 */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-raised: #f7f8f9;
  --border: #e3e5e8;
  --text: #1a1c1e;
  --text-dim: #6b7076;

  --up: #2e9e5b;
  --degraded: #d9932a;
  --down: #d64545;
  --none: #d7dade;

  --radius: 10px;
  --maxw: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131517;
    --bg-raised: #1a1d20;
    --border: #2a2e33;
    --text: #e8eaed;
    --text-dim: #9aa0a6;

    --up: #3fbf74;
    --degraded: #e0a33c;
    --down: #e35d5d;
    --none: #33383d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 64px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; }

/* --- Header -------------------------------------------------------------- */

header { padding: 40px 0 8px; }

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }

.checked { color: var(--text-dim); font-size: 13px; }

/* The overall verdict. Deliberately the largest thing on the page: most
 * visitors came to read exactly this one line and then leave. */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 32px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 17px;
  font-weight: 500;
}

.banner .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.banner[data-status="up"] .dot { background: var(--up); }
.banner[data-status="degraded"] .dot { background: var(--degraded); }
.banner[data-status="down"] .dot { background: var(--down); }
.banner[data-status="none"] .dot { background: var(--none); }

/* --- Service card -------------------------------------------------------- */

.service {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  margin-bottom: 16px;
  overflow: hidden;
}

.service-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 10px;
  flex-wrap: wrap;
}

.service-name { font-weight: 600; font-size: 15px; }
.service-target { color: var(--text-dim); font-size: 12px; font-weight: 400; margin-left: 8px; }

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill[data-status="up"] { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.pill[data-status="degraded"] { color: var(--degraded); background: color-mix(in srgb, var(--degraded) 16%, transparent); }
.pill[data-status="down"] { color: var(--down); background: color-mix(in srgb, var(--down) 16%, transparent); }
.pill[data-status="none"] { color: var(--text-dim); background: color-mix(in srgb, var(--none) 40%, transparent); }

/* --- The 31-day strip ---------------------------------------------------- */

.bars {
  display: flex;
  gap: 3px;
  padding: 4px 20px 6px;
  align-items: stretch;
  height: 46px;
}

.bar {
  flex: 1 1 0;
  min-width: 3px;
  border-radius: 2px;
  background: var(--none);
  position: relative;
  cursor: default;
  transition: opacity .12s ease;
}
.bar[data-status="up"] { background: var(--up); }
.bar[data-status="degraded"] { background: var(--degraded); }
.bar[data-status="down"] { background: var(--down); }
.bar:hover { opacity: .7; }

/* Tooltip. A title attribute would do the job but takes a second to appear and
 * cannot be styled; on a page whose entire content is 93 tiny rectangles, the
 * hover IS the interface. */
.bar .tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: var(--text);
  color: var(--bg);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.bar:hover .tip { display: block; }
/* Nudge the edge tooltips inward so they do not clip off the card. */
.bar:first-child .tip { left: 0; transform: none; }
.bar:last-child .tip { left: auto; right: 0; transform: none; }

.scale {
  display: flex;
  justify-content: space-between;
  padding: 0 20px 14px;
  color: var(--text-dim);
  font-size: 12px;
}

/* --- Collapsible check list ---------------------------------------------- */

details.checks { border-top: 1px solid var(--border); }

details.checks > summary {
  cursor: pointer;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-dim);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
details.checks > summary::-webkit-details-marker { display: none; }

.chev { transition: transform .15s ease; flex: none; }
details.checks[open] .chev { transform: rotate(90deg); }

.detail-link { margin-left: auto; color: var(--text-dim); text-decoration: none; }
.detail-link:hover { color: var(--text); text-decoration: underline; }

.section { border-top: 1px solid var(--border); }

.section > summary {
  cursor: pointer;
  padding: 10px 20px 10px 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  user-select: none;
}
.section > summary::-webkit-details-marker { display: none; }
.section-count { margin-left: auto; color: var(--text-dim); font-size: 12px; font-weight: 400; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 20px 7px 52px;
  font-size: 13px;
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.check-name { flex: 1 1 auto; min-width: 0; }
.check-detail {
  color: var(--text-dim);
  font-size: 12px;
  text-align: right;
  flex: 0 1 46%;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Status glyph as a shape, not an emoji: emoji render differently on every
 * platform and carry no meaning to a screen reader. */
.mark { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 6px; }
.mark[data-status="pass"] { background: var(--up); }
.mark[data-status="fail"] { background: var(--down); }
.mark[data-status="warn"] { background: var(--degraded); }
.mark[data-status="info"] { background: var(--none); }

/* --- Detail page --------------------------------------------------------- */

.back { display: inline-block; margin: 32px 0 0; color: var(--text-dim); text-decoration: none; font-size: 13px; }
.back:hover { color: var(--text); }

.meta {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin: 16px 0 28px;
  color: var(--text-dim);
  font-size: 13px;
}
.meta b { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 2px; }

h2 { font-size: 15px; font-weight: 600; margin: 32px 0 12px; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
}

.incident { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; }
.incident:first-child { border-top: none; }
.incident-when { color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.incident ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-dim); }

.empty { padding: 20px; color: var(--text-dim); font-size: 13px; }

footer { margin-top: 40px; color: var(--text-dim); font-size: 12px; }
footer a { color: inherit; }

@media (max-width: 560px) {
  .check { padding-left: 32px; flex-wrap: wrap; }
  .check-detail { text-align: left; flex-basis: 100%; padding-left: 19px; }
}
