/* ==========================================================================
   1. VARIABLES & ROOT CONFIGURATION
   ========================================================================== */
:root {
    --primary-color: #1a202c;
    --secondary-color: #3182CE;
    --text-color: #2d3748;
    --background-color: #edf2f7;
    --card-background: #ffffff;
    --accent-color: #718096;
    
    /* Common Transition Patterns */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bouncy: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}


/* ==========================================================================
   2. RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 17px;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* ==========================================================================
   2.5 UTILITY CLASSES (Common Patterns)
   ========================================================================== */

/* Common Transitions */
.transition-normal {
    transition: all var(--transition-normal);
}

.transition-transform {
    transition: transform var(--transition-normal);
}

.transition-color {
    transition: color var(--transition-normal);
}

.transition-opacity {
    transition: opacity var(--transition-normal);
}


/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */
p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.7;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    position: relative;
    transition: color var(--transition-normal);
}

a:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 4px;
    border-radius: 2px;
}

a:focus:not(:focus-visible) {
    outline: none;
}

a:active {
    transform: translateY(1px);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1.5em;
}

/* Project page H1 static underline */
.section-content-wrapper > h1:first-child {
    position: relative;
    display: inline-block;
    padding-bottom: 20px;
    margin: 0 auto 40px;
    text-align: center;
    width: 100%;
}

.section-content-wrapper > h1:first-child::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 120px;
    height: 4px;
    background-color: var(--secondary-color);
    transform: translateX(-50%);
}

h1 {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 30px;
    letter-spacing: -0.015em;
}

h2 {
    color: var(--primary-color);
    font-size: 32px;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

h3 {
    color: var(--secondary-color);
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 600;
}

h4 {
    color: var(--primary-color);
    font-size: 20px;
    margin-bottom: 16px;
}

h5 {
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

h6 {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

ul {
    padding-left: 20px;
}

ul li {
    margin-bottom: 10px;
    position: relative;
}

figcaption {
    text-align: center;
    color: #666666;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0 10px;
}


/* ==========================================================================
   4. LAYOUT & STRUCTURE
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

main {
    background-color: var(--background-color);
}

main section {
    margin-bottom: 30px;
}

main > section:nth-of-type(odd) {
    background-color: var(--background-color);
}

main > section:nth-of-type(even) {
    background-color: var(--card-background);
}

main > section:last-of-type {
    margin-bottom: 0;
}

.section-content-wrapper {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 40px;
    padding-bottom: 40px;
    padding-right: 40px;
    padding-left: 270px;
    position: relative;
}

section.overview {
    text-align: left;
}

main section > h2:first-child {
    margin-top: 0;
}

.overview {
    padding-top: 80px;
}

.logo svg {
  height: 6rem; /* ~56px */
  width: auto;
}

/* ==========================================================================
   5. HEADER & MAIN NAVIGATION
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    padding: 15px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
    height: 50px;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.9;
}

header nav {
    height: 100%;
    display: flex;
    align-items: center;
}

header nav ul {
    display: flex;
    gap: 40px;
}

header nav ul li {
    margin: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-link {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    position: relative;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    width: 100%;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
}

.figure-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    max-width: 1000px;
    margin: auto;
  }


/* ==========================================================================
   6. ON-PAGE NAVIGATION (e.g., Case Study Sidebar)
   ========================================================================== */
.on-page-nav {
    position: sticky;
    top: 100px;
    width: 220px;
    padding: 20px;
    margin-right: 30px;
    float: left;
    border: 1px solid #e2e8f0;
    border-radius: 0px 8px 8px 0px;
    background-color: var(--card-background);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 900;
}

.on-page-nav h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

.on-page-nav ul {
    list-style: none;
    padding-left: 0;
}

.on-page-nav ul li {
    margin-bottom: 10px;
}

.on-page-nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
    display: block;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.on-page-nav ul li a:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.on-page-nav ul li a.active-on-page-link {
    color: var(--secondary-color);
    font-weight: 700;
    position: relative;
}

.on-page-nav ul li a.active-on-page-link::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background-color: var(--secondary-color);
    border-radius: 50%;
}

/* ==========================================================================
   7. COMMON COMPONENTS
   ========================================================================== */
button {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color var(--transition-normal);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

button:hover,
button.primary:hover {
    background-color: #2b6cb0;
    cursor: pointer;
}

.button.primary {
    background-color: var(--secondary-color);
    color: white;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-bouncy);
}

.button.primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.button.primary:hover::before {
    width: 300px;
    height: 300px;
}

.button.primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(49, 130, 206, 0.3);
}

