/*
 * status.unitpost.com (ADR-0106). Brand tokens copied from
 * packages/ui/src/theme.css (light :root, dark .dark) without bundling the
 * app; packages/contracts/src/status-page.test.ts fails if a value here drifts
 * from theme.css. Type follows DESIGN.md §2.8 (Inter UI, DM Sans headings,
 * when installed; no web fonts are loaded, so nothing third-party is fetched).
 */

:root {
  color-scheme: light;
  --background: #ffffff;
  --surface-subtle: #fafafa;
  --surface: #f6f6f6;
  --border-subtle: #ededed;
  --border: #d8d8d8;
  --border-strong: #b8b8b8;
  --foreground: #191c1f;
  --muted-foreground: #70757b;
  --placeholder: #9aa0a6;
  --destructive: #dc3545;
  --destructive-surface: #fff1f2;
  --destructive-border: #fecdd3;
  --success: #008f68;
  --success-surface: #edf9f5;
  --success-border: #b9e7d8;
  --warning: #a97800;
  --warning-surface: #fff8e6;
  --warning-border: #eed79b;
  --info: #276ef1;
  --info-surface: #eef4ff;
  --info-border: #c6d8ff;
  --link: #1f63da;
  --radius-panel: 14px;
  --radius-control: 9999px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #080808;
    --surface-subtle: #0b0b0b;
    --surface: #111111;
    --border-subtle: #1d1d1d;
    --border: #292929;
    --border-strong: #3a3a3a;
    --foreground: #f5f5f5;
    --muted-foreground: #929292;
    --placeholder: #656565;
    --destructive: #df656b;
    --destructive-surface: #211113;
    --destructive-border: #4b2428;
    --success: #42b991;
    --success-surface: #0d1b16;
    --success-border: #204638;
    --warning: #c99a3b;
    --warning-surface: #1d180d;
    --warning-border: #493a1d;
    --info: #6f96e8;
    --info-surface: #101725;
    --info-border: #283b62;
    --link: #7b9fe6;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
.bar:focus-visible {
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  margin: 0;
}

p {
  margin: 0;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--foreground);
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
}

.brand:hover {
  text-decoration: none;
}

.brand svg {
  width: 20px;
  height: 22px;
}

.brand-sub {
  color: var(--muted-foreground);
  font-weight: 500;
}

.site-link {
  font-size: 14px;
}

/* --- Summary ------------------------------------------------------------ */

.summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  margin-bottom: 24px;
}

.summary-dot {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: var(--radius-control);
  background: var(--placeholder);
}

.summary-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.summary-detail {
  color: var(--muted-foreground);
  font-size: 14px;
}

.summary[data-state="operational"] {
  background: var(--success-surface);
  border-color: var(--success-border);
}
.summary[data-state="operational"] .summary-dot {
  background: var(--success);
}
.summary[data-state="degraded"],
.summary[data-state="partial_outage"] {
  background: var(--warning-surface);
  border-color: var(--warning-border);
}
.summary[data-state="degraded"] .summary-dot,
.summary[data-state="partial_outage"] .summary-dot {
  background: var(--warning);
}
.summary[data-state="major_outage"] {
  background: var(--destructive-surface);
  border-color: var(--destructive-border);
}
.summary[data-state="major_outage"] .summary-dot {
  background: var(--destructive);
}
.summary[data-state="maintenance"] {
  background: var(--info-surface);
  border-color: var(--info-border);
}
.summary[data-state="maintenance"] .summary-dot {
  background: var(--info);
}

/* --- Incidents and maintenance ------------------------------------------ */

.notices {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.notice {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--background);
}

.notice[data-tone="incident"] {
  border-color: var(--warning-border);
}

.notice[data-tone="maintenance"] {
  border-color: var(--info-border);
}

.notice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.notice-title {
  font-size: 16px;
  font-weight: 600;
}

.notice-affected {
  color: var(--muted-foreground);
  font-size: 12px;
  margin-bottom: 8px;
}

.pill {
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.pill[data-tone="incident"] {
  color: var(--warning);
  background: var(--warning-surface);
  border-color: var(--warning-border);
}

.pill[data-tone="maintenance"] {
  color: var(--info);
  background: var(--info-surface);
  border-color: var(--info-border);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.timeline-meta {
  color: var(--muted-foreground);
  font-size: 12px;
}

.timeline-message {
  white-space: pre-line;
}

/* --- Components ---------------------------------------------------------- */

.components {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  overflow: hidden;
}

.component {
  padding: 16px 20px;
}

.component + .component {
  border-top: 1px solid var(--border-subtle);
}

.component-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.component-title {
  font-size: 16px;
  font-weight: 600;
}

.component-description {
  color: var(--muted-foreground);
  font-size: 12px;
}

.component-state {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-control);
  background: var(--placeholder);
}

.component[data-state="operational"] .component-state {
  color: var(--success);
}
.component[data-state="operational"] .dot {
  background: var(--success);
}
.component[data-state="degraded"] .component-state,
.component[data-state="partial_outage"] .component-state {
  color: var(--warning);
}
.component[data-state="degraded"] .dot,
.component[data-state="partial_outage"] .dot {
  background: var(--warning);
}
.component[data-state="major_outage"] .component-state {
  color: var(--destructive);
}
.component[data-state="major_outage"] .dot {
  background: var(--destructive);
}
.component[data-state="maintenance"] .component-state {
  color: var(--info);
}
.component[data-state="maintenance"] .dot {
  background: var(--info);
}

.bars {
  display: flex;
  gap: 2px;
  height: 32px;
}

.bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: var(--border);
}

.bar[data-state="operational"] {
  background: var(--success);
}
.bar[data-state="degraded"],
.bar[data-state="partial_outage"] {
  background: var(--warning);
}
.bar[data-state="major_outage"] {
  background: var(--destructive);
}
.bar[data-state="maintenance"] {
  background: var(--info);
}

.bars-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--placeholder);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.bars-legend span:nth-child(2) {
  color: var(--muted-foreground);
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 32px;
  color: var(--muted-foreground);
  font-size: 12px;
}

@media (max-width: 560px) {
  .bars {
    gap: 1px;
    height: 28px;
  }
  .component-head {
    flex-direction: column;
    gap: 6px;
  }
}
