/* --- Global Reset & Typography --- */
body {
    font-family: "Hoefler Text", "Baskerville", "Times New Roman", serif;
    background-color: #fff;
    color: #202122;
    /* Large, readable base size */
    font-size: 1.2rem; 
    line-height: 1.65;
    font-variant-numeric: oldstyle-nums;
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

/* --- Header Mini (Nav) - Fixed & Stable --- */
.header-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #eaecf0;
    background: #f8f9fa;
}

.header-mini .logo {
    height: 28px; /* Kept small for the "mini" feel */
    width: auto;
}

.mini-link {
    text-decoration: none;
    color: #0645ad; /* Classic Wikipedia blue for light mode */
    font-weight: 600;
    font-size: 0.95rem;
    font-family: sans-serif; /* High-contrast UI font */
}

/* --- Layout Container --- */
main {
    max-width: 800px;
    margin: 4rem auto;
    padding: 0 1.5rem;
}

/* --- Primary Entry Header (The Page Title) --- */
.entry-header {
    margin-bottom: 2.5rem;
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 0.5rem;
}

.entry-title {
    font-size: 2.8rem; /* Large and authoritative */
    font-weight: 400;
    margin: 0;
    line-height: 1;
}

.entry-date {
    display: block;
    font-size: 0.9rem;
    color: #54595d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* --- Entry Content (The "About" Markdown) --- */
.entry-content {
    margin-top: 2rem;
}

/* Sub-headers inside the content */
.entry-content h1 {
    font-size: 1.8rem;
    margin: 2rem 0 1rem;
    border-bottom: 1px solid #a2a9b1;
    font-weight: 400;
}

.entry-content h2 {
    font-size: 1.4rem;
    margin: 1.8rem 0 0.8rem;
    border-bottom: 1px solid #a2a9b1;
    font-weight: 400;
}

.entry-content a {
    color: #0645ad;
    text-decoration: none;
}

.entry-content a:hover {
    text-decoration: underline;
}

/* --- Infobox (Reference Component) --- */
.infobox {
    float: right;
    width: 290px;
    margin: 0 0 1.5rem 2rem;
    padding: 0.8rem;
    background-color: #f8f9fa;
    border: 1px solid #a2a9b1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.infobox-caption {
    font-weight: bold;
    text-align: center;
    background: #eaecf0;
    padding: 0.4rem;
    margin-bottom: 0.5rem;
    font-variant: all-small-caps;
    letter-spacing: 0.05rem;
}

.infobox table {
    width: 100%;
    border-collapse: collapse;
}

.infobox th {
    text-align: left;
    width: 35%;
    padding: 4px;
    font-variant: all-small-caps;
    color: #54595d;
    vertical-align: top;
    border-bottom: 1px solid #eaecf0;
}

.infobox td {
    padding: 4px;
    vertical-align: top;
    border-bottom: 1px solid #eaecf0;
}

/* --- Footer (Restored to your original layout) --- */
footer[role="contentinfo"] {
    margin-top: 6rem;
    padding: 3rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #eaecf0;
    text-align: center;
    font-size: 0.95rem;
    color: #54595d;
}

/* Ensure footer links pick up the light mode blue by default */
footer[role="contentinfo"] a {
    color: #0645ad;
    text-decoration: none;
}

footer[role="contentinfo"] a:hover {
    text-decoration: underline;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    body {
        font-size: 1.15rem; /* Slightly smaller for mobile screens */
    }
    
    .entry-title {
        font-size: 2.2rem;
    }
    
    .infobox {
        float: none;
        width: 100%;
        margin: 2rem 0;
    }
}

/* ==========================================================================
   DARK MODE - Encyclopedia Slate
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #202122; /* Deep slate baseline */
        color: #eaecf0; /* Soft white for legibility */
    }

    /* Header & Navigation */
    .header-mini {
        background: #2a2a2c;
        border-bottom-color: #404244;
    }
    .mini-link {
        color: #8ab4f8; /* Brighter, highly legible blue */
    }
    .mini-link:hover {
        color: #d2e3fc; /* Icy white-blue on hover */
    }

    /* Headings & Structure */
    .entry-header,
    .entry-content h1,
    .entry-content h2 {
        border-bottom-color: #54595d;
    }
    .entry-title {
        color: #fff;
    }
    .entry-date {
        color: #a2a9b1;
    }

    /* Content Links */
    .entry-content a {
        color: #8ab4f8; 
    }
    .entry-content a:hover {
        color: #d2e3fc; 
    }

    /* Infobox */
    .infobox {
        background-color: #2a2a2c;
        border-color: #54595d;
    }
    .infobox-caption {
        background: #404244;
        color: #eaecf0;
    }
    .infobox th {
        color: #a2a9b1;
        border-bottom-color: #404244;
    }
    .infobox td {
        border-bottom-color: #404244;
    }

    /* Footer (Colors only, layout untouched) */
    footer[role="contentinfo"] {
        background: #2a2a2c;
        border-top-color: #404244;
        color: #a2a9b1;
    }
    footer[role="contentinfo"] a {
        color: #8ab4f8; /* Fixes the invisible links! */
    }
    footer[role="contentinfo"] a:hover {
        color: #d2e3fc;
    }
}