/* ===== Base Reset & Variables ===== */

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

:root {
    --bg: #CED6C2;
    --bg-subtle: #dce3d8;
    --text: #2c3527;
    --text-muted: #5a6454;
    --link: #4E5E7E;
    --link-hover: #3a4760;
    --shadow: rgba(44, 53, 39, 0.12);
    --max-width: 900px;
    --font-body: 'Georgia', 'Times New Roman', serif;
    --font-nav: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #20261c;
        --bg-subtle: #2b3326;
        --text: #d8dfcd;
        --text-muted: #9caa8f;
        --link: #9fb1d4;
        --link-hover: #bcc9e2;
        --shadow: rgba(0, 0, 0, 0.35);
    }
}


/* ===== Body & Layout ===== */

html {
    font-size: 112.5%; /* 18px at the browser default, but respects the user's setting */
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.7;
    min-height: 100vh;
    min-height: 100svh;
    padding: 2rem 1.5rem;
}


/* ===== Navigation ===== */

nav {
    max-width: var(--max-width);
    margin: 0 auto 4rem auto;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    font-family: var(--font-nav);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--link);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

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


/* ===== Main Content ===== */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 700px) {
    main {
        grid-template-columns: 1fr 280px;
        gap: 4rem;
        align-items: start;
    }
}


/* ===== Article / Text Content ===== */

article h1 {
    font-family: var(--font-body);
    font-size: 2rem;
    font-style: italic;
    font-weight: normal;
    margin-bottom: 1.5rem;
    text-wrap: balance;
}

article p {
    margin-bottom: 1.25rem;
    text-wrap: pretty;
}

article p:last-child {
    margin-bottom: 0;
}

article a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

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

.email {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--text);
    margin-top: 0.5rem;
}


/* ===== Aside / Photo ===== */

aside {
    display: flex;
    justify-content: center;
}

aside img {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 20px var(--shadow);
}

@media (min-width: 700px) {
    aside {
        position: sticky;
        top: 2rem;
    }
}


/* ===== Footer ===== */

footer {
    max-width: var(--max-width);
    margin: 4rem auto 0 auto;
    padding-top: 2rem;
    border-top: 1px solid var(--bg-subtle);
}

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


/* ===== Motion ===== */

@media (prefers-reduced-motion: no-preference) {
    nav, main, footer {
        animation: fade-up 0.4s ease-out both;
    }

    main { animation-delay: 0.05s; }
    footer { animation-delay: 0.1s; }

    @keyframes fade-up {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: none;
        }
    }
}


/* ===== Focus ===== */

:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
    border-radius: 2px;
}


/* ===== Selection ===== */

::selection {
    background: var(--link);
    color: var(--bg);
}
