
:root {
    --bg-primary: #232A34; /* Dark Navy Blue */
    --bg-secondary: #2C3440; /* Slightly lighter navy for cards */
    --text-primary: #F5F5F5; /* Off-white */
    --text-secondary: #a9b3c1; /* Lighter gray for subtitles */
    --accent: #00C49B; /* Bright Green */
    --border-light: #3a4450;
    --header-height: 70px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Lora', serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.7;
    font-size: 16px;
    overflow-x: hidden;
    width: 100%;
}

/* Accessibility */
.skip-to-main {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--accent);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 9999;
}

.skip-to-main:focus {
    left: 20px;
    top: 20px;
    width: auto;
    height: auto;
    overflow: visible;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; margin-bottom: 40px; text-align: center; }
h3 { font-size: 1.5rem; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #00e6b8; /* Lighter green on hover */
}

section {
    padding: 100px 20px;
    max-width: 1100px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    border-bottom: 1px solid var(--border-light);
}
section:last-of-type {
    border-bottom: none;
}


section.visible {
    opacity: 1;
    transform: translateY(0);
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}


/* Header */
header {
    background-color: rgba(35, 42, 52, 0.85); /* var(--bg-primary) with opacity */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

header .logo {
    font-weight: 700;
    font-size: 1.5em;
    color: var(--accent); /* Green logo */
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 30px;
}

.nav-menu a {
    font-family: 'Lato', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}
.nav-menu a:hover {
    color: var(--accent);
}


/* Hero Section */
#home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align content to the left */
    text-align: left;
    padding-top: var(--header-height);
    padding-left: 10%; /* Add some padding to the left */
    border-bottom: none;
    background: linear-gradient(rgba(35, 42, 52, 0.8), rgba(35, 42, 52, 0.8)), url('images/joel_standing.jpeg') no-repeat top center/cover;
    position: relative;
}

.hero-content {
    max-width: 50%; /* Ensure content doesn't overlap with the subject in the image */
}

.hero h1 {
    margin-bottom: 20px;
    font-size: 4rem; /* Larger font size for impact */
}

.hero h1 span.degree {
    font-size: 60%;
    font-weight: normal;
    vertical-align: baseline; /* Remove superscript */
    color: inherit; /* Set color to parent color */
}

.hero h2 {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 1.5rem;
    max-width: 600px;
    margin: 0 0 30px 0; /* Adjust margin */
    color: var(--text-secondary);
    text-align: left;
}

.cta-button {
    display: inline-block;
    background-color: var(--accent);
    color: #ffffff;
    padding: 15px 30px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.cta-button:hover {
    background-color: #00e6b8;
    color: #ffffff;
    transform: translateY(-2px);
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 60px;
    align-items: center;
}

.headshot {
    width: 100%;
    max-width: 250px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 3px solid var(--border-light);
}

.bio p {
    margin-bottom: 1.5em; /* Add spacing between paragraphs */
}

.bio p:last-child {
    margin-bottom: 0; /* Remove margin from the last paragraph */
}

/* Experience Section */
#experience {
    background-color: var(--bg-secondary);
}

.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
    justify-items: center; /* Center items within their grid cell */
    align-items: start; /* Align to start so logos align */
    gap: 50px 28px; /* Larger row gap to accommodate text wrapping */
    margin-top: 28px;
}

.logo-item {
    display: grid;
    grid-template-rows: 91px 1fr; /* Logo wrapper (84px) + gap (7px) */
    justify-items: center;
    align-items: start;
    min-height: 126px; /* Minimum height, allows for expansion */
    gap: 7px;
}

.logo-img-wrapper {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background-color: #ffffff;
    padding: 10.5px;
    box-shadow: 0 3.5px 10.5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-name {
    display: block;
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    text-align: center;
    color: var(--text-secondary);
    min-height: 28px; /* Minimum height, allows for expansion */
    width: 100%; /* Ensure the container takes the full width */
    line-height: 1.3; /* Better line spacing for wrapped text */
}

.google-x-logo .logo-img-wrapper {
    padding: 17.5px;
}

.logo-item a {
    text-decoration: none;
    color: inherit;
    display: grid;
    grid-template-rows: 91px 1fr;
    justify-items: center;
    align-items: start;
    height: 100%;
    width: 100%;
    gap: 7px;
}



/* Project Carousel */
.project-carousel {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.project-carousel-container {
    flex: 1;
    overflow: hidden;
    border-radius: 8px;
}

.project-carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.project-card {
    min-width: 100%;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    border: 1px solid var(--border-light);
    opacity: 0.7;
    transform: scale(0.95);
}

.project-card.active {
    opacity: 1;
    transform: scale(1);
}

.project-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.project-card img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    object-position: center;
    background-color: var(--bg-primary);
    opacity: 0.9;
    transition: opacity 0.3s ease;
}
.project-card:hover img {
    opacity: 1;
}

.carousel-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.carousel-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

.carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: var(--accent);
    border-color: var(--accent);
}

.indicator:hover {
    border-color: var(--accent);
}

.project-content {
    padding: 25px;
}

.project-content h3 {
    margin-bottom: 15px;
}

/* Research Section */
.research-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

.research-section h3 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: left;
}

.research-list {
    list-style-type: disc;
    padding-left: 20px;
}

