/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Warm paper palette */
    --color-paper: #f5f0e8;
    --color-text: #2c2416;
    --color-text-muted: #4a453c;
    --color-accent: #8b4513;
    --color-accent-hover: #6b3410;
    --color-border: #d4c9b8;

    /* Fonts */
    --font-serif: 'Sorts Mill Goudy', Georgia, serif;
    --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Layout */
    --max-width: 720px;
    --spacing-section: 4rem;
    --spacing-element: 1.5rem;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* Fixed map background */
body {
    font-family: var(--font-serif);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image: url('../assets/Cantino_planisphere_(1502).jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
}

/* Content box - scrollable paper container */
.content-box {
    max-width: var(--max-width);
    margin: 2rem auto;
    background-color: var(--color-paper);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid #1d48979d;
    padding: 0 2rem;
}

@media (min-width: 800px) {
    .content-box {
        margin: 3rem auto;
        padding: 0 3rem;
    }
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-serif);
    line-height: 1.3;
    font-weight: 700;
}

h1 {
    font-size: 1.75rem;
    letter-spacing: 0.01em;
}

h2 {
    font-size: 1.35rem;
    margin-bottom: var(--spacing-element);
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
}

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

/* Hero Section */
.hero {
    padding: 4rem 0 1.5rem;
    text-align: center;
}

.hero h1 {
    margin-bottom: 0;
}

.hero h1 a {
    color: inherit;
    text-decoration: none;
}

.hero h1 a:hover {
    color: var(--color-accent);
}

/* Nav */
.nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}

.nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 1.05rem;
}

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

.nav a.active {
    color: var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 2px;
}

/* Intro Section */
.intro {
    padding: 2.5rem 0;
}

.intro p {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 0;
}

/* Sections */
section {
    padding: var(--spacing-section) 0;
}

/* Page Content (sub-pages) */
.page-content {
    padding: 2.5rem 0;
}

/* Placeholder text */
.placeholder {
    font-style: italic;
    color: var(--color-text-muted);
}

/* Listing (future writing/project entries) */
.listing {
    list-style: none;
    padding: 0;
}

.listing li {
    border-bottom: 1px solid var(--color-border);
}

.listing li:last-child {
    border-bottom: none;
}

.listing a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.75rem 0;
    color: var(--color-text);
    text-decoration: none;
}

.listing a:hover {
    color: var(--color-accent);
}

.listing-title {
    font-size: 1.05rem;
}

.listing-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-left: 1rem;
}

/* Footer */
footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
}

footer a {
    color: var(--color-accent);
    text-decoration: none;
}

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

/* Responsive */
@media (max-width: 600px) {
    :root {
        --spacing-section: 3rem;
    }

    /* Fix iOS background-attachment: fixed bug */
    body {
        background-attachment: scroll;
    }

    .content-box {
        margin: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
        padding: 0 1.25rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .hero {
        padding: 3rem 0 1.5rem;
    }

    .nav {
        gap: 1.5rem;
    }

    .listing a {
        flex-direction: column;
        gap: 0.25rem;
    }

    .listing-date {
        margin-left: 0;
    }
}
