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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --border-color: #d0d0d0;
    --link-color: #0066cc;
    --link-hover: #0052a3;
    --header-bg: #ffffff;
    --header-text: #1a1a1a;
    --code-bg: #f4f4f4;
    --info-bg: #e3f2fd;
    --info-border: #2196f3;
    --warning-bg: #fff3e0;
    --warning-border: #ff9800;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2a2a2a;
        --bg-tertiary: #3a3a3a;
        --text-primary: #e8e8e8;
        --text-secondary: #b8b8b8;
        --border-color: #404040;
        --link-color: #5c9fd6;
        --link-hover: #7fb3e0;
        --header-bg: #0a0a0a;
        --header-text: #e8e8e8;
        --code-bg: #2d2d2d;
        --info-bg: #1a2a3a;
        --info-border: #4a7ba7;
        --warning-bg: #3a2a1a;
        --warning-border: #b87333;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

header img {
    height: 40px;
    width: auto;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--header-text);
}

header h1 .light-text {
    opacity: 0.5;
    font-weight: 400;
}

header .header-link {
    margin-left: auto;
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

header .header-link:hover {
    background-color: var(--bg-secondary);
    color: var(--link-hover);
}

header .github-stars {
    font-size: 0.875rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header .stat-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    display: inline-block;
    color: inherit;
    filter: brightness(0) saturate(100%) invert(var(--icon-invert, 0));
}

:root {
    --icon-invert: 0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --icon-invert: 1;
    }
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--bg-primary);
    min-height: calc(100vh - 120px);
}

nav {
    width: 220px;
    background-color: var(--bg-secondary);
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--border-color);
}

aside {
    width: 240px;
    background-color: var(--bg-secondary);
    padding: 2rem 1.5rem;
    border-left: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: fit-content;
    max-height: 100vh;
    overflow-y: auto;
}

aside h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

aside ul {
    list-style: none;
}

aside ul li {
    margin-bottom: 0.5rem;
}

aside ul li a {
    color: var(--link-color);
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

aside ul li a:hover {
    background-color: var(--bg-tertiary);
    color: var(--link-hover);
}

aside ul li a.active {
    background-color: var(--link-color);
    color: var(--bg-primary);
}

/* Expandable navigation sections */
aside .nav-section {
    margin-bottom: 1rem;
}

aside .nav-section .section-title {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    padding-left: 1.25rem;
}

aside .nav-section .section-title::before {
    content: '▼';
    position: absolute;
    left: 0;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

aside .nav-section.collapsed .section-title::before {
    transform: rotate(-90deg);
}

aside .nav-section .subsection {
    margin-top: 0.5rem;
    margin-left: 1rem;
    border-left: 2px solid var(--border-color);
    padding-left: 0.75rem;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

aside .nav-section.collapsed .subsection {
    max-height: 0;
    margin-top: 0;
}

nav h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

nav h2:not(:first-child) {
    margin-top: 2rem;
}

nav ul {
    list-style: none;
}

nav ul li {
    margin-bottom: 0.5rem;
}

nav ul li a {
    color: var(--link-color);
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

nav ul li a:hover {
    background-color: var(--bg-tertiary);
    color: var(--link-hover);
}

nav ul li a.active {
    background-color: var(--link-color);
    color: #ffffff;
}

/* Navigation category headers */
nav ul li.nav-category {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

/* Navigation sections in left nav */
nav .nav-section {
    margin-bottom: 1rem;
    margin-top: 1rem;
}

nav .nav-section .section-title {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 0.5rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    display: block;
}

nav .nav-section .subsection {
    list-style: none;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border-color);
}

nav .nav-section .subsection li {
    margin-bottom: 0.5rem;
}

nav .nav-section .subsection li a {
    color: var(--link-color);
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

nav .nav-section .subsection li a:hover {
    background-color: var(--bg-tertiary);
    color: var(--link-hover);
}

nav .nav-section .subsection li a.active {
    background-color: var(--link-color);
    color: #ffffff;
}

.page-nav {
    font-size: 0.95rem;
}

html {
    scroll-behavior: smooth;
}

main h1[id], main h2[id], main h3[id] {
    scroll-margin-top: 2rem;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
}

main h1 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--link-color);
    padding-bottom: 0.5rem;
}

main h2 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    position: relative;
}

main h3 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

/* Anchor links */
main h2[id]::before,
main h3[id]::before {
    content: '#';
    position: absolute;
    left: -1.5rem;
    color: var(--link-color);
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: normal;
}

main h2[id]:hover::before,
main h3[id]:hover::before {
    opacity: 1;
}

/* Highlight effect for anchored sections */
main h2:target,
main h3:target {
    animation: highlight 2s ease-out;
}

@keyframes highlight {
    0% {
        background-color: var(--warning-bg);
        padding-left: 1rem;
        margin-left: -1rem;
        border-radius: 4px;
    }
    100% {
        background-color: transparent;
        padding-left: 1rem;
        margin-left: -1rem;
    }
}

main p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

main a {
    color: var(--link-color);
    text-decoration: none;
}

main a:hover {
    text-decoration: underline;
}

main ul, main ol {
    margin-bottom: 1rem;
    margin-left: 2rem;
    color: var(--text-secondary);
}

main li {
    margin-bottom: 0.5rem;
}

code {
    background-color: var(--code-bg);
    color: var(--text-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

pre {
    background-color: var(--code-bg);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    padding: 0;
    background: none;
}

.info-box {
    background-color: var(--info-bg);
    border-left: 4px solid var(--info-border);
    padding: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.warning-box {
    background-color: var(--warning-bg);
    border-left: 4px solid var(--warning-border);
    padding: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

footer {
    background-color: var(--header-bg);
    color: var(--header-text);
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--link-color);
}

/* Distro page styles */
.distro-section {
    margin-bottom: 2.5rem;
}

.distro-icon {
    height: 38px;
    width: auto;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background-color: var(--bg-primary);
}

table thead {
    background-color: var(--bg-tertiary);
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

table th {
    font-weight: 600;
    color: var(--text-primary);
}

table td {
    color: var(--text-secondary);
}

table code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

/* Responsive design */
@media (max-width: 1024px) {
    aside {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    aside {
        display: none;
    }

    header img {
        height: 32px;
    }
}