
:root {
    --bg-0: #0b0f14; /* page */
    --bg-1: #0f1620; /* header/nav */
    --bg-2: #121a25; /* cards */
    --bg-3: #0c141e; /* overlays */
    --fg-0: #e9eef5; /* text */
    --fg-1: #c9d2dd; /* muted */
    --fx-0: #21d49b; /* accent */
    --fx-1: #7cf5c5; /* accent light */
    --fx-2: #00a2ff; /* secondary */
    --ring: rgba(33, 212, 155, .35);
    --border: #213040;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .03);
    --radius: 18px;
    --container: min(1080px, 92vw);
}

html[data-theme="light"] {
    --bg-0: #f7f8fb;
    --bg-1: #ffffff;
    --bg-2: #ffffff;
    --bg-3: #0b0f141a;
    --fg-0: #111827;
    --fg-1: #374151;
    --fx-0: #0ea5e9;
    --fx-1: #38bdf8;
    --fx-2: #10b981;
    --ring: rgba(56, 189, 248, .35);
    --border: #e5e7eb;
    --shadow: 0 10px 30px rgba(17, 24, 39, .08), inset 0 1px 0 rgba(255, 255, 255, .6);
}

*, *::before, *::after {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--fg-0);
    background: radial-gradient(1200px 600px at 80% -10%, rgba(0, 162, 255, .25), transparent 60%),
    radial-gradient(1000px 800px at -10% 10%, rgba(33, 212, 155, .22), transparent 55%),
    var(--bg-0);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--fx-0);
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(180deg, var(--bg-1), color-mix(in oklab, var(--bg-1), transparent 14%));
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: saturate(1.2) blur(8px);
}

.header-inner {
    width: var(--container);
    margin-inline: auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: .2px
}

.brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: conic-gradient(from 210deg, var(--fx-0), var(--fx-2));
    box-shadow: 0 6px 20px var(--ring);
}

.brand span {
    font-size: 16px
}

/* Nav */
.nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px
}

.theme-btn, .burger-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--fg-0);
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.theme-btn:hover, .burger-btn:hover {
    outline: 2px solid var(--ring)
}

.theme-btn svg, .burger-btn svg {
    width: 18px;
    height: 18px
}

nav#site-nav {
    position: fixed;
    inset: 0 0 auto auto;
    width: min(340px, 86vw);
    height: 100dvh;
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -24px 0 40px rgba(0, 0, 0, .25);
}

nav#site-nav .nav-inner {
    height: 100%;
    display: flex;
    flex-direction: column
}

#site-nav header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border)
}

#site-nav h2 {
    font-size: 16px;
    margin: 0
}

#site-nav .close-btn {
    background: transparent;
    border: 0;
    color: var(--fg-0);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px
}

#site-nav .close-btn:hover {
    outline: 2px solid var(--ring)
}

#site-nav ul {
    list-style: none;
    margin: 0;
    padding: 10px 6px;
    overflow: auto;
    flex: 1
}

#site-nav li a {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--fg-0)
}

#site-nav li a:hover {
    background: color-mix(in oklab, var(--fx-0) 10%, transparent)
}

#site-nav li a[aria-current="true"] {
    background: color-mix(in oklab, var(--fx-0) 16%, transparent);
    color: var(--fg-0);
    font-weight: 600
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease
}

/* Desktop nav */
.desktop-nav {
    display: none;
    margin-left: auto
}

.desktop-nav ul {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0
}

.desktop-nav a {
    display: block;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--fg-0)
}

.desktop-nav a:hover {
    background: color-mix(in oklab, var(--fx-0) 12%, transparent)
}

/* Main */
main {
    padding: 28px 0 80px
}

.container {
    width: var(--container);
    margin-inline: auto
}

.hero {
    position: relative;
    padding: 28px 20px 8px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, color-mix(in oklab, var(--fx-0) 4%, transparent), transparent 60%),
    linear-gradient(120deg, color-mix(in oklab, var(--fx-2) 4%, transparent), transparent 50%),
    var(--bg-2);
    box-shadow: var(--shadow);
    border: 1px solid var(--border)
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.15;
    letter-spacing: .2px;
    text-align: center;
}

