/* ==================================================
   STATUS PAGE
   Our own front-end over the HetrixTools API, so the
   status page looks like the rest of Callisto instead
   of like a third-party embed.
================================================== */

.status-page {
    /* Status colours are reserved: they only ever mean state, never decoration,
       and every use is paired with a written label so colour is never the only
       channel carrying the meaning. These match the online/offline/restarting
       dots the Aurora app icons already use. */
    --st-good: #22c55e;
    --st-warn: #f59e0b;
    --st-bad: #ff6b6b;
    --st-none: rgba(255, 255, 255, 0.11);

    /* Single series charts use the brand purple; the one two-series chart
       (bandwidth) pairs it with the teal accent, which is far enough away in
       hue to survive colour blindness, and both are direct-labelled anyway. */
    --st-chart-1: #ba72f1;
    --st-chart-2: #4ecdc4;

    --st-surface: rgba(255, 255, 255, 0.035);
    --st-surface-hover: rgba(255, 255, 255, 0.055);
    --st-line: rgba(255, 255, 255, 0.08);
    --st-ink-2: rgba(255, 255, 255, 0.62);
    --st-ink-3: rgba(255, 255, 255, 0.4);
}

/* ── Hero ───────────────────────────────────────── */

.status-hero {
    position: relative;
    padding: 9rem 0 2.25rem;
    overflow: hidden;
}

/* One large, quiet watermark rather than a scatter of little decorative
   glyphs. Sits behind everything and is never read out. */
.status-hero-mark {
    position: absolute;
    top: 50%;
    right: max(2rem, calc((100vw - 1200px) / 2 + 2rem));
    transform: translateY(-46%) rotate(-12deg);
    font-size: clamp(8rem, 15vw, 13rem);
    line-height: 1;
    color: #fff;
    opacity: 0.045;
    pointer-events: none;
    user-select: none;
}

/* Below this it starts crowding the headline, and it earns nothing there. */
@media (max-width: 900px) {
    .status-hero-mark { display: none; }
}

.status-hero .container {
    position: relative;
    z-index: 1;
}

.status-headline {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 0.9rem;
}

.status-beacon {
    position: relative;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--st-none);
}

.status-beacon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: status-beacon-ring 2.4s ease-out infinite;
}

@keyframes status-beacon-ring {
    0%   { transform: scale(1);   opacity: 0.55; }
    70%  { transform: scale(2.6); opacity: 0; }
    100% { transform: scale(2.6); opacity: 0; }
}

.status-hero h1 {
    font-size: clamp(1.9rem, 4.6vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
}

.status-hero .status-lede {
    max-width: 46ch;
    color: var(--st-ink-2);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.status-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--st-ink-3);
}

.status-refresh {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--st-line);
    background: var(--st-surface);
    color: inherit;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.status-refresh:hover:not(:disabled) {
    background: rgba(169, 73, 243, 0.12);
    border-color: rgba(169, 73, 243, 0.4);
    color: #fff;
}

.status-refresh:disabled { opacity: 0.5; cursor: default; }
.status-refresh.is-busy i { animation: spin 0.8s linear infinite; }

/* Colour the hero by overall state. */
.status-page[data-state="operational"]   .status-beacon { background: var(--st-good); }
.status-page[data-state="maintenance"]   .status-beacon { background: var(--st-warn); }
.status-page[data-state="partial_outage"] .status-beacon { background: var(--st-warn); }
.status-page[data-state="major_outage"]  .status-beacon { background: var(--st-bad); }

/* ── Summary tiles ──────────────────────────────── */

.status-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2.25rem;
}

.status-tile {
    padding: 1rem 1.2rem;
    border: 1px solid var(--st-line);
    border-radius: 14px;
    background: var(--st-surface);
}

.status-tile-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--st-ink-3);
    margin-bottom: 0.55rem;
}

.status-tile-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.status-tile-value small {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--st-ink-3);
    margin-left: 0.15rem;
}

.status-tile-note {
    font-size: 0.78rem;
    color: var(--st-ink-3);
    margin-top: 0.35rem;
}

