/*
 * Nuno Sousa - 3D Artist Portfolio
 * Enhanced stylesheet with modern design elements
 */


/* Custom Properties - Minimal Style */
:root {
    --primary-bg: #fafafa;
    --secondary-bg: #ffffff;
    --accent-color: #333333;
    --accent-hover: #666666;
    --text-primary: #333333;
    --text-secondary: #333333;
    --text-muted: #666666;
    --text-subtle: #999999;
    --border-color: #eeeeee;
    --border-hover: #dddddd;
    --max-width: 1200px;
    --side-padding: 5%;
    --header-height: 100px;
    
    /* Animation variables */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Enhanced Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    background: var(--primary-bg);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--header-height) var(--side-padding) 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Allow scroll on body when mobile menu is open - removed overflow restriction */
/* body.mobile-menu-open {
    overflow: hidden;
} */


/* Enhanced Typography */
h1, h2, h3 {
    font-weight: normal;
    letter-spacing: 1px;
    color: var(--text-primary);
    position: relative;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 1.5rem);
    margin: 3rem 0 1.5rem;
    letter-spacing: 1px;
    padding-bottom: 0;
    position: relative;
    font-weight: normal;
}


.subtitle {
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    margin-bottom: 0;
    margin-top: 0;
    color: var(--text-muted);
    word-spacing: 0.3rem;
    line-height: 1.2;
    font-weight: 300;
}

p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Enhanced Header */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem var(--side-padding);
    margin-bottom: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(15px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    height: var(--header-height);
    gap: 1rem;
}


#main-header.scrolled {
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
    letter-spacing: 1px;
    font-weight: bold;
    line-height: 1.1;
}

/* ADDED: Style for the new header logo link */
.header-logo-link {
    color: inherit;
    text-decoration: none;
}

.header-nav-section {
    display: flex;
    align-items: center;
    gap: 1rem; /* Reduced gap between nav and language toggle */
}

/* Enhanced Navigation */
#main-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 1rem; /* Reduced gap between navigation items */

}

#main-nav li {
    letter-spacing: 1px;
    font-size: 0.95rem;
    position: relative;
}

#main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-normal);
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

#main-nav a:hover {
    color: var(--text-primary);
}

/* --- Hamburger Menu Styles --- */

.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    position: relative;
    z-index: 1010; /* Above the nav panel */
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.hamburger-box {
    width: 30px;
    height: 24px;
    display: inline-block;
    position: relative;
}

.hamburger-inner {
    display: block;
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 30px;
    height: 2px;
    background-color: var(--text-primary);
    position: absolute;
    transition: transform 0.2s ease-in-out;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: '';
    display: block;
}

.hamburger-inner::before {
    top: -10px;
}

.hamburger-inner::after {
    bottom: -10px;
}

/* Hamburger animation to 'X' */
.hamburger-menu.is-active .hamburger-inner {
    transform: rotate(45deg);
}

.hamburger-menu.is-active .hamburger-inner::before {
    top: 0;
    transform: rotate(90deg);
}

.hamburger-menu.is-active .hamburger-inner::after {
    bottom: 0;
    opacity: 0; /* Hides the bottom bar */
}


/* Enhanced Page Index */
.page-index {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.index-dot {
    width: 8px;
    height: 8px;
    background-color: var(--border-hover);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.index-dot.active {
    background: var(--text-primary);
}

/* Enhanced Home Section */
#home {
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.home-bio {
    text-align: center;
    max-width: 800px;
    margin: 2rem auto 0;
}

.instagram-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-normal);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.instagram-link:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    transform: translateY(-1px);
}

.instagram-icon {
    margin-right: 10px;
    transition: transform var(--transition-normal);
}

.instagram-link:hover .instagram-icon {
    transform: rotate(15deg) scale(1.1);
}

/* Enhanced Slideshow */
.slideshow-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    height: 500px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin: 2rem auto;
}

/* Target the home container when it has the new layout class */
.home-container.layout-side-by-side {
    flex-direction: row; /* Arrange items horizontally */
    align-items: center;    /* Vertically center the image and text block */
    gap: 3rem;              /* Add space between the image and text */
    justify-content: center;
    flex-wrap: wrap;        /* Allow items to wrap on smaller screens */
}

/* Assign a flexible base width to the slideshow */
.layout-side-by-side .slideshow-container {
    flex: 1 1 500px; /* Allow it to grow and shrink, with a base width of 500px */
    max-width: 600px;
    height: 450px;   /* Adjust height for a better aspect ratio in this layout */
}

