/* Base Reset and Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #2c2c2c;
    background: linear-gradient(to bottom, #fafaf8 0%, #f5f5f3 100%);
    min-height: 100vh;
}

/* Page animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.page-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.card-fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 4px;
}

.back-button:focus-visible {
    outline-color: #ffffff;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5em;
    color: #1a1a1a;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.5rem;
}

/* Header Section */
.header-section {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 400px;
    overflow: hidden;
    animation: fadeInScale 0.8s ease-out;
}

.header-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/images/header.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.header-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
    transition: opacity 0.3s ease;
}

/* Portfolio Owner Information */
.owner-info {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    text-align: center;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.owner-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #1a1a1a;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.owner-description {
    font-size: 1.25rem;
    color: #5a5a5a;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Section Titles */
.section-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #1a1a1a;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Featured Projects Section */
.featured-projects {
    width: 100%;
    padding: 4rem 2rem;
}

.featured-projects .section-title {
    animation: fadeIn 0.8s ease-out 0.3s both;
}

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

/* Project Cards */
.project-card {
    display: block;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 
                0 1px 3px rgba(0, 0, 0, 0.08);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 
                0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-thumbnail {
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #f8f8f6;
}

/* Regular thumbnails for featured grid (images) */
.card-thumbnail.thumbnail-regular {
    height: 580px; /* 846×580px (~1.46:1 ratio) */
}

/* Carousel thumbnails (PDFs and videos) */
.card-thumbnail.thumbnail-carousel {
    width: 100%;
    height: 225px; /* 16:9 aspect ratio (400px wide × 225px tall) */
}

.thumbnail-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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


/* Carousel Section */
.carousel-section {
    width: 100%;
    padding: 4rem 2rem;
}

.carousel-section .section-title {
    animation: fadeIn 0.8s ease-out 0.5s both;
}

.carousel-container {
    position: relative;
    width: 100%;
}

.carousel-wrapper {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.carousel-track {
    display: flex;
    gap: 1.5rem;
    transition: transform 0.5s ease;
    will-change: transform;
}

.carousel-track .project-card {
    flex: 0 0 400px; /* Fixed width for 16:9 carousel thumbnails */
    min-width: 300px;
}

.carousel-track .project-card .thumbnail-carousel {
    width: 100%;
    height: 225px; /* 16:9 aspect ratio (400px wide × 225px tall) */
}

/* Carousel Navigation Buttons */
.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #2c2c2c;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
}

.carousel-button:hover {
    background: #ffffff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.12);
}

.carousel-button:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-button-prev {
    left: -25px;
}

.carousel-button-next {
    right: -25px;
}

.carousel-button span {
    line-height: 1;
}

/* Project Detail Page */
.project-nav {
    width: 100%;
    padding: 2rem;
    animation: fadeIn 0.5s ease-out;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    background: #2c2c2c;
    transform: translateX(-6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.project-detail {
    width: 100%;
    animation: fadeIn 0.6s ease-out 0.1s both;
}

.project-detail:has(.project-pdf-container) {
    padding: 0;
}

.project-detail:has(.project-media-container) {
    padding: 2rem;
}

.project-media-container {
    width: 50%;
    max-width: 50%;
    margin: 0 auto 3rem;
    border-radius: 12px;
    overflow: hidden;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 
                0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-media-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 
                0 4px 12px rgba(0, 0, 0, 0.08);
}

.project-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    animation: fadeIn 0.6s ease-out;
}

.project-video {
    width: 1920px;
    height: 1080px;
    max-width: 100%;
    max-height: 80vh;
    display: block;
    object-fit: contain;
    animation: fadeIn 0.6s ease-out;
}

/* Video container card styling */
.project-media-container:has(.project-video) {
    width: fit-content;
    max-width: calc(100% - 4rem);
    padding: 2rem;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 
                0 2px 8px rgba(0, 0, 0, 0.06);
}

.project-media-container:has(.project-video):hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 
                0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Maintain 16:9 aspect ratio for video on smaller screens */
@media (max-width: 1920px) {
    .project-video {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* PDF Viewer - Infinite Scroll */
.project-pdf-container {
    width: 100%;
    min-height: 100vh;
    background-color: #f5f5f5;
    padding: 0;
}

.pdf-pages-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    background-color: #f5f5f5;
}

.pdf-page-container {
    width: 100%;
    display: flex;
    justify-content: center;
    background: #ffffff;
    padding: 0;
}

.pdf-page-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.project-content {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.7s ease-out 0.2s both;
}

.project-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.project-description {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #5a5a5a;
}

.project-description p {
    margin-bottom: 1rem;
}

/* Responsive Breakpoints */

/* Tablet */
@media (max-width: 1024px) {
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 50px;
    }
    
    .card-thumbnail.thumbnail-regular {
        height: 480px; /* Slightly smaller on tablet, maintaining aspect ratio */
    }
    
    .carousel-track .project-card {
        flex: 0 0 350px; /* Smaller carousel cards on tablet */
    }
    
    .carousel-track .project-card .thumbnail-carousel {
        width: 100%;
        height: 197px; /* 16:9 aspect ratio (350px wide × 197px tall) */
    }

    .carousel-track .project-card {
        flex: 0 0 calc(50% - 25px); /* Maintain 2 per line */
    }

    .carousel-button-prev {
        left: 10px;
    }

    .carousel-button-next {
        right: 10px;
    }

    .project-media-container {
        width: 70%;
        max-width: 70%;
    }

    h1 {
        font-size: 2rem;
    }

    .owner-title {
        font-size: 2.5rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .header-section {
        height: 40vh;
        min-height: 300px;
    }

    .owner-info {
        padding: 3rem 1.5rem;
    }

    .owner-title {
        font-size: 2rem;
    }

    .owner-description {
        font-size: 1rem;
    }

    .featured-projects,
    .carousel-section {
        padding: 3rem 1.5rem;
    }

    .featured-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .card-thumbnail.thumbnail-regular {
        height: 350px; /* Smaller on mobile, maintaining aspect ratio */
    }
    
    .carousel-track .project-card {
        flex: 0 0 280px; /* Smaller carousel cards on mobile */
    }
    
    .carousel-track .project-card .thumbnail-carousel {
        width: 100%;
        height: 158px; /* 16:9 aspect ratio (280px wide × 158px tall) */
    }

    .carousel-track {
        gap: 1rem;
    }

    .carousel-track .project-card {
        flex: 0 0 calc(50% - 25px); /* 2 per line with 50px gap */
        min-width: 200px;
    }

    .carousel-button {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .carousel-button-prev {
        left: 5px;
    }

    .carousel-button-next {
        right: 5px;
    }

    .section-title {
        font-size: 2rem;
    }

    .project-detail:has(.project-media-container) {
        padding: 1.5rem;
    }
    
    .project-detail:has(.project-pdf-container) {
        padding: 0;
    }

    .project-media-container {
        width: 90%;
        max-width: 90%;
        padding: 1.5rem;
    }

    .project-title {
        font-size: 2rem;
    }

    .project-description {
        font-size: 1rem;
    }

    .project-pdf-container {
        padding: 0;
    }

    .pdf-pages-wrapper {
        gap: 0;
    }

    .pdf-page-container {
        padding: 0;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .carousel-track .project-card {
        flex: 0 0 85%;
    }

    .owner-title {
        font-size: 1.75rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .section-title {
        font-size: 1.75rem;
    }
}