/* ── Group headings ─────────────────────────────── */

.status-group { margin-bottom: 2rem; }

.status-group-head {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.status-group-head h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--st-ink-2);
    white-space: nowrap;
}

.status-group-head p {
    font-size: 0.82rem;
    color: var(--st-ink-3);
    margin: 0;
}

.status-group-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--st-line);
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── The systems list ───────────────────────────── */

/* Collapsed, a row says only what a status page needs to say: what it is,
   where it is, whether it is up, and its history. Everything else lives
   behind the chevron. */
.st-table {
    border: 1px solid var(--st-line);
    border-radius: 14px;
    background: var(--st-surface);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.st-row + .st-row { border-top: 1px solid var(--st-line); }
.st-row[data-status="down"] { background: rgba(255, 107, 107, 0.05); }
.st-row[data-status="maintenance"] { background: rgba(245, 158, 11, 0.04); }

.st-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0 1.1rem;
    width: 100%;
    padding: 1rem 1.3rem 0.75rem;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
}

button.st-head { cursor: pointer; }
button.st-head:hover { background: var(--st-surface-hover); }
button.st-head:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.st-row .app-icon {
    --icon-size: 38px;
    --icon-radius: 11px;
    --icon-font-size: 17px;
}

.st-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.st-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--st-ink-3);
    margin-top: 0.1rem;
}

.st-sub .st-sep { opacity: 0.45; }
.st-flag { font-size: 0.85rem; line-height: 1; }

.st-state {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.83rem;
    font-weight: 600;
    white-space: nowrap;
}

.st-state i { font-size: 0.75rem; }

.st-row[data-status="up"] .st-state { color: var(--st-good); }
.st-row[data-status="down"] .st-state { color: var(--st-bad); }
.st-row[data-status="maintenance"] .st-state { color: var(--st-warn); }
.st-row[data-status="paused"] .st-state { color: var(--st-ink-3); }

.st-caret {
    color: var(--st-ink-3);
    transition: transform 0.25s ease, color 0.2s;
    font-size: 0.8rem;
}

.st-head[aria-expanded="true"] .st-caret {
    transform: rotate(180deg);
    color: #fff;
}

/* ── Uptime strip ───────────────────────────────── */

.st-strip-wrap { padding: 0 1.3rem 1.1rem; }

.st-strip {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 34px;
}

.st-bar {
    flex: 1 1 0;
    min-width: 2px;
    border-radius: 2px;
    background: var(--st-none);
    transition: transform 0.15s ease, filter 0.15s ease;
    transform-origin: center;
}

.st-bar[data-day="good"] { background: var(--st-good); }
.st-bar[data-day="warn"] { background: var(--st-warn); }
.st-bar[data-day="bad"]  { background: var(--st-bad); }

.st-bar:hover {
    transform: scaleX(1.8);
    filter: brightness(1.3);
}

.st-scale {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.7rem;
    color: var(--st-ink-3);
    margin-top: 0.5rem;
}

.st-scale-figure {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--st-ink-2);
}

/* ── Expanded detail ────────────────────────────── */

.st-detail {
    border-top: 1px solid var(--st-line);
    padding: 1.3rem 1.2rem;
    background: rgba(0, 0, 0, 0.14);
}

/* Beszel's system header: the current numbers, then the charts behind them. */
.st-readings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem 1.5rem;
    padding-bottom: 1.3rem;
    margin-bottom: 1.3rem;
    border-bottom: 1px solid var(--st-line);
}

.st-reading-label {
    display: block;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--st-ink-3);
    margin-bottom: 0.3rem;
}

.st-reading-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.st-reading-value i {
    font-style: normal;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--st-ink-3);
    margin-left: 1px;
}

.st-reading-bar {
    display: block;
    height: 4px;
    margin-top: 0.5rem;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.09);
    overflow: hidden;
}

.st-reading-bar i {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--st-chart-1);
}