.hero p.lead {
    margin: 0;
    color: var(--fg-1)
}

article.content {
    margin-top: 18px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--bg-2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow)
}

article.content > * {
    max-width: 75ch
}

article.content h2 {
    margin-top: 28px;
    font-size: clamp(20px, 3.6vw, 30px)
    text-align: center;
}

article.content h3 {
    margin-top: 20px
}

article.content p {
    color: var(--fg-1)
}

article.content ul, article.content ol {
    padding-left: 22px
}

/* Table (progressive enhanced) */
article.content table {
    width: 100%;
    border-collapse: collapse;
    background: linear-gradient(180deg, color-mix(in oklab, var(--fx-0) 3%, transparent), transparent 30%), var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: block
}

article.content table thead {
    position: sticky;
    top: 0;
    background: var(--bg-1);
    z-index: 1
}

article.content table tr {
    display: grid;
    grid-template-columns: 1.2fr .9fr .5fr
}

article.content table th, article.content table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border)
}

article.content table th {
    font-weight: 700;
    text-align: left;
    cursor: pointer
}

article.content table th .sort-ind {
    opacity: .65;
    font-size: 12px;
    margin-left: 8px
}

article.content table tr:hover td {
    background: color-mix(in oklab, var(--fx-0) 8%, transparent)
}

@media (max-width: 700px) {
    article.content table tr {
        grid-template-columns: 1fr
    }

    article.content table thead {
        display: none
    }

    article.content table tbody tr {
        border-bottom: 1px solid var(--border)
    }

    article.content table tbody td {
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 10px
    }

    article.content table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--fg-0)
    }
}

/* Back to top */
.to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--fg-0);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease
}

.to-top.show {
    opacity: 1;
    pointer-events: auto
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    translate: 0 12px;
    transition: opacity .5s ease, translate .5s ease
}

.reveal.in {
    opacity: 1;
    translate: 0 0
}

/* Footer */
footer {
    margin-top: 24px;
    padding: 20px 0;
    color: var(--fg-1)
}

footer .foot-inner {
    width: var(--container);
    margin-inline: auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: 16px
}

/* Breakpoints */
@media (min-width: 1000px) {
    .burger-btn {
        display: none
    }

    .desktop-nav {
        display: block
    }

    nav#site-nav {
        display: none
    }
}

/* States */
body.nav-open nav#site-nav {
    transform: translateX(0)
}

body.nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto
}



/* Off-canvas basics */
nav#site-nav{
    position: fixed;
    inset: 0 0 0 auto;
    width: min(340px, 86vw);
    height: 100dvh;
    background: var(--bg-2, #fff);
    color: var(--fg-0, #111827);
    border-left: 1px solid var(--border, #e5e7eb);
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -24px 0 40px rgba(0,0,0,.25);
    z-index: 1001; /* вище за overlay */
}
body.nav-open nav#site-nav{ transform: translateX(0); }

/* Overlay */
.nav-overlay{
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
    z-index: 1000;
}
body.nav-open .nav-overlay{ opacity: 1; pointer-events: auto; }

/* Вміст меню */
nav#site-nav .nav-inner{ height: 100%; display: flex; flex-direction: column; }
nav#site-nav header{
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid var(--border, #e5e7eb);
}
nav#site-nav h2{ margin: 0; font-size: 16px; }

nav#site-nav ul{
    list-style: none; margin: 0; padding: 10px 6px;
    overflow: auto; flex: 1;
}
nav#site-nav li a{
    display: block; padding: 12px 14px; border-radius: 10px;
    color: inherit; text-decoration: none;
}
nav#site-nav li a:hover{
    background: rgba(0,0,0,.06); /* у світлій темі */
}
html[data-theme="dark"] nav#site-nav li a:hover{
    background: color-mix(in oklab, #21d49b 12%, transparent); /* у темній */
}


@media (min-width:1000px){
    .burger-btn{ display:none; }
    .desktop-nav{ display:block; margin-left:auto; }
    nav#site-nav{ display:none; }
}