.button.primary:active {
    transform: translateY(-1px) scale(0.98);
}

.button.secondary {
    background-color: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.button.secondary:hover {
    background-color: #2b6cb0;
    color: white;
}

/* Back to Home button styling */
.back-home-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    color: var(--text-color);
    text-decoration: none;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.back-home-button:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: translateX(-5px);
}

.back-home-button .arrow {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.back-home-button:hover .arrow {
    transform: translateX(-3px);
}

picture img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 20px 0;
}

figure {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin-bottom: 1rem;
    padding: 10px;
    border-radius: 8px;
    align-items: center;
}

.design-insight {
    background-color: #f0f4f8;
    border-left: 4px solid var(--secondary-color);
    padding: 15px 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.95rem;
}

.design-insight p {
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.design-insight strong {
    color: var(--primary-color);
    font-weight: 600;
}

.profile {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 5rem;
    background: rgba(255, 255, 255, 0.7);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeInProfile 1s ease-out forwards;
}

.intro {
    position: relative;
    z-index: 1;
    text-align: left;
    margin-bottom: 2rem;
}

.intro-text p {
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--text-color);
    max-width: 600px;
}

.name {
    font-family: 'Montserrat', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.title {
    font-size: 1.5rem;
    font-weight: 400;
    font-style: italic;
    color: var(--accent-color);
    margin-top: 0;
    margin-bottom: 2rem;
}

.headshot {
    width: min(400px, 80vw);
    height: min(400px, 80vw);
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 25%;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    border: 4px solid rgba(225, 240, 232, 0.8);
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.cta-buttons .button {
    flex: 1;
}

.social-media {
    display: flex;
    gap: 2rem;
    justify-content: flex-start;
    margin-top: 1rem;
}

.social-media a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: all var(--transition-bouncy);
}

.social-media a:hover {
    transform: translateY(-5px) rotate(5deg);
    color: var(--secondary-color);
}

.social-media a:hover .social-icon {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.social-icon {
    width: 1.75rem;
    height: 1.75rem;
    transition: transform var(--transition-normal);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    transition: all 0.3s ease;
}

.project-card {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all var(--transition-smooth);
    will-change: transform, box-shadow;
    transform: translateZ(0); /* Force GPU acceleration */
    backface-visibility: hidden; /* Fix for animation flicker */
}

.project-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-card:active {
    transform: translateY(-5px) scale(1.01);
}

.project-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    object-position: center;
    transition: transform var(--transition-smooth);
}

.project-date {
    color: var(--secondary-color);
    font-size: 0.9em;
    margin: 0 20px 10px;
    font-style: italic;
}

.project-card h3 {
    color: var(--primary-color);
    margin: 15px 20px 5px; /* Further adjusted bottom margin */
    font-size: 20px; /* Added base font size */
    line-height: 1.3; /* Added line-height */
}

.project-card p {
    font-size: 1em;
    color: var(--text-color);
    margin: 0 20px 20px;
    line-height: 1.5;
    flex-grow: 1;
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.category-tag {
    background-color: var(--background-color);
    color: var(--secondary-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tech-stack {
    list-style: none;
    padding: 0 20px;
    margin-top: auto;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 40px;
}

.tech-stack li {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9em;
}

.project-button {
    display: block;
    width: calc(100% - 40px);
    margin: 0 20px 20px;
    padding: 10px;
    background-color: var(--secondary-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

/* ==========================================================================
   EXPAND/COLLAPSE PORTFOLIO FEATURE
   ========================================================================== */

/* Hidden projects - initially hidden */
.project-card.hidden-project {
    display: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    will-change: opacity, transform;
}

/* When expanded, make hidden projects visible */
.project-card.hidden-project.visible {
    display: flex;
    animation: fadeSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Stagger animation for each card */
.project-card.hidden-project:nth-of-type(4).visible {
    animation-delay: 0.1s;
}

.project-card.hidden-project:nth-of-type(5).visible {
    animation-delay: 0.2s;
}

.project-card.hidden-project:nth-of-type(6).visible {
    animation-delay: 0.3s;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Expand Portfolio Button Container */
.expand-portfolio-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 20px;
}

/* Expand Portfolio Button - Subtle text link style */
.expand-portfolio-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: transparent;
    color: var(--accent-color);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.expand-portfolio-btn:hover {
    color: var(--accent-color);
    background-color: transparent;
    box-shadow: none;
}

.expand-portfolio-btn:active {
    transform: scale(0.98);
    background-color: transparent;
    box-shadow: none;
}

.expand-portfolio-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
}

/* Icon rotation animation */
.expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    width: 20px;
    height: 20px;
}

/* When expanded, spin icon to x orientation */
.expand-portfolio-btn[aria-expanded="true"] .expand-icon {
    transform: rotate(135deg);
}

/* Screen reader only class for announcements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .project-card.hidden-project.visible {
        animation: fadeIn 0.3s ease forwards;
    }
    
    .project-card.hidden-project:nth-of-type(4).visible,
    .project-card.hidden-project:nth-of-type(5).visible,
    .project-card.hidden-project:nth-of-type(6).visible {
        animation-delay: 0s;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

.expertise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.expertise-area {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.expertise-area:hover {
    transform: translateY(-5px);
}

.expertise-area h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.expertise-area p {
    color: var(--text-color);
    line-height: 1.6;
}

.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 6px;
    background: var(--secondary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
    border-radius: 3px;
    z-index: 1;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    transform-origin: center right;
    z-index: 2;
}

.timeline-item:nth-child(odd) {
    left: 0;
}

.timeline-item:nth-child(even) {
    transform-origin: center left;
    left: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    right: -17px;
    background-color: white;
    border: 4px solid var(--secondary-color);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
    transition: all 0.3s ease;
    transform-origin: center center;
}

.timeline-item:nth-child(even)::after {
    left: -16px;
    transform-origin: center center;
}

.timeline-item:hover::after {
    background-color: var(--secondary-color);
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
}

.timeline-content {
    padding: 20px 30px;
    background-color: var(--card-background);
    position: relative;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.07);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    opacity: 0;
}

.timeline-item:nth-child(odd) .timeline-content {
    transform: translateX(-100px) rotate(-5deg);
}

.timeline-item:nth-child(even) .timeline-content {
    transform: translateX(100px) rotate(5deg);
}

.timeline-item.in-view .timeline-content {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
}

.timeline-content {
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.07);
}

.timeline-content h4 {
    color: var(--primary-color);
    font-size: 1.4em;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.timeline-content h5 {
    color: var(--secondary-color);
    font-size: 1.2em;
    margin-bottom: 10px;
}

.timeline-date {
    color: var(--text-color);
    font-style: italic;
    margin-bottom: 15px;
}

.timeline-content ul {
    list-style-type: none;
    padding-left: 0;
}

.timeline-content li {
    margin-bottom: 10px;
    line-height: 1.4;
}

.timeline-content.education {
    border-left: 5px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
}

.timeline-content.education::before {
    content: '🎓';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5em;
    transition: opacity 0.3s ease;
}

.role-details {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.skills-section,
.tools-section {
    background-color: var(--background-color);
    padding: 15px;
    border-radius: 8px;
}

.skills-list,
.tools-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
}

.skills-list li,
.tools-list li {
    background-color: var(--card-background);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: default;
}

.responsibilities {
    margin-top: 5px;
}

.responsibilities ul {
    list-style-type:disc;
    padding-left: 15px;
}

.responsibilities li {
    position: relative;
    margin-bottom: 12px;
    line-height: 1.5;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
}

.quote {
    font-style: italic;
    color: var(--secondary-color);
    margin-left: 20px;
    background-color: rgba(49, 130, 206, 0.05);
    border-left: 4px solid var(--secondary-color);
    padding: 25px;
    margin: 20px 0;
}

.insight {
    padding: 15px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 30px 0;
}

.comparison-item {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    /* margin: 20px 0; */
}

.comparison-item.before {
    border-left: 4px solid var(--accent-color);
}

.comparison-item.after {
    border-left: 4px solid var(--secondary-color);
}

.comparison-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, rgba(0,0,0,0.05), transparent);
}

.comparison-text {
    margin-bottom: 25px;
}

.comparison-text h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.comparison-item.before h4::after {
    content: '→';
    color: var(--accent-color);
    font-size: 1.4rem;
}

.comparison-text p {
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
}

.comparison-image {
    margin-top: auto;
}

.comparison-image figure {
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
}

.comparison-image figure picture {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.comparison-image figure picture img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
}

.comparison-image figcaption {
    margin-top: 12px;
    text-align: center;
    color: var(--text-color);
    font-style: italic;
    font-size: 0.9em;
}

.project-process {
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow-x: auto;
    scrollbar-width: thin;
    margin: 10px 0;
}

.process-step {
    min-width: 200px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

/* New Narrative Metrics Styles */
.narrative-metrics-summary p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1.5em;
}

.metric-highlight {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 1.15em;
}

.design-iterations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.iteration-card {
    background: var(--background-color);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.iteration-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

.user-feedback {
    background: #f8f9fa;
    margin: 20px;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-color);
    font-style: italic;
}

.problem-statement {
    background-color: rgba(49, 130, 206, 0.05);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--secondary-color);
}

.problem-statement h3 {
    margin-bottom: 1rem;
}

.problem-statement p {
    margin-bottom: 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

.persona-card {
    display: flex;
    gap: 40px;
    background-color: var(--card-background);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.07);
    margin-top: 20px;
    margin-bottom: 40px;
}

.persona-left {
    flex-shrink: 0;
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.persona-image figure {
    margin: 0;
    padding: 0;
}

.persona-image figure {
    margin: 0;
    padding: 0;
}

.persona-image img {
    width: 300px;
    height: 300px;
    border-radius: 12px;
    object-fit: cover;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.persona-quote {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.persona-quote blockquote {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--secondary-color);
    margin: 0;
    line-height: 1.5;
}

.persona-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.persona-basics {
    margin-bottom: auto;
}

.persona-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    height: 100%;
    margin-top: 0;
}

.persona-category {
    padding: 15px 0;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #f0f0f0;
}

.persona-category:last-child {
    border-bottom: none;
}

.persona-category h4 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.persona-category ul {
    flex-grow: 1;
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.persona-category li {
    margin: 0;
}

.prototype-links {
    margin-top: 30px;
}

.prototype-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.prototype-button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.prototype-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.prototype-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.prototype-grid figure {
    margin: 0;
    padding: 0;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.prototype-grid figure picture {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #f8f9fa;
}

.prototype-grid figure picture img {
    width: 100%;
    height: auto;
    object-fit: contain;
    margin: 0;
    background-color: #f8f9fa;
    padding: 10px;
}

.prototype-grid figcaption {
    padding: 15px;
    background-color: white;
}

.usability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.usability-section {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.usability-section h4 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.usability-section h5 {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(52, 152, 219, 0.2);
}

.task-list {
    list-style-position: inside;
    padding-left: 0;
}

.task-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.task-list li:last-child {
    border-bottom: none;
}

.question-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-category ul {
    list-style: none;
    padding-left: 0;
}

.question-category li {
    padding: 8px 0 8px 20px;
    position: relative;
}

.question-category li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

.usability-details {
    margin-bottom: 40px;
}

.usability-details .persona-details {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.usability-details .persona-category {
    height: fit-content;
}

.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 30px;
}

.tasks-overview {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.task-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.task-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border-left: 4px solid var(--secondary-color);
}

.task-card.highlighted {
    border-left-color: var(--accent-color);
}

.task-number {
    background-color: var(--secondary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.task-card.highlighted .task-number {
    background-color: var(--accent-color);
}

.task-card p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.storyboard {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
}

.storyboard figure {
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
}

.storyboard figure picture img {
    width: 100%;
    height: auto;
    object-fit: contain;
    margin: 0;
    border-radius: 8px;
}

.storyboard figcaption {
    margin-top: 15px;
    text-align: center;
    color: var(--text-color);
    margin-bottom: 0;
}

.project-metadata ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.project-metadata li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.project-metadata li::before {
    content: "-";
    position: absolute;
    left: 0;
}

.research-overview ul,
.key-insights ul {
    list-style: none;
    padding: 0;
}

.research-overview li,
.key-insights li {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
}

.research-overview li::before,
.key-insights li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.method-card {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.method-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    position: relative;
}

.method-card p {
    color: var(--text-color);
    line-height: 1.5;
    margin: 0;
}

/* ==========================================================================
   8. PAGE-SPECIFIC SECTIONS & STYLES
   ========================================================================== */
#home, #projects, #experience {
    min-height: 100vh;
    padding: 40px 20px;
}

#home {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    position: relative;
    background: var(--background-color);
    overflow: hidden;
}

/* Subtle dot pattern background */
#home::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Staggered Fade-In Animation for Intro Section */
.intro-text > * {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.intro .name {
    animation-delay: 0.2s;
}

.intro .title {
    animation-delay: 0.4s;
}

.intro-text > p {
    animation-delay: 0.6s;
}

.cta-buttons {
    animation-delay: 0.8s;
}

.social-media {
    animation-delay: 1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#projects {
    background: var(--background-color);
}

#experience {
    background: var(--background-color);
}

#contact {
    min-height: calc(100vh - 100px);
    padding: 60px 20px;
    background: var(--background-color);
}

.contact-form {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

.form-group.subject-group {
    grid-column: 1 / -1;
}

.form-group.message-group {
    grid-column: 1 / -1;
    margin-top: 1rem;
    width: 100%;
}

.contact-form button[type="submit"] {
    grid-column: 1 / -1;
    width: 100%;
}

/* Styles for RepairLens Project Page */
.finding,
.pros,
.cons {
    padding: 25px;
    margin: 20px 0;
}

.feedback-conclusion {
    margin-top: 20px;
}

.pros-cons {
    display: flex;
    margin-bottom: 1rem;
    justify-content: space-between;
}

.pros-cons .pros, .pros-cons .cons {
    width: 48%;
    background-color: var(--background-color);
    padding: 20px;
    border-radius: 5px;
}

/* Styles for Renewable Energy Project Page */
.challenge-section {
    margin: 2rem 0;
}

.challenge-overview {
    background-color: rgba(49, 130, 206, 0.05);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.challenge-main {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
}

.key-challenges {
    margin-top: 2rem;
}

.challenge-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.challenge-item {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.challenge-item p {
    color: var(--text-color);
    line-height: 1.5;
    margin: 0;
}

/* Styles for Mann Library Project Page */
.project-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin: 2rem 0;
}

.project-images figure:first-child {
    grid-column: 1 / -1;
}

.project-images figure {
    margin: 0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.project-images figure picture {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
    background-color: var(--card-background);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.07);
}

.project-images figure picture img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0;
}

.project-images figure:first-child picture img {
    height: 600px;
}

.project-images figcaption {
    margin-top: 1rem;
    text-align: center;
    color: #666666;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0 10px;
}

.project-image-integrated {
    margin-top: 2em;
    margin-bottom: 2em;
    padding: 0;
    border-radius: 0;
}

.role-impact {
    background-color: rgba(49, 130, 206, 0.05);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.role-impact h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.role-impact ul {
    list-style: none;
    padding: 0;
}

.role-impact li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
}

.role-impact li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

.research-overview, .research-methods, .key-insights {
    margin: 2rem 0;
}

.project-image-hero {
    width: 100%;
    margin: 2.5em auto;
    padding: 0;
    border-radius: 0;
    display: block;
}

.project-image-hero picture img {
    border-radius: 10px;
    margin: 0;
}

.project-image-hero figcaption {
    margin-top: 0.75em;
}

.project-details {
    width: 100%;
    margin-top: 2em;
    margin-left: 0;
    margin-right: 0;
    text-align: left;
}


/* ==========================================================================
   8.5 BACK TO TOP BUTTON
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--card-background);
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    padding: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Circular Progress Ring - outer layer */
.back-to-top::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    width: calc(100% + 10px);
    height: calc(100% + 10px);
    border-radius: 50%;
    background: conic-gradient(
        var(--secondary-color) var(--scroll-progress, 0%),
        rgba(113, 128, 150, 0.15) var(--scroll-progress, 0%)
    );
    z-index: -2;
}

/* Inner ring gap for contrast */
.back-to-top::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border-radius: 50%;
    background: var(--background-color);
    z-index: -1;
}

/* SVG Arrow Icon */
.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
    display: block;
    position: relative;
    z-index: 1;
    transition: all var(--transition-smooth);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow: 0 8px 24px rgba(49, 130, 206, 0.3), 0 4px 12px rgba(49, 130, 206, 0.2);
}

.back-to-top:hover::before {
    transform: rotate(180deg);
    transition: transform 0.6s ease;
}

.back-to-top:hover svg {
    transform: translateY(-2px);
}

.back-to-top:active {
    transform: translateY(-2px) scale(1.04);
}

.back-to-top:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 4px;
}

.back-to-top:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .back-to-top:hover {
        transform: none;
    }
    
    .back-to-top:hover::before {
        transform: none;
    }
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}