.st-reading-bar i[data-level="warn"] { background: var(--st-warn); }
.st-reading-bar i[data-level="bad"] { background: var(--st-bad); }

.st-reading--net .st-reading-value {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.5;
}

.st-reading--net .st-reading-value i {
    font-size: 0.62rem;
    margin-right: 0.4rem;
    opacity: 0.55;
}

.st-detail-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--st-ink-3);
    margin-bottom: 0.7rem;
}

/* ── Charts ─────────────────────────────────────── */

.st-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.4rem 1.6rem;
    margin-bottom: 1.5rem;
}

.st-chart { margin: 0; }

.st-chart figcaption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.st-chart-title {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.st-plot-key {
    display: inline-flex;
    gap: 0.7rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--st-ink-3);
}

.st-plot-key span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.st-plot-key i {
    width: 7px;
    height: 7px;
    border-radius: 2px;
}

.st-chart-read {
    font-size: 0.76rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--st-ink-2);
    white-space: nowrap;
}

.st-chart-body {
    display: flex;
    gap: 0.6rem;
}

/* Axis labels live in HTML so the plot itself can stretch without distorting
   any text. */
.st-chart-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    height: 80px;
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1;
    flex-shrink: 0;
    min-width: 3.4rem;
}

.st-plot {
    flex: 1 1 auto;
    min-width: 0;
    height: 80px;
    overflow: visible;
    cursor: crosshair;
    border-left: 1px solid var(--st-line);
    border-bottom: 1px solid var(--st-line);
}

.st-plot-grid {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.st-plot-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.st-plot-area { stroke: none; }

.st-plot-cursor {
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
    opacity: 0;
}

.st-plot-dot {
    stroke: #14141a;
    stroke-width: 2;
    opacity: 0;
}

.st-plot:hover .st-plot-cursor,
.st-plot:hover .st-plot-dot { opacity: 1; }

.st-chart-foot {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 0.35rem;
    padding-left: 4rem;
}

/* ── Specs ──────────────────────────────────────── */

.st-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.9rem 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--st-line);
}

.st-spec dt {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--st-ink-3);
    margin-bottom: 0.15rem;
}

.st-spec dd {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* ── Checking locations ─────────────────────────── */

.st-locs {
    padding-top: 1.2rem;
    margin-top: 1.2rem;
    border-top: 1px solid var(--st-line);
}

.st-loc-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem 1.4rem;
}

.st-loc {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.83rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.st-loc-name {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    color: var(--st-ink-2);
}

.st-loc-name i { font-size: 0.42rem; position: relative; top: -0.2em; }
.st-loc[data-state="up"] i { color: var(--st-good); }
.st-loc[data-state="down"] i { color: var(--st-bad); }

.st-loc-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.8rem;
}

/* ── Monitored services ─────────────────────────── */

.st-services {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.3rem;
    padding-top: 1.2rem;
    margin-top: 1.2rem;
    border-top: 1px solid var(--st-line);
}

.st-service {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--st-ink-2);
}

.st-service i { font-size: 0.5rem; }
.st-service[data-state="online"] i { color: var(--st-good); }
.st-service[data-state="offline"] i { color: var(--st-bad); }

.st-detail-empty {
    font-size: 0.85rem;
    color: var(--st-ink-3);
}

.st-detail-warn {
    color: var(--st-ink-2);
    padding: 0.85rem 1rem;
    margin-bottom: 1.2rem;
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.06);
    line-height: 1.6;
}

.st-detail-warn i { color: var(--st-warn); }

/* ── Incidents ──────────────────────────────────── */

.status-incidents { margin-bottom: 2rem; }

.status-incident {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--st-line);
    border-radius: 12px;
    background: var(--st-surface);
    margin-bottom: 0.6rem;
}

.status-incident-date {
    font-size: 0.78rem;
    color: var(--st-ink-3);
    min-width: 5.5rem;
    font-variant-numeric: tabular-nums;
}

.status-incident-name { font-size: 0.9rem; font-weight: 600; flex: 1; }

.status-incident-detail {
    font-size: 0.8rem;
    color: var(--st-ink-3);
    text-align: right;
    white-space: nowrap;
}

