/* ==================================================================
 * 服务状态页面样式
 * ================================================================== */

/* ---------- 变量 ---------- */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e8f0;
  --border-strong: #d3dae6;

  --text: #101828;
  --text-2: #5a6478;
  --text-3: #98a2b3;

  --brand: #2563eb;

  --ok: #12a150;
  --warn: #eab308;
  --partial: #f97316;
  --err: #dc2626;
  --maint: #3b82f6;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -16px rgba(16, 24, 40, .22);

  --wrap: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c222b;
    --border: #272e38;
    --border-strong: #333c48;

    --text: #e8edf4;
    --text-2: #9aa6b6;
    --text-3: #6b7684;

    --brand: #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -16px rgba(0, 0, 0, .8);
  }
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 20px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 12.5px; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

main { padding-bottom: 44px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 44px 0 30px;
  background: var(--bg);
  background:
    radial-gradient(900px 320px at 50% -120px, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.hero__eyebrow {
  margin-bottom: 14px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.overall {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.overall--degraded_performance { border-left-color: var(--warn); }
.overall--partial_outage { border-left-color: var(--partial); }
.overall--major_outage { border-left-color: var(--err); }

.overall__icon {
  display: grid;
  place-items: center;
  width: 50px; height: 50px;
  flex-shrink: 0;
  border-radius: 14px;
  background: #e8f7ee;
  color: #0b7a3c;
}
.overall__icon--warn { background: #fef6e0; color: #a16207; }
.overall__icon--partial { background: #ffefe4; color: #c2410c; }
.overall__icon--err { background: #feebe9; color: #b42318; }

.overall__title { font-size: 26px; letter-spacing: -.2px; }
.overall__sub { margin-top: 8px; color: var(--text-2); max-width: 62ch; }
.overall__tags { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 摘要指标 ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.metric__label { color: var(--text-3); font-size: 12.5px; }
.metric__value { font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.metric__value--ok { color: var(--ok); }
.metric__value--warn { color: #b45309; }
.metric__value--err { color: var(--err); }
.metric__value--maint { color: var(--maint); }
.metric__hint { color: var(--text-3); font-size: 11.5px; }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-3);
  font-size: 12.5px;
}
.dot-sep { color: var(--border-strong); }

/* ---------- 通用区块 ---------- */
.section { padding: 38px 0 8px; }
.section__head { margin-bottom: 18px; }
.section__head h2 { font-size: 20px; }
.section__head p { margin-top: 6px; color: var(--text-2); font-size: 14px; max-width: 76ch; }

/* ---------- 监测项列表 ---------- */
.group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.component { padding: 16px 20px; }
.component + .component { border-top: 1px solid var(--border); }

.component__row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.component__info { display: flex; flex-direction: column; min-width: 0; }
.component__name { font-weight: 500; }
.component__desc { color: var(--text-3); }
.component__stat {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}
.component__uptime {
  min-width: 66px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  color: var(--text-2);
}
.component__uptime--ok { color: var(--ok); }
.component__uptime--warn { color: #b45309; }
.component__uptime--err { color: var(--err); }

.status-dot {
  width: 9px; height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}
.status-dot--warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.status-dot--partial { background: var(--partial); box-shadow: 0 0 0 3px color-mix(in srgb, var(--partial) 20%, transparent); }
.status-dot--err { background: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 20%, transparent); }
.status-dot--maint { background: var(--maint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--maint) 20%, transparent); }

/* ---------- 可用率色条 ---------- */
.bars {
  position: relative;
  display: flex;
  gap: 2px;
  height: 30px;
  margin-top: 12px;
}
.bar {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: var(--ok);
  transition: transform .12s;
}
.bar--warn { background: var(--warn); }
.bar--partial { background: var(--partial); }
.bar--err { background: var(--err); }
.bar:last-child { outline: 1.5px solid var(--text); outline-offset: 1.5px; }
.bar:hover { transform: scaleY(1.18); }

.bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  padding: 5px 9px;
  background: #101828;
  color: #fff;
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s, transform .14s;
  z-index: 5;
}
.bar:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 首尾两根的提示框向内对齐，避免溢出容器 */
.bar:first-child::after { left: 0; transform: translateY(3px); }
.bar:first-child:hover::after { transform: translateY(0); }
.bar:last-child::after { left: auto; right: 0; transform: translateY(3px); }
.bar:last-child:hover::after { transform: translateY(0); }

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  color: var(--text-2);
  font-size: 12.5px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend__note { color: var(--text-3); }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch--ok { background: var(--ok); }
.swatch--warn { background: var(--warn); }
.swatch--partial { background: var(--partial); }
.swatch--err { background: var(--err); }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge--ok { color: #0b7a3c; background: #e8f7ee; }
.badge--warn { color: #a16207; background: #fef6e0; }
.badge--partial { color: #c2410c; background: #ffefe4; }
.badge--err { color: #b42318; background: #feebe9; }
.badge--maint { color: #1d4ed8; background: #e8efff; }
.badge--muted { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }

@media (prefers-color-scheme: dark) {
  .badge--ok { color: #4ade80; background: rgba(18, 161, 80, .16); }
  .badge--warn { color: #fbbf24; background: rgba(234, 179, 8, .16); }
  .badge--partial { color: #fb923c; background: rgba(249, 115, 22, .16); }
  .badge--err { color: #f87171; background: rgba(220, 38, 38, .18); }
  .badge--maint { color: #93c5fd; background: rgba(59, 130, 246, .18); }
  .metric__value--warn, .component__uptime--warn { color: #fbbf24; }
  .overall__icon { background: rgba(18, 161, 80, .16); color: #4ade80; }
  .overall__icon--warn { background: rgba(234, 179, 8, .16); color: #fbbf24; }
  .overall__icon--partial { background: rgba(249, 115, 22, .16); color: #fb923c; }
  .overall__icon--err { background: rgba(220, 38, 38, .18); color: #f87171; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .hero { padding: 30px 0 24px; }
  .overall { flex-direction: column; padding: 22px 20px; }
  .overall__title { font-size: 21px; }

  .component { padding: 15px 16px; }
  .component__row { flex-wrap: wrap; }
  .component__stat { width: 100%; margin-left: 21px; }
  .component__uptime { margin-left: auto; }

  .bars { height: 26px; gap: 1px; }
  .bar { border-radius: 1px; }
  .bar::after { display: none; }
}

/* ---------- 页脚：备案信息 ---------- */
.site-footer {
  margin-top: 56px;
  padding: 22px 0 38px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 24px;
  text-align: center;
}

.site-footer__line {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-3);
}

.site-footer__link {
  color: var(--text-3);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}

.site-footer__link:hover,
.site-footer__link:focus-visible {
  color: var(--brand);
  border-bottom-color: currentColor;
}

.site-footer__link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (max-width: 520px) {
  .site-footer { margin-top: 40px; padding: 18px 0 30px; }
  .site-footer__inner { flex-direction: column; gap: 4px; }
  .site-footer__line { font-size: 12px; }
}
