:root {
    --bg-base: #081124;
    --bg-card: rgba(9, 14, 26, 0.84);
    --bg-card-strong: rgba(8, 12, 22, 0.92);
    --bg-chip: rgba(15, 23, 42, 0.74);
    --stroke: rgba(94, 114, 143, 0.34);
    --stroke-strong: rgba(130, 156, 194, 0.44);
    --text-main: #f2f7ff;
    --text-soft: #bcc7dd;
    --text-muted: #8896b0;
    --brand-blue: #7dd3fc;
    --brand-cyan: #22d3ee;
    --brand-green: #34d399;
    --brand-violet: #a78bfa;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-pill: 999px;
    --shadow-soft: 0 22px 72px rgba(1, 5, 14, 0.62);
    --scroll-ratio: 0;
    --hub-gutter: clamp(108px, 10.5vw, 148px);
}

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

html,
body {
    min-height: 100%;
}

body {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    padding: 28px 16px 44px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 8;
    opacity: 0;
    background:
        radial-gradient(circle at 50% 12%, rgba(125, 211, 252, 0.26), transparent 42%),
        radial-gradient(circle at 72% 18%, rgba(52, 211, 153, 0.16), transparent 45%);
    transition: opacity 0.38s ease;
}

body.hub-jump::after {
    opacity: 1;
}

/* Dynamic network background */

.network-bg {
    position: fixed;
    inset: 0;
    z-index: -3;
    overflow: hidden;
    background:
        radial-gradient(circle at 8% 4%, rgba(34, 211, 238, 0.4), transparent 52%),
        radial-gradient(circle at 86% 2%, rgba(52, 211, 153, 0.34), transparent 48%),
        radial-gradient(circle at 55% 100%, rgba(99, 102, 241, 0.38), transparent 56%),
        var(--bg-base);
}

.network-bg::before {
    content: "";
    position: absolute;
    inset: -8%;
    background-image:
        linear-gradient(rgba(26, 37, 57, 0.22) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 37, 57, 0.2) 1px, transparent 1px);
    background-size: 34px 34px, 34px 34px;
    opacity: 0.55;
    transform: translate3d(0, calc(var(--scroll-ratio) * -24px), 0);
    animation: grid-drift 28s linear infinite;
}

.network-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% -16%, rgba(9, 14, 26, 0), rgba(5, 8, 16, 0.6) 68%),
        radial-gradient(circle at 50% 120%, rgba(9, 14, 26, 0), rgba(5, 8, 16, 0.68) 72%);
    pointer-events: none;
}

.network-canvas {
    position: absolute;
    inset: -3%;
    width: 106%;
    height: 106%;
    opacity: 1;
    filter: saturate(145%) brightness(1.08);
}

.network-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(80px);
    pointer-events: none;
    mix-blend-mode: screen;
}

.network-glow--one {
    width: 420px;
    height: 420px;
    left: -160px;
    top: 6%;
    background: rgba(34, 211, 238, 0.44);
    animation: glow-drift-a 17s ease-in-out infinite alternate;
}

.network-glow--two {
    width: 460px;
    height: 460px;
    right: -180px;
    top: 52%;
    background: rgba(52, 211, 153, 0.38);
    animation: glow-drift-b 19s ease-in-out infinite alternate;
}

/* Hub controls */

.network-hubs {
    position: fixed;
    inset: 0;
    z-index: 6;
    pointer-events: none;
}

.network-hub {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    width: clamp(74px, 7.8vw, 96px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(126, 153, 192, 0.48);
    background:
        radial-gradient(circle at 32% 24%, rgba(125, 211, 252, 0.18), rgba(15, 23, 42, 0.84) 50%),
        rgba(4, 8, 18, 0.78);
    color: #e5f0ff;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    box-shadow:
        0 12px 34px rgba(2, 8, 22, 0.78),
        inset 0 0 24px rgba(125, 211, 252, 0.16);
    cursor: pointer;
    pointer-events: auto;
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    transition: transform 0.26s ease, box-shadow 0.26s ease, border-color 0.26s ease;
}

.network-hub::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(125, 211, 252, 0.25);
    animation: ring-spin 10s linear infinite;
}

.network-hub::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-green);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.22);
}

.network-hub span {
    display: inline-block;
    text-align: center;
    padding: 0 8px;
}

.network-hub:hover,
.network-hub:focus-visible {
    transform: translate(-50%, -50%) scale(1.06);
    border-color: rgba(125, 211, 252, 0.78);
    box-shadow:
        0 18px 42px rgba(2, 8, 22, 0.84),
        inset 0 0 28px rgba(125, 211, 252, 0.26);
    outline: none;
}

.network-hub.is-active {
    border-color: rgba(52, 211, 153, 0.86);
    box-shadow:
        0 18px 52px rgba(5, 14, 35, 0.94),
        0 0 0 8px rgba(52, 211, 153, 0.15),
        inset 0 0 28px rgba(52, 211, 153, 0.2);
}

/* Progress bar */

.scroll-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 40;
    background: rgba(9, 14, 26, 0.62);
}

