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

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: var(--border) var(--bg);
}

html::-webkit-scrollbar {
    width: 12px;
    -webkit-appearance: none;
    background: var(--bg);
}

html::-webkit-scrollbar-track {
    background: var(--bg);
    border-left: 1px solid var(--border);
}

html::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
    border: 3px solid var(--bg);
}

html::-webkit-scrollbar-thumb:hover {
    background: var(--fg3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1 0 auto;
}

/* Reserve the header's vertical space before the web component upgrades,
   so layout doesn't shift on first paint. */
h2-header {
    display: block;
    min-height: 76px;
    border-bottom: 1px solid var(--border);
}

h2-footer {
    display: block;
    min-height: 70px;
    border-top: 1px solid var(--border);
    /* Stick to the bottom on short pages. Post pages use <article>
       rather than <main>, so the flex-grow on `body > main` doesn't
       apply to them and the footer would otherwise sit right under
       short content. margin-top:auto on the last flex child of the
       body column absorbs the free space above it. It's a no-op on
       pages where <main> already fills the viewport height. */
    margin-top: auto;
}

h2-footer .footer {
    border-top: none;
    margin-top: 0;
}

/* Header */
.header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}

h2-header .header {
    border-bottom: none;
}

.header-container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.6;
    color: var(--fg);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.logo-sep {
    color: var(--fg3);
    font-weight: 400;
}

.logo-section {
    color: var(--fg2);
    font-weight: 600;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav a,
.nav a:visited,
.nav a:active,
.nav a:focus {
    color: var(--fg2);
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.6;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.nav a:hover,
.nav a.active {
    color: var(--accent);
}

/* Footer */
.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 60px;
}

.footer-container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 60px;
    text-align: center;
}

.footer p {
    color: var(--fg3);
    font-size: 13px;
}

@media (max-width: 768px) {
    .header-container,
    .footer-container {
        padding-left: 20px;
        padding-right: 20px;
    }
    .nav { display: none; }
}
