:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --background-color: #f8f8f8;
    --text-color: #000;
    --heading-font: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
    --max-width: 1200px;
    --side-padding: 1rem;
}

body {
    font-family: 'Crimson Text', serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    font-size: 1.2rem;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "kern";
    -moz-font-feature-settings: "kern";
    font-feature-settings: "kern";
}

h1, h2, h3, h4, h5, h6, header a, nav ul li a {
    font-family: var(--heading-font);
    letter-spacing: -0.02rem;
/*    font-stretch: semi-condensed;*/
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0; /* Changed from 1rem to 1rem 0 */
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--side-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

nav ul {
    list-style-type: none;
    display: flex;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

main {
    max-width: var(--max-width);
    margin: 2rem auto;
    padding: 0 var(--side-padding);
}

#intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.left-content {
    flex: 2;
    margin-right: 2rem;
}

.right-content {
    flex: 1;
}

.name-and-social {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.profile-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 3;
    object-fit: cover;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--secondary-color);
    font-size: 1.5rem;
}

.bio {
    font-size: 1.5rem;
    margin-bottom: 0;
}

h2 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    font-weight: 600;
}

article {
    margin-bottom: 2rem;
}

h3 {
    color: var(--primary-color);
    font-weight: 600;
}

footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

/* Shared styles for sections */
.section-title {
    font-size: 1.5rem;
    color: #000;
    border-bottom: 1px solid #ff0000;
    padding-bottom: 0.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.section-item {
    margin-bottom: 0;
}

.section-details {
    overflow: hidden;
    max-height: 0; /* Start with max-height of 0 */
    padding: 0 1rem; /* Keep padding for animation smoothness */
    background: white;
    transition: max-height 0.5s ease, padding 0.5s ease; /* Animate max-height and padding */
}

.section-item:target .section-details {
    max-height: 500px; /* Adjust this value based on your content's needs */
    padding: 1rem; /* Restore padding when expanded */
}

.section-item:target .section-details {
    display: block;
}

.section-details p {
    margin-top: 0;
}

.section-details ul {
    padding-left: 1.2rem;
}

.section-item-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    cursor: pointer; /* Add this to indicate clickability */
}

.section-item-title h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}

.section-item-title em, .location {
    font-style: italic;
}

.section-item-title .date {
    font-style: normal;
}

/* Specific styles for the sections */
#experience, #projects {
    font-family: 'Crimson Text', serif;
}

/* Background images for each project */
#project8 { background-image: url('imgs/flfl.jpeg'); }
#project7 { background-image: url('imgs/cs224n_project.jpeg'); }
#project6 { background-image: url('imgs/cs229_project.jpeg'); }
#project5 { background-image: url('imgs/allegorical_lisp_machine.jpeg'); }
#project4 { background-image: url('imgs/7guis.jpeg'); }
#project3 { background-image: url('imgs/flow_browser.jpeg'); }
#project2 { background-image: url('imgs/hikari_cornell_2.jpeg'); }
#project1 { background-image: url('imgs/math.c_trig.jpeg'); }

.project {
    background-size: cover;
    background-position: center;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.5s ease;
}

.project-link {
    display: block;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    color: #333;
    position: relative;
    min-height: 80px;
    display: flex;
    flex-direction: column;
}

.project-link p {
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-link::after {
    content: '';
    position: absolute;
    right: 1rem;
    bottom: 1.75rem;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
}

.section-item:target .project-link::after {
    transform: rotate(45deg);
}

.project:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.project-link h3 {
    margin: 0;
}

.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    #intro {
        flex-direction: column;
    }

    .left-content, .right-content {
        width: 100%; /* Ensure full width coverage */
        order: 0; /* Reset order to default for left content */
    }

    .right-content {
        order: 1; /* Higher order value moves the photo to the bottom */
        margin-top: 1rem; /* Add some space above the photo */
    }

    .project-list {
        grid-template-columns: 1fr; /* Stack projects in a single column */
    }

    h1, h2, h3 {
        font-size: 1.5rem; /* Adjust heading sizes for readability */
    }

    .section-item-title h3, .project-link h3 {
        font-size: 1rem; /* Adjust project title sizes */
    }

    .section-details p, .project-link p {
        font-size: 0.9rem; /* Adjust paragraph text sizes for details */
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }

    header a {
        display: block; /* Hide the main title link on smaller screens */
    }

    nav ul {
        flex-direction: row; /* Align nav items horizontally */
        width: 100%; /* Ensure nav items utilize the full width */
        justify-content: flex-start; /* Align nav items to the left */
        padding-top: 0.5rem; /* Add a little space between the hidden title and the nav links */
    }

    nav ul li {
        display: inline; /* Align nav items in a row */
    }

    nav ul li a {
        padding-right: 20px; /* Add spacing between nav links */
    }
}
