/* ── Reset & Tokens ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

:root {
    --surface-black: #09090b;
    --surface-dark: #0f0f12;
    --surface-dark-raised: #16161a;
    --surface-dark-border: #232329;
    --surface-light: #f7f7f8;
    --surface-light-raised: #ffffff;
    --surface-light-subtle: #eeeff1;

    --text-primary: #f0f0f2;
    --text-secondary: #9394a1;
    --text-tertiary: #5e5f6e;
    --text-on-light: #131316;
    --text-on-light-secondary: #5e5f6e;
    --text-on-light-tertiary: #9394a1;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-muted: #1e3a5f;
    --accent-glow: rgba(59, 130, 246, 0.15);

    --green: #22c55e;
    --green-muted: rgba(34, 197, 94, 0.12);
    --green-border: rgba(34, 197, 94, 0.25);
    --red: #ef4444;
    --red-muted: rgba(239, 68, 68, 0.12);
    --red-border: rgba(239, 68, 68, 0.25);
    --yellow: #eab308;
    --yellow-muted: rgba(234, 179, 8, 0.12);
    --yellow-border: rgba(234, 179, 8, 0.25);

    --font-display: 'DM Sans', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --max-width: 720px;
    --content-padding: 1.5rem;
}

body {
    font-family: var(--font-body);
    background: var(--surface-black);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.01em;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::selection {
    background: var(--accent);
    color: white;
}

/* ── Layout ── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--content-padding);
}

/* ── Header ── */
.site-header {
    padding: 1rem 0;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--surface-dark-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo img {
    height: 28px;
    width: auto;
}

.header-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--surface-dark-border);
    border-radius: var(--radius-sm);
}

/* ── Main ── */
main {
    flex: 1;
    padding: 3rem 0 4rem;
}

/* ── Status Banner ── */
.status-banner {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2.5rem;
    border: 1px solid;
    transition: all 0.4s var(--ease-out);
}

.status-banner.operational {
    background: var(--green-muted);
    border-color: var(--green-border);
}

.status-banner.degraded {
    background: var(--yellow-muted);
    border-color: var(--yellow-border);
}

.status-banner.down {
    background: var(--red-muted);
    border-color: var(--red-border);
}

.status-banner.unknown {
    background: var(--surface-dark-raised);
    border-color: var(--surface-dark-border);
}

.status-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

.status-pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    opacity: 0.4;
    animation: pulse 2s var(--ease-out) infinite;
}

.operational .status-pulse { background: var(--green); }
.operational .status-pulse::after { background: var(--green); }
.degraded .status-pulse { background: var(--yellow); }
.degraded .status-pulse::after { background: var(--yellow); }
.down .status-pulse { background: var(--red); }
.down .status-pulse::after { background: var(--red); }
.unknown .status-pulse { background: var(--text-tertiary); }
.unknown .status-pulse::after { background: var(--text-tertiary); }

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.8); opacity: 0; }
}

.status-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.operational .status-text { color: var(--green); }
.degraded .status-text { color: var(--yellow); }
.down .status-text { color: var(--red); }
.unknown .status-text { color: var(--text-secondary); }

/* ── Service Card ── */
.service-card {
    background: var(--surface-dark);
    border: 1px solid var(--surface-dark-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.service-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.service-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.service-status-pill {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.service-status-pill.ok {
    background: var(--green-muted);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.service-status-pill.degraded {
    background: var(--yellow-muted);
    color: var(--yellow);
    border: 1px solid var(--yellow-border);
}

.service-status-pill.down {
    background: var(--red-muted);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.service-status-pill.unknown {
    background: var(--surface-dark-raised);
    color: var(--text-secondary);
    border: 1px solid var(--surface-dark-border);
}

.service + .service {
    margin-top: 3rem;
}

.service-error,
.service-note {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.service-note {
    margin: -0.5rem 0 1rem;
}

/* ── Uptime Bars ── */
.uptime-section {
    margin-bottom: 0.75rem;
}

.uptime-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 32px;
}

.uptime-bar {
    flex: 1;
    height: 100%;
    border-radius: 2px;
    min-width: 2px;
    transition: opacity 0.15s;
    position: relative;
    cursor: default;
}

.uptime-bar.ok { background: var(--green); opacity: 0.7; }
.uptime-bar.ok:hover { opacity: 1; }
.uptime-bar.degraded { background: var(--yellow); opacity: 0.85; }
.uptime-bar.degraded:hover { opacity: 1; }
.uptime-bar.fail { background: var(--red); opacity: 0.85; }
.uptime-bar.fail:hover { opacity: 1; }
.uptime-bar.empty { background: var(--surface-dark-border); opacity: 0.4; }

/* Tooltip */
.uptime-bar .bar-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-dark-raised);
    border: 1px solid var(--surface-dark-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.uptime-bar:hover .bar-tooltip {
    display: block;
}

.bar-tooltip-date {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.bar-tooltip-uptime {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
}

.bar-tooltip-uptime.ok { color: var(--green); }
.bar-tooltip-uptime.degraded { color: var(--yellow); }
.bar-tooltip-uptime.fail { color: var(--red); }

.uptime-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.uptime-range {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.uptime-percent {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ── Stats Row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2.5rem;
}

.stat-card {
    background: var(--surface-dark);
    border: 1px solid var(--surface-dark-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.125rem;
}

.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red { color: var(--red); }
.stat-value.neutral { color: var(--text-primary); }

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Last Updated ── */
.last-updated {
    text-align: center;
    margin-top: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

.last-updated span {
    color: var(--text-secondary);
}

/* ── Footer ── */
.site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--surface-dark-border);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.footer-link {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: color 0.15s;
}

.footer-link:hover {
    color: var(--text-secondary);
}

/* ── Loading ── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    gap: 1rem;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--surface-dark-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ── Error ── */
.error-state {
    text-align: center;
    padding: 3rem 0;
}

.error-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.retry-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.retry-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

/* ── Animations ── */
.fade-in {
    animation: fadeIn 0.5s var(--ease-out) both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    :root {
        --content-padding: 1rem;
    }
    main { padding: 2rem 0 3rem; }
    .stats-row { grid-template-columns: 1fr; gap: 0.75rem; }
    .footer-inner { flex-direction: column; gap: 0.75rem; text-align: center; }
}
