/* styles.css */

/* Variables for theme colors */
:root {
    --primary: #354E36;            /* Forest Green */
    --secondary-dark: #2F3D2E;     /* Moss Green */
    --secondary-light: #637C64;    /* Sage Green */
    --accent: #8A9A84;             /* Greyish Olive */
    --highlight: #F24130;          /* Bright Red */
    --subtle-green: #6B8E23;       /* Olive Drab for subtle attribution text */

    /* Define default value for --hero-background */
    --hero-background: url('img/default-hero.jpg');
}

/* Global Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Nunito Sans', sans-serif;
    background-color: var(--secondary-light);
    color: var(--primary);
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    text-decoration: underline;
}

/* Remove link styles inside flip cards */
.flip-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Navbar Styles */
.navbar {
    position: fixed; /* Fix the navbar at the top */
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--primary); /* Green background */
    color: var(--accent);
    padding: 0.5rem 1rem;
    z-index: 2; /* Ensure the navbar is above other elements */
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-in-out; /* Smooth transition for hiding/showing */
}

.navbar-hidden {
    transform: translateY(-100%); /* Hide navbar by moving it up */
}

.navbar .container {
    display: flex;
    justify-content: space-between; /* Space between menu and lab info */
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
    overflow: hidden;
}

.menu {
    display: flex;
    align-items: center;
    flex-shrink: 1;
}

.menu a {
    color: var(--accent);
    margin-right: 0.5rem;
    white-space: nowrap; /* Prevent wrapping */
}

.menu a:last-child {
    margin-right: 0;
}

.menu a:hover {
    color: var(--highlight);
}

#menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
}

/* Lab Name and Logo Styles */
.lab-info {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.lab-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-right: 0.5rem;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo img {
    max-height: 40px;
    max-width: 100px;
    height: auto;
    width: auto;
    padding: 0.5rem 0;
}

/* Mobile Menu Styles */
@media (max-width: 767px) {
    #menu-toggle {
        display: block;
    }

    .menu {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        background-color: var(--primary);
        width: 100%;
        position: fixed;
        top: 60px; /* Position below the navbar */
        left: 0;
        padding: 1rem;
        z-index: 1;
    }

    .menu a {
        margin: 0.5rem 0;
        color: var(--accent);
    }

    .navbar.active .menu {
        display: flex;
    }

    .navbar .container {
        flex-direction: row;
        justify-content: space-between;
        flex-wrap: wrap; /* Allow wrapping on small screens */
    }

    .lab-info {
        order: 2; /* Move lab info below menu toggle on mobile */
        width: 100%; /* Take full width */
        justify-content: center; /* Center the lab info */
        margin-top: 0.5rem;
    }

    .menu {
        flex-shrink: 0;
    }
}

/* Hero Section Styles */
.hero {
    position: relative;
    height: calc(100vh - 60px); /* Adjust height to account for navbar */
    overflow: hidden;
    margin-top: 60px; /* Push down to avoid overlap with fixed navbar */
}

.hero-content {
    position: relative;
    z-index: 1; /* Ensure content is above the hero image */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%; /* Fill the hero section's height */
    text-align: center;
    color: var(--highlight);
    padding: 0 1rem;
}

.hero-content h1 {
    font-size: 4rem;
    margin: 0;
    text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.7);
}

.hero-content h2 {
    font-size: 2rem;
    margin: 0;
    color: var(--accent);
    text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.7);
}

/* Hero Image Styles */
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.9);
    background-image: linear-gradient(
            rgba(0, 0, 0, 0.4),
            rgba(0, 0, 0, 0.4)
    ), var(--hero-background, none);
    background-size: cover;
    background-position: center;
    z-index: 0;
    transition: opacity 0.5s ease-in-out;
    opacity: 0;
    filter: sepia(60%) hue-rotate(20deg) saturate(70%) contrast(90%);
}

.hero.loaded::before {
    opacity: 1;
}

/* Attribution Styles */
.attribution {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: var(--subtle-green); /* Subtle green color */
    font-size: 0.8rem;
    z-index: 1;
    opacity: 0.8; /* Slightly reduce opacity */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* Improve readability */
}

.attribution a {
    color: var(--subtle-green);
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Section Styles */
.section {
    padding: 4rem 0;
    text-align: center;
}

#people {
    background-color: var(--accent);
    color: var(--primary);
}

#projects {
    background-color: var(--secondary-light);
    color: var(--primary);
}

#spinoffs {
    background-color: var(--primary);
    color: var(--accent);
}

#publications {
    background-color: var(--secondary-dark);
    color: white;
}

