/* Portfolio Page Header Styling */
#portfolio-header.page-header.hero {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)),
        url('../images/portfolio/portfolioheader.jpg'); /* or your portfolio header image */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 70vh;
    display: flex;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid var(--muted-gold);
}

#portfolio-header .crown-animation {
    margin-bottom: 2rem;
    animation: crownFloat 3s ease-in-out infinite;
}

#portfolio-header .crown-animation i {
    font-size: 4rem;
    color: var(--muted-gold);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

#portfolio-header .hero-content h1 {
    font-size: 3.5rem;
    color: var(--white);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 1rem;
    line-height: 1.2;
}

#portfolio-header .hero-content .subtitle {
    font-size: 1.5rem;
    color: var(--muted-gold);
    font-weight: 300;
    margin-bottom: 3rem;
}

/* Particles for portfolio page */
#portfolio-header .hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, var(--muted-gold), transparent),
        radial-gradient(2px 2px at 40px 70px, var(--gold), transparent),
        radial-gradient(1px 1px at 90px 40px, var(--muted-gold), transparent),
        radial-gradient(1px 1px at 130px 80px, var(--gold), transparent),
        radial-gradient(2px 2px at 160px 30px, var(--muted-gold), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: particleMove 20s linear infinite;
    opacity: 0.3;
}

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

@keyframes particleMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-200px, -100px); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #portfolio-header .hero-content h1 {
        font-size: 2.5rem;
    }
    
    #portfolio-header .hero-content .subtitle {
        font-size: 1.2rem;
    }
    
    #portfolio-header .crown-animation i {
        font-size: 3rem;
    }
}

/* Gallery Section */
.gallery-section {
    padding: 100px 0;
    background: var(--black);
    border-bottom: 2px solid var(--muted-gold);
}

.gallery-intro {
    text-align: center;
    font-size: 1.1rem;
    color: #e0e0e0;
    max-width: 700px;
    margin: 0 auto 3rem auto;
    line-height: 1.7;
}

/* Gallery Filter Tabs */
.gallery-filter-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-tab {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--primary-red);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.filter-tab:hover,
.filter-tab.active {
    background: var(--muted-gold);
    color: var(--black);
    border-color: var(--muted-gold);
    transform: translateY(-2px);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.gallery-item {
    background: var(--dark-gray);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid var(--primary-red);
    opacity: 1;
    transform: scale(1);
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(212, 175, 55, 0.3);
    border-color: var(--muted-gold);
}

.gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.gallery-item-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background-color: var(--black);
}

.gallery-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover .gallery-item-image img {
    transform: scale(1.1);
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-overlay i {
    font-size: 3rem;
    color: var(--muted-gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.gallery-item-info {
    padding: 1.5rem;
    text-align: center;
}

.gallery-item-info h4 {
    color: var(--muted-gold);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.gallery-item-info p {
    color: #ccc;
    font-size: 0.9rem;
    margin: 0;
}

/* Gallery Modal Styles */
.gallery-modal {
    display: none;
    opacity: 0;
    visibility: hidden;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.92);
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.gallery-modal.modal--is-open {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.gallery-modal-content {
    position: relative;
    background-color: var(--black);
    padding: 0;
    border: 2px solid var(--muted-gold);
    border-radius: 10px;
    width: 100%;
    max-width: 1080px; /* Updated width */
    max-height: 100%;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.close-gallery-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--white);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0,0,0,0.6);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2510 !important;
    line-height: 1;
}

.close-gallery-modal:hover {
    background: var(--muted-gold);
    color: var(--black);
    transform: rotate(90deg);
}

.gallery-modal-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 2px solid var(--muted-gold);
    background: var(--dark-gray);
}

.gallery-modal-header h2 {
    color: var(--muted-gold);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.gallery-modal-header p {
    color: #ccc;
    font-size: 1.1rem;
    margin: 0;
}

.gallery-modal-body {
    padding: 2rem;
    flex-grow: 1;
}

/* Default Video Container (16:9) */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; 
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--muted-gold);
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Fixed Size Video Container (Boxing Star) */
.fixed-size-video-container {
    width: 640px;
    height: 480px;
    max-width: 100%; 
    margin: 0 auto 2rem auto; 
    border-radius: 8px;
    overflow: hidden; 
    border: 2px solid var(--muted-gold);
}

.fixed-size-video-container video {
    width: 100%;
    height: 100%;
}

/* General Campaign & Creative Gallery Styles */
.creative-gallery {
    margin-bottom: 2rem;
}

.creative-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.creative-grid img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    border: 1px solid var(--muted-gold);
    transition: transform 0.3s ease;
}

.creative-grid img:hover {
    transform: scale(1.05);
}

/* Gallery Modal Description */
.gallery-modal-description h4 {
    color: var(--muted-gold);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--dark-gray);
    padding-bottom: 0.5rem;
}

