/**
 * status.streamurl.link - status page
 * Same visual language as streamurl.link (style.css / stats.css):
 * dark ground, green primary, system font stack, card surfaces.
 * streamurl.link is dark-only by design, so this page is too.
 */

:root {
    --primary: #198754;
    --primary-bright: #22c55e;
    --bg: #0c0c0c;
    --card: #1c1c24;
    --border: #262626;
    --border-soft: #2a2a2a;
    --text: #ffffff;
    --muted: #888888;
    --faint: #555555;
    --warn: #f59e0b;
    --down: #ef4444;
    --none: #2a2a2a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: dark; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.5;
}

a:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 3px; border-radius: 0.25rem; }

.page { min-height: 100dvh; display: flex; flex-direction: column; }

/* Header (as streamurl.link .header / .logo) */
.header {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #222;
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); text-decoration: none; }
.logo-highlight { color: var(--primary); }
.header-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--border-soft);
    border-radius: 2rem;
    padding: 0.15rem 0.6rem;
}

.content {
    flex: 1 0 auto;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
}

/* Overall state */
.state {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
}
.state-dot {
    width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
    background: var(--faint);
}
.state--ok   { border-color: rgba(34, 197, 94, 0.35); }
.state--ok   .state-dot { background: var(--primary-bright); box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.15); }
.state--down { border-color: rgba(239, 68, 68, 0.5); }
.state--down .state-dot { background: var(--down); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18); }

.state-text { flex: 1; min-width: 0; }
.state-text h1 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.state-text p { color: var(--muted); font-size: 0.875rem; margin-top: 0.125rem; }

/* Sections (as stats.css .stats-heading) */
.block { display: flex; flex-direction: column; gap: 0.875rem; }
.block-head h2 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
.block-head p { color: var(--muted); font-size: 0.875rem; margin-top: 0.125rem; }
.empty { color: var(--faint); font-size: 0.9rem; }

.pill {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.pill--ok       { background: rgba(34, 197, 94, 0.15); color: var(--primary-bright); }
.pill--down     { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.pill--resolved,
.pill--unknown  { background: #26262e; color: var(--muted); }

/* Components (station-card surface) */
.components, .incidents { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.component {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}
.component-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.component-name { display: flex; flex-direction: column; min-width: 0; }
.component-name strong { font-weight: 600; }
.component-name span { color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }

/* 90-day bars (inside each component) */
.days {
    display: grid;
    grid-template-columns: repeat(90, minmax(0, 1fr));
    gap: 2px;
    height: 30px;
}
.day { border-radius: 2px; background: var(--none); }
.day--ok   { background: var(--primary); }
.day--warn { background: var(--warn); }
.day--down { background: var(--down); }
.days-axis {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}
.days-axis span:nth-child(2) { color: var(--muted); }

/* Response time chart */
.chart {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1rem 0.5rem 0.5rem;
}
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: #2c2c36; stroke-width: 1; }
.chart .fail { stroke: rgba(239, 68, 68, 0.55); stroke-width: 2; }
.chart .line { fill: none; stroke: var(--primary-bright); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot  { fill: var(--primary-bright); stroke: var(--card); stroke-width: 2; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: inherit; }

/* Incidents */
.incident {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
}
.incident .pill { margin-top: 0.15rem; }
.incident-text { display: flex; flex-direction: column; min-width: 0; }
.incident-when { font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.incident-cause { font-size: 0.8125rem; color: var(--muted); }

footer { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.8125rem; }

@media (max-width: 640px) {
    .header { padding: 1rem; }
    .content { padding: 1.5rem 1rem; gap: 1.75rem; }
    .state { padding: 1rem; }
    .state-text h1 { font-size: 1.2rem; }
    .component { padding: 0.875rem 1rem; }
    /* All 90 days stay visible: thinner gaps instead of fewer bars */
    .days { gap: 1px; height: 26px; }
    .day { border-radius: 1px; }
    /* The chart scales down with the viewport; keep its labels readable */
    .chart { padding: 0.75rem 0.75rem 0.25rem 0.25rem; }
    .chart .axis { font-size: 24px; }
}
