
:root {
    --bg: #0b0f14; /* page background */
    --card: #111722; /* surfaces */
    --text: #e7eef6; /* main text */
    --muted: #b8c7d9; /* secondary text */
    --accent: #35ffad; /* mint accent */
    --accent2: #8a4dff; /* violet accent */
    --outline: rgba(255, 255, 255, .08);
    --max: 1100px; /* content width */
    --radius: 16px; /* rounded corners */
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f6f7fb;
        --card: #ffffff;
        --text: #0f172a;
        --muted: #475569;
        --outline: #e5e7eb;
    }
}

html {
    scroll-behavior: smooth
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: radial-gradient(1400px 700px at 100% -10%, rgba(138, 77, 255, .14), transparent 60%),
    radial-gradient(1100px 600px at -10% 10%, rgba(53, 255, 173, .12), transparent 60%),
    var(--bg);
    color: var(--text);
    font: 16px/1.65 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, Apple Color Emoji, Segoe UI Emoji;
}

/* Sticky top bar */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(6px);
    background: linear-gradient(180deg, rgba(17, 23, 34, .9), rgba(17, 23, 34, .5), transparent);
    border-bottom: 1px solid var(--outline);
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: var(--max);
    margin: 0 auto;
    padding: 12px 16px
}

.brand .mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: conic-gradient(from 0deg, var(--accent), var(--accent2));
    box-shadow: 0 0 0 1px var(--outline) inset
}

.brand .title {
    font-weight: 600;
    letter-spacing: .2px
}

.strip {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: .95rem;
    background: linear-gradient(90deg, rgba(53, 255, 173, .12), rgba(138, 77, 255, .12));
    border-top: 1px solid var(--outline);
    border-bottom: 1px solid var(--outline)
}

/* Layout */
.page {
    padding: clamp(16px, 2.5vw, 32px);
}

.container {
    max-width: var(--max);
    margin-inline: auto
}

.grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: minmax(230px, 280px) 1fr;
        align-items: start
    }

    .toc {
        position: sticky;
        top: 12px;
        max-height: calc(100dvh - 24px);
        overflow: auto;
        padding-right: 12px
    }
}

/* TOC */
.toc {
    background: var(--card);
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    padding: 16px
}

.toc h2 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--muted);
    letter-spacing: .3px;
    text-transform: uppercase
}

.toc a {
    display: block;
    padding: 8px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent
}

.toc a:hover, .toc a.active {
    border-color: var(--outline);
    background: linear-gradient(180deg, rgba(53, 255, 173, .09), rgba(138, 77, 255, .07))
}

/* Article */
main {
    background: var(--card);
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    padding: clamp(18px, 3vw, 32px)
}

main h1 {
    font-size: clamp(28px, 4.2vw, 44px);
    line-height: 1.2;
    margin: 6px 0 16px
}

main h2 {
    margin-top: 40px;
    font-size: clamp(20px, 3.2vw, 28px);
    line-height: 1.25;
    border-top: 1px dashed var(--outline);
    padding-top: 24px;
    position: relative
}

main h2::before {
    content: "";
    position: absolute;
    left: -12px;
    top: calc(24px + .4em);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent)
}

main h3 {
    margin-top: 28px;
    font-size: clamp(18px, 2.5vw, 22px)
}

p {
    margin: 12px 0 14px
}

/* Lists as soft cards */
main ul {
    list-style: none;
    padding-left: 0;
    margin: 12px 0 18px
}

main ul li {
    padding: 10px 12px;
    border: 1px solid var(--outline);
    border-radius: 12px;
    margin: 8px 0
}

main ul li::before {
    content: "•";
    margin-right: 10px;
    display: inline-block;
    transform: translateY(-1px)
}

/* Links */
a {
    color: var(--accent)
}

a:hover {
    text-decoration: underline
}

/* Progress bar */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    z-index: 100
}

/* Back to top */
.toTop {
    position: fixed;
    right: 16px;
    bottom: 16px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid var(--outline);
    background: var(--card);
    box-shadow: 0 8px 16px rgba(0, 0, 0, .2);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s, transform .2s
}

.toTop.show {
    opacity: 1;
    transform: translateY(0)
}

.toTop:focus-visible {
    outline: 2px solid var(--accent)
}

/* Heading anchors */
.anchor {
    opacity: 0;
    margin-left: 8px;
    text-decoration: none;
    font-size: .9rem;
    color: var(--muted)
}

h2:hover .anchor {
    opacity: 1
}

/* Reading width */
main > * {
    max-width: 70ch
}

main > ul, main > ol {
    max-width: unset
}

/* Footer */
footer {
    max-width: var(--max);
    margin: 32px auto;
    padding: 12px 16px;
    color: var(--muted);
    font-size: .92rem
}

footer a {
    color: var(--muted)
}

/* Mobile tweaks */
@media (max-width: 1023px) {
    .toc {
        display: none
    }

    .strip {
        flex-wrap: wrap;
        text-align: center
    }
}

@media print {
    body {
        background: #fff;
        color: #000
    }

    .header, .strip, .toc, .progress, .toTop {
        display: none
    }

    main {
        border: none;
        padding: 0
    }
}


img {
    display: block;
    margin: 30px auto;
    max-width: 100%;
    border-radius: 14px;
}

figure img {
    border-radius: 14px;
    margin: 30px auto;
}


.img-left {
    float: left;
    margin: 10px 15px 10px 0;
    width: 200px;
}

.img-right {
    float: right;
    margin: 30px 0 10px 15px;
    max-width: 300px;
}


/* --- Simple burger menu (all screens) --- */
.menu-btn {
    margin-left: auto;
    width: 40px;
    height: 36px;
    border: 1px solid var(--outline);
    background: var(--card);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer
}

.menu-btn:focus-visible {
    outline: 2px solid var(--accent)
}

.menu-btn .bar {
    position: relative;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px
}

.menu-btn .bar:before, .menu-btn .bar:after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px
}

.menu-btn .bar:before {
    top: -6px
}

.menu-btn .bar:after {
    top: 6px
}

.menu {
    display: none;
    border-top: 1px solid var(--outline);
    border-bottom: 1px solid var(--outline);
    background: var(--card)
}

.menu.open {
    display: block
}

.menu ul {
    list-style: none;
    margin: 0;
    padding: 8px 16px;
    display: flex;
    gap: 10px
}

.menu a {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent
}

.menu a:hover {
    border-color: var(--outline);
    background: linear-gradient(180deg, rgba(53, 255, 173, .09), rgba(138, 77, 255, .07))
}
