:root {
    --margin-page: 2em;
    --ui-primary: #000;
    --ui-secondary: #6b7280;
    --link-color: #0056b3;
    --link-hover: #003d80;
    --bg-color: #fdfdfd;
    --border-color: #eee;
    --header-color: #444;
}

html {
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.6;
    margin: 0;
    padding: 0 var(--margin-page, 20px);
    color: var(--ui-primary, #000);
    text-wrap: pretty;
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    max-width: 70em;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 3em;
    flex: 1;
}

p {
    margin: 0 0 1.5em;
}

a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
    transition: color 0.2s, text-decoration-style 0.2s;
}

a:hover {
    text-decoration-style: dotted;
    color: var(--link-hover);
}

h1 {
    font-size: clamp(3em, 4vw, 4.5em);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-wrap: balance;
    font-family: 'Chakra Petch', 'Courier New', Courier, monospace;
    font-weight: 500;
    padding: 0.5em 0;
    color: #333;
    margin: 0;
}

h2 {
    font-size: 1.8em;
    font-weight: 700;
    margin: 0.2em 0 1em;
    text-wrap: balance;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
    padding-left: 0;
    color: var(--header-color);
}

section {
    max-width: 70em;
    margin: 2.5em auto;
    padding: 0 1rem;
}

section:last-of-type {
    margin-bottom: 1em; /* Reduce from 2.5em to 1em */
}

.header {
    padding-block: 25px 10px;
}

.header-content-align {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    max-width: 70em;
    margin: 0 auto;
    padding: 0 1rem;
    gap: 20px;
}

.header-content-align h1 {
    margin-right: auto;
    margin-top: 10px;
    padding: 0.2em 0 0.1em 0;
}

.profile-pic-container {
    flex-shrink: 0;
    margin-top: 10px;
}

.profile-pic {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    transition: transform 0.3s ease;
}

.profile-pic:hover {
    transform: scale(1.05);
}

.profile-section {
    max-width: 70em;
    margin: 0 auto;
    padding: 0 1rem;
}

.about-me-text {
    flex-grow: 1;
    text-align: left;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.about-me-text p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.research-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.2rem;
    padding-left: 1.5rem;
}

.research-list li {
    margin-bottom: 0.1rem; /* Add small bottom margin to list items */
}

.contact-icons {
    margin-top: 1em;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-icons li {
    margin-bottom: 0.5em;
}

.contact-icons a {
    text-decoration: none;
    font-weight: bold;
    color: #0077cc;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.contact-icons a:hover {
    text-decoration: underline;
    background-color: #f0f8ff;
    color: #005fa3;
}

.footer {
    text-align: center;
    margin: 1em 0 1.5em; /* Reduce top margin from 3em to 1em */
    font-size: 0.9em;
    color: #555;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

@media(prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

@media(max-width:750px) {
    :root {
        --margin-page: 1.333em;
    }
    .header-content-align {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        align-items: center;
    }
    .profile-pic-container {
        order: -1;
    }
    .header-content-align h1 {
        text-align: center;
        margin-right: 0;
    }
    h1 {
        font-size: 2.5em;
    }
    h2 {
        font-size: 1.5em;
    }
    .research-list {
        grid-template-columns: 1fr;
    }
    .contact-icons {
        gap: 1rem;
    }
}