:root {
  /* Surfaces */
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --border: #e7e4dc;
  --border-strong: #d8d4c8;

  /* Ink */
  --ink: #1c1b18;
  --ink-2: #57544c;
  --ink-3: #8b8779;

  /* Status palette — green means something; each state distinct and colorblind-safe */
  --ok: #2f8f5b;
  --ok-soft: #e4f1e8;
  --degraded: #c8810a;
  --degraded-soft: #f7ecd6;
  --partial: #d4632a;
  --partial-soft: #f8e6da;
  --major: #c2392f;
  --major-soft: #f7e0dd;
  --maint: #5161c2;
  --maint-soft: #e5e7f6;

  --accent: #2f8f5b;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 27, 24, 0.04), 0 8px 24px rgba(28, 27, 24, 0.05);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --surface: #1d1d17;
    --surface-2: #19190f;
    --border: #2c2b22;
    --border-strong: #3a392e;
    --ink: #f0eee6;
    --ink-2: #b3afa1;
    --ink-3: #807c6f;
    --ok: #4fb87c;
    --ok-soft: #18301f;
    --degraded: #e0a233;
    --degraded-soft: #312713;
    --partial: #e8824a;
    --partial-soft: #34211393;
    --major: #e36258;
    --major-soft: #361c19;
    --maint: #7e8ce0;
    --maint-soft: #1e2138;
    --accent: #4fb87c;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 28px rgba(0,0,0,0.35);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 44px) clamp(16px, 4vw, 24px) 64px;
}

/* Masthead */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: none;
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #1f6e44);
  position: relative; flex: none;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 9px 0 0 9px;
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--surface);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  display: flex; flex-direction: column; line-height: 1.1;
}
.brand-sub {
  font-family: var(--font-mono);
  font-weight: 400; font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 2px;
}
.subscribe {
  font-family: inherit;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  background: none; cursor: pointer;
  text-decoration: none; padding: 8px 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  transition: border-color .15s, color .15s;
}
.subscribe:hover { color: var(--ink); border-color: var(--ink-3); }
.subscribe:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Banner */
.banner {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.banner-glyph {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--state-soft, var(--ok-soft));
  display: grid; place-items: center; position: relative;
}
.banner-glyph::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  background: var(--state-color, var(--ok));
}
.banner.state-ok .banner-glyph { animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--state-soft, var(--ok-soft)); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.banner-text { flex: 1; min-width: 0; }
.banner-text h1 {
  font-family: var(--font-display);
  font-size: clamp(19px, 4.5vw, 25px); font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.15;
}
.banner-text p { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.banner-stamp {
  text-align: right; flex: none; display: flex; flex-direction: column; gap: 2px;
}
.stamp-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.stamp-time { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }

/* Blocks */
.block { margin-top: 38px; }
.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.block-title {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-2);
}

/* Legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-3);
}
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* Services */
.services {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.service {
  padding: 18px 22px;
  border-top: 1px solid var(--border);
}
.service:first-child { border-top: none; }
.service-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.service-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.service-right { display: flex; align-items: center; gap: 14px; }
.service-uptime {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  color: var(--state-color); background: var(--state-soft);
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--state-color); }

/* Uptime bar */
.uptime {
  display: flex; gap: 2px; align-items: flex-end; height: 30px;
}
.uptime-day {
  flex: 1 1 0; min-width: 0; height: 100%; border-radius: 2px;
  background: var(--ok); opacity: 0.85; cursor: default;
  transition: opacity .12s, transform .12s;
}
.uptime-day:hover { opacity: 1; transform: scaleY(1.08); }
.uptime-day.is-ok { background: var(--ok); }
.uptime-day.is-degraded { background: var(--degraded); }
.uptime-day.is-partial { background: var(--partial); }
.uptime-day.is-major { background: var(--major); }
.uptime-day.is-maint { background: var(--maint); }
.uptime-note { font-size: 11.5px; color: var(--ink-3); margin-top: 12px; }

/* Cards (incidents + maintenance) */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.card-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title { font-weight: 600; font-size: 14.5px; }
.card-meta {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
}
.card-scope {
  font-size: 12px; color: var(--ink-2); margin-top: 4px;
}
.card-scope b { color: var(--ink); font-weight: 600; }
.timeline { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.tl-row { display: flex; gap: 12px; font-size: 13px; }
.tl-stage {
  font-weight: 600; font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--state-color, var(--ink-2));
  flex: none; width: 92px; padding-top: 1px;
}
.tl-body { color: var(--ink-2); flex: 1; }
.tl-time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); display: block; margin-top: 2px; }

.maint-window {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
  margin-top: 6px;
}
.maint-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  color: var(--maint); background: var(--maint-soft);
}
.maint-badge.is-live { color: var(--surface); background: var(--maint); }

/* History */
.history { display: flex; flex-direction: column; gap: 22px; margin-top: 10px; }
.history-empty {
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); padding: 28px; text-align: center;
  color: var(--ink-3); font-size: 13.5px;
}
.history-group-date {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
  letter-spacing: 0.04em; margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Footer */
.footer {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
}
.footer-dot { color: var(--border-strong); }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--bg);
  font-size: 11.5px; line-height: 1.4; padding: 7px 10px; border-radius: 7px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap; max-width: 240px;
}
.tooltip .tt-status { font-weight: 600; }
.tooltip .tt-date { font-family: var(--font-mono); opacity: 0.75; display: block; }

/* Subscribe modal */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative; width: 100%; max-width: 540px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 20px 22px 0;
}
.modal-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-sub { margin-top: 5px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.modal-close {
  flex: none; width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid transparent; background: none; cursor: pointer;
  color: var(--ink-3); font-size: 20px; line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-input {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
  transition: border-color .15s;
}
.field-input::placeholder { color: var(--ink-3); }
.field-input:focus { outline: none; border-color: var(--accent); }
.field-input.is-invalid { border-color: var(--major); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.scope {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-top: 4px; max-height: 168px; overflow-y: auto;
}
.scope[hidden] { display: none; }

.form-msg { font-size: 13px; line-height: 1.5; color: var(--major); }
.form-msg[hidden] { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: opacity .15s, background-color .15s, border-color .15s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { opacity: .9; }
.btn-ghost { background: none; color: var(--ink-2); border-color: var(--border-strong); }
.btn-ghost:not(:disabled):hover { color: var(--ink); border-color: var(--ink-3); }

.modal-done { padding: 8px 22px 24px; text-align: center; }
.modal-done[hidden] { display: none; }
.done-glyph {
  width: 44px; height: 44px; margin: 8px auto 14px; border-radius: 50%;
  background: var(--ok-soft); position: relative;
}
.done-glyph::after {
  content: ""; position: absolute; left: 15px; top: 12px;
  width: 10px; height: 18px; border: solid var(--ok);
  border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.done-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.done-sub { margin: 6px 0 18px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }

@media (max-width: 560px) {
  .banner { flex-wrap: wrap; }
  .banner-stamp { text-align: left; width: 100%; flex-direction: row; gap: 8px; align-items: baseline; }
  .service-head { flex-wrap: wrap; }
}

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