* {
    box-sizing: border-box;
}

:root {
    --background: #fafafa;
    --text: #171717;
    --muted: #666;
    --hover: #555;
}

:root[data-theme="dark"] {
    --background: #171717;
    --text: #fafafa;
    --muted: #999;
    --hover: #ccc;
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    padding: 48px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
}

p {
    margin: 0 0 20px;
}

a {
    color: inherit;
    text-underline-offset: 4px;
}

a:hover {
    color: var(--hover);
}

.theme-toggle {
    padding: 0;
    border: 0;
    font: inherit;
    color: inherit;
    background: none;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--hover);
}

.theme-toggle-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1;
    font-size: 16px;
}

/* Homepage */

.home {
    min-height: 100vh;
    align-items: center;
    padding: 32px 20px;
}

.page {
    width: min(100%, 960px);
    display: grid;
    grid-template-columns: minmax(0, 680px) 200px;
    gap: 56px;
    align-items: start;
}

.home main {
    font-size: clamp(18px, 2.5vw, 24px);
}

.links {
    margin-bottom: 0;
}

aside {
    padding-top: 8px;
    font-size: clamp(18px, 2.5vw, 24px);
}

aside h2 {
    margin: 0 0 12px;
    font-size: inherit;
    font-weight: 600;
}

aside ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

aside li {
    margin-bottom: 8px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Writing pages */

.writing main {
    width: min(100%, 680px);
    font-size: clamp(17px, 2.2vw, 20px);
}

.writing h1 {
    margin: 24px 0 16px;
    font-size: clamp(28px, 4vw, 36px);
    line-height: 1.2;
}

.back {
    font-size: 16px;
}

.empty {
    color: var(--muted);
}

@media (max-width: 760px) {
    .home {
        align-items: flex-start;
    }

    .page {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}
