/* ============================================
   BASE.CSS — Reset, Variables, Typography, Layout
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Source+Sans+3:wght@300;400;500;600&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Colors — warm academic palette */
    --bg-primary: #f5f0eb;
    --bg-header: #f5f0eb;
    --bg-sidebar: #f0ebe5;
    --bg-white: #ffffff;

    --accent-red: #8b1a1a;
    --accent-red-hover: #a52a2a;
    --accent-red-light: rgba(139, 26, 26, 0.08);

    --text-primary: #2c2c2c;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-heading: #333333;

    --border-light: #ddd5cc;
    --border-medium: #c5bdb4;

    /* Typography */
    --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Source Sans 3', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Sizing */
    --max-width: 1100px;
    --sidebar-width: 180px;
    --header-height: auto;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
}

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

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

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent-red);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

ul,
ol {
    list-style-position: outside;
    padding-left: 1.5em;
}

/* ---------- Typography ---------- */
h1 {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 400;
    color: var(--text-heading);
    margin-bottom: 0.6em;
    line-height: 1.3;
}

h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-top: 2em;
    margin-bottom: 0.75em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.3;
}

h3 {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-red);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
    color: var(--text-primary);
}

/* ---------- Main Layout ---------- */
.page-wrapper {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
}

.content-area {
    display: flex;
    gap: 40px;
    padding: 40px 0;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* First h1 on each page — no extra top margin */
.main-content>h1:first-child {
    margin-top: 0;
}

/* Divider under first h1 like the reference */
.main-content>h1:first-child::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: var(--border-light);
    margin-top: 0.5em;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-light);
    padding: 16px 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto;
}

.site-footer a {
    color: var(--text-muted);
}

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

/* ---------- Utility Classes ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Responsive: Tablet ---------- */
@media (max-width: 900px) {
    .content-area {
        gap: 28px;
        padding: 30px 0;
    }
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 768px) {
    .page-wrapper {
        padding: 0 16px;
    }

    .content-area {
        flex-direction: column;
        gap: 16px;
        padding: 20px 0;
    }

    h1 {
        font-size: 1.45rem;
    }

    h2 {
        font-size: 1.15rem;
        margin-top: 1.5em;
    }

    h3 {
        font-size: 1rem;
    }

    p {
        font-size: 0.95rem;
    }

    .site-footer {
        padding: 14px 16px;
        font-size: 0.82rem;
    }
}

/* ---------- Responsive: Small Mobile ---------- */
@media (max-width: 480px) {
    .page-wrapper {
        padding: 0 12px;
    }

    .content-area {
        padding: 16px 0;
        gap: 12px;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.08rem;
    }
}