/*
 * status.churchrating.com
 *
 * Tokens are copied from apps/web/app/globals.css rather than imported: this
 * service is deliberately outside the workspace so that nothing it reports on
 * can break its build, and that isolation costs a copy. The values below are the
 * AA-corrected Grove palette. If globals.css moves a value, move it here too —
 * `--nodata` is the only token that exists here and nowhere else, because no
 * other surface in the product draws "we have no sample for this day".
 *
 * Faces follow the design system's role ruling with no exceptions: Space Grotesk
 * carries the wordmark and nothing else, Source Serif 4 carries headings, IBM
 * Plex Mono carries numerals and uppercase eyebrows, Inter carries every other
 * piece of interface copy. The mockup set the banner headline in Space Grotesk;
 * that is the same defect the review flagged on the spotlight hero, so it is
 * corrected here rather than reproduced.
 */

:root {
  color-scheme: light;

  --bg: #ffffff;
  --surface: #f4f8f6;
  --surface-2: #eef3f0;
  --surface-3: #e4ebe7;
  --border: #e6ece9;
  --border-strong: #cdd8d2;

  --text: #0e1a14;
  --text-2: #2e4038;
  --text-muted: #5a6e65;

  --accent: #10936a;
  --accent-strong: #0b5a40;

  --danger: #c9221b;
  --warn: #a86200;
  --warn-bg: #fff4e5;
  --warn-text: #7a4a00;
  --success: #2da44e;
  --success-text: #176632;
  --success-strong: #176632;

  --on-accent: #ffffff;
  --on-success: #ffffff;
  --on-warn: #ffffff;
  --on-danger: #ffffff;

  /* No sample for that day. Used only where telemetry genuinely does not exist. */
  --nodata: #cdd8d2;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-xxl: 26px;

  --radius-control: 12px;
  --radius-card: 14px;
  --radius-pill: 999px;

  --font-body: 'Inter';
  --font-serif: 'Source Serif 4';
  --font-display: 'Space Grotesk';
  --font-mono: 'IBM Plex Mono';

  --stack-body: var(--font-body), -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --stack-serif: var(--font-serif), Georgia, 'Times New Roman', serif;
  --stack-display: var(--font-display), var(--stack-body);
  --stack-mono: var(--font-mono), ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #0d0e0f;
    --surface: #18191b;
    --surface-2: #202225;
    --surface-3: #292c2f;
    --border: #34373b;
    --border-strong: #43474c;

    --text: #eef0f1;
    --text-2: #c4c8cc;
    --text-muted: #8e949b;

    --accent: #34d99a;
    --accent-strong: #5de6b2;

    --danger: #ff453a;
    --warn: #ff9f0a;
    --warn-bg: #3a2a0a;
    --warn-text: #ffcf8f;
    --success: #45c97a;
    --success-text: #45c97a;
    --success-strong: #45c97a;

    --on-accent: #031409;
    --on-success: #051a0d;
    --on-warn: #1f1302;
    --on-danger: #1f0604;

    --nodata: #43474c;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--stack-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-strong);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  margin: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
}

/* ── header ─────────────────────────────────────────────────────────────── */

.masthead {
  border-bottom: 1px solid var(--border);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 28px;
}

.mark {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border-radius: 50% 50% 50% 0;
  background: var(--accent);
  transform: rotate(-45deg);
}

.wordmark {
  font-family: var(--stack-display);
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.2px;
  color: var(--text);
  text-decoration: none;
}

.masthead__slash {
  font-size: 15px;
  color: var(--border-strong);
}

.masthead__section {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text-2);
}

.masthead__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.masthead__link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
}

.masthead__link:hover {
  color: var(--text);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface);
  color: var(--text);
}

/* ── page shell ─────────────────────────────────────────────────────────── */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px;
}

/* ── banner ─────────────────────────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-radius: var(--radius-control);
}

.banner--ok {
  background: var(--success-strong);
  color: var(--on-success);
}

.banner--warn {
  background: var(--warn);
  color: var(--on-warn);
}

.banner--down {
  background: var(--danger);
  color: var(--on-danger);
}

.banner__icon {
  flex: 0 0 auto;
  display: flex;
}

.banner__headline {
  margin: 0;
  flex: 1;
  font-family: var(--stack-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.banner__meta {
  margin: 0;
  flex: 0 0 auto;
  font-family: var(--stack-mono);
  font-size: 13px;
  font-weight: 400;
}

/* ── section headings ───────────────────────────────────────────────────── */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-lg);
  margin: 30px 0 10px;
}

