/*
 * Chordizone status page - design tokens from docs/07-design-system.md.
 *
 * Values are the real ones from the design system, not eyeballed:
 *   light  background gray-100 #ECECEA, surface white, surface-alt gray-50 #F0F0F0,
 *          border gray-200 #DEDFDD, text gray-900 #1E1E1E, secondary gray-500 #888A8D
 *   dark   background #121212, surface gray-800 #2E2E2E, elevated gray-900 #1E1E1E,
 *          text #FFFFFF, secondary gray-500 #888A8D (single-valued), border #3F3F3F
 *
 * Status colours:
 *   operational  semantic/success #166534 light / #22C55E dark.
 *                CAVEAT: doc 07 marks these PROVISIONAL - they are not in Figma and still need
 *                design sign-off (DEV-255). They are used here rather than invented, and both clear
 *                WCAG AA on their own page background per that doc's contrast note.
 *   degraded     tuner/near #D78324 (single-valued, real token)
 *   outage       Accent/Red #BB3846 (single-valued, real token - the retired brand red #CD4F5C is
 *                NOT used anywhere)
 *   no data      the secondary text grey, deliberately low-contrast so it reads as absence
 *
 * Type: Suisse Int'l and Geist are the design's Latin families but are not licensed for the web here,
 * so this uses the same system stack as the served legal pages (server/presentation/resources/legal).
 */

:root {
  color-scheme: light dark;

  --bg: #ECECEA;
  --surface: #FFFFFF;
  --surface-alt: #F0F0F0;
  --border: #DEDFDD;
  --text: #1E1E1E;
  --text-secondary: #888A8D;

  --up: #166534;
  --degraded: #D78324;
  --outage: #BB3846;
  --nodata: #C9C9C7;

  --radius-card: 12px;
  --radius-pill: 999px;
  --gap: 16px;
  --maxw: 860px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #2E2E2E;
    --surface-alt: #1E1E1E;
    --border: #3F3F3F;
    --text: #FFFFFF;
    --text-secondary: #888A8D;

    --up: #22C55E;
    --nodata: #3F3F3F;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "Padauk", "Noto Sans Myanmar", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 20px;
  top: 12px;
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 17px;
}
.wordmark { font-weight: 700; letter-spacing: -0.01em; }
.brand-sep { color: var(--text-secondary); }
.brand-page { color: var(--text-secondary); }

.header-link {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.header-link:hover,
.header-link:focus-visible { color: var(--text); border-bottom-color: var(--border); }

/* Banner ------------------------------------------------------------------ */

.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 36px;
}

.banner-dot {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--nodata);
}
.banner[data-state="OPERATIONAL"] .banner-dot { background: var(--up); }
.banner[data-state="DEGRADED"] .banner-dot { background: var(--degraded); }
.banner[data-state="OUTAGE"] .banner-dot { background: var(--outage); }

.banner-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.banner-meta { margin: 4px 0 0; color: var(--text-secondary); font-size: 14px; }

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

.section-heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 12px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-name { margin: 0; font-size: 17px; font-weight: 600; }
.card-desc { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }

/* The pill always carries TEXT: colour alone must never be the only signal. */
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.pill.is-up { color: var(--up); }
.pill.is-degraded { color: var(--degraded); }
.pill.is-outage { color: var(--outage); }

.strip {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-top: 18px;
  height: 34px;
}

.bar {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
  border-radius: 2px;
  background: var(--nodata);
}
.bar.is-up { background: var(--up); }
.bar.is-degraded { background: var(--degraded); }
.bar.is-outage { background: var(--outage); }

.strip-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--nodata); }
.swatch.is-up { background: var(--up); }
.swatch.is-degraded { background: var(--degraded); }
.swatch.is-outage { background: var(--outage); }
.swatch.is-nodata { background: var(--nodata); }

.legend-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 62ch;
}

/* Incidents --------------------------------------------------------------- */

.incidents { margin-top: 40px; }

.incident {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--outage);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.incident.is-resolved { border-left-color: var(--border); }

.incident-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.incident-title { margin: 0; font-size: 15px; font-weight: 600; }
.incident-when { font-size: 13px; color: var(--text-secondary); }
.incident-detail { margin: 6px 0 0; font-size: 13px; color: var(--text-secondary); }

/* Error panel ------------------------------------------------------------- */

.error-panel {
  background: var(--surface);
  border: 1px solid var(--outage);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.error-panel h3 { margin: 0 0 4px; font-size: 15px; }
.error-panel p { margin: 0; font-size: 14px; color: var(--text-secondary); }

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

.site-footer {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.muted { color: var(--text-secondary); font-size: 13px; margin: 0 0 6px; max-width: 62ch; }

/* Skeletons --------------------------------------------------------------- */

.skeleton .sk-line,
.skeleton .sk-pill,
.skeleton .sk-strip {
  background: var(--surface-alt);
  border-radius: 6px;
  animation: pulse 1.4s ease-in-out infinite;
}
.sk-title { width: 40%; height: 18px; }
.sk-pill { width: 96px; height: 26px; border-radius: var(--radius-pill); }
.sk-strip { height: 34px; margin-top: 18px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton .sk-line,
  .skeleton .sk-pill,
  .skeleton .sk-strip { animation: none; }
}

/* Narrow screens: 90 hairlines are unreadable on a phone, so the strip scrolls
   instead of collapsing into an indistinct block. */
@media (max-width: 520px) {
  .strip { overflow-x: auto; }
  .bar { min-width: 3px; }
  .banner-title { font-size: 19px; }
  .card-head { flex-direction: column; align-items: flex-start; }
}
