:root {
    color-scheme: light dark;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #eef2f8;
    --text: #152033;
    --muted: #657084;
    --line: rgba(44, 61, 88, 0.14);
    --line-strong: rgba(44, 61, 88, 0.24);
    --accent: #3f66d4;
    --accent-strong: #2d4fae;
    --accent-soft: rgba(63, 102, 212, 0.12);
    --success: #177a52;
    --warning: #9b6400;
    --danger: #a43b45;
    --shadow: 0 18px 48px rgba(28, 42, 69, 0.08);
    --radius: 16px;
    --radius-small: 10px;
    --shell: 1240px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f131b;
        --surface: #171d28;
        --surface-2: #202735;
        --text: #edf2fb;
        --muted: #a5afc0;
        --line: rgba(205, 219, 244, 0.11);
        --line-strong: rgba(205, 219, 244, 0.2);
        --accent: #86a5ff;
        --accent-strong: #aec0ff;
        --accent-soft: rgba(134, 165, 255, 0.13);
        --success: #70d7aa;
        --warning: #efc36d;
        --danger: #ff9aa4;
        --shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.58;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--accent-strong);
}

button,
input {
    font: inherit;
}

button,
a,
input,
summary {
    outline-offset: 4px;
}

:focus-visible {
    outline: 3px solid var(--accent);
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    line-height: 1.12;
    letter-spacing: -0.035em;
}

h1 {
    margin-bottom: 1rem;
    font-size: clamp(2.75rem, 7vw, 5.8rem);
    font-weight: 760;
}

h2 {
    margin-bottom: 0.65rem;
    font-size: clamp(1.8rem, 4vw, 2.9rem);
}

h3 {
    margin-bottom: 0.55rem;
    font-size: 1.2rem;
}

.shell {
    width: min(calc(100% - 2rem), var(--shell));
    margin-inline: auto;
}

.section {
    padding-block: clamp(3.5rem, 7vw, 6.5rem);
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    background: var(--text);
    color: var(--bg);
    transform: translateY(-180%);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-header {
    position: relative;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(16px);
}

.header-inner {
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    font-weight: 750;
    letter-spacing: -0.025em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.site-nav a {
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.91rem;
    font-weight: 650;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
    background: var(--surface-2);
    color: var(--text);
}

.nav-toggle {
    display: none;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.hero,
.detail-hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 78% 16%, var(--accent-soft), transparent 34%),
        linear-gradient(180deg, var(--surface), var(--bg));
}

.hero::after,
.detail-hero::after {
    position: absolute;
    right: -10rem;
    bottom: -18rem;
    width: 34rem;
    height: 34rem;
    border: 1px solid var(--line);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 610px;
    align-items: center;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
    gap: clamp(2rem, 7vw, 7rem);
    padding-block: clamp(5rem, 10vw, 8rem);
}

.eyebrow {
    margin-bottom: 0.85rem;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-copy {
    max-width: 720px;
    color: var(--muted);
    font-size: clamp(1.08rem, 2.1vw, 1.35rem);
}

.hero-actions,
.detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    margin-top: 2rem;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 720;
    text-decoration: none;
}

.button.primary {
    background: var(--accent);
    color: #fff;
}

.button.primary:hover {
    background: var(--accent-strong);
    color: #fff;
}

.button.secondary {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--text);
}

.collector-note {
    display: flex;
    gap: 1rem;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    box-shadow: var(--shadow);
}

.collector-note p {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    margin-top: 0.43rem;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 15%, transparent);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card,
.panel,
.empty-state {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 32px rgba(28, 42, 69, 0.035);
}

.metric-card {
    display: flex;
    min-height: 145px;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.35rem;
}

.metric-card span,
.metric-card small,
.panel-heading > span {
    color: var(--muted);
}