.section-head h2,
.page > h2 {
  margin: 0;
  font-family: var(--stack-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.page > h2 {
  margin: 30px 0 10px;
}

.section-head__note {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── components table ───────────────────────────────────────────────────── */

.components {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.components__group-title {
  margin: 0;
  padding: 10px 18px;
  background: var(--surface-2);
  font-family: var(--stack-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* The card clips its own corners, so a divider belongs BETWEEN rows only —
   a border on the last child doubles the card's own edge. */
.components__group + .components__group .components__group-title,
.component + .component,
.components__group + .components__group {
  border-top: 1px solid var(--border);
}

.component {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px 128px;
  align-items: center;
  gap: 22px;
  padding: 14px 18px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.component__id {
  min-width: 0;
}

.component__name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.component__desc {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.strip {
  display: flex;
  gap: 1.5px;
  height: 26px;
}

.strip__day {
  flex: 1 1 0;
  border-radius: 1.5px;
  background: var(--nodata);
}

.strip__day--ok {
  background: var(--success);
}

.strip__day--warn {
  background: var(--warn);
}

.strip__day--down {
  background: var(--danger);
}

.strip__scale {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: var(--stack-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.strip__scale-30 {
  display: none;
}

.component__state {
  margin: 0;
  text-align: right;
  font-size: 13.5px;
  font-weight: 600;
}

.state--operational {
  color: var(--success-text);
}

.state--degraded {
  color: var(--warn);
}

.state--partial-outage,
.state--major-outage {
  color: var(--danger);
}

.state--nodata {
  color: var(--text-muted);
}

/* ── incident thread ────────────────────────────────────────────────────── */

.thread {
  margin-top: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.thread__head {
  padding: 18px 20px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--border);
}

.thread__tags {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--stack-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pill--live {
  background: var(--warn);
  color: var(--on-warn);
}

.thread__affects {
  font-size: 12.5px;
  color: var(--warn-text);
}

.thread__title {
  margin: 11px 0 0;
  font-family: var(--stack-serif);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--warn-text);
}

.thread__summary {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--warn-text);
  max-width: 80ch;
}

.update {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: var(--space-xl);
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.update__label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.update__time {
  margin: 2px 0 0;
  font-family: var(--stack-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.update__body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}

/* ── past incidents ─────────────────────────────────────────────────────── */

.incidents {
  display: flex;
  flex-direction: column;
}

.incident {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.incident__date {
  margin: 0;
  font-family: var(--stack-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.incident__title {
  margin: 9px 0 0;
  font-family: var(--stack-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}

.incident__tags {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.incident__meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.incident__body {
  margin: 11px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 80ch;
}

.incidents__more {
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
}

.incidents__more a {
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.empty {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

/* ── subscribe ──────────────────────────────────────────────────────────── */

.subscribe {
  margin-top: 30px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}

.subscribe h2 {
  margin: 0;
  font-family: var(--stack-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.subscribe p {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 60ch;
}

.subscribe__form {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.subscribe__input {
  flex: 1 1 240px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.subscribe__submit {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.notice {
  margin: var(--space-md) 0 0;
  font-size: 13.5px;
  font-weight: 500;
}

.notice--ok {
  color: var(--success-text);
}

.notice--error {
  color: var(--danger);
}

/* ── footer ─────────────────────────────────────────────────────────────── */

.footer {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text-2);
}

.footer__since {
  margin-left: auto !important;
  font-family: var(--stack-mono);
}

.footer__caveat {
  flex-basis: 100%;
  margin: 0;
  padding-top: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── phone ──────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .masthead__inner {
    gap: 9px;
    padding: 16px 18px;
  }

  .mark {
    width: 18px;
    height: 18px;
  }

  .masthead__slash,
  .masthead__section,
  .masthead__link {
    display: none;
  }

  .wordmark {
    font-size: 15px;
  }

  .page {
    padding: 18px;
  }

  .banner {
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    flex-wrap: wrap;
  }

  .banner__headline {
    flex: 1 1 auto;
    font-size: 17px;
    letter-spacing: -0.3px;
  }

  .banner__meta {
    flex-basis: 100%;
    padding-left: 34px;
    font-size: 12px;
  }

  .section-head {
    margin: 26px 0 10px;
  }

  .section-head h2,
  .page > h2 {
    font-size: 17px;
  }

  .section-head__note {
    display: none;
  }

  /* The row becomes a stack: name and state on one line, the strip beneath.
     One state element serves both layouts — rendering it twice and hiding one
     is how a screen reader ends up hearing "Operational Operational".

     `order` does the rearranging rather than the markup. The strip sits between
     the name and the state in the DOM, which is what the desktop grid and a
     screen reader both want; left in that order here the full-width strip wraps
     before the state is reached and drops it onto a third line of its own. */
  .component {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 10px;
    padding: 13px 15px;
  }

  .component__id {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }

  .component__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .component__desc {
    display: none;
  }

  .component__state {
    order: 2;
    flex: 0 0 auto;
    font-size: 12.5px;
  }

  .component__history {
    order: 3;
    flex-basis: 100%;
    margin-top: 9px;
  }

  .strip {
    height: 18px;
  }

  /* 90 cells do not resolve at 393px — show the last 30. */
  .strip__day:nth-last-child(n + 31) {
    display: none;
  }

  .strip__scale-90 {
    display: none;
  }

  .strip__scale-30 {
    display: inline;
  }

  .update {
    display: block;
    padding: 13px 15px;
  }

  .update__time {
    display: inline;
    margin-left: var(--space-sm);
  }

  .update__body {
    margin-top: 7px;
  }

  .incident__title {
    font-size: 15px;
  }

  .footer {
    justify-content: center;
    text-align: center;
  }

  .footer__since {
    margin-left: 0 !important;
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
