/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #111; /* Darker text for better visibility */
    background-color: #f9f9f9;
    font-size: 17px; /* Slightly larger base size */
    -webkit-font-smoothing: antialiased;
}

a {
    color: #8C1515; /* Stanford Cardinal - WCAG AA compliant against white */
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #5e0e0e;
    text-decoration: underline;
}

/* Layout Wrapper */
.wrapper {
    display: flex;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    box-shadow: 0 0 30px rgba(0,0,0,0.03);
    align-items: flex-start; /* Required for sticky sidebar to work properly */
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    padding: 60px 30px 50px; /* Increased top padding for alignment */
    background-color: #fff;
    border-right: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    text-align: center;
    
    /* Sticky Positioning */
    position: sticky;
    top: 0;
    height: 100vh; /* Full viewport height */
    overflow-y: auto; /* Allows scrolling within sidebar if content is too tall */
}

.profile-image {
    width: 100%; /* Full width of sidebar padding area */
    max-width: 260px; /* Cap the max width */
    height: auto; /* Maintain aspect ratio */
    aspect-ratio: 4 / 6;
    object-fit: cover;
    border-radius: 8px; /* Slight rounding, not circle */
    margin: 0 auto 25px;
    border: none; /* Remove thick white border if preferred, or keep minimal */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: block;
}

.sidebar h1 {
    font-family: 'Merriweather', serif;
    font-size: 28px; /* Larger Name */
    font-weight: 900; /* Extra Bold */
    color: #000; /* Pure Black */
    margin-bottom: 10px;
    line-height: 1.2;
}

.affiliation {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 17px;
    color: #444; /* Darker gray */
    font-weight: 600; /* Semi-bold */
    margin-bottom: 5px; /* Reduced to match top margin of email */
    line-height: 1.4;
}

.contact-info {
    margin-bottom: 20px;
}

.email {
    font-family: 'Source Sans Pro', monospace;
    font-size: 15px;
    color: #8C1515;
    margin-bottom: 20px;
    margin-top: 20px; /* Equal spacing above and below */
    font-weight: 700; /* Bold email */
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px; /* More space between icons */
    font-size: 18px; /* Larger icons */
}

.social-links a {
    color: #555;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.social-links a:hover {
    color: #8C1515;
    text-decoration: none;
    transform: translateY(-2px); /* Subtle lift on hover */
}

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 60px 50px;
}

section {
    margin-bottom: 60px;
}

/* Aligning the top of the first h2 with the sidebar content/image visually */
#about h2 {
    margin-top: 0; /* Ensure no top margin pushes it down */
}

h2 {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 22px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 800;
    color: #8C1515;
    margin-bottom: 20px; /* Reduced margin */
    padding-bottom: 8px; /* Reduced padding */
    border-bottom: 3px solid #f0f0f0;
    line-height: 1.3;
}

/* Bio */
.bio p {
    margin-bottom: 20px; /* Reduced spacing */
    font-size: 19px;
    line-height: 1.7; /* Tighter line height */
    color: #000;
    max-width: 720px;
    font-weight: 400;
}

/* Publications */
.publication-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.pub-entry {
    display: flex;
    gap: 15px;
}

.pub-title {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 20px; /* Large title */
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.35;
    color: #000;
}

.pub-title a {
    color: #222;
    text-decoration: none;
}

.pub-title a:hover {
    color: #8C1515;
}

.pub-authors {
    font-size: 16px;
    color: #555; /* Lighter gray so bold name stands out */
    margin-bottom: 8px;
    line-height: 1.5;
}

.pub-venue {
    font-size: 15px; /* Larger venue text */
    font-weight: 700; /* Bolder venue */
    color: #8C1515;
    margin-right: 10px;
    display: inline-block;
}

.pub-links {
    display: inline-block;
    font-size: 13px;
}

.pub-links a {
    margin-right: 12px;
    font-weight: 700; /* Bolder links */
    text-transform: uppercase;
    font-size: 13px; /* Slightly larger */
    letter-spacing: 0.5px;
}

/* Teaching Grid Layout - Improved Alignment */
.teaching-grid {
    display: flex;
    flex-direction: column;
    gap: 0; /* Remove gap to rely on border/padding */
}

.teaching-item {
    display: grid;
    grid-template-columns: 260px 1fr; /* Fixed width for left column ensures perfect alignment */
    align-items: start; /* Align top for multiline content */
    padding: 18px 0;
    border-bottom: 1px solid #f0f0f0;
}

.teaching-item:first-child {
    padding-top: 0;
}

.teaching-item:last-child {
    border-bottom: none;
}

.course-role {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.course-role .role {
    font-weight: 700;
    color: #111; /* Unified Color */
    font-size: 16px;
}

.course-role .term {
    font-size: 14px;
    color: #666;
    font-style: italic;
    font-family: 'Source Sans Pro', sans-serif;
}

.course-info {
    color: #333; /* Unified body color */
    padding-top: 0;
}

/* Matching Coursework Styling for Teaching */
.course-code {
    font-weight: 400; /* Normal weight */
    color: #333;
    margin-right: 8px;
    display: inline-block;
    min-width: 70px;
}

.course-name {
    color: #111;
    font-weight: 400; /* Normal weight */
    font-size: 16px;
}

/* Coursework Grid */
.coursework-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.category-col h3 {
    font-size: 17px; /* Larger */
    font-weight: 800;
    text-transform: none; /* Match h2 style */
    letter-spacing: normal;
    color: #000;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.course-list {
    list-style: none;
}

.course-list li {
    font-size: 17px;
    color: #111;
    margin-bottom: 6px; /* Reduced from 10px */
    padding-left: 15px;
    position: relative;
    font-weight: 500;
}

.course-list li::before {
    content: "›";
    color: #8C1515;
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    top: -1px;
}

/* Footer */
footer {
    margin-top: 80px;
    padding-top: 30px;
    border-top: 1px solid #eee;
    color: #aaa; /* Softer footer text */
    font-size: 13px;
}

/* Responsive Design */
@media (max-width: 850px) {
    .wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 40px 20px;
        /* Reset sticky on mobile so it scrolls normally */
        position: static;
        height: auto;
    }
    
    .main-content {
        padding: 40px 25px;
    }

    .profile-image {
        width: 150px;
        height: 150px;
    }
    
    .coursework-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .teaching-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .course-code {
        min-width: auto;
    }
}
