/* ===================================================================
   Modern Stylesheet for the CRAG Lab Website
   =================================================================== */

/* --- 1. General & Base Styles --- */
body {
    margin: 0;
    font-family: 'Lato', sans-serif;
    color: #333;
    line-height: 1.6;
    
    /* --- Background Image Styles --- */
    background-color: #e6ebea; /* Fallback color if image fails to load */
    background-image: url('images/NereaRuiz_02.png');
    background-attachment: fixed; /* Keeps the image stationary on scroll */
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover; /* Responsively covers the entire background */
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4 {
    font-family: 'Roboto Slab', serif;
    color: #2c3e50;
}

main {
    padding: 40px 0;
}

.page-section {
    background: #ffffff;
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

h1.section-title {
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    margin-top: 0;
}

/* --- 2. Header & Navigation --- */
.site-header {
    background-color: #ffffff;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area img {
    max-height: 60px;
}

.lab-title h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #2c3e50;
}

.lab-title h2 {
    font-size: 1rem;
    margin: 0;
    font-weight: 400;
    color: #7f8c8d;
}

.main-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.main-nav a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #ffffff; /* White text */
    font-weight: 700;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    background-color: #2c3e50; /* Dark blue-gray from footer */
    border: 1px solid rgba(255, 255, 255, 0.2); /* Subtle light edge */
}


.main-nav a.current,
.main-nav a:hover {
    background-color: #3498db;
    color: #ffffff;
}

/* --- 3. Page-Specific Styles --- */

/* 3.1 Homepage & Research Topics */
.welcome-section, .research-topic {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}
.welcome-section .text-content { flex: 3; min-width: 300px; }
.welcome-section .image-content { flex: 2; min-width: 300px; text-align: center; }
.welcome-section img, .research-topic img { max-width: 100%; height: auto; border-radius: 8px; }

.research-topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.topic-card { border: 1px solid #eee; border-radius: 8px; padding: 20px; display: flex; flex-direction: column; }
.topic-card p { flex-grow: 1; }
.button { display: inline-block; background-color: #333; color: #fff; padding: 10px 20px; text-decoration: none; border-radius: 5px; text-align: center; margin-top: 15px; }
.button:hover { background-color: #555; }

.research-topic { margin-top: 40px; padding-top: 40px; border-top: 1px solid #eee; }
.research-topic:first-of-type { margin-top: 20px; padding-top: 0; border-top: none; }
.research-topic .text-content { flex: 1; }
.research-topic .image-content { flex: 1; }
.research-topic:nth-child(even) { flex-direction: row-reverse; }

/* 3.2 Publications Page */
.publication-year { font-size: 2rem; color: #3498db; border-bottom: 2px solid #eee; padding-bottom: 10px; margin: 40px 0 20px 0; }
.publication-entry { margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid #f0f0f0; }
.publication-entry:last-child { border-bottom: none; }
.pub-authors { font-size: 0.95rem; color: #555; }
.pub-title { font-size: 1.1rem; font-weight: 700; }
.pub-title a { text-decoration: none; color: #2c3e50; }
.pub-title a:hover { text-decoration: underline; color: #3498db; }
.pub-citation { font-size: 1rem; color: #7f8c8d; }
.pub-citation em { font-style: normal; font-weight: bold; }
.search-container { margin-bottom: 30px; }
#pub-search { width: 100%; padding: 12px 15px; font-size: 1rem; border: 2px solid #ddd; border-radius: 5px; box-sizing: border-box; }
#pub-search:focus { outline: none; border-color: #3498db; }

/* 3.3 Members Page */
.team-section { margin-top: 50px; }
.team-section:first-child { margin-top: 0; }
.pi-card { display: flex; flex-wrap: wrap; gap: 30px; padding: 25px; background-color: #fdfdfd; border: 1px solid #eee; border-radius: 8px; margin-bottom: 25px; }
.pi-image { flex: 0 0 220px; text-align: center; }
.pi-image img { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; border: 4px solid #f0f0f0; }
.pi-image h2 { margin: 10px 0 5px 0; font-size: 1.4rem; }
.pi-details { flex: 1; min-width: 300px; }
.pi-details h3 { margin-top: 0; border-bottom: 2px solid #3498db; padding-bottom: 5px; }
.pi-links { margin-top: 20px; display: flex; gap: 15px; flex-wrap: wrap; }
.pi-links a { background-color: #34495e; color: white; padding: 8px 15px; border-radius: 5px; text-decoration: none; font-size: 0.9rem; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 25px; }
.member-card { background-color: #fdfdfd; border: 1px solid #eee; border-radius: 8px; padding: 20px; text-align: center; }
.member-card img { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; margin-bottom: 15px; }
.member-card h4 { margin: 0 0 5px 0; font-size: 1.2rem; }
.member-card .member-role { font-size: 1rem; color: #777; }

/* 3.4 Gallery & News Page */
.album { margin-bottom: 50px; }
.album h2 { margin-top: 0; border-bottom: 2px solid #eee; padding-bottom: 10px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.gallery-item { display: block; overflow: hidden; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.gallery-item img, .gallery-item video { display: block; width: 100%; height: 200px; object-fit: cover; transition: transform 0.3s ease; }
.gallery-item:hover img, .gallery-item:hover video { transform: scale(1.05); }
.news-item { padding: 25px 0; border-bottom: 1px solid #eee; }
.news-item:first-of-type { padding-top: 0; }
.news-item:last-of-type { border-bottom: none; }
.news-date { font-size: 0.9rem; color: #7f8c8d; }
.news-title { margin: 5px 0 10px 0; }
.news-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 15px; }
.news-gallery .gallery-item img { height: 120px; }

/* 3.5 Links Page */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.link-card { background-color: #fdfdfd; border: 1px solid #eee; border-radius: 8px; padding: 20px; display: flex; flex-direction: column; }
.link-card h3 { margin-top: 0; font-size: 1.2rem; }
.link-card p { flex-grow: 1; color: #555; }
.link-card a { display: block; margin-top: 10px; padding: 10px; background-color: #f0f0f0; border-radius: 5px; text-decoration: none; color: #3498db; font-weight: bold; }
.link-card a:hover { background-color: #e0e0e0; }
.link-card a::after { content: ' →'; }

/* 3.6 Contact Page */
.contact-layout { display: flex; flex-wrap: wrap; gap: 40px; }
.contact-info, .contact-form-container { flex: 1; min-width: 320px; }
.map-container { position: relative; overflow: hidden; padding-top: 75%; margin-top: 20px; border-radius: 8px; }
.map-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 700; }
.form-group input, .form-group textarea { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 5px; font-size: 1rem; box-sizing: border-box; }
.submit-btn { display: inline-block; background-color: #3498db; color: white; padding: 12px 25px; border: none; border-radius: 5px; font-size: 1rem; cursor: pointer; }

/* --- 4. Lightbox (For Gallery/News) --- */
.lightbox { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.85); justify-content: center; align-items: center; }
.lightbox-content { position: relative; max-width: 90vw; max-height: 80vh; }
.lightbox-content img { width: 100%; height: 100%; object-fit: contain; }
.lightbox-close, .lightbox-prev, .lightbox-next { position: absolute; color: white; font-size: 40px; cursor: pointer; }
.lightbox-close { top: 15px; right: 35px; }
.lightbox-prev { left: 15px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 15px; top: 50%; transform: translateY(-50%); }
.lightbox-caption { text-align: center; color: #ccc; padding: 15px 0; }

/* --- 5. Footer --- */
.site-footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px 0;
    font-size: 0.9rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}
.footer-grid h3 {
    color: #ffffff;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}
.footer-grid ul { padding: 0; list-style: none; }
.footer-grid a { color: #ecf0f1; text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    font-size: 0.8rem;
}

/* --- 6. Responsive Adjustments --- */
@media (max-width: 768px) {
    .header-content, .welcome-section, .research-topic, .research-topic:nth-child(even) {
        flex-direction: column;
        text-align: center;
    }
}

/* 3.7 Members Page - Alumni List */
.alumni-list ul {
    padding: 0;
    list-style: none;
    -webkit-column-count: 3; /* For Safari and Chrome */
    -moz-column-count: 3;    /* For Firefox */
    column-count: 3;         /* Standard syntax */
    -webkit-column-gap: 30px;
    -moz-column-gap: 30px;
    column-gap: 30px;
}

.alumni-list li {
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
    break-inside: avoid-column;
    page-break-inside: avoid;
}

.alumni-category-title {
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* Responsive adjustments for the alumni list */
@media (max-width: 768px) {
    .alumni-list ul {
        -webkit-column-count: 2;
        -moz-column-count: 2;
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .alumni-list ul {
        -webkit-column-count: 1;
        -moz-column-count: 1;
        column-count: 1;
    }
}

.pi-email a {
    color: inherit; /* Makes the link color match the surrounding text */
    text-decoration: none; /* Removes the default underline */
}

.pi-email a:hover {
    color: #3498db; /* Changes color to the site's main blue on hover */
    text-decoration: underline;
}
.social-links svg {
    width: 24px;  /* Reduced from 28px */
    height: 24px; /* Reduced from 28px */
    fill: #ecf0f1;
    transition: fill 0.3s, transform 0.3s;
}