.gallery-modal-description p {
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.gallery-modal-description ul {
    list-style: disc;
    padding-left: 20px;
    color: #ccc;
}

.gallery-modal-description ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Animation for gallery filter */
@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item.fade-in {
    animation: galleryFadeIn 0.5s ease forwards;
}

/* Styles for WPT Japan Tiled Gallery */
.image-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 10px; 
}

.image-tile-grid a {
    display: block;
    position: relative;
    height: 250px; 
    border-radius: 8px; 
    overflow: hidden; 
    border: 2px solid var(--dark-gray);
    transition: border-color 0.3s ease;
}

.image-tile-grid a:hover {
    border-color: var(--muted-gold);
}

.image-tile-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.image-tile-grid a:hover img {
    transform: scale(1.05);
    filter: brightness(0.75);
}

.image-tile-grid a::after {
    content: 'View Full Image';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

.image-tile-grid a:hover::after {
    opacity: 1;
}

/* Masonry-style layout for the GTO LAB ad gallery */
.masonry-ad-gallery {
    column-count: 3; /* Display content in 3 columns */
    column-gap: 10px; /* The space between columns */
}

.masonry-ad-gallery a {
    display: inline-block; /* Necessary for masonry layout */
    width: 100%;
    margin-bottom: 10px; /* The vertical space between images */
    border-radius: 5px;
    overflow: hidden;
    break-inside: avoid; /* Prevents images from breaking across columns */
}

.masonry-ad-gallery img {
    /* The display property is changed to block for more reliable margins */
    display: block;
    width: 100%;
    height: auto;
    /* This now correctly adds the vertical space you want */
    margin-bottom: 10px; 
    border-radius: 5px;
    break-inside: avoid;
}


/* Responsive Design */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .creative-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .image-tile-grid {
        grid-template-columns: repeat(2, 1fr); 
    }

    .masonry-ad-gallery {
        column-count: 2; /* Switch to 2 columns on medium screens */
    }
}

@media (max-width: 768px) {
    #portfolio-header .hero-content h1 {
        font-size: 2.2rem; 
    }
    
    #portfolio-header .hero-content .subtitle {
        font-size: 1.1rem; 
    }
    
    .page-intro-text {
        font-size: 1rem;
    }
    
    .gallery-filter-tabs {
        gap: 0.5rem;
    }
    
    .filter-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .gallery-modal-content {
        width: 95%;
        max-height: calc(100% - 40px);
    }
    
    .gallery-modal-header {
        padding: 1.5rem;
    }
    
    .gallery-modal-header h2 {
        font-size: 1.5rem;
    }
    
    .gallery-modal-body {
        padding: 1.5rem;
    }
    
    .creative-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .image-tile-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .gallery-filter-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-tab {
        width: 200px;
        text-align: center;
    }
    
    .creative-grid {
        grid-template-columns: 1fr;
    }
    
    .image-tile-grid {
        grid-template-columns: 1fr; 
    }

    .masonry-ad-gallery {
        column-count: 1; /* Switch to 1 column on small screens */
    }
}