/* ==========================================================================
   9. FOOTER
   ========================================================================== */
footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d3748 100%);
    color: white;
    padding: 60px 20px 20px;
    width: 100%;
    margin-top: auto;
    z-index: 10;
    border-top: 3px solid var(--secondary-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto 40px;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 60px;
    padding: 0 20px;
    align-items: start;
}

.footer-section h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: var(--secondary-color);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all var(--transition-normal);
    display: inline-block;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: white;
    transform: translateX(5px);
}

.footer-social {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.footer-social a:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
}

.footer-social-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

.footer-email {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-top: 5px;
    margin-bottom: 0;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-bottom p {
    font-size: 0.9em;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

/* Footer responsive styles */
@media screen and (max-width: 768px) {
    footer {
        padding: 40px 15px 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}


/* ==========================================================================
   10. UTILITY CLASSES 
   ========================================================================== */


/* ==========================================================================
   11. ANIMATIONS & KEYFRAMES
   ========================================================================== */
/* ==========================================================================
   Image Grid Layout (e.g., for RepairLens project)
   ========================================================================== */
.rl-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Fixed 2 columns */
    gap: 30px; /* Increased gap for better spacing */
    padding: 20px 0;
    max-width: 1200px; /* Limit max width for better readability */
    margin: 0 auto; /* Center the grid */
}

/* Optional: Ensure figures in the grid behave well */
.rl-image-grid .project-image-integrated {
    /* The existing 'figure' styles should work well, 
       but you can add specific overrides here if needed.
       For example, if you want less margin at the bottom for grid items: */
    margin-bottom: 0; /* Override default figure margin if it's too much in a grid context */
    /* Ensure the figure itself doesn't constrain the image too much if it has a fixed width elsewhere */
    width: 100%; /* Make figure take full width of grid cell */
}

/* Quotes */
p.quote {
    position: relative;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-color);
    line-height: 1.6;
    border-left: 4px solid var(--secondary-color);
    background-color: rgba(49, 130, 206, 0.05);
    border-radius: 0 4px 4px 0;
}

p.quote.highlight {
    background-color: rgba(49, 130, 206, 0.1);
    border-left-width: 6px;
    font-size: 1.1rem;
}

.quote-source {
    display: block;
    margin-top: 0.5rem;
    font-style: normal;
    color: var(--accent-color);
    font-size: 0.9rem;
    text-align: right;
}

/* Project Metadata Grid */
.project-overview {
    margin: 2rem 0;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.metadata-item {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    transform: none;
}

.metadata-label {
    display: block;
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 500;
    line-height: 1.4;
}

/* ==========================================================================
   Feature Grid for Research Section
   ========================================================================== */
.feature-showcase {
    margin: 2em 0;
}

.feature-category {
    margin: 2.5em 0;
}

.feature-category h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.feature-category p {
    color: var(--text-color);
    margin-bottom: 1.25rem;
    max-width: 800px;
    opacity: 0.9;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.feature-example {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

.feature-example img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.feature-example figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--accent-color);
    text-align: center;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.contribution-note {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-background);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.contribution-note p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.6;
}

.contribution-note strong {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .metadata-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .logo svg {
        height: 4.5 rem;   /* ≈ 48 px */
    }
}

@media (max-width: 480px) {
    .metadata-grid {
        grid-template-columns: 1fr;
    }
}

/* Ensure images within the grid figures fill their container */
.rl-image-grid .project-image-integrated picture {
    position: relative;    /* For absolute positioning of the img */
    display: block;        /* Allows padding-bottom trick and takes full width */
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio (9 / 16 * 100%). Adjust if needed. */
    margin-bottom: 0.5rem; /* Space between image area and caption */
    background-color: #f8f9fa; /* Optional: light background for letterboxed areas */
    border-radius: 8px;    /* Apply radius to the picture frame */
    overflow: hidden;      /* Ensure img doesn't break out if its aspect ratio is very different */
}

.rl-image-grid .project-image-integrated img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the image */
    max-width: 100%;   /* Ensure image scales down to fit container */
    max-height: 100%;  /* Ensure image scales down to fit container */
    object-fit: contain; /* Show entire image, letterboxed if necessary */
    margin: 0;           /* Reset margin */
    /* border-radius is now on the picture element */
}

.rl-image-grid .project-image-integrated figcaption {
    padding-top: 8px; /* Add some space above the caption */
}
@keyframes fadeInProfile {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ==========================================================================
   12. MEDIA QUERIES & RESPONSIVE STYLES
   ========================================================================== */
/* 950 px */
@media screen and (max-width: 950px) {
    main section {
        margin-left: 0px !important;
    }
    .section-content-wrapper {
        padding-left: 20px;
        padding-right: 20px;
    }
    /* Navigation menu */
    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--card-background);
        transition: left 0.3s ease-in-out;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 20px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    body.menu-open {
        overflow: hidden;
    }

    .nav-link {
        display: block;
        padding: 20px 0;
        font-size: 22px;
        width: 100%;
        position: relative;
        transition: all 0.3s ease;
        color: var(--primary-color);
        text-align: center;
    }

    .nav-link:hover {
        color: var(--primary-color);
    }

    .on-page-nav {
        display: none;
    }


    header nav ul {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        width: 100%;
        padding: 20px 0;
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        padding: 0;
        margin-left: 20px;
        transform: translateY(3px);
    }

    .hamburger:hover {
        background: none;
    }

    .bar {
        width: 28px;
        height: 3px;
        background-color: var(--primary-color);
        transition: all 0.3s ease-in-out;
        border-radius: 1px;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Home Page  */
    .profile {
        flex-direction: column;
        text-align: center;
        gap: 0;
    }

    .headshot {
        width: min(300px, 70vw);
        height: min(300px, 70vw);
        margin-bottom: 1.5rem;
    }

    .intro {
        text-align: center;
    }

    .social-media {
        justify-content: center;
    }


    /* Timeline section */
    .timeline-item:hover {
        transform: none;
    }

    .timeline::after {
        left: 31px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-item:nth-child(odd) {
        left: 0;
    }

    .timeline-item::after {
        left: 15px;
        right: auto;
    }

    .timeline-item:nth-child(even)::after {
        left: 15px;
    }

    /* RepairLens Project Page (and other project pages using these components) */
    .overview-flex {
        flex-direction: column;
    }

    .persona-card {
        flex-direction: column;
        padding: 25px;
    }

    .persona-left {
        width: 100%;
        align-items: center;
    }

    .persona-image img {
        max-width: 250px;
        height: auto;
    }

    .persona-details {
        grid-template-columns: 1fr;
    }

    .persona-category {
        height: auto;
    }

    .comparison-container {
        grid-template-columns: 1fr;
    }

    .pros-cons {
        flex-direction: column;
        gap: 1rem;
    }

    .pros-cons .pros, .pros-cons .cons {
        width: 100%;
    }

    .usability-grid {
        grid-template-columns: 1fr;
    }


    /* Contact Form */
    .contact-form {
        grid-template-columns: 1fr;
    }

    /* Project Cards */
    .project-image {
        height: 250px;
    }

    /* Headings */
    h1 {
        font-size: 32px;
    }
    h2 {
        font-size: 28px;
    }
    h3 {
        font-size: 22px;
    }
    h4 {
        font-size: 18px;
    }
    .project-card h3 { /* New rule for project card title */
        font-size: 18px;
        line-height: 1.3; /* Added line-height */
    }

    /* Section Padding */
    #home, #projects, #experience, #contact {
        padding-top: 80px;
        padding-bottom: 40px;
    }

    #home {
        padding-top: 120px;
    }

    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    header .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Mann Library Project Page Specifics */
    .project-images {
        grid-template-columns: 1fr;
    }

    .project-images figure:first-child {
        grid-column: auto;
    }

    .project-images figure picture img,
    .project-images figure:first-child picture img {
        height: auto;
        max-height: 450px;
    }

    .challenge-grid {
        grid-template-columns: 1fr;
    }

    .method-grid {
        grid-template-columns: 1fr;
    }

    .expertise-grid {
        grid-template-columns: 1fr;
    }

    .prototype-grid {
        grid-template-columns: 1fr;
    }

    .task-cards {
        grid-template-columns: 1fr;
    }
}

/* 480 px */
@media screen and (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    /* Home Page */
    .profile {
        padding: 1.5rem;
        gap: 0rem;
    }

    .headshot {
        width: 200px;
        height: 200px;
    }

    .intro-text {
        width: 100%;
    }

    .intro-text p {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }

    .name {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .title {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    /* Project Grid (Projects Page) */
    .project-grid {
        grid-template-columns: 1fr;
    }

    /* Expand Portfolio Button - Mobile styles */
    .expand-portfolio-btn {
        font-size: 0.95rem;
        padding: 8px 12px;
    }
    
    .expand-portfolio-container {
        margin-top: 25px;
    }

    /* Timeline (Experience Page) */
    .timeline {
        width: 100%;
        /* max-width: 1200px; */
    }

    .timeline-content {
        width: 100%;
        margin: 0 0 20px 0;
        padding: 15px;
    }

    .timeline::after {
        display: none;
    }

    .timeline-item {
        width: 100%;
        padding: 15px;
        margin: 0;
    }

    .timeline-item::after {
        display: none;
    }


    .timeline-item:nth-child(even),
    .timeline-item:nth-child(odd) {
        left: 0;
    }

    .timeline-date {
        margin-bottom: 10px;
    }

    /* RepairLens & other project page components */
    .overview-flex .project-details {
        min-width: 0;
    }

    .overview-flex figure {
        min-width: 0;
    }

    .persona-image img {
        width: 100%;
        max-width: 200px;
        height: auto;
    }

    .tasks-container {
        padding: 1rem;
    }

    /* Project Cards (general) */
    .project-image {
        height: 200px;
    }

    /* Headings */
    h1 {
        font-size: 28px;
    }
    h2 {
        font-size: 24px;
    }
    h3 {
        font-size: 20px;
    }
    h4 {
        font-size: 16px;
    }
    .project-card h3 { /* New rule for project card title */
        font-size: 16px;
        line-height: 1.3; /* Added line-height */
    }

    /* Section Padding */
    #home, #projects, #experience, #contact {
        padding-top: 30px;
        padding-bottom: 30px;
    }

     #home {
        padding-top: 100px;
    }

    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    header .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Active navigation link styling for home page sections */
.nav-link.active-nav-link {
    font-weight: 600;
}

/* Desktop: Use the same underline styling as hover for active links */
.nav-link.active-nav-link::after {
    width: 100%; /* Keep underline visible instead of 0 width */
    opacity: 1;
}

/* Remove dot for desktop */
.nav-link.active-nav-link::before {
    content: none;
}

/* Mobile menu: Keep dot styling */
@media (max-width: 768px) {
    .nav-menu.active .nav-link.active-nav-link::after {
        width: 0; /* Remove underline on mobile */
        opacity: 0;
    }
    
    .nav-menu.active .nav-link.active-nav-link::before {
        content: "•";
        color: #508a8b;
        font-weight: bold;
        margin-right: 8px;
    }
}
