/* LevelChat Status — Claude-Status-inspired palette.
 *
 * Design notes:
 *   - Cream background (#FBF9F4) intentionally matches the Anthropic
 *     reference so the page reads as a status page, not a marketing
 *     site. Pure white was too clinical.
 *   - The big green banner uses #9BB73E — Anthropic's specific olive-
 *     green, NOT a saturated brand green. We mirror the palette
 *     because the operator wanted "looks like Claude Status".
 *   - Day bars are 8px wide × 36px tall, 2px gutter. That packs 90
 *     bars into the 1000px content column with breathing room.
 *   - System sans-serif stack — no web font fetch, so the page renders
 *     instantly during a CDN incident.
 */

:root {
  --bg: #fbf9f4;
  --card: #ffffff;
  --line: #ece9e2;
  --text: #1b1a17;
  --muted: #7a766b;

  --ok: #9bb73e;
  --degraded: #d8a93c;
  --partial: #e07a2a;
  --outage: #c84a3b;
  --unknown: #e0dcd2;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ─── Masthead ──────────────────────────────────────────────────── */
.masthead {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand img {
  display: block;
  height: 36px;
  width: auto;
}
.brand-suffix {
  color: var(--muted);
  font-weight: 500;
}
.brand:hover {
  text-decoration: none;
}

.cta {
  background: #1a1a1a;
  color: #ffffff;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cta:hover {
  background: #000;
  text-decoration: none;
}

/* ─── Page wrap ─────────────────────────────────────────────────── */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

/* ─── Big banner ────────────────────────────────────────────────── */
.big-banner {
  border-radius: var(--radius-sm);
  padding: 26px 32px;
  margin: 12px 0 28px;
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}
.big-banner.ok {
  background: var(--ok);
}
.big-banner.degraded {
  background: var(--degraded);
}
.big-banner.outage {
  background: var(--outage);
}

.uptime-caption {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 14px;
}
.uptime-caption a {
  color: var(--muted);
  border-bottom: 1px dotted var(--muted);
}

/* ─── Components list ───────────────────────────────────────────── */
.components {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.component {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}
.component:last-child {
  border-bottom: 0;
}

.component-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.component-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.state {
  font-size: 13px;
  font-weight: 600;
}
.state-ok {
  color: var(--ok);
}
.state-degraded {
  color: var(--degraded);
}
.state-partial {
  color: var(--partial);
}
.state-outage {
  color: var(--outage);
}
.state-info {
  color: var(--muted);
}
.state-maint {
  color: var(--muted);
}

/* Bar grid — 90 days × 36 px tall. */
.bars {
  display: flex;
  gap: 2px;
  height: 36px;
  margin: 6px 0 10px;
}
.bar {
  flex: 1 1 0;
  min-width: 4px;
  max-width: 10px;
  height: 100%;
  border-radius: 2px;
  background: var(--unknown);
  /* Anchor for the absolutely-positioned hover/focus tooltip. */
  position: relative;
  cursor: default;
  outline: none;
}
.bar-ok {
  background: var(--ok);
}
.bar-degraded {
  background: var(--degraded);
}
.bar-partial {
  background: var(--partial);
}
.bar-outage {
  background: var(--outage);
}
.bar-unknown {
  background: var(--unknown);
}
/* Keyboard focus ring — bars are focusable (tabindex=0) so the tooltip
   is reachable without a mouse. */
.bar:focus-visible {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--text);
}

/* ── Day bar hover/focus tooltip ─────────────────────────────────────
 * Pure-CSS, zero-JS card. The status page must render — and stay
 * useful — during a CDN / JS-bundle incident, so the tooltip is driven
 * entirely by :hover / :focus — no script, no listener, nothing to
 * hydrate. `display:none` until shown means the 810 hidden tips
 * (9 components × 90 days) cost the browser no layout until one opens. */
.bar-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 240px;
  padding: 11px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 24px rgba(27, 26, 23, 0.13),
    0 2px 6px rgba(27, 26, 23, 0.07);
  text-align: left;
  /* The tip has no interactive content — letting the pointer pass
     through avoids any hover-gap flicker between the bar and the card
     floating above it. */
  pointer-events: none;
}
.bar:hover,
.bar:focus-visible {
  z-index: 10;
}
.bar:hover .bar-tip,
.bar:focus .bar-tip {
  display: block;
}

/* Caret pointing down at the bar. */
.bar-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--card);
  margin-top: -1px;
}