.research-list li {
    margin-bottom: 15px;
    line-height: 1.6;
}

.research-list li strong {
    color: var(--text-primary);
}

.patent-number {
    color: var(--accent);
    font-weight: 600;
    font-family: 'Lato', sans-serif;
}

.venue {
    color: var(--accent);
    font-style: italic;
    font-weight: 500;
}

.authors {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.scholar-link {
    text-align: center;
    font-size: 1.1rem;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-light);
}

.tags {
    margin-top: 20px;
}

.tags span {
    display: inline-block;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    margin-right: 5px;
    margin-bottom: 5px;
    border: 1px solid var(--border-light);
}

/* Speaking Section */
#speaking {
    text-align: center;
}

#speaking .cta-button {
    margin-top: 30px;
}

/* Footer */
footer {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-secondary);
}

footer .email-link {
    font-size: 1.5rem;
    font-weight: 600;
    display: block;
    margin: 20px 0;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.social-links a {
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.footer-info {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.footer-info .copyright {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0;
}

.footer-info .last-updated {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin: 5px 0 0 0;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    /* Fix viewport overflow issues */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    * {
        box-sizing: border-box;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    header {
        padding: 0 15px;
        width: 100%;
    }
    
    header nav {
        position: relative;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        padding: 0;
        width: 100%;
    }
    
    .nav-menu {
        position: absolute;
        top: calc(100% + 10px);
        left: -15px;
        right: -15px;
        background: var(--bg-primary);
        flex-direction: column;
        gap: 0;
        padding: 20px;
        border: 1px solid var(--border-light);
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-menu li {
        padding: 15px 0;
        border-bottom: 1px solid var(--border-light);
        text-align: center;
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }
    
    .nav-menu a {
        display: block;
        font-size: 1.1rem;
        padding: 5px 0;
    }
    
    /* Hero section mobile fixes */
    #home {
        padding-left: 20px;
        padding-right: 20px;
        min-height: 100vh;
        text-align: center;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero h2 {
        font-size: 1.2rem;
        text-align: center;
        margin: 0 auto 30px auto;
    }
    
    /* Section padding adjustments */
    section {
        padding: 60px 15px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* About section mobile */
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
        width: 100%;
    }
    
    .headshot {
        margin: 0 auto 20px auto;
        max-width: 200px;
    }
    
    /* Projects carousel mobile - CRITICAL FIXES */
    .project-carousel {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }
    
    .project-carousel-container {
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }
    
    .project-carousel-track {
        width: 100%;
    }
    
    .project-card {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        box-sizing: border-box;
        margin: 0;
        overflow: hidden;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        flex-shrink: 0;
    }
    
    .carousel-indicators {
        position: static;
        transform: none;
        margin-top: 15px;
    }
    
    .project-card img {
        height: 200px;
        width: 100%;
    }
    
    .project-content {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .project-content h3 {
        font-size: 1.2rem;
        line-height: 1.3;
        margin-bottom: 10px;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .project-content p {
        font-size: 0.85rem;
        line-height: 1.5;
        overflow-wrap: break-word;
        word-wrap: break-word;
        margin-bottom: 15px;
    }
    
    .tags {
        margin-top: 15px;
        width: 100%;
    }
    
    .tags span {
        font-size: 0.7rem;
        padding: 4px 8px;
        margin-right: 4px;
        margin-bottom: 4px;
        display: inline-block;
    }
    
    /* Organizations mobile */
    .logo-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 45px 20px; /* Large vertical gap for text wrapping on mobile */
        width: 100%;
        padding: 0 5px;
    }
    
    .logo-item {
        min-height: auto; /* Remove min-height constraint on mobile */
        grid-template-rows: 71px 1fr; /* Logo wrapper (64px) + gap (7px) */
    }
    
    .logo-item a {
        grid-template-rows: 71px 1fr; /* Match the logo-item grid */
    }
    
    .logo-img-wrapper {
        width: 64px;
        height: 64px;
        padding: 8px;
    }
    
    .logo-name {
        font-size: 0.75rem; /* Slightly smaller font */
        min-height: auto; /* Remove min-height constraint on mobile */
        line-height: 1.2; /* Tighter line spacing for mobile */
    }
    
    /* Research responsive */
    .research-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .research-list li {
        padding: 15px;
    }
    
    /* Footer mobile */
    .social-links {
        gap: 15px;
    }
    
    .social-links a {
        width: 35px;
        height: 35px;
    }
}

/* Extra mobile fixes for very small screens */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero h2 {
        font-size: 1.1rem;
    }
    
    .project-content p {
        font-size: 0.85rem;
    }
    
    .tags span {
        font-size: 0.7em;
        padding: 3px 8px;
    }
    
    .logo-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 40px 15px; /* Large vertical gap for very small screens */
    }
    
    .logo-item {
        grid-template-rows: 63px 1fr; /* Logo wrapper (56px) + gap (7px) */
    }
    
    .logo-item a {
        grid-template-rows: 63px 1fr;
    }
    
    .logo-img-wrapper {
        width: 56px;
        height: 56px;
        padding: 6px;
    }
    
    .logo-name {
        font-size: 0.7rem;
        min-height: auto; /* Remove fixed height */
        line-height: 1.2;
    }
    
    .research-list li {
        padding: 12px;
    }
}
