/* ============================================================
   Service Status page (/status) — Data-Trust visual identity.

   Loaded AFTER tokens.css and site.css (via $page_extra_css in
   status.php), so:
     - All brand colors come from tokens.css.
     - Generic public-page chrome (.container, .section-eyebrow,
       .section-head, .lede, .btn, etc.) comes from site.css.

   Everything in this file is prefixed `.status-` so it can never
   collide with the rest of the marketing CSS or the authenticated
   app shell.

   Status-state colours are scoped here as new custom properties
   (not added to tokens.css) because they're meaningful to the
   /status page only and we want to keep the global token surface
   minimal.
   ============================================================ */

:root {
    --status-ok:    var(--color-brand-600);   /* operational — reuse brand teal */
    --status-warn:  #d97706;                  /* amber-600 — degraded */
    --status-down:  #dc2626;                  /* red-600   — outage */
    --status-maint: #64748b;                  /* slate-500 — maintenance */
}

/* ---------------------------------------------------------
   Layout shell
   --------------------------------------------------------- */
.status-main { padding-bottom: 96px; }
.status-main > section { padding: 32px 0; }
.status-main > section + section { padding-top: 0; }

/* The hero section needs a bit more top breathing room. */
.status-hero { padding-top: 80px !important; padding-bottom: 32px !important; text-align: center; }
.status-hero h1 {
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.1;
    letter-spacing: -.025em;
    font-weight: 700;
    margin: 8px 0 14px;
}
.status-hero .lede {
    margin: 0 auto 32px;
    max-width: 640px;
}

/* ---------------------------------------------------------
   1. Overall status banner
   --------------------------------------------------------- */
.status-banner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-full);
    background: var(--color-brand-50);
    border: 1px solid var(--color-brand-100);
    color: var(--color-brand-700);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
    flex-wrap: wrap;
}
.status-banner.is-warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.status-banner.is-down {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.status-banner.is-maint {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
.status-banner-dot {
    width: 10px; height: 10px;
    border-radius: var(--radius-full);
    background: var(--status-ok);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, .15);
    flex-shrink: 0;
}
.status-banner.is-warn  .status-banner-dot { background: var(--status-warn);  box-shadow: 0 0 0 4px rgba(217, 119, 6, .15); }
.status-banner.is-down  .status-banner-dot { background: var(--status-down);  box-shadow: 0 0 0 4px rgba(220, 38, 38, .18); }
.status-banner.is-maint .status-banner-dot { background: var(--status-maint); box-shadow: 0 0 0 4px rgba(100, 116, 139, .18); }

@media (prefers-reduced-motion: no-preference) {
    .status-banner-dot {
        animation: status-pulse 2.4s ease-in-out infinite;
    }
}
@keyframes status-pulse {
    0%, 100% { transform: scale(1);   opacity: 1;   }
    50%      { transform: scale(1.15); opacity: .85; }
}

.status-banner-icon  { display: inline-flex; }
.status-banner-icon svg { stroke: currentColor; }
.status-banner-label { font-size: 16px; }
.status-banner-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    padding-left: 12px;
    border-left: 1px solid currentColor;
    opacity: .75;
    font-weight: 500;
    font-size: 13px;
    font-family: var(--font-mono);
}
.status-banner-meta svg { stroke: currentColor; opacity: .85; }

/* ---------------------------------------------------------
   2. KPI strip + legend
   --------------------------------------------------------- */
.status-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.status-kpi {
    padding: 24px 28px;
    text-align: left;
    border-right: 1px solid var(--color-border);
}
.status-kpi:last-child { border-right: 0; }
.status-kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-fg-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.status-kpi-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--color-fg);
    letter-spacing: -.02em;
    font-feature-settings: "tnum";
}
.status-kpi-unit {
    font-size: 14px;
    color: var(--color-fg-muted);
    font-weight: 500;
    margin-left: 4px;
}

.status-legend {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 13px;
    color: var(--color-fg-muted);
}
.status-legend li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.status-legend-swatch {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 3px;
    background: var(--status-ok);
}
.status-legend .is-warn  .status-legend-swatch { background: var(--status-warn); }
.status-legend .is-down  .status-legend-swatch { background: var(--status-down); }
.status-legend .is-maint .status-legend-swatch { background: var(--status-maint); }