.scroll-bar-inner {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-green), var(--brand-cyan), var(--brand-violet));
    box-shadow: 0 0 14px rgba(125, 211, 252, 0.8);
    transition: width 0.08s linear;
}

/* Layout */

.page {
    position: relative;
    z-index: 2;
    max-width: 1140px;
    margin: 0 auto;
    padding-left: max(clamp(58px, 6.4vw, 82px), var(--hub-gutter));
}

.hero {
    margin-bottom: 26px;
}

.badge-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--stroke-strong);
    color: var(--text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(8, 13, 24, 0.78);
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-green));
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.2);
}

.title {
    max-width: 980px;
    margin-bottom: 12px;
    font-size: clamp(1.92rem, 3.9vw, 3.18rem);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.title-accent {
    background: linear-gradient(118deg, #93c5fd, #22d3ee 48%, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    max-width: 880px;
    color: var(--text-soft);
    font-size: clamp(1rem, 1.3vw, 1.06rem);
}

.meta-row {
    margin-top: 16px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--stroke);
    background: rgba(8, 13, 24, 0.66);
    color: var(--text-muted);
    padding: 4px 14px;
    font-size: 0.78rem;
}

.meta-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-cyan);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* Article */

.article-card {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(101, 124, 157, 0.26);
    background:
        linear-gradient(150deg, rgba(20, 28, 48, 0.42), rgba(8, 13, 24, 0.12) 38%, rgba(8, 13, 24, 0.1)),
        var(--bg-card);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    position: relative;
}

.article-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 14% 8%, rgba(34, 211, 238, 0.14), transparent 46%),
        radial-gradient(circle at 92% 80%, rgba(52, 211, 153, 0.1), transparent 44%);
}

.article-inner {
    position: relative;
    z-index: 1;
    padding: clamp(20px, 2.4vw, 32px);
}

.article-inner h2 {
    margin: 1.32rem 0 0.64rem;
    font-size: clamp(1.04rem, 1.3vw, 1.2rem);
    line-height: 1.3;
    color: #f3f8ff;
    letter-spacing: -0.01em;
}

.article-inner h3 {
    margin: 0 0 0.36rem;
    font-size: 0.96rem;
    color: #eef6ff;
    letter-spacing: -0.01em;
}

.article-inner p {
    margin-bottom: 0.84rem;
    color: var(--text-soft);
    font-size: 0.98rem;
}

.article-inner ul {
    margin: 0 0 1rem 1.2rem;
}

.article-inner li {
    color: var(--text-soft);
    margin-bottom: 0.35rem;
}

.callout {
    margin: 0.95rem 0 1.25rem;
    padding: 0.82rem 0.92rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(125, 211, 252, 0.36);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(52, 211, 153, 0.08));
}

.callout strong {
    display: block;
    margin-bottom: 0.34rem;
    color: #f6fbff;
}

/* Step flow */

.flow-list {
    list-style: none;
    counter-reset: compass-step;
    margin: 0.86rem 0 1.06rem;
    display: grid;
    gap: 12px;
}

.flow-step {
    counter-increment: compass-step;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(101, 124, 157, 0.28);
    background: rgba(8, 14, 24, 0.6);
    transition: transform 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
}

.flow-step::before {
    content: counter(compass-step);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-top: 2px;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 0.84rem;
    color: #dbf4ff;
    border: 1px solid rgba(125, 211, 252, 0.7);
    background: radial-gradient(circle at 32% 20%, rgba(34, 211, 238, 0.44), rgba(8, 13, 24, 0.86));
    box-shadow: inset 0 0 10px rgba(34, 211, 238, 0.2);
}

.flow-step:hover {
    transform: translateX(3px);
    border-color: rgba(125, 211, 252, 0.48);
    background: rgba(8, 14, 24, 0.78);
}

.flow-content p {
    margin-bottom: 0.58rem;
    font-size: 0.94rem;
}

.step-toggle {
    border-radius: 10px;
    border: 1px solid rgba(101, 124, 157, 0.24);
    background: rgba(8, 13, 24, 0.58);
}

.step-toggle summary {
    cursor: pointer;
    list-style: none;
    padding: 7px 10px;
    color: #d7e4fb;
    font-size: 0.82rem;
    font-family: "IBM Plex Mono", monospace;
    letter-spacing: 0.02em;
}

.step-toggle summary::-webkit-details-marker {
    display: none;
}

.step-toggle summary::before {
    content: "+";
    margin-right: 8px;
    color: var(--brand-cyan);
}

.step-toggle[open] summary::before {
    content: "-";
}

.step-toggle p {
    padding: 0 10px 10px;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.figure {
    margin: 1.1rem 0 1.22rem;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(101, 124, 157, 0.28);
    background: rgba(5, 10, 19, 0.9);
}

.figure img {
    display: block;
    width: 100%;
    max-height: 350px;
    object-fit: cover;
}

.figure-architecture img {
    max-height: none;
    height: auto;
    object-fit: contain;
}

.figure figcaption {
    padding: 0.62rem 0.86rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(8, 13, 24, 0.92);
    border-top: 1px solid rgba(101, 124, 157, 0.23);
}

.sources {
    margin-top: 1.18rem;
    border-top: 1px solid rgba(101, 124, 157, 0.26);
    padding-top: 0.76rem;
}

.sources h3 {
    font-size: 0.9rem;
    margin-bottom: 0.36rem;
}

.sources p {
    margin-bottom: 0.32rem;
    font-size: 0.84rem;
    color: var(--text-muted);
}

code {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.83em;
    padding: 0.08em 0.35em;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.7);
    color: #d2e5ff;
}

