/* --- PART 1: IMPORT THE POPPINS FONT --- */
/* --- PART 2: APPLY THE FONT TO THE ENTIRE WEBSITE --- */
body {
    font-family: 'Poppins', sans-serif;
}

h1, h2, h3, h4, h5, h6, .wp-block-heading {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

.site-title, .site-title a, .site-description, .main-navigation a, .primary-menu a, .menu-item a, #toggle-menu {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 400;
}

.wp-block-button__link, .wp-element-button {
    font-family: 'Poppins', sans-serif !important;
}

.site-footer, footer, .footer-widgets, .footer-copyright {
    font-family: 'Poppins', sans-serif !important;
}

/* --- PART 3: STYLES FOR THE HERO SECTION (VIDEO) --- */
.entry-content .wp-block-cover {
    max-width: 1200px;
    margin: 40px auto;
    border-radius: 25px;
    overflow: hidden;
    min-height: 500px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
    transform: translateZ(0);
    backface-visibility: hidden;
}

.hero-section {
    background-color: rgba(232, 222, 210, 0.45);
    padding: 20px;
    border-radius: 20px;
    max-width: 1200px;
    margin: 60px auto 50px;
    position: relative;
    z-index: 10;
}

.hero-section .wp-block-heading {
    color: #3D2314;
}

/* --- PART 4: STYLES FOR THE PORTFOLIO SECTION ON HOMEPAGE --- */
.entry-content .portfolio-section-home {
    max-width: 1200px;
    margin: 80px auto;
    padding: 0;
}

.entry-content .portfolio-section-home .wp-block-columns {
    margin: 0;
}

.entry-content .portfolio-section-home .wp-block-column {
    padding: 0;
}

.entry-content .portfolio-section-home > .wp-block-heading:first-child {
    text-align: center;
    margin-bottom: 60px;
    color: #3D2314;
}

.entry-content .portfolio-section-home .wp-block-column {
    position: relative;
}

.entry-content .portfolio-section-home .wp-block-image {
    margin: 0;
}

.entry-content .portfolio-section-home .wp-block-image img {
    display: block;
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform .3s ease;
}

.entry-content .portfolio-section-home .wp-block-image:hover img {
    transform: scale(1.03);
}

.portfolio-item-title {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(232, 222, 210, 0.85);
    padding: 10px 35px;
    border-radius: 15px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 0;
    font-size: 1.1em;
    text-align: center;
    color: #4B2613;
    white-space: nowrap;
}

.portfolio-item-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    margin: 0;
}

