/* ---------------------------------------------------------------------------
   OpenAI status mirror — Claude / Anthropic visual language
   Warm paper background, editorial serif headings, soft warm borders,
   a single muted terracotta accent used sparingly.
   No external fonts or CDNs (works from any network).
--------------------------------------------------------------------------- */

:root {
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Songti SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --paper: #faf9f5;
  --paper-sunken: #f2efe7;
  --surface: #ffffff;
  --surface-2: #fbfaf7;

  --ink: #1f1e1d;
  --ink-soft: #55524c;
  --ink-muted: #87837a;
  --ink-faint: #a8a49a;

  --line: #e9e5db;
  --line-soft: #f0ece3;
  --line-strong: #dcd6c8;

  --accent: #d97757;
  --accent-deep: #bf5b3b;
  --accent-wash: #fbeee8;

  --ok: #4a8665;
  --ok-wash: #e8f1ea;
  --warn: #b0851f;
  --warn-wash: #f8efd9;
  --mid: #d97757;
  --mid-wash: #fbeee8;
  --bad: #b8433a;
  --bad-wash: #f9e8e5;
  --maint: #5b7ba6;
  --maint-wash: #e9eef6;
  --idle: #c9c4b8;
  --idle-wash: #f0ece3;

  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(48, 42, 32, 0.04);
  --shadow-md: 0 1px 2px rgba(48, 42, 32, 0.04), 0 8px 24px -14px rgba(48, 42, 32, 0.18);
  --shadow-pop: 0 6px 24px -8px rgba(48, 42, 32, 0.28);

  --maxw: 880px;
}

html[data-theme="dark"] {
  --paper: #1c1b19;
  --paper-sunken: #232220;
  --surface: #26251f;
  --surface-2: #2b2a24;

  --ink: #f3f0e8;
  --ink-soft: #c9c4b8;
  --ink-muted: #948f83;
  --ink-faint: #75706680;

  --line: #383630;
  --line-soft: #302e29;
  --line-strong: #494640;

  --accent: #e08a6c;
  --accent-deep: #f0a184;
  --accent-wash: #35271f;

  --ok: #7fb99a;
  --ok-wash: #23302a;
  --warn: #d7b062;
  --warn-wash: #332c1c;
  --mid: #e08a6c;
  --mid-wash: #35271f;
  --bad: #e08b80;
  --bad-wash: #38231f;
  --maint: #90aed6;
  --maint-wash: #232b36;
  --idle: #4a4740;
  --idle-wash: #302e29;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -14px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 6px 24px -8px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px 72px;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 0 16px;
  margin-bottom: 22px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark { color: var(--accent); display: flex; flex: none; }
.brand-mark svg { display: block; }

.brand-text { min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.updated {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-right: 2px;
}

.btn {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-wash); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-icon { padding: 8px; width: 32px; display: inline-flex; align-items: center; justify-content: center; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-muted); }
.btn-quiet:hover { color: var(--accent-deep); background: var(--accent-wash); border-color: transparent; }

html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }

/* ---------------------------------------------------------------- banner */

.banner {
  margin: -6px 0 20px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--warn-wash);
  color: var(--ink-soft);
  font-size: 13px;
}
.banner strong { color: var(--ink); font-weight: 600; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------------ hero */

.hero { padding: 26px 26px 22px; margin-bottom: 40px; }

.hero-main { display: flex; align-items: flex-start; gap: 14px; }

.status-dot {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--idle);
  box-shadow: 0 0 0 5px var(--idle-wash);
}
.status-dot[data-status="operational"] { background: var(--ok); box-shadow: 0 0 0 5px var(--ok-wash); }
.status-dot[data-status="degraded_performance"] { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-wash); }
.status-dot[data-status="partial_outage"] { background: var(--mid); box-shadow: 0 0 0 5px var(--mid-wash); }
.status-dot[data-status="full_outage"] { background: var(--bad); box-shadow: 0 0 0 5px var(--bad-wash); }
.status-dot[data-status="under_maintenance"] { background: var(--maint); box-shadow: 0 0 0 5px var(--maint-wash); }

.hero-copy { min-width: 0; flex: 1; }

.hero-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.hero-sub {
  margin: 7px 0 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--paper-sunken);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.stat b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat.is-warn { background: var(--warn-wash); border-color: transparent; }
.stat.is-bad { background: var(--bad-wash); border-color: transparent; }