/* Sidebar cards */

aside {
    position: sticky;
    top: 68px;
}

.side-card {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(101, 124, 157, 0.28);
    background: var(--bg-card-strong);
    box-shadow: 0 16px 42px rgba(1, 7, 17, 0.56);
    overflow: hidden;
    margin-bottom: 12px;
}

.side-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: "IBM Plex Mono", monospace;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.09em;
    color: #c9d7f0;
    background: rgba(8, 13, 24, 0.92);
}

.side-summary::-webkit-details-marker {
    display: none;
}

.side-summary-indicator {
    transition: transform 0.2s ease;
}

.side-card[open] .side-summary-indicator {
    transform: rotate(180deg);
}

.side-content {
    padding: 12px 14px 13px;
    border-top: 1px solid rgba(101, 124, 157, 0.22);
}

.side-content p {
    margin-bottom: 0.58rem;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.side-block-title {
    margin: 0.12rem 0 0.52rem;
    color: #d7e6ff !important;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-content strong {
    color: #e8f2ff;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.9rem;
    color: #eef8ff;
    border: 1px solid rgba(125, 211, 252, 0.5);
    background: radial-gradient(circle at 26% 24%, rgba(34, 211, 238, 0.45), rgba(9, 14, 26, 0.96));
}

.profile-main {
    min-width: 0;
}

.profile-name {
    margin-bottom: 0.06rem;
    color: #f0f7ff;
    font-weight: 600;
}

.profile-role,
.profile-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
}

.chip-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0.58rem 0 0;
}

.chip-list li {
    margin: 0;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(101, 124, 157, 0.3);
    background: var(--bg-chip);
    color: #d4e2fb;
    font-size: 0.74rem;
}

.soft-note {
    margin-top: 0.62rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.mini-toggle {
    border-radius: 12px;
    border: 1px solid rgba(101, 124, 157, 0.24);
    background: rgba(8, 13, 24, 0.56);
    margin-bottom: 8px;
    overflow: hidden;
}

.mini-toggle:last-child {
    margin-bottom: 0;
}

.mini-toggle summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 10px;
    font-size: 0.82rem;
    color: #d8e6fb;
    font-family: "IBM Plex Mono", monospace;
}

.mini-toggle summary::-webkit-details-marker {
    display: none;
}

.mini-toggle summary::before {
    content: ">";
    display: inline-block;
    margin-right: 8px;
    color: var(--brand-cyan);
    transition: transform 0.2s ease;
}

.mini-toggle[open] summary::before {
    transform: rotate(90deg);
}

.mini-toggle p {
    padding: 0 10px 9px;
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* Reveal + focus states */

.reveal {
    opacity: 1;
    transform: none;
    transition: none;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

.section-focus {
    animation: section-focus 0.95s ease;
}

@keyframes section-focus {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.48);
    }
    100% {
        box-shadow: 0 0 0 16px rgba(34, 211, 238, 0);
    }
}

@keyframes ring-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes grid-drift {
    0% {
        transform: translate3d(0, calc(var(--scroll-ratio) * -24px), 0);
    }
    50% {
        transform: translate3d(-18px, calc(var(--scroll-ratio) * -24px - 8px), 0);
    }
    100% {
        transform: translate3d(-36px, calc(var(--scroll-ratio) * -24px), 0);
    }
}

@keyframes glow-drift-a {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(70px, 30px, 0);
    }
}

@keyframes glow-drift-b {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-82px, -36px, 0);
    }
}

/* Responsive */

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }

    aside {
        position: static;
    }

    .page {
        padding-left: 112px;
    }

    .network-hub {
        width: 78px;
    }
}

@media (max-width: 760px) {
    body {
        padding: 22px 12px 32px;
    }

    .page {
        padding-left: 96px;
    }

    .network-hub {
        width: 66px;
        font-size: 0.54rem;
        letter-spacing: 0.08em;
    }

    .network-hub[data-hub="intro"] {
        left: 6.5% !important;
        top: 22% !important;
        bottom: auto;
    }

    .network-hub[data-hub="research"] {
        left: 6.5% !important;
        top: 38% !important;
        bottom: auto;
    }

    .network-hub[data-hub="conclusion"] {
        left: 6.5% !important;
        top: 54% !important;
        bottom: auto;
    }

    .network-hub[data-hub="context"] {
        left: 6.5% !important;
        top: 70% !important;
        bottom: auto;
    }

    .article-inner {
        padding: 18px 16px 20px;
    }

    .flow-step {
        grid-template-columns: 42px minmax(0, 1fr);
        padding: 10px 11px;
    }

    .flow-step::before {
        width: 32px;
        height: 32px;
        font-size: 0.78rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