.metric-card > span {
    font-size: 0.82rem;
    font-weight: 760;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.metric-card strong {
    margin-block: 0.5rem 0.2rem;
    font-size: clamp(2rem, 4.5vw, 3.15rem);
    letter-spacing: -0.055em;
    line-height: 1;
}

.section-heading {
    max-width: 760px;
    margin-bottom: 2rem;
}

.section-heading p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.split-heading {
    display: flex;
    max-width: none;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
}

.search-field {
    width: min(100%, 360px);
}

.search-field input {
    width: 100%;
    min-height: 46px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}

.search-field input::placeholder {
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

td small,
td > span:not(.status),
.server-list small {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.network-name {
    display: inline-block;
    color: var(--text);
    font-weight: 760;
}

.status {
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.35;
    text-transform: uppercase;
}

.status-fresh {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.status-degraded,
.status-stale {
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
}

.status-pending {
    background: var(--surface-2);
    color: var(--muted);
}

.empty-state {
    padding: 2rem;
}

.empty-state code {
    display: inline-block;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: var(--surface-2);
}

.principles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    border-top: 1px solid var(--line);
}

.principles-grid article {
    position: relative;
    padding-top: 1rem;
}

.principles-grid p,
.quality-grid p {
    color: var(--muted);
}

.principle-number {
    display: block;
    margin-bottom: 1.25rem;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.detail-hero {
    padding-block: clamp(3.5rem, 7vw, 6.5rem);
}

.detail-hero h1 {
    font-size: clamp(2.8rem, 6vw, 5rem);
}

.back-link {
    display: inline-flex;
    margin-bottom: 2rem;
    color: var(--muted);
    font-weight: 650;
    text-decoration: none;
}

.detail-title-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
}

.detail-actions {
    justify-content: flex-end;
    margin: 0;
}

.detail-actions .status {
    margin-left: 0;
}

.snapshot-line {
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.detail-metrics {
    padding-bottom: 1rem;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 1rem;
}

.panel {
    min-width: 0;
    padding: 1.35rem;
}

.panel-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.panel-heading h2 {
    margin: 0;
    font-size: 1.55rem;
}

.panel-heading .eyebrow {
    margin-bottom: 0.35rem;
}

.trend-chart {
    min-height: 300px;
}

.trend-chart svg {
    width: 100%;
    min-height: 280px;
    overflow: visible;
}

.chart-grid {
    stroke: var(--line);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.chart-area {
    fill: var(--accent-soft);
}

.chart-dot {
    fill: var(--surface);
    stroke: var(--accent);
    stroke-width: 2;
}

.chart-label {
    fill: var(--muted);
    font: 12px ui-sans-serif, system-ui, sans-serif;
}

.definition-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
}

.definition-grid div {
    min-width: 0;
    padding: 0.9rem;
    border-radius: 10px;
    background: var(--surface-2);
}

.definition-grid dt {
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 760;
    text-transform: uppercase;
}

.definition-grid dd {
    overflow-wrap: anywhere;
    margin: 0.25rem 0 0;
    font-weight: 700;
}

details {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

summary {
    cursor: pointer;
    font-weight: 700;
}

.evidence-list {
    padding-left: 1.2rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.server-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
    gap: 1rem;
}

.world-map {
    position: relative;
    display: grid;
    min-height: 440px;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at center, var(--accent-soft), transparent 66%),
        var(--surface);
}

.world-map svg {
    width: 100%;
}

.map-land {
    fill: var(--surface-2);
    stroke: var(--line-strong);
    stroke-width: 2;
}

.map-point-halo {
    fill: var(--accent-soft);
}

.map-point {
    fill: var(--accent);
    stroke: var(--surface);
    stroke-width: 2;
}

.map-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 2rem;
    color: var(--muted);
    text-align: center;
}

.server-list {
    max-height: 440px;
    overflow: auto;
}

.server-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.server-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.server-list li:first-child {
    padding-top: 0;
}

.server-list li:last-child {
    border-bottom: 0;
}

.server-list li > span {
    flex: 0 0 36%;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: right;
}

.topic-text {
    display: block;
    max-width: 680px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-note,
.filter-empty {
    margin-top: 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.data-quality {
    display: grid;
    grid-template-columns: minmax(240px, 0.45fr) minmax(0, 1fr);
    gap: 3rem;
    border-top: 1px solid var(--line);
}

.quality-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.5fr) minmax(180px, 0.5fr);
    gap: 3rem;
    padding-block: 3.5rem;
}

.footer-brand {
    margin-bottom: 1rem;
}

.footer-grid p {
    max-width: 580px;
    color: var(--muted);
}

.footer-grid nav,
.footer-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

.footer-grid nav a,
.footer-meta span {
    color: var(--muted);
    font-size: 0.9rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

[hidden] {
    display: none !important;
}

@media (max-width: 980px) {
    .nav-toggle {
        display: inline-flex;
    }

    .site-nav {
        position: absolute;
        top: calc(100% + 1px);
        right: 1rem;
        left: 1rem;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 0.7rem;
        border: 1px solid var(--line);
        border-radius: 0 0 var(--radius) var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    .site-nav.is-open {
        display: flex;
    }

    .hero-grid,
    .two-column,
    .server-layout {
        grid-template-columns: 1fr;
    }

    .hero-grid {
        min-height: auto;
    }

    .collector-note {
        max-width: 620px;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quality-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(calc(100% - 1.25rem), var(--shell));
    }

    .section {
        padding-block: 3.5rem;
    }

    .header-inner {
        min-height: 66px;
    }

    .hero-grid {
        padding-block: 4.5rem;
    }

    .metric-grid,
    .principles-grid,
    .data-quality,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 125px;
    }

    .split-heading,
    .detail-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-actions {
        justify-content: flex-start;
    }

    .search-field {
        width: 100%;
    }

    .network-table-wrap,
    .channel-table {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .network-table thead,
    .channel-table thead {
        display: none;
    }

    .network-table,
    .network-table tbody,
    .network-table tr,
    .network-table td,
    .channel-table,
    .channel-table tbody,
    .channel-table tr,
    .channel-table td {
        display: block;
        width: 100%;
    }

    .network-table tr,
    .channel-table tr {
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.9rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-small);
        background: var(--surface);
    }

    .network-table td,
    .channel-table td {
        display: grid;
        grid-template-columns: minmax(92px, 0.38fr) minmax(0, 0.62fr);
        gap: 1rem;
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--line);
        overflow-wrap: anywhere;
    }

    .network-table td:last-child,
    .channel-table td:last-child {
        border-bottom: 0;
    }

    .network-table td::before,
    .channel-table td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .topic-text {
        white-space: normal;
    }

    .definition-grid {
        grid-template-columns: 1fr;
    }

    .world-map {
        min-height: 280px;
    }

    .server-list {
        max-height: none;
    }

    .footer-grid {
        gap: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