/* Assign a flexible base width to the biography text block */
.layout-side-by-side .home-bio {
    flex: 1 1 400px; /* Allow it to grow and shrink, with a base width of 400px */
    max-width: 500px;
    text-align: left;/* Align text to the left for better readability */
    margin: 0;       /* Reset the original margin */
}

.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 1;
}

.slide.active {
    opacity: 1;
    z-index: 2;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 8s ease;
    cursor: pointer;
    transform-origin: center center;
}

.slide.active img {
    transform: scale(1.02);
}

/* Enhanced Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.2rem;
    margin: 2rem 0;
}

/* Enhanced Project Item */
.project-item {
    position: relative;
    overflow: hidden;
    border: none;
    height: 300px;
    transition: all var(--transition-normal);
    background: var(--secondary-bg);
    cursor: pointer;
}

.project-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.project-item a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 2;
}

/* Project Image */
.project-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.project-item:hover img {
    transform: none;
}

/* Enhanced Project Info Overlay */
.project-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.75);
    padding: 1.5rem;
    z-index: 3;
    pointer-events: none;
}

/* Project Title */
.project-title {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: normal;
    letter-spacing: 0;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

/* Project Meta Info */
.project-info-overlay .project-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.8rem;
    opacity: 0.9;
    transition: all var(--transition-normal);
}

.project-item:hover .project-info-overlay .project-meta {
    opacity: 1;
    transform: translateY(-2px);
}

.project-info-overlay .project-year {
    color: var(--text-subtle);
    font-weight: normal;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.project-info-overlay .project-category {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* Coming Soon Style */
.project-item.coming-soon {
    opacity: 0.7;
}

.project-item.coming-soon:hover {
    opacity: 1;
    transform: translateY(-4px) scale(1.01);
}

.project-item {
    opacity: 1;
    transform: none;
}



/* Removed problematic overlay that was covering images */

/* Enhanced About Section */
.about-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 3rem 0;
    align-items: start;
}

.about-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border: none;
}


/* Enhanced CV Section */
.cv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.cv-item {
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    background: var(--secondary-bg);
    position: relative;
    margin-bottom: 2rem;
}

.cv-item h3 {
    margin-bottom: 1.2rem;
    font-size: 1.5rem;
    letter-spacing: 0;
    color: var(--text-primary);
    font-weight: normal;
}

.cv-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cv-item li {
    margin-bottom: 1rem; /* Increased spacing between items */
    padding-left: 1rem;
    position: relative;
    color: var(--text-secondary); /* Brighter text */
    line-height: 1.6; /* Better line spacing */
    font-size: 0.95rem; /* Slightly larger text */
}

/* Add custom bullet points for better readability */
.cv-item li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* Style nested lists differently */
.cv-item ul ul {
    margin-top: 0.5rem;
    margin-left: 1rem;
}

.cv-item ul ul li {
    margin-bottom: 0.6rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cv-item ul ul li::before {
    content: '•';
    color: var(--text-subtle);
}

/* Improve strong/bold text visibility */
.cv-item strong {
    color: var(--text-primary);
    font-weight: bold;
}

/* Add better spacing for dates and institutions */
.cv-item li br + * {
    color: var(--text-muted);
    font-style: italic;
}

/* Enhanced Contact Section */
.contact-section {
    margin: 3rem 0;
    text-align: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.social-icon {
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--secondary-bg);
    min-width: 120px;
}

.social-icon:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    transform: translateY(-1px);
}

.icon-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Footer --- */
body > footer {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

footer p {
    margin: 0;
    color: var(--text-subtle);
    font-size: 0.8rem;
    letter-spacing: 1px;
}


/* Inner content alignment */
footer .footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--side-padding);
}

.project-hero {
    text-align: center;
    padding: 1.5rem 0 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 3rem;
}

.project-hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem); /* Reduced from 2rem-3rem */
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: 2px; /* Reduced from 3px */
    line-height: 1.3;
}

.project-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.project-meta span {
    color: var(--accent-color);
    font-size: 0.8rem; /* Reduced from 0.9rem */
    letter-spacing: 1.5px; /* Reduced from 2px */
    text-transform: uppercase;
}

/* Project content sections */
.project-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0; /* Remove double padding - body already has side padding */
}

.project-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin: 3rem 0;
    align-items: start;
}

.project-featured-image {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.project-featured-image img {
    width: 100%;
    height: auto;
    border: none;
    object-fit: cover;
}

/* Right side - Text content */
.project-text-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.project-description {
    margin-bottom: 0; /* Remove default margin since we're using gap */
}

.project-description p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    text-align: left; /* Align text to left instead of center */
}


