/* ============================================================
 * status.css — Public status page styling.
 * Scoped with `.st-` prefix so it never collides with app UI.
 * Relies on the main.css design tokens.
 * ============================================================ */

.st-page {
    min-height: 100vh;
    background: var(--color-bg);
    padding: var(--space-xl) var(--space-lg);
    box-sizing: border-box;
}

.st-header,
.st-banner,
.st-section,
.st-footer {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* The footer carries this class ONLY to pick up the reading width above.
   Its own styling — the centred layout, colour, links — is .site-footer in
   main.css, shared with every other surface in the product. */
.st-footer {
    padding-bottom: var(--space-lg);
    font-size: 0.8rem;
}

.st-header {
    margin-bottom: var(--space-xl);
}
/* Back link left, subscribe right. It wraps rather than shrinks: at 320px
   the two labels do not fit on one line, and the subscribe link dropping
   to its own row is better than either label truncating. */
.st-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    column-gap: var(--space-md);
    row-gap: 2px;
}
/* The Atom feed, which lived in the shared footer until 2026-08-27. The
   24px min-height is the WCAG 2.5.8 AA floor — the same reasoning as the
   footer's 32px, one step tighter because this is a single link on a line
   of its own rather than a wrapping row where lines sit under each other. */
.st-subscribe {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}
.st-subscribe:hover { text-decoration: underline; }
.st-subscribe-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.st-header .st-back {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}
.st-header .st-back:hover { text-decoration: underline; }
.st-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 4px 0 2px;
}
.st-header p {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 0.92rem;
}

/* ── Banner ───────────────────────────────────────────────── */
.st-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-lg) var(--space-lg);
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-xl);
}
.st-banner-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.15);
}
.st-banner-headline {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}
.st-banner-message {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}
.st-banner-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: right;
    white-space: nowrap;
}
.st-banner-meta time {
    display: block;
    color: var(--color-text);
    font-weight: 500;
}

/* state-tinted banners */
.st-banner-operational    .st-banner-dot { background: var(--color-success); box-shadow: 0 0 0 4px rgba(39,174,96,.15); }
.st-banner-degraded       .st-banner-dot { background: var(--color-warning); box-shadow: 0 0 0 4px rgba(230,126,34,.15); }
.st-banner-partial-outage .st-banner-dot { background: var(--color-warning); box-shadow: 0 0 0 4px rgba(230,126,34,.25); }
.st-banner-major-outage   .st-banner-dot { background: var(--color-danger);  box-shadow: 0 0 0 4px rgba(192,57,43,.20); }
.st-banner-maintenance    .st-banner-dot { background: #3b82f6;             box-shadow: 0 0 0 4px rgba(59,130,246,.20); }

/* ── Sections ────────────────────────────────────────────── */
.st-section { margin-bottom: var(--space-xl); }
.st-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--color-border);
}

/* ── Pills ──────────────────────────────────────────────── */
.st-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.6;
}
.status-pill-operational    { background: var(--color-success-bg); color: var(--color-success-text); border: 1px solid var(--color-success-border); }
.status-pill-degraded       { background: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid var(--color-warning-border); }
.status-pill-partial-outage { background: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid var(--color-warning-border); }
.status-pill-major-outage   { background: #fef2f2;                 color: #991b1b;                   border: 1px solid #fecaca; }
.status-pill-maintenance    { background: #eff6ff;                 color: #1e40af;                   border: 1px solid #bfdbfe; }

/* ── Components list ──────────────────────────────────────── */
/* Group heading above a component list. A database outage and a queue
   outage are not the same kind of event; the grouping says so before
   either happens. */
.st-group-title {
    margin: var(--space-lg) 0 var(--space-sm);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}
.st-group-title:first-of-type { margin-top: 0; }
.st-components + .st-group-title { margin-top: var(--space-lg); }

.st-components {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}
.st-component {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}
.st-component:last-child { border-bottom: none; }
.st-component-name { font-weight: 500; }

/* ── Incident cards ──────────────────────────────────────── */
.st-incident {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    border-left: 4px solid var(--color-warning);
}
.st-incident-major-outage   { border-left-color: var(--color-danger); }
.st-incident-partial-outage { border-left-color: var(--color-warning); }
.st-incident-degraded       { border-left-color: var(--color-warning); }
.st-incident-maintenance    { border-left-color: #3b82f6; }

.st-incident-head {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--space-sm);
}
.st-incident-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.st-incident-kind {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}
.st-incident-summary {
    margin: 0 0 var(--space-sm);
    color: var(--color-text);
    font-size: 0.92rem;
}
.st-incident-affected {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}
.st-incident-affected span { color: var(--color-text); }

/* ── Update feed ─────────────────────────────────────────── */
.st-update-feed {
    list-style: none;
    padding: 0;
    margin: var(--space-md) 0 0;
    border-top: 1px solid var(--color-border);
}
.st-update {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
}
.st-update:last-child { border-bottom: none; }
.st-update-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}
.st-update-meta strong { color: var(--color-text); }
.st-update-body {
    font-size: 0.88rem;
    color: var(--color-text);
    line-height: 1.5;
}

/* ── Maintenance ─────────────────────────────────────────── */
.st-maint {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: #fff;
    border: 1px solid var(--color-border);
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    margin-bottom: var(--space-sm);
}
.st-maint-when {
    font-size: 0.85rem;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.st-maint-when .st-arrow { color: var(--color-text-muted); }
.st-maint-title {
    font-weight: 600;
}
.st-maint-summary {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 0.88rem;
}

/* ── History ─────────────────────────────────────────────── */
.st-history {
    list-style: none;
    padding: 0;
    margin: 0;
}
.st-history {
    padding-bottom: var(--space-md);
}
.st-history-item {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: var(--space-md);
    align-items: start;
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--color-border);
}
.st-history-item:last-child { border-bottom: none; }
.st-history-date {
    font-size: 0.78rem;
    color: var(--color-text-light);
    line-height: 1.45;
    padding-top: 2px;
}
.st-history-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    font-weight: 500;
    line-height: 1.35;
    color: var(--color-text);
}
.st-resolved-tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-success-text);
    background: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.4;
}
.st-history-summary {
    margin-top: 6px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    line-height: 1.55;
    max-width: 72ch;
}

