/* --- CSS Variable Mapping --- */
/* These variables are populated by the class set on the <body> tag in templates/index.html */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Header & Navigation --- */
header {
    background-color: var(--header-bg);
    color: #ffffff;
    height: 90px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.header-container {
    max-width: 1100px;
    width: 90%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    color: #ffffff;
}

.brand img {
    height: 42px;
    width: auto;
    /* Inverts black logo to white for dark headers; 
       removes filters if you switch to a light-header palette */
    filter: brightness(0) invert(1);
}

.brand-text h1 {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.15em;
    /* Premium Wordmark Kerning */
    text-transform: uppercase;
    line-height: 1;
}

.brand-text p {
    font-size: 0.75rem;
    margin: 4px 0 0 0;
    opacity: 0.7;
    font-weight: 300;
    letter-spacing: 0.02em;
}

nav {
    display: flex;
    align-items: baseline;
    /* Baseline alignment for technical rigor */
}

nav a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 32px;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

nav a:hover {
    color: var(--accent-color);
    /* Uses the specific palette's accent */
}

/* --- Main Content Layout --- */
.content-wrapper {
    max-width: 850px;
    margin: 80px auto;
    padding: 0 30px;
}

h1 {
    font-size: 2.6rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.6rem;
    margin-top: 60px;
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 10px;
}

.intro-lead {
    font-size: 1.35rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 50px;
    max-width: 90%;
    line-height: 1.5;
}

/* --- Geometric List Styling --- */
ul {
    list-style: none;
    padding-left: 0;
    margin-top: 30px;
}

li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 25px;
    /* Forces the entire line (bold + normal) to justify together */
    text-align: justify;
    text-justify: inter-word;
}

li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background-color: var(--bullet-color);
    transform: rotate(45deg);
}

/* 1. FORCE ALL BOLD TEXT TO BE INLINE (This fixes the bibliography) */
li strong,
li b,
strong,
b {
    display: inline !important;
    font-size: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 2. ONLY TURN THE FIRST BOLD ITEM INTO A HEADER IF WRAPPED IN THE DIV */
.specializations li strong:first-of-type,
.specializations li b:first-of-type {
    display: block !important;
    font-size: 1.15rem !important;
    margin-bottom: 6px !important;
}

/* Global Bold Rule: Inline and "contents" to prevent justification gaps */
strong,
b {
    color: var(--text-main);
    font-weight: 700;
    font-size: inherit !important;
    display: contents;
    /* Essential for seamless justification */
}

/* Specific Override for Landing Page Specializations: 
   Wrap the specializations list in <div class="specializations"> in your markdown. */
.specializations li>strong:first-of-type {
    display: block;
    font-size: 1.15rem !important;
    margin-bottom: 6px;
}

/* Updated to keep bold text within the paragraph flow */
li strong {
    color: var(--text-main);
    display: inline;
    font-size: inherit;
}

/* Ensures the first bold item (the header) still behaves like a title */
li strong:first-of-type {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 6px;
}

/* --- Links & Interaction --- */
a {
    color: var(--text-main);
    transition: opacity 0.2s;
}

.content-wrapper a {
    text-decoration: underline;
    text-underline-offset: 4px;
}

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

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

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 20px 0;
        text-align: center;
    }

    .brand {
        flex-direction: column;
        gap: 10px;
    }

    nav {
        margin-top: 20px;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    nav a {
        margin: 0 10px;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Standardizing bold text size */
strong,
b {
    font-size: inherit !important;
    font-weight: 700;
    /* The following lines ensure seamless justification: */
    display: inline;
    white-space: normal;
    word-spacing: inherit;
    letter-spacing: inherit;
}

/* Specific fix for bold text inside lists if headers are bleeding in */
li strong,
li b {
    font-size: inherit !important;
}

/* Justify body text for a clean, structural look */
section,
p,
li {
    text-align: justify;
    hyphens: auto;
    /* Highly recommended with justification */
    text-justify: inter-word;
}