/* Project details section - smaller header */
.project-details {
    margin: 0;
    padding: 2rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
}

.project-details h2 {
    margin-top: 0 !important;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    letter-spacing: 0;
    font-weight: normal;
}

.project-details ul {
    list-style: none;
    padding: 0;
    
}

.project-details li {
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem; /* Slightly smaller */
}

.project-details strong {
    color: var(--text-primary);
    margin-right: 0.5rem;
    font-size: 0.95rem; /* Consistent with li */
}

/* Nested lists in project details */
.project-details ul ul {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
}

.project-details ul ul li {
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem; /* Smaller for nested items */
}
/* Additional gallery below main content */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
    margin: 3rem 0 2rem;
}

/* ===================================== */
/* ======== PROJECT GALLERIES ========= */
/* ===================================== */

.project-gallery h3 {
    grid-column: 1 / -1;
    font-size: 1.3rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 1rem;
}

/* ===================================== */
/* ======== MASONRY GALLERY =========== */
/* ===================================== */

/* Masonry Gallery Layout */
.project-gallery.masonry {
    display: block; /* Override grid for masonry */
    columns: 3;
    column-gap: 0.8rem;
    margin: 3rem 0 2rem;
}

.project-gallery.masonry h3 {
    column-span: all; /* Make title span all columns */
    margin-bottom: 2rem;
    text-align: center;
}

.project-gallery.masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 0.8rem;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    display: block; /* Ensure proper masonry behavior */
}

.project-gallery.masonry .gallery-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.project-gallery.masonry .gallery-item img,
.project-gallery.masonry .gallery-item video {
    width: 100%;
    height: auto; /* Important for masonry - maintain aspect ratio */
    display: block;
    transition: all var(--transition-slow);
}

.project-gallery.masonry .gallery-item:hover img,
.project-gallery.masonry .gallery-item:hover video {
    transform: scale(1.03);
}

.project-gallery.masonry .gallery-item iframe {
    width: 100%;
    height: 250px; /* Fixed height for YouTube videos in masonry */
    border: none;
}

/* Media overlay for masonry items */
.project-gallery.masonry .gallery-item .media-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 1.5rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
}

.project-gallery.masonry .gallery-item:hover .media-overlay {
    transform: translateY(0);
}

.project-gallery.masonry .media-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.project-gallery.masonry .media-description {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Video play button overlay for masonry */
.project-gallery.masonry .gallery-item[data-media-type="video"]::after,
.project-gallery.masonry .gallery-item[data-media-type="youtube"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    z-index: 2;
}

.project-gallery.masonry .gallery-item[data-media-type="video"]::before,
.project-gallery.masonry .gallery-item[data-media-type="youtube"]::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-45%, -50%);
    color: white;
    font-size: 20px;
    z-index: 3;
    pointer-events: none;
    transition: all 0.3s ease;
}

.project-gallery.masonry .gallery-item[data-media-type="video"]:hover::after,
.project-gallery.masonry .gallery-item[data-media-type="youtube"]:hover::after {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.project-gallery.masonry .gallery-item[data-media-type="video"]:hover::before,
.project-gallery.masonry .gallery-item[data-media-type="youtube"]:hover::before {
    transform: translate(-45%, -50%) scale(1.1);
}




/* ===================================== */
/* ======= FULLSCREEN GALLERY ========= */
/* ===================================== */
/* Fullscreen Gallery Overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fullscreen-overlay.active {
    display: flex;
    opacity: 1;
}

.fullscreen-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-image, .fullscreen-video, .fullscreen-youtube {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.fullscreen-video {
    background: #000;
}

.fullscreen-video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.7);
}

.fullscreen-youtube {
    width: 90vw;
    height: 50.625vw; /* 16:9 aspect ratio */
    max-height: 90vh;
    border: none;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    opacity: 0.6;
}

.fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    opacity: 1;
    transform: scale(1.05);
}

.fullscreen-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    opacity: 0.5;
}

.fullscreen-nav:hover {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
}

.fullscreen-prev {
    left: 30px;
}

.fullscreen-next {
    right: 30px;
}

.fullscreen-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    backdrop-filter: blur(5px);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.fullscreen-counter:hover {
    opacity: 1;
}


/* Gallery item enhancements for fullscreen functionality */
.gallery-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.gallery-item img, .gallery-item video, .gallery-item iframe {
    width: 100%;
    height: 350px;
    object-fit: cover;
    object-position: center;
    transition: all var(--transition-normal);
}

.gallery-item video {
    background: #000;
}

.gallery-item iframe {
    border: none;
}