.status-incident-detail b {
    color: #fff;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.status-incident-detail span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.75;
}

/* Sets expectations before the list rather than after it. */
.status-note {
    max-width: 74ch;
    margin-bottom: 1rem;
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--st-ink-3);
}

.status-clear {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.15rem 1.3rem;
    border: 1px solid rgba(34, 197, 94, 0.22);
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.06);
    font-size: 0.92rem;
    color: var(--st-ink-2);
}

.status-clear i { color: var(--st-good); }

/* ── Legend + footer note ───────────────────────── */

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--st-line);
    font-size: 0.8rem;
    color: var(--st-ink-3);
}

.status-legend-key {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-key-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--st-none);
}

.status-key-swatch[data-day="good"] { background: var(--st-good); }
.status-key-swatch[data-day="warn"] { background: var(--st-warn); }
.status-key-swatch[data-day="bad"]  { background: var(--st-bad); }

.status-cta {
    text-align: center;
    padding: 3.5rem 0 1rem;
}

.status-cta p {
    color: var(--st-ink-3);
    margin-bottom: 1.25rem;
}

.status-cta .btn + .btn { margin-left: 0.75rem; }

.status-source {
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.32);
    padding-bottom: 3rem;
}

.status-source a { color: inherit; }

/* ── Tooltip ────────────────────────────────────── */

.status-tooltip {
    position: fixed;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%);
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(18, 18, 24, 0.96);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    font-size: 0.76rem;
    line-height: 1.5;
    white-space: nowrap;
    transition: opacity 0.12s ease;
}

.status-tooltip.is-visible { opacity: 1; }
.status-tooltip b { display: block; font-size: 0.8rem; }
.status-tooltip span { color: var(--st-ink-3); }

/* ── Loading / error ────────────────────────────── */

.status-skeleton {
    height: 96px;
    border: 1px solid var(--st-line);
    border-radius: 14px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.07) 37%,
        rgba(255, 255, 255, 0.03) 63%);
    background-size: 400% 100%;
    animation: status-shimmer 1.4s ease infinite;
    margin-bottom: 0.75rem;
}

@keyframes status-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.status-notice {
    text-align: center;
    padding: 3.5rem 2rem;
    border: 1px solid var(--st-line);
    border-radius: 16px;
    background: var(--st-surface);
}

.status-notice i {
    font-size: 2rem;
    color: var(--st-ink-3);
    margin-bottom: 1rem;
    display: block;
}

.status-notice h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.status-notice p { color: var(--st-ink-3); max-width: 44ch; margin: 0 auto 1.25rem; }

.status-enter {
    animation: status-enter 0.45s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

@keyframes status-enter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 900px) {
    .st-chart-axis { min-width: 3rem; }
    .st-chart-foot { padding-left: 3.6rem; }
}

@media (max-width: 640px) {
    .st-head {
        grid-template-columns: auto minmax(0, 1fr) auto;
        row-gap: 0.6rem;
        padding: 0.9rem 1.1rem 0.7rem;
    }
    .st-state { grid-column: 2 / -1; }
    .st-strip-wrap { padding: 0 1.1rem 1rem; }
    .st-strip { gap: 1px; height: 30px; }
    .st-scale { font-size: 0.65rem; }
    /* 90 hairlines plus a figure will not fit; the figure moves under them. */
    .st-scale { flex-wrap: wrap; gap: 0.2rem 0.5rem; }
    .st-scale-figure { order: 3; flex: 1 1 100%; }
    .status-incident { flex-wrap: wrap; gap: 0.35rem 1rem; }
    .status-incident-name { flex: 1 1 100%; order: -1; }
    .status-incident-detail { text-align: left; }
    .st-charts { grid-template-columns: minmax(0, 1fr); }
    .status-hero { padding-top: 7.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .status-beacon::after,
    .status-skeleton,
    .status-enter,
    .status-refresh.is-busy i { animation: none; }
    .st-bar { transition: none; }
}