.bar-tip-date {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.bar-tip-status {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}
/* Severity-coded: a coloured dot + matching text colour so a glance
   reads ok / degraded / outage without parsing the words. */
.bar-tip-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--unknown);
}
.bar-tip-status-ok::before {
  background: var(--ok);
}
.bar-tip-status-degraded::before {
  background: var(--degraded);
}
.bar-tip-status-partial::before {
  background: var(--partial);
}
.bar-tip-status-outage::before {
  background: var(--outage);
}
.bar-tip-status-degraded {
  color: var(--degraded);
}
.bar-tip-status-partial {
  color: var(--partial);
}
.bar-tip-status-outage {
  color: var(--outage);
}

.bar-tip-related-label {
  display: block;
  margin-top: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.bar-tip-related {
  margin: 3px 0 0;
  padding: 0;
  list-style: none;
}
.bar-tip-related li {
  font-size: 12.5px;
  color: var(--text);
  padding: 1px 0;
}

/* Edge handling — the first / last several bars sit too close to the
   content-column edge for a centred tip. Anchor those to the bar's own
   edge so the card never clips off-screen. CSS-only — `:nth-child`
   keeps it scriptless. */
.bars .bar:nth-child(-n + 9) .bar-tip {
  left: 0;
  transform: none;
}
.bars .bar:nth-child(-n + 9) .bar-tip::after {
  left: 12px;
}
.bars .bar:nth-child(n + 82) .bar-tip {
  left: auto;
  right: 0;
  transform: none;
}
.bars .bar:nth-child(n + 82) .bar-tip::after {
  left: auto;
  right: 12px;
}

/* The `.components` card uses `overflow:hidden` to clip its rounded
   corners — so the TOPMOST component has no room above it for an
   upward tip. Drop that one component's tips DOWN instead (it has its
   own footer + the rest of the card below it), with the caret flipped
   to point back up at the bar. Every other component's tips go up
   normally — they rise into the component above, still inside the
   card. */
.components > .component:first-child .bar-tip {
  top: calc(100% + 9px);
  bottom: auto;
}
.components > .component:first-child .bar-tip::after {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: -1px;
  border-top-color: transparent;
  border-bottom-color: var(--card);
}

.component-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.uptime-pct {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
}

/* ─── Incidents ─────────────────────────────────────────────────── */
.incidents {
  margin-top: 40px;
}
.incidents h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.incident {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 12px;
}
.incident header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}
.incident h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.incident time {
  color: var(--muted);
  font-size: 12px;
}
.incident ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 14px;
}
.incident li {
  padding: 4px 0;
  color: var(--text);
}

.severity {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.severity.sev-minor {
  color: var(--degraded);
}
.severity.sev-major {
  color: var(--partial);
}
.severity.sev-critical {
  color: var(--outage);
}
.severity.sev-maintenance {
  color: var(--muted);
}

.quiet {
  color: var(--muted);
  font-size: 14px;
  padding: 14px 4px;
}

/* ─── Subscribe ─────────────────────────────────────────────────── */
.subscribe {
  margin-top: 40px;
}
.subscribe h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.subscribe form {
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
  max-width: 540px;
}
.subscribe input[type='email'] {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  outline: none;
}
.subscribe button {
  border: 0;
  background: #1a1a1a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.subscribe button:hover {
  background: #000;
}

/* ─── Page foot ─────────────────────────────────────────────────── */
.page-foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.page-foot a {
  color: var(--muted);
}

/* ─── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 18px 8px;
  }
  .page {
    padding: 8px 18px 48px;
  }
  .big-banner {
    font-size: 1.35rem;
    padding: 22px 22px;
  }
  .uptime-caption {
    text-align: left;
  }
  .bars {
    gap: 1px;
    height: 28px;
  }
  .bar {
    max-width: 6px;
    /* Drop the 4px floor on a phone — 90 bars + gaps cannot fit a
       ~320px card at 4px each, so they overflowed and the most
       recent days were clipped. `min-width: 0` lets the flex bars
       shrink to share the row exactly, so all 90 days stay visible. */
    min-width: 0;
  }
  .component {
    padding: 18px;
  }
  .page-foot {
    flex-direction: column;
    gap: 6px;
  }
}