.hero-chart { margin-top: 24px; }

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.chart-label { font-size: 12.5px; color: var(--ink-muted); }
.chart-value { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ----------------------------------------------------------------- pills */

.pills {
  display: block;
  width: 100%;
  height: 26px;
  overflow: visible;
}
.pills-sm { height: 17px; }

.pills .pill {
  fill: var(--idle);
  transition: opacity 0.12s ease;
}

.pill[data-status="operational"] { fill: var(--ok); }
.pill[data-status="degraded_performance"] { fill: var(--warn); }
.pill[data-status="partial_outage"] { fill: var(--mid); }
.pill[data-status="full_outage"] { fill: var(--bad); }
.pill[data-status="under_maintenance"] { fill: var(--maint); }
.pill[data-status="unknown"] { fill: var(--line); }

.pill:hover { opacity: 0.55; }

/* --------------------------------------------------------------- section */

.section { margin-bottom: 40px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-note { font-size: 12.5px; color: var(--ink-muted); }
.section-tools { display: flex; gap: 2px; }

/* ---------------------------------------------------------------- groups */

.groups { display: flex; flex-direction: column; gap: 14px; }

.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease;
}
.group-head:hover { background: var(--surface-2); }
.group.open .group-head { border-bottom-color: var(--line-soft); }

.group-chevron {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  transition: transform 0.18s ease;
}
.group.open .group-chevron { transform: rotate(90deg); }

.group-name-wrap { min-width: 0; flex: 0 1 auto; }

.group-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-count { font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; }

.group-spacer { flex: 1; min-width: 8px; }

.group-uptime {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.group-uptime b { font-weight: 500; color: var(--ink-soft); }

.group-body { display: none; padding: 4px 18px 8px; }
.group.open .group-body { display: block; }

.group-overview { padding: 12px 0 6px; }

.component {
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}
.component:first-child { border-top: none; }

.component-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.component-name {
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.component-spacer { flex: 1; min-width: 6px; }

.component-uptime {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  line-height: 1.45;
  white-space: nowrap;
  background: var(--idle-wash);
  color: var(--ink-soft);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.badge[data-status="operational"] { background: var(--ok-wash); color: var(--ok); }
.badge[data-status="degraded_performance"] { background: var(--warn-wash); color: var(--warn); }
.badge[data-status="partial_outage"] { background: var(--mid-wash); color: var(--mid); }
.badge[data-status="full_outage"] { background: var(--bad-wash); color: var(--bad); }
.badge[data-status="under_maintenance"] { background: var(--maint-wash); color: var(--maint); }

.badge-plain { background: var(--paper-sunken); color: var(--ink-muted); }
.badge-plain::before { display: none; }

/* ------------------------------------------------------------- incidents */

.incidents { display: flex; flex-direction: column; gap: 10px; }

.incident {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.incident-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.incident-head:hover { background: var(--surface-2); }

.incident-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--idle);
}
.incident-dot[data-impact="minor"] { background: var(--warn); }
.incident-dot[data-impact="major"] { background: var(--mid); }
.incident-dot[data-impact="critical"] { background: var(--bad); }
.incident-dot[data-impact="maintenance"] { background: var(--maint); }
.incident-dot[data-impact="none"] { background: var(--ok); }

.incident-main { flex: 1; min-width: 0; }

.incident-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.incident-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--ink-muted);
}
.incident-meta .sep { color: var(--ink-faint); }

.incident-side { display: flex; align-items: center; gap: 8px; flex: none; }

.incident-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-faint);
  transition: transform 0.18s ease;
}
.incident.open .incident-chevron { transform: rotate(90deg); }

.incident-body { display: none; padding: 2px 18px 16px; }
.incident.open .incident-body { display: block; }

.timeline {
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.update {
  position: relative;
  padding: 0 0 16px 20px;
}
.update:last-child { padding-bottom: 2px; }
.update::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}
.update:last-child::before { display: none; }
.update::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
}
.update[data-status="resolved"]::after { border-color: var(--ok); background: var(--ok); }
.update[data-status="monitoring"]::after { border-color: var(--warn); background: var(--warn); }
.update[data-status="identified"]::after { border-color: var(--mid); background: var(--mid); }
.update[data-status="investigating"]::after { border-color: var(--maint); background: var(--maint); }

.update-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.update-status { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.update-time { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.update-body { font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }

.incident-components {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--paper-sunken);
  border: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.chip .badge { padding: 0; background: none; }
.chip .badge::before { width: 5px; height: 5px; }

.empty {
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* ---------------------------------------------------------------- footer */

.footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12.5px;
}
.footer p { margin: 0; }
.footer-note { margin-bottom: 8px !important; line-height: 1.65; }
.footer-meta { color: var(--ink-faint); }
.dot-sep { margin: 0 7px; }

/* --------------------------------------------------------------- tooltip */

.tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: var(--shadow-pop);
  max-width: 260px;
  white-space: nowrap;
}
html[data-theme="dark"] .tooltip { background: #3a3833; color: #f3f0e8; }
.tooltip b { font-weight: 600; }
.tooltip .t-status { display: block; opacity: 0.82; }

/* -------------------------------------------------------------- skeleton */

.skeleton-group, .skeleton-row {
  height: 62px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 0%, var(--paper-sunken) 50%, var(--surface) 100%);
  background-size: 220% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-row { height: 54px; }
@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-group, .skeleton-row { animation: none; }
  * { transition: none !important; }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 720px) {
  .page { padding: 0 15px 56px; }
  .topbar { padding: 14px 0 12px; margin-bottom: 18px; }
  .brand-text h1 { font-size: 18px; }
  .updated { display: none; }
  .hero { padding: 20px 18px 18px; margin-bottom: 32px; }
  .hero-title { font-size: 24px; }
  .pills { height: 22px; }
  .pills-sm { height: 14px; }
  .group-head { padding: 13px 14px; }
  .group-body { padding: 2px 14px 8px; }
  .incident-head { padding: 13px 14px; }
  .incident-body { padding: 2px 14px 14px; }
  .component-name { font-size: 13.5px; }
}

@media (max-width: 460px) {
  .group-count { display: none; }
  .update { padding-left: 18px; }
}