/* ── Footer ───────────────────────────────────────────────── */

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .st-page { padding: var(--space-lg) var(--space-md); }
    .st-header h1 { font-size: 1.3rem; }
    .st-banner {
        grid-template-columns: auto 1fr;
        gap: var(--space-sm) var(--space-md);
    }
    .st-banner-meta {
        grid-column: 1 / -1;
        text-align: left;
        border-top: 1px solid var(--color-border);
        padding-top: var(--space-sm);
    }
    .st-banner-meta time { display: inline; margin-left: 4px; }
    .st-maint { grid-template-columns: 1fr; }
    .st-history-item {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: var(--space-md) 0;
    }
    .st-history-date { font-size: 0.72rem; padding-top: 0; }
    .st-history-summary { max-width: 100%; }
}

/* ── Measured availability ────────────────────────────────── */
/* .st-component was a single flex row. It now stacks: the name/pill row
   keeps the old layout, and the uptime block (when there IS measured
   data) sits underneath. Components without a monitor render only the
   head row, so they look exactly as before. */
.st-component { display: block; }
.st-component-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

/* Plain-language line under the component name. Carries what a failure
   MEANS, so partial-vs-major is understood before anything breaks rather
   than only at the moment a pill changes colour. */
/* When monitoring saw it, as distinct from when someone wrote about it.
   The two are routinely minutes apart and the gap is the audit trail. */
.st-detected {
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.st-component-desc {
    margin-top: 3px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    max-width: 60ch;
}

.st-uptime { margin-top: var(--space-md); }

.st-bar {
    display: flex;
    gap: 2px;
    align-items: stretch;
    height: 30px;
}
.st-bar-cell {
    flex: 1 1 0;
    min-width: 2px;
    border-radius: 2px;
    background: var(--color-border);
}
.st-bar-major-outage { background: #ef4444; }
.st-bar-degraded     { background: #f59e0b; }
.st-bar-maintenance  { background: #93c5fd; }
.st-bar-operational  { background: #22c55e; }
/* No data is deliberately NOT green — an unmonitored day must never read
   as a good day. */
.st-bar-none         { background: #e5e7eb; }

.st-bar-axis {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}
.st-bar-headline { text-align: center; }
.st-axis-narrow { display: none; }
.st-bar-headline strong { color: var(--color-text); font-variant-numeric: tabular-nums; }

.st-uptime-grid {
    display: grid;
    /* Exactly four windows (availability_windows()), so the track count is
       fixed rather than auto-fit — auto-fit was materialising empty tracks
       and paying gap for them. */
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.st-uptime-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-sm) 0;
    border-top: 1px solid var(--color-border);
}
.st-uptime-pct {
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.st-uptime-label { font-size: 0.72rem; color: var(--color-text-muted); }
.st-uptime-cell-empty .st-uptime-pct { color: var(--color-text-muted); font-weight: 500; }

.st-uptime-collecting {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* A window the data does not yet cover: the figure is real, but it is not
   the period the label names. Muted, with the reason on hover. The
   asterisk + footnote this replaced made every number look authoritative
   while simultaneously disclaiming it; .st-uptime-meta states the
   coverage once instead. */
.st-uptime-cell-partial .st-uptime-pct { color: var(--color-text-muted); font-weight: 500; }
.st-uptime-cell-partial { cursor: help; }

/* Started monitoring / how much data is behind the figures. */
.st-uptime-meta {
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.st-uptime-downtime {
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.st-uptime-note {
    margin: var(--space-sm) 0 0;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

@media (max-width: 640px) {
    /* Show the most recent 30 cells only — 90 two-pixel slivers are not
       readable on a phone, and a squeezed bar reads as noise. */
    .st-bar-cell:nth-child(-n+60) { display: none; }
    .st-bar { height: 26px; }
    .st-axis-wide   { display: none; }
    .st-axis-narrow { display: inline; }
    .st-bar-axis .st-bar-headline { flex: 1 1 100%; order: -1; text-align: left; }
    .st-uptime-grid { grid-template-columns: repeat(2, 1fr); }
}