/* ---------------------------------------------------------
   3. Components list + 90-day history
   --------------------------------------------------------- */
.status-components-section { padding-top: 24px !important; }
.status-components {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: grid;
    gap: 16px;
}
.status-component {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px 16px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.status-component:hover { border-color: var(--color-border-2); box-shadow: var(--shadow); }

.status-component-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 14px;
    align-items: center;
}
.status-component-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    background: var(--color-brand-50);
    border: 1px solid var(--color-brand-100);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-brand-700);
}
.status-component-icon svg { stroke: currentColor; }
.status-component-name strong {
    display: block;
    color: var(--color-fg);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}
.status-component-name span {
    color: var(--color-fg-muted);
    font-size: 13px;
}

.status-component-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    border: 1px solid var(--color-brand-100);
    white-space: nowrap;
}
.status-component-pill svg { stroke: currentColor; }
.status-component.is-warn  .status-component-pill { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.status-component.is-down  .status-component-pill { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.status-component.is-maint .status-component-pill { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }

.status-history {
    display: grid;
    grid-template-columns: repeat(90, minmax(0, 1fr));
    gap: 2px;
    margin: 14px 0 6px;
}
.status-history-cell {
    display: block;
    height: 28px;
    border-radius: 2px;
    background: var(--status-ok);
    opacity: .85;
    transition: opacity .15s ease, transform .15s ease;
}
.status-history-cell:hover { opacity: 1; transform: scaleY(1.05); }
.status-history-cell.is-warn  { background: var(--status-warn); }
.status-history-cell.is-down  { background: var(--status-down); }
.status-history-cell.is-maint { background: var(--status-maint); }

.status-history-caption {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-fg-faint);
    font-weight: 600;
}

/* ---------------------------------------------------------
   4. Active / Past incidents + timeline
   --------------------------------------------------------- */
.status-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px;
    background: var(--color-brand-50);
    border: 1px solid var(--color-brand-100);
    border-radius: var(--radius-lg);
    color: var(--color-brand-700);
    font-weight: 500;
}
.status-empty p { margin: 0; }
.status-empty-icon { display: inline-flex; flex-shrink: 0; color: var(--color-brand-600); }
.status-empty-icon svg { stroke: currentColor; }

.status-incidents {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: grid;
    gap: 20px;
}
.status-incident {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--status-ok);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}
.status-incident.is-warn  { border-left-color: var(--status-warn); }
.status-incident.is-down  { border-left-color: var(--status-down); }
.status-incident.is-maint { border-left-color: var(--status-maint); }

.status-incident-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.status-incident h3 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--color-fg);
    margin: 0;
}
.status-incident-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    border: 1px solid var(--color-brand-100);
    white-space: nowrap;
}
.status-incident.is-maint .status-incident-pill {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
.status-incident-summary {
    color: var(--color-fg-muted);
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 10px;
}
.status-incident-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--color-fg-faint);
    font-size: 12px;
    font-family: var(--font-mono);
}

.status-incident-timeline {
    list-style: none;
    padding: 16px 0 0;
    margin: 16px 0 0;
    border-top: 1px dashed var(--color-border);
    display: grid;
    gap: 14px;
}
.status-incident-timeline > li {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
    align-items: start;
}
.status-incident-timeline time {
    color: var(--color-fg-faint);
    font-size: 12px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: 1px;
}
.status-incident-timeline p {
    color: var(--color-fg);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}

/* ---------------------------------------------------------
   Responsive tweaks
   --------------------------------------------------------- */
@media (max-width: 720px) {
    .status-kpis { grid-template-columns: 1fr; }
    .status-kpi { border-right: 0; border-bottom: 1px solid var(--color-border); }
    .status-kpi:last-child { border-bottom: 0; }

    .status-component-row {
        grid-template-columns: 36px 1fr;
    }
    .status-component-pill {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .status-history-cell { height: 22px; }

    .status-incident-timeline > li { grid-template-columns: 1fr; gap: 4px; }
}