.gallery-item:hover img, .gallery-item:hover video {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Video overlay indicator */
.gallery-item[data-media-type="video"]::after, .gallery-item[data-media-type="youtube"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    z-index: 2;
}

.gallery-item[data-media-type="video"]::before, .gallery-item[data-media-type="youtube"]::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-45%, -50%);
    color: white;
    font-size: 20px;
    z-index: 3;
    pointer-events: none;
    transition: all 0.3s ease;
}

.gallery-item[data-media-type="video"]:hover::after, .gallery-item[data-media-type="youtube"]:hover::after {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.gallery-item[data-media-type="video"]:hover::before, .gallery-item[data-media-type="youtube"]:hover::before {
    transform: translate(-45%, -50%) scale(1.1);
}

/* Mobile responsive adjustments for fullscreen gallery and project galleries */
@media (max-width: 768px) {
    .project-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gallery-item img, .gallery-item video, .gallery-item iframe {
        height: 300px;
    }
    
    .fullscreen-image, .fullscreen-video, .fullscreen-youtube {
        max-width: 95vw;
        max-height: 85vh;
    }
    
    .fullscreen-youtube {
        width: 95vw;
        height: 53.4375vw; /* 16:9 aspect ratio for mobile */
    }
    
    .fullscreen-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .fullscreen-nav {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .fullscreen-prev {
        left: 15px;
    }
    
    .fullscreen-next {
        right: 15px;
    }
}

@media (max-width: 480px) {
    .project-gallery {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .gallery-item img, .gallery-item video, .gallery-item iframe {
        height: 250px;
    }
}

/* Project navigation */
.project-navigation {
    text-align: center;
    margin: 3rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* ===================================== */
/* ========= UI COMPONENTS ============ */
/* ===================================== */


/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    z-index: 10000;
    animation: slideInNotification 0.3s ease;
}

.notification.success {
    background: #4caf50;
    color: white;
}

.notification.error {
    background: #f44336;
    color: white;
}

.notification.info {
    background: #2196f3;
    color: white;
}

.email-copied-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    z-index: 10000;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideInEmailNotification 0.3s ease-out;
}

@keyframes slideInNotification {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutNotification {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes slideInEmailNotification {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

@keyframes slideOutEmailNotification {
    from { 
        transform: translateX(0); 
        opacity: 1; 
    }
    to { 
        transform: translateX(100%); 
        opacity: 0; 
    }
}

/* Utility classes for better performance */
.clipboard-textarea {
    position: fixed;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

.back-to-projects {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.8rem 2rem;
    border: 1px solid var(--border-color);
    background: var(--secondary-bg);
    transition: all var(--transition-normal);
    font-size: 0.95rem;
    letter-spacing: 0;
}

.back-to-projects:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-icon {
    font-size: 1.1rem; /* Reduced from 1.2rem */
    transition: transform var(--transition-normal);
}

.back-to-projects:hover .nav-icon {
    transform: translateX(-3px);
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--border-color);
    background: #f8f9fa;
}

.lang-option {
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    border: none;
    background: none;
}

.lang-option.active {
    background: var(--text-primary);
    color: white;
}

.lang-option:not(.active):hover {
    color: var(--text-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-left: 1rem;
    font-size: 0.9rem;
}

.theme-toggle:hover {
    border-color: var(--text-primary);
    transform: scale(1.05);
}

.theme-icon {
    display: inline-block;
    transition: transform var(--transition-normal);
}

.theme-toggle:hover .theme-icon {
    transform: rotate(10deg);
}

/* Content visibility based on language */
[data-lang="en"] { 
    display: block; 
}

[data-lang="pt"] { 
    display: none; 
}

body.lang-pt [data-lang="en"] { 
    display: none; 
}

body.lang-pt [data-lang="pt"] { 
    display: block; 
}


/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Responsive Design */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .home-container.layout-side-by-side {
        flex-direction: column;
        gap: 2rem;
        margin-top: 0; 
    }

    .layout-side-by-side .home-bio {
        text-align: center;
    }

    .project-main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem; /* Reduce gap on mobile */
        margin: 2rem 0; /* Reduce margins on mobile */
    }
    
    .project-featured-image {
        position: static; /* Remove sticky behavior on mobile */
        top: auto;
        margin-bottom: 1rem; /* Add breathing room between image and text */
    }
    
    /* --- Hamburger Menu Activation --- */
    .hamburger-menu {
        display: block; /* Show the hamburger */
    }

    .header-nav-section {
        position: fixed;
        top: 0;
        right: 0;
        width: min(65vw, 320px); 
        height: 100vh;
        background: rgba(255, 255, 255, 0.95); 
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px); 
        border-left: 1px solid var(--border-color); 
        
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 1005;
        transform: translateX(100%); 
        transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
        padding: 2rem;
    }

    .header-nav-section.is-active {
        transform: translateX(0); /* Slide in */
    }

    #main-nav ul {
        flex-direction: column; /* Stack nav items vertically */
        gap: 1.5rem;
        text-align: center;
    }

    #main-nav li {
        font-size: 1.2rem;
    }
}


/* Tablets */
@media (max-width: 768px) {
    .about-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .project-item {
        height: 280px;
    }

    .project-info-overlay {
        padding: 1.5rem 1rem 1rem;
    }

    .project-title {
        font-size: 1rem;
        letter-spacing: 1.5px;
    }

    .project-meta {
        font-size: 0.75rem;
    }


    .slideshow-container {
        height: 350px;
    }
    
    /* Masonry responsive - 2 columns on tablets */
    .project-gallery.masonry {
        columns: 2;
        column-gap: 0.6rem;
    }
    
    .project-gallery.masonry .gallery-item {
        margin-bottom: 0.6rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    :root {
        --side-padding: 18px; /* Slightly more padding on small mobile */
        --header-height: 80px; /* Reduced header height for mobile */
    }
    
    #main-header {
        height: var(--header-height);
        padding: 0 var(--side-padding);
    }
    
    .header-content h1 {
        font-size: 1.3rem;
        letter-spacing: 3px;
    }

    .subtitle {
        display: none; /* Hide subtitle on small screens for cleanliness */
    }

    .slideshow-container {
        height: 250px;
    }

    .layout-side-by-side .slideshow-container {
        height: 250px;
    }

    .project-grid {
        grid-template-columns: 1fr; /* Single column on smallest screens */
        gap: 1.5rem;
    }
    
    .project-item {
        height: 280px;
    }

    .project-title {
        font-size: 0.95rem;
        letter-spacing: 1px;
    }


    .page-index {
        display: none;
    }

    h1 {
        font-size: 2rem;
    }

    .about-image {
        max-height: 400px;
    }

    .cv-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .cv-item {
        padding: 1.2rem;
    }
    
    .cv-item h3 {
        font-size: 1.2rem;
    }
    
    .cv-item li {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .social-links {
        gap: 1rem;
    }

    .social-icon {
        min-width: 100px;
        padding: 0.8rem;
    }

    .project-main-content {
        gap: 1.5rem;
    }
    
    .project-details {
        padding: 1rem;
    }
    
    .project-gallery {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 3rem 0 2rem;
    }

    .project-hero {
        padding: 2rem 0 1.5rem;
    }
    
    .project-hero h1 {
        font-size: 1.4rem;
        letter-spacing: 1.5px;
    }
    
    .project-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .project-meta span {
        font-size: 0.75rem;
    }
    
    .project-description p {
        font-size: 0.95rem;
    }
    
    .project-details h2 {
        font-size: 1.2rem;
    }
    
    .project-details li {
        font-size: 0.9rem;
    }
    
    .back-to-projects {
        padding: 0.8rem 1.5rem;
        font-size: 0.85rem;
    }
    footer {
        padding: 1.5rem 0; /* Slightly less padding on mobile */
    }
    
    /* Ensure full-width behavior on mobile */
    body > footer {
        width: 100vw;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
    }
    
    /* Masonry responsive - 2 columns on small mobile */
    .project-gallery.masonry {
        columns: 2;
        column-gap: 0.5rem;
    }
    
    .project-gallery.masonry .gallery-item {
        margin-bottom: 0.5rem;
    }

  
}

/* Enhanced scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Loading animation for images */
img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Email copy button specific styling */

.email-copy {
    cursor: pointer;
    position: relative;
}

.email-copy:hover {
    transform: translateY(-8px) scale(1.05);
    color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(255, 87, 34, 0.3);
}

.email-copy::after {
    content: "Click to copy";
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.email-copy:hover::after {
    opacity: 1;
}

/* Make sure email icon is clearly interactive */
.email-copy .icon-label {
    user-select: none; /* Prevent text selection */
}

/* Subsection divider styling */
.subsection-divider {
    margin: 3rem 0 2rem;
    text-align: center;
    position: relative;
}

.subsection-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: 1;
}

.subsection-divider h3 {
    display: inline-block;
    background: var(--primary-bg);
    padding: 0 2rem;
    margin: 0;
    font-size: 1.1rem;
    font-weight: normal;
    color: var(--accent-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
}