/* Uttu Status — käsin kirjoitettu tyylitiedosto, ei build-työkaluja. */

:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #131a2b;
    --muted: #5b6478;
    --line: rgb(19 26 43 / .1);
    --brand: #5b5bd6;
    --accent: #0ea5a5;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0ea5a5;
    --bar-none: #d4d8e3;
    --radius: 10px;
    --shadow: 0 1px 2px rgb(19 26 43 / .05), 0 4px 16px rgb(19 26 43 / .05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0e1a;
        --card: #141a2b;
        --text: #e7eaf3;
        --muted: #9aa3b8;
        --line: rgb(255 255 255 / .08);
        --brand: #8b8bf0;
        --bar-none: #2a3147;
        --shadow: none;
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Ylätunniste */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-muted { color: var(--brand); font-weight: 600; }
.brand-mark {
    width: .85rem;
    height: .85rem;
    border-radius: 30%;
    background: linear-gradient(135deg, var(--brand), var(--accent));
}

.site-nav { display: flex; gap: 1.1rem; }
.site-nav a { color: var(--muted); font-weight: 500; }
.site-nav a:hover { color: var(--brand); }

/* Kokonaistilan banneri */
.banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .7rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    color: #fff;
    margin-bottom: 1.5rem;
}
.banner--success { background: var(--success); }
.banner--warning { background: var(--warning); }
.banner--danger { background: var(--danger); }
.banner--info { background: var(--info); }

.banner-text { font-size: 1.15rem; font-weight: 700; margin: 0; }
.banner-dot {
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    background: rgb(255 255 255 / .9);
    flex: none;
}
.banner-updated {
    margin-left: auto;
    font-size: .8rem;
    opacity: .85;
}

/* Osiot ja kortit */
.section { margin-bottom: 1.5rem; }
.section-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin: 0 0 .7rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.2rem;
}

.group-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .4rem;
    color: var(--brand);
}

/* Palvelurivi */
.service { padding: .85rem 0; border-top: 1px solid var(--line); }
.service:first-of-type { border-top: 0; }

.service-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .45rem;
}
.service-title { font-weight: 600; }
.service-desc {
    display: block;
    font-size: .8rem;
    color: var(--muted);
}

.service-state {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}
.state-dot { width: .55rem; height: .55rem; border-radius: 50%; background: currentcolor; }
.state--success { color: var(--success); }
.state--warning { color: var(--warning); }
.state--danger { color: var(--danger); }
.state--info { color: var(--info); }

/* Uptime-palkisto: 90 palkkia, skaalautuu leveyden mukaan */
.uptime-bar {
    display: flex;
    gap: 2px;
    height: 34px;
}
.bar {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 2px;
    background: var(--bar-none);
}
.bar--ok { background: var(--success); }
.bar--warn { background: var(--warning); }
.bar--bad { background: var(--danger); }

.uptime-stats {
    display: flex;
    justify-content: flex-end;
    gap: 1.1rem;
    font-size: .8rem;
    color: var(--muted);
    margin-top: .4rem;
}
.uptime-stats strong { color: var(--text); font-weight: 600; }

/* Mobiilissa näytetään vain 45 viimeisintä palkkia */
@media (max-width: 560px) {
    .bar:nth-child(-n+45) { display: none; }
    .service-row { flex-direction: column; align-items: flex-start; gap: .2rem; }
    .banner-updated { margin-left: 0; flex-basis: 100%; }
}

/* Häiriöt ja huollot */
.incident {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.2rem;
    margin-bottom: .8rem;
}

.incident-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}
.incident-title { font-size: 1.02rem; margin: 0; margin-right: auto; }

.badge {
    font-size: .72rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 999px;
    color: #fff;
    white-space: nowrap;
}
.badge--success { background: var(--success); }
.badge--warning { background: var(--warning); }
.badge--danger { background: var(--danger); }
.badge--info { background: var(--info); }

.incident-meta {
    font-size: .8rem;
    color: var(--muted);
    margin: .35rem 0 0;
}
.incident-services { display: block; }

/* Päivitysten aikajana */
.timeline {
    list-style: none;
    margin: .9rem 0 0;
    padding: 0;
}
.timeline-item {
    position: relative;
    padding: 0 0 .9rem 1.15rem;
    border-left: 2px solid var(--line);
    margin-left: .3rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -6px;
    top: .3rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
}
.timeline-item--success::before { background: var(--success); }
.timeline-item--warning::before { background: var(--warning); }
.timeline-item--danger::before { background: var(--danger); }
.timeline-item--info::before { background: var(--info); }

.timeline-head {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    font-size: .85rem;
}
.timeline-head time { color: var(--muted); font-size: .78rem; }
.timeline-body { font-size: .9rem; }
.timeline-body p { margin: .25rem 0; }
.timeline-body a { color: var(--accent); }

/* Historia */
.page-title { font-size: 1.35rem; margin: .2rem 0 1.2rem; }
.empty-note { color: var(--muted); }

/* Alatunniste */
.site-footer {
    margin-top: 2.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
    font-size: .85rem;
    color: var(--muted);
    text-align: center;
}
.site-footer p { margin: .25rem 0; }
.footer-note { font-size: .78rem; }
