:root {
    --primary-color: #d0e3fd;
    --secondary-color: #dccae4;
    --text-color: #1c2833;
    --border-color: #583f99;
}

body {
    font-family: 'Merriweather', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--primary-color);
    margin: 0;
    padding: 0;
    scroll-margin-top: 70px; /* Adjusted for sticky header */
}

html {
    scroll-behavior: smooth;
}

.container {
    width: 80%;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: var(--secondary-color);
    padding: 0.1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 50px;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center; /* Vertically align items for consistent look */
    height: 100%;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    font-weight: bold;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

h1,
h2,
h3,
h4 {
    margin-bottom: 0rem; /* Original: 0rem, consider 0.5em or 1em if more space is needed */
    margin-top: 0; /* Added for consistency */
}

.section h2,
.section h3,
.section h4 { /* More specific targeting for headings within sections */
    margin-top: 1rem; /* Add some space above headings in sections */
    margin-bottom: 0.5rem; /* Space below headings */
}
.section h2:first-child, /* No top margin for the first heading in a section */
.section h3:first-child,
.section h4:first-child {
    margin-top: 0;
}


img.profile {
    width: 100px;
    height: auto;
    border-radius: 0;
    float: left;
    margin-right: 2rem;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.social-links a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0.3rem;
    padding: 0.3rem 0.3rem;
    background-color: var(--secondary-color);
    border-radius: 5px;
    transition: background-color 0.3s;
}

.social-links a:hover {
    background-color: #f5eef8;
}

.section {
    margin-bottom: 3rem;
    clear: both;
    padding: 2rem;
    background-color: var(--secondary-color);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    scroll-margin-top: 70px; /* Ensures content below sticky header is visible on jump */
}

.section-divider {
    margin: 5rem 0;
    border-bottom: 2px solid var(--border-color);
    opacity: 0.3;
}

.subsection-divider {
    width: 50%;
    margin: 2rem auto;
    border-bottom: 1px solid var(--border-color);
    opacity: 0.4;
}

hr {
    border: none;
    border-top: 1px solid var(--secondary-color);
    margin: 2rem 0;
}

a {
    color: var(--text-color);
    text-decoration: underline;
    transition: text-decoration 0.3s ease;
}

a:hover {
    text-decoration: none;
}

/* Styles for #top section */
#top {
    display: flex;
    align-items: center;
    padding: 2rem;
    background-color: var(--secondary-color);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Prevents content from breaking out */
}

#top .logo-container {
    flex: 0 0 auto;
    width: 100px;
    margin-right: 2rem;
}

#top img.profile { /* Overrides general img.profile for #top if needed */
    width: 100%;
    height: auto;
    display: block; /* Removes potential extra space below image */
    max-width: 100%;
    /* Resetting float and margins if they were previously set on general img.profile */
    float: none;
    margin-right: 0;
    margin-bottom: 0;
}

#top .content {
    flex: 1;
}

#top h1 {
    margin-top: 0;
    font-size: calc(1.2rem + 1vw);
}

#top h2 {
    font-size: calc(0.9rem + 0.5vw);
    margin-top: 0.25rem; /* Small space between h1 and h2 in #top */
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    body {
         scroll-margin-top: 120px; /* Adjust scroll margin for potentially taller header on mobile */
    }
    .container {
        width: 95%;
    }

    header {
        height: auto; /* Allow header to grow if nav links wrap or stack */
        padding-bottom: 0.5rem; /* Add some padding at the bottom if nav items stack */
    }
    nav {
        flex-direction: column;
        align-items: center;
    }

    nav a {
        padding: 0.8rem 1rem;
        margin: 0.3rem 0;
        width: 80%;
        text-align: center;
        box-sizing: border-box;
    }

    .section {
        scroll-margin-top: 120px; /* Match body's scroll-margin for mobile */
    }

    img.profile { /* General rule for mobile, might be overridden by #top img.profile */
        float: none;
        display: block;
        margin: 0 auto 1rem;
    }

    #top {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    #top .logo-container {
        margin-right: 0;
        margin-bottom: 1rem;
        width: 80px;
    }

    #top img.profile { /* Specific for #top on mobile */
        margin: 0 auto 1rem; /* Center if it's part of the flex column now */
    }

    #top h1 {
        font-size: calc(1rem + 1vw);
    }

    #top h2 {
        font-size: calc(0.8rem + 0.5vw);
    }
}