/* Common Card Styles */
.card-common-styles {
    flex: 1 0 20vw;
    min-width: 80px;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 20px;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.card-bg-common-styles {
    flex: 1 0 21%;
    max-width: 250px;
    min-width: 80px;
    background-color: var(--secondary-light);
    color: var(--primary);
    border-radius: 10%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 10px auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Grid Styles */
.grid-common {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-evenly;
    align-items: stretch;
    padding: 20px;
}

/* People Grid Styles */

/* People Headshot Styles */
.headshot {
    width: 15vw; /* Use viewport width for responsiveness */
    height: 15vw; /* Maintain aspect ratio to keep images circular */
    max-width: 100px; /* Maximum size for larger screens */
    max-height: 100px; /* Maximum size to match width */
    border-radius: 50%; /* Makes the image circular */
    object-fit: cover; /* Ensures the image fills the container without distortion */
    border: 3px solid var(--primary); /* Optional: border around the image */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Optional: subtle shadow for depth */
}

/* Responsive Adjustments for Mobile Screens */
@media (max-width: 768px) {
    .headshot {
        width: 20vw; /* Adjust width for smaller screens */
        height: 20vw; /* Maintain aspect ratio */
        max-width: 80px; /* Reduce max size on smaller screens */
        max-height: 80px; /* Match width to keep circular shape */
    }
}

@media (max-width: 480px) {
    .headshot {
        width: 30vw; /* Further adjust width for very small screens */
        height: 30vw; /* Maintain aspect ratio */
        max-width: 60px; /* Further reduce max size for very small screens */
        max-height: 60px; /* Match width to keep circular shape */
    }
}

.person h3, .person p {
    white-space: normal;
    overflow-wrap: break-word;
    text-align: center;
    line-height: 1.2;
    margin: 0.5rem 0;
}

/* Project Grid Styles */
.project-grid {
    justify-content: center;
}

.project-border {
    width: 50%;
    height: auto;
    padding: 3px;
    background: var(--highlight);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.project-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: block;
}

.project-title {
    position: relative;
    z-index: 2;
    padding: 16px;
    color: var(--primary);
    flex-grow: 1;
}

.project-card:hover {
    transform: translateY(-10px);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .person {
        flex-basis: 45%;
        max-width: none;
    }
    .headshot {
        width: 50%;
    }
    .flip-card {
        width: 40vw;
        height: 40vw;
    }
    .hero-content h1 {
        font-size: 2.5rem;
    }
    .hero-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .person {
        flex-basis: 90%;
    }
    .headshot {
        width: 60%;
    }
    .flip-card {
        width: 80vw;
        height: 80vw;
    }
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero-content h2 {
        font-size: 1.2rem;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Allow scrolling if content is long */
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.9);
    margin: 2% auto;
    padding: 2rem;
    border: 1px solid #ccc;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    max-height: 90vh; /* Limit the max height */
    overflow-y: auto; /* Enable vertical scrolling if content exceeds max-height */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.modal-headshot {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 1rem;
}

.modal h3 {
    margin-top: 0;
    color: var(--primary);
}

.modal p {
    color: var(--secondary-dark);
    white-space: normal;    /* Allow normal white-space handling */
    overflow: visible;      /* Ensure overflow is visible */
    text-overflow: clip;    /* Prevent text-overflow ellipsis */
    margin-bottom: 1rem;
}

.modal p:last-child {
    margin-bottom: 0;
}

/* Project Modal Image */
.modal-project-image {
    max-width: 100%; /* Ensure the image doesn't exceed the modal width */
    height: auto; /* Maintain aspect ratio */
    object-fit: cover; /* Ensures the image covers the container without distortion */
    border-radius: 5px; /* Optional: adds rounded corners */
    margin-bottom: 1rem; /* Adds space below the image */
}

/* Responsive Adjustments for Smaller Screens */
@media (max-width: 768px) {
    .modal-project-image {
        max-width: 90%; /* Slightly reduce the max-width on smaller screens */
        height: auto; /* Maintain aspect ratio */
    }
}

@media (max-width: 480px) {
    .modal-project-image {
        max-width: 80%; /* Further reduce the max-width on very small screens */
        height: auto; /* Maintain aspect ratio */
    }
}

/* Modal Social Icons */
.modal-content .social-icons {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.modal-content .social-icons a {
    font-size: 1.2rem;
    color: var(--primary);
    margin-right: 0.5rem;
    transition: color 0.3s;
}

.modal-content .social-icons a:hover {
    color: var(--highlight);
}

.modal-content .social-icons .social-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.modal-content .social-icons a:last-child {
    margin-right: 0;
}

/* Close Button Styling */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    margin-left: 20px;
}

.close:hover,
.close:focus {
    color: #000;
    cursor: pointer;
    text-decoration: none;
}

/* Spinout Section Styles */
.spinoff-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    justify-content: center;
    align-items: center;
}

.flip-card {
    background-color: transparent;
    perspective: 1000px;
    width: 25vw;
    height: 25vw;
    max-width: 200px;
    max-height: 200px;
    margin: 2rem;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 15px;
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
}

.flip-card-front {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background-color: var(--primary);
}

.flip-card-back {
    background: var(--primary);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
    transform: rotateY(180deg);
}

.flip-card-back h3 {
    margin-bottom: 0.5rem;
}

.flip-card-back p {
    font-size: 0.9rem;
    padding: 0 1rem;
}

.flip-card-front img {
    width: calc(100% - 20px);
    height: auto;
    object-fit: contain;
    border-radius: 10%;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.flip-card a:hover {
    text-decoration: none;
}

/* Footer Styles */
.footer {
    background-color: var(--primary); /* Adjust background to your primary theme color */
    color: var(--accent); /* Text color for the footer */
    padding: 1rem 0;
    text-align: center;
}

.footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Social Icons Styles */
.social-icons {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.social-icons a {
    color: var(--accent); /* Set initial color */
    font-size: 1.5rem; /* Icon size */
    transition: color 0.3s ease;
}

.social-icons a:hover {
    color: var(--highlight); /* Hover color effect */
}

.footer-text {
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .social-icons {
        gap: 0.5rem;
    }
}