.portfolio-item-button .wp-block-button__link {
    background-color: #4B2613;
    color: #FFFFFF;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: .9em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* --- PART 5: IMPROVED MOBILE STYLES --- */
@media (max-width: 768px) {
    .entry-content .wp-block-cover {
        max-width: 100%;
        margin: 40px -0;
        border-radius: 15px;
        min-height: 300px;
    }
    
    .entry-content .wp-block-group.hero-section {
        width: calc(100% - 40px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .entry-content .portfolio-section-home {
        margin: 60px auto;
        padding: 0;
    }
    
    .entry-content .portfolio-section-home > .wp-block-heading:first-child {
        margin-bottom: 40px;
    }
    
    .portfolio-item-title {
        top: 15px;
        padding: 12px 25px;
        font-size: 1.2em;
    }
    
    .portfolio-item-button {
        bottom: 15px;
    }
    
    .portfolio-item-button .wp-block-button__link {
        padding: 12px 20px;
        font-size: 1em;
    }
}

/* --- PART 8: STYLES FOR THE PHOTOGRAPHY COLLAGE SECTION --- */
.entry-content .photography-collage {
    max-width: 1200px !important;
    margin: 80px auto !important;
    padding: 0;
}

.entry-content .photography-collage .wp-block-group__inner-container {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    grid-auto-rows: 200px !important;
    gap: 15px !important;
}

.entry-content .photography-collage .wp-block-image {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    margin: 0 !important;
}

.entry-content .photography-collage .wp-block-image a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.entry-content .photography-collage .wp-block-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform .4s ease !important;
    display: block !important;
}

.entry-content .photography-collage .wp-block-image figcaption {
    position: absolute !important;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(75, 38, 19, 0.7);
    color: #FFFFFF;
    padding: 10px;
    font-size: .9em;
    text-align: center;
    opacity: 1;
    transition: opacity .3s ease;
    z-index: 2;
    box-sizing: border-box !important; /* Ensure padding doesn't affect layout */
    white-space: normal !important; /* Allow text to wrap */
}

@media (min-width: 769px) {
    .entry-content .photography-collage .wp-block-image figcaption {
        opacity: 0;
    }
    
    .entry-content .photography-collage .wp-block-image:hover figcaption {
        opacity: 1;
    }
    
    .entry-content .photography-collage .wp-block-image:hover img {
        transform: scale(1.08);
    }
}

.collage-item-1 {
    grid-column: span 2;
    grid-row: span 2;
}

.collage-item-5 {
    grid-column: span 2;
}

.collage-item-2 {
    grid-row: span 2;
}

.collage-item-6 {
    grid-column: span 2;
    grid-row: span 2;
}

@media (max-width: 768px) {
    /* Force the grid to be 2 columns on mobile */
    .entry-content .photography-collage .wp-block-group__inner-container {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-auto-rows: 200px !important;
        gap: 10px !important;
    }
    
    /* Reset all grid items to span 1 column and 1 row */
    .entry-content .photography-collage .wp-block-image {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
    
    /* Adjust figcaption for mobile to prevent text cutoff */
    .entry-content .photography-collage .wp-block-image figcaption {
        padding: 8px !important;
        font-size: .8em !important;
        line-height: 1.2 !important;
        white-space: normal !important;
    }
}

/* --- CUSTOM PORTFOLIO FILTER STYLES (UPDATED) --- */

/* Hide all portfolio sections by default - MORE SPECIFIC */
body .entry-content .wp-block-group.portfolio-section {
    display: none !important;
}

/* Show the section that is currently active - MORE SPECIFIC */
body .entry-content .wp-block-group.portfolio-section.active {
    display: block !important;
    animation: fadeIn 0.5s ease-in-out;
}

/* Simple fade-in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Style for the filter buttons container */
.wp-block-group.filter-buttons-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

/* Style for the filter buttons (INACTIVE STATE) */
.filter-btn .wp-block-button__link {
    background-color: #4b2613;
    color: #FFFFFF;
    border-radius: 25px;
    padding: 10px 25px;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    border: none;
}

/* Style for the ACTIVE (currently selected) button - MORE SPECIFIC */
body .entry-content .filter-btn.active .wp-block-button__link {
    background-color: #b04b19 !important; /* Use !important to override theme styles */
    color: #fff !important; /* Changed text color so it's visible on the light background */
}

/* Hover effect for INACTIVE buttons only */
.filter-btn .wp-block-button__link:hover {
    background-color: #b04b19 !important;
    color: #fff !important;
    transform: translateY(-2px);
}

/* --- VIDEO PORTFOLIO STYLES (CORRECTED FOR ALIGNMENT & SELECTORS) --- */

/* 
   FIX 1: This now targets the first grid container AND all subsequent columns blocks.
   The comma separates the selectors.
*/
.video-portfolio-grid,
.video-portfolio-grid ~ .wp-block-columns {
    margin-bottom: 30px; /* Space between rows */
    gap: 30px;           /* Space between videos in a row */
}

/* 
   FIX 2: Force all columns in a row to align to the TOP.
   This prevents the "offset" look when videos have different aspect ratios.
   The :not(:only-child) ensures this only applies to rows with multiple columns.
*/
.video-portfolio-grid ~ .wp-block-columns:not(:only-child) {
    align-items: flex-start;
    display: flex;
}

/* Target the video blocks themselves */
.video-portfolio-grid .wp-block-video,
.video-portfolio-grid ~ .wp-block-columns .wp-block-video {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Removed flex-grow: 1 to prevent stretching issues */
}

.video-portfolio-grid .wp-block-video:hover,
.video-portfolio-grid ~ .wp-block-columns .wp-block-video:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* --- CORE LOGIC FOR ASPECT RATIOS (UNCHANGED) --- */

/* This creates a responsive 16:9 container for all standard videos. */
.video-portfolio-grid .wp-block-video,
.video-portfolio-grid ~ .wp-block-columns .wp-block-video {
    aspect-ratio: 16 / 9;
    width: 100%;
}

/* Special handling for vertical videos you mark with the 'video-vertical' class. */
.video-portfolio-grid .wp-block-video.video-vertical,
.video-portfolio-grid ~ .wp-block-columns .wp-block-video.video-vertical {
    aspect-ratio: 9 / 16;
    max-width: 300px; /* Prevents vertical videos from becoming too large */
    margin: 0 auto;     /* Centers a single vertical video in its column */
}

/* Make the actual video player/iframe fill the aspect-ratio container perfectly. */
.video-portfolio-grid .wp-block-video video,
.video-portfolio-grid .wp-block-video iframe,
.video-portfolio-grid ~ .wp-block-columns .wp-block-video video,
.video-portfolio-grid ~ .wp-block-columns .wp-block-video iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* --- MOBILE FIX FOR UNSTACKED COLUMNS (FINAL CORRECTED VERSION) --- */
@media (max-width: 768px) {
    
    /* 
       FIX 1: Target BOTH the first grid container AND all subsequent columns blocks.
       The comma separates the selectors to apply the same rules to both.
    */
    .video-portfolio-grid,
    .video-portfolio-grid ~ .wp-block-columns {
        display: flex !important;
        align-items: flex-start !important; 
        justify-content: center;
        margin-bottom: 20px;
        gap: 15px !important;
    }

    /* 
       FIX 2: Target the columns within BOTH the first and subsequent rows.
    */
    .video-portfolio-grid .wp-block-column,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-column {
        margin: 0 !important;
        padding: 0 !important;
        vertical-align: top !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
    }

    /* 
       Reset any default margins/padding on the video blocks.
    */
    .video-portfolio-grid .wp-block-video,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video {
        margin: 0 !important;
        padding: 0 !important;
        flex-grow: 1;
    }
    
    /* 
       Force all HORIZONTAL videos to a uniform height.
    */
    .video-portfolio-grid .wp-block-video:not(.video-vertical),
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video:not(.video-vertical) {
        aspect-ratio: unset !important;
        height: 220px !important;
        width: 100% !important;
    }

    /* 
       FIX 3: Corrected logic for VERTICAL videos.
       We give them a fixed size based on the row height to prevent them from disappearing.
    */
    .video-portfolio-grid .wp-block-video.video-vertical,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video.video-vertical {
        aspect-ratio: 9 / 16 !important;
        height: 220px !important; /* Give them the same height as the row */
        width: auto !important;   /* Let the width be calculated by the aspect-ratio */
        margin: 0 auto !important;
        flex-grow: 0; /* Don't let them stretch */
    }
    
    /* Ensure the video player/iframe fills the containers correctly */
    .video-portfolio-grid .wp-block-video video,
    .video-portfolio-grid .wp-block-video iframe,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video video,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video iframe {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        position: absolute;
        top: 0;
        left: 0;
    }
    
    /* For vertical videos, use 'contain' to avoid cropping them awkwardly */
    .video-portfolio-grid .wp-block-video.video-vertical video,
    .video-portfolio-grid .wp-block-video.video-vertical iframe,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video.video-vertical video,
    .video-portfolio-grid ~ .wp-block-columns .wp-block-video.video-vertical iframe {
        object-fit: contain;
        background-color: #000;
    }
}