/* Public status-page presentation tokens and layout primitives. */
:root {
  --color-text: #1f2328;
  --color-muted: #57606a;
  --color-border: #8c959f;
  --color-surface: #ffffff;
  --color-surface-subtle: #f6f8fa;
  --color-link: #0550ae;
  --color-focus: #0969da;
  --content-max: 68rem;
  --page-gutter: clamp(1rem, 3vw, 2rem);
  --module-gap: 1.5rem;
  --card-padding: 1rem;
  --card-radius: 0.75rem;

  /* Existing status accents remain the source-of-truth color semantics. */
  --status-green-accent: #1a7f37;
  --status-green-surface: #dafbe1;
  --status-green-foreground: #116329;
  --status-green-border: #1a7f37;
  --status-grey-accent: #d0d7de;
  --status-grey-surface: #f6f8fa;
  --status-grey-foreground: #1f2328;
  --status-grey-border: #57606a;
  --status-blue-accent: #0969da;
  --status-blue-surface: #ddf4ff;
  --status-blue-foreground: #0550ae;
  --status-blue-border: #0969da;
  --status-yellow-accent: #f2cc60;
  --status-yellow-surface: #fff8c5;
  --status-yellow-foreground: #4d3800;
  --status-yellow-border: #9a6700;
  --status-orange-accent: #bc4c00;
  --status-orange-surface: #fff1e5;
  --status-orange-foreground: #7d2d00;
  --status-orange-border: #bc4c00;
  --status-red-accent: #cf222e;
  --status-red-surface: #ffebe9;
  --status-red-foreground: #a40e26;
  --status-red-border: #cf222e;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 0;
}

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-surface-subtle);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

main,
.page-shell {
  width: 100%;
  max-width: var(--content-max);
  min-width: 0;
  margin-inline: auto;
  padding: 2rem var(--page-gutter);
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding-inline: var(--page-gutter);
}

.site-header__inner,
.site-header > .brand {
  display: block;
  width: 100%;
  max-width: var(--content-max);
  min-width: 0;
  margin-inline: auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
}

.brand {
  display: inline-block;
  padding-block: 1rem;
  color: var(--color-text);
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: none;
}

/* Skip link: parked off-screen until keyboard focus, so it stays reachable by Tab. */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--color-surface);
  color: var(--color-link);
  font-weight: 600;
  transform: translateY(-100%);
}

.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid var(--color-focus);
  outline-offset: -3px;
}

.site-footer {
  width: 100%;
  max-width: var(--content-max);
  min-width: 0;
  margin: 2rem auto 0;
  padding: 1.5rem var(--page-gutter);
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
}

.site-footer p {
  margin-block: 0.5rem;
  overflow-wrap: anywhere;
}

a {
  color: var(--color-link);
  overflow-wrap: anywhere;
}

a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 var(--module-gap);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.125rem;
  line-height: 1.3;
}

.module > h2:first-child,
.panel > h2:first-child {
  margin-top: 0;
}

.module,
.panel {
  min-width: 0;
  margin-block: var(--module-gap);
  padding: var(--card-padding);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
}

.home-modules {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--module-gap);
}

.home-modules > .module,
.home-modules > .panel {
  margin: 0;
}

.status-green {
  --status-accent: var(--status-green-accent);
  --status-surface: var(--status-green-surface);
  --status-foreground: var(--status-green-foreground);
  --status-border: var(--status-green-border);
  --status-badge-foreground: #ffffff;
}

.status-grey {
  --status-accent: var(--status-grey-accent);
  --status-surface: var(--status-grey-surface);
  --status-foreground: var(--status-grey-foreground);
  --status-border: var(--status-grey-border);
  --status-badge-foreground: var(--color-text);
}

.status-blue {
  --status-accent: var(--status-blue-accent);
  --status-surface: var(--status-blue-surface);
  --status-foreground: var(--status-blue-foreground);
  --status-border: var(--status-blue-border);
  --status-badge-foreground: #ffffff;
}

.status-yellow {
  --status-accent: var(--status-yellow-accent);
  --status-surface: var(--status-yellow-surface);
  --status-foreground: var(--status-yellow-foreground);
  --status-border: var(--status-yellow-border);
  --status-badge-foreground: var(--color-text);
}

.status-orange {
  --status-accent: var(--status-orange-accent);
  --status-surface: var(--status-orange-surface);
  --status-foreground: var(--status-orange-foreground);
  --status-border: var(--status-orange-border);
  --status-badge-foreground: #ffffff;
}

.status-red {
  --status-accent: var(--status-red-accent);
  --status-surface: var(--status-red-surface);
  --status-foreground: var(--status-red-foreground);
  --status-border: var(--status-red-border);
  --status-badge-foreground: #ffffff;
}

.status-banner,
.banner {
  width: 100%;
  min-width: 0;
  margin-block: var(--module-gap);
  padding: var(--card-padding);
  border: 1px solid var(--status-border, var(--color-border));
  border-inline-start-width: 0.375rem;
  border-radius: var(--card-radius);
  background: var(--status-surface, var(--color-surface));
  color: var(--status-foreground, var(--color-text));
  font-size: 1.25rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.status-banner p,
.banner p {
  margin: 0;
}

.status-banner__icon,
.status-banner__text,
.icon {
  overflow-wrap: anywhere;
}

.status,
.status-badge {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  max-width: 100%;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--status-border, var(--color-border));
  border-radius: 0.375rem;
  background: var(--status-accent, var(--color-surface-subtle));
  color: var(--status-badge-foreground, var(--color-text));
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.status .icon,
.status-badge .icon {
  display: inline-block;
  grid-column: 1;
  min-width: 0;
  flex: 0 0 auto;
  line-height: 1;
}

.status-label {
  grid-column: 2;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The maintenance symbol is small in most fonts; make it one step larger. */
.status-blue .icon {
  font-size: 1.3em;
  line-height: 1;
  vertical-align: -0.1em;
}

.plain,
.components,
.history-list,
.timeline {
  padding-inline-start: 0;
}

.plain {
  list-style: none;
}

.components,
.history-list,
.timeline {
  margin-block: 0;
}

.components > li,
.component-row {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) minmax(6rem, min(16rem, 42%));
  column-gap: 0.5rem;
  row-gap: 0.5rem;
  min-width: 0;
  box-sizing: border-box;
  align-items: start;
  padding-block: 0.75rem;
  border-block-end: 1px solid var(--color-border);
  overflow-wrap: anywhere;
}

.components > li:first-child,
.component-row:first-child {
  padding-block-start: 0.25rem;
}

.components > li:last-child,
.component-row:last-child {
  border-block-end: 0;
}

.components .name,
.component-name {
  grid-column: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.component-row > .status,
.component-row > .status-badge {
  grid-column: 2;
  justify-self: end;
  min-width: 0;
  max-width: 100%;
}

.auto-detected,
.auto-detected-block {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

/* Duration note (AA-368, spec 4.2). Two classes outrank `.components > li`; --color-muted
   is 5.9:1 or better on both the white card and the subtle page background. */
.component-row > .status-duration {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--color-muted);
}

.auto-detected-help {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}
.auto-detected-help > summary {
  cursor: pointer;
  text-decoration: underline;
}
.auto-detected-help > p {
  margin: 0.25rem 0 0;
  overflow-wrap: anywhere;
}
.incident,
.incident-card,
.maintenance,
.maintenance-card,
.notice,
.notice-card,
.history-item {
  min-width: 0;
  padding-block: var(--card-padding);
  border-block-end: 1px solid var(--color-border);
  overflow-wrap: anywhere;
}

.incident:first-child,
.incident-card:first-child,
.maintenance:first-child,
.maintenance-card:first-child,
.notice:first-child,
.notice-card:first-child {
  padding-block-start: 0.25rem;
}

.incident:last-child,
.incident-card:last-child,
.maintenance:last-child,
.maintenance-card:last-child,
.notice:last-child,
.notice-card:last-child,
.history-item:last-child {
  border-block-end: 0;
}

.incident h3,
.incident-card h3,
.maintenance h3,
.maintenance-card h3,
.notice h3,
.notice-card h3,
.history-item h2 {
  margin-block: 0 0.5rem;
}

.incident-card__meta,
.incident-card__update {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-list {
  display: grid;
  gap: var(--module-gap);
}

.history-list > .history-item,
.history-list > .incident {
  margin: 0;
  padding: var(--card-padding);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
}

.timeline {
  list-style: none;
}

.timeline > li,
.timeline-item {
  min-width: 0;
  padding-block: var(--card-padding);
  border-block-start: 1px solid var(--color-border);
  overflow-wrap: anywhere;
}

.timeline > li:first-child,
.timeline-item:first-child {
  padding-block-start: 0.25rem;
  border-block-start: 0;
}

.facts {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  gap: 0.5rem 1rem;
  margin-block: 0;
}

.facts dt {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--color-muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

@media (min-width: 48rem) {
  .home-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-modules > .status-banner,
  .home-modules > .banner {
    grid-column: 1 / -1;
  }
}

@media (max-width: 32rem) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .facts dd {
    margin-block-end: 0.75rem;
  }
}

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

/* ─── Home component list: legend, icon-only OPERATIONAL, highlighted problems ─── */

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1rem;
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
}

.status-legend__item {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.375rem;
  overflow-wrap: anywhere;
}

.status-legend__icon {
  display: inline-flex;
  width: 1.375rem;
  height: 1.375rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--status-border, var(--color-border));
  border-radius: 50%;
  background: var(--status-accent, var(--color-surface-subtle));
  color: var(--status-badge-foreground, var(--color-text));
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
}

/* The stripe and its padding take 0.75rem; give it back from the name track so a
   320px viewport does not overflow the row. The selector must outrank `.components > li`. */
.components > .component-row--ok,
.components > .component-row--attention {
  grid-template-columns: minmax(7.5rem, 1fr) minmax(6rem, min(16rem, 42%));
}

.component-row--ok,
.component-row--attention {
  padding-inline-start: 0.5rem;
  border-inline-start: 0.25rem solid transparent;
}

.component-row--attention {
  border-inline-start-color: var(--status-border);
}

.component-row--attention > .component-name {
  font-weight: 700;
}

.component-row--ok > .status {
  position: relative;
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}

/* Visually hidden, still read by screen readers (status is never icon-only for them). */
.component-row--ok > .status > .status-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
