:root {
    --color-bg: #0f1117;
    --color-surface: #1a1d27;
    --color-border: #2a2d3a;
    --color-text: #e0e0e8;
    --color-text-muted: #8888a0;
    --color-primary: #6c8cff;
    --color-primary-hover: #8aa4ff;
    --color-accent: #ff6c8c;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    --radius: 8px;
    --max-width: 900px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

nav .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

nav .logo:hover {
    color: var(--color-primary-hover);
}

nav .logo img {
    border-radius: 4px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

nav ul a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition);
}

nav ul a:hover {
    color: var(--color-primary);
}

/* Main content */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

section {
    margin-bottom: 3rem;
}

article {
    max-width: 70ch;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    color: #fff;
}

h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.4rem;
    color: var(--color-text-muted);
}

li a {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Images */
.banner {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
}

.diagram, .photo {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
    border: 1px solid var(--color-border);
}

/* Error page */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-page h1 {
    font-size: 3rem;
    color: var(--color-accent);
}

/* Footer */
footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
}

footer p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

main section {
    animation: fadeIn 0.4s ease both;
}

main section:nth-child(2) { animation-delay: 0.1s; }
main section:nth-child(3) { animation-delay: 0.2s; }
main section:nth-child(4) { animation-delay: 0.3s; }

/* Responsive */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    nav ul {
        gap: 1rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }

    main {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    :root {
        --max-width: 100%;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
}

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

/* Print styles */
@media print {
    header, footer { display: none; }
    body { background: #fff; color: #000; }
    a { color: #000; text-decoration: underline; }
}
