/**
 * Blueprint Gallery - Frontend CSS
 * Blueprint
 */

/* ==========================================================================
   Archive Page
   ========================================================================== */

.blueprint-gallery-archive {
    min-height: 100vh;
}

.blueprint-gallery-archive .nav-pills .nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--bp-radius-section);
    color: var(--bs-body-color);
    font-weight: 500;
    transition: all 0.2s ease;
}

.blueprint-gallery-archive .nav-pills .nav-link:hover {
    background: var(--bs-tertiary-bg);
}

.blueprint-gallery-archive .nav-pills .nav-link.active {
    background: var(--bs-primary);
    color: #fff;
}

/* ==========================================================================
   Gallery Card
   ========================================================================== */

.gallery-card {
    transition: transform 0.3s ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
}

.gallery-card-image {
    border-radius: var(--bp-radius-badge);
    overflow: hidden;
}

.gallery-card-image img {
    transition: transform 0.5s ease;
}

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

.gallery-card-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    transition: background 0.3s ease;
}

.gallery-card:hover .gallery-card-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
}

.gallery-card-title {
    line-height: 1.3;
}

/* ==========================================================================
   Single Gallery
   ========================================================================== */

.blueprint-gallery-single .gallery-hero {
    display: flex;
    align-items: flex-end;
}

/* ==========================================================================
   Gallery Grid (True Masonry with JS)
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    grid-auto-rows: 1px;
}

@media (min-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.625rem;
    }
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
}

@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.gallery-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--bp-radius-badge);
    cursor: pointer;
    background: var(--bs-tertiary-bg);
}

.gallery-grid-img {
    width: 100%;
    display: block;
    object-position: center 20%;
    transition: transform 0.4s ease;
}

.gallery-grid-item:hover .gallery-grid-img {
    transform: scale(1.08);
}

.gallery-grid-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.25s ease;
}

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

/* ==========================================================================
   Front Page Gallery Section
   ========================================================================== */

.blueprint-gallery-section {
    position: relative;
    padding: 5rem 0;
    overflow: hidden;
}

.blueprint-gallery-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.blueprint-gallery-section .section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.blueprint-gallery-section .section-subtitle {
    color: var(--bs-secondary-color);
    margin-bottom: 0;
}

.blueprint-gallery-section .section-nav {
    display: flex;
    gap: 0.5rem;
}

.blueprint-gallery-section .section-nav .btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bp-radius-circle);
}

/* Gallery Swiper */
.blueprint-gallery-swiper {
    overflow: visible !important;
}

.blueprint-gallery-swiper .swiper-slide {
    border-radius: var(--bp-radius-badge);
    overflow: hidden;
    aspect-ratio: 4/5;
}

.blueprint-gallery-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.4s ease;
}

.blueprint-gallery-swiper .swiper-slide:hover img {
    transform: scale(1.05);
}

.blueprint-gallery-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.blueprint-gallery-swiper .swiper-slide:hover .blueprint-gallery-slide-overlay {
    opacity: 1;
}

.blueprint-gallery-slide-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.blueprint-gallery-slide-count {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ==========================================================================
   Stack Cards (Homepage & Archive)
   ========================================================================== */

.blueprint-gallery-stacks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .blueprint-gallery-stacks {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 768px) {
    .blueprint-gallery-stacks {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

.blueprint-stack-card {
    cursor: pointer;
    position: relative;
}

.blueprint-stack-visual {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--bp-radius-badge);
    margin-bottom: 1rem;
}

.blueprint-stack-layer {
    position: absolute;
    border-radius: var(--bp-radius-badge);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.blueprint-stack-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
}

.blueprint-stack-layer--0 {
    inset: 0;
    z-index: 3;
}

.blueprint-stack-layer--1 {
    inset: -4px 4px 4px -4px;
    z-index: 2;
    opacity: 0.7;
}

.blueprint-stack-layer--2 {
    inset: -8px 8px 8px -8px;
    z-index: 1;
    opacity: 0.5;
}

.blueprint-stack-card:hover .blueprint-stack-layer--1 {
    transform: translate(-6px, 6px) rotate(-3deg);
}

.blueprint-stack-card:hover .blueprint-stack-layer--2 {
    transform: translate(12px, -12px) rotate(4deg);
}

.blueprint-stack-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0.75rem;
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: var(--bp-radius-badge);
    z-index: 4;
}

.blueprint-stack-card:hover .blueprint-stack-overlay {
    opacity: 1;
}

.blueprint-stack-count {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
}

.blueprint-stack-expand {
    opacity: 0.9;
}

.blueprint-stack-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
    padding: 0.25rem 0.5rem;
    background: var(--bs-warning);
    color: #000;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.blueprint-stack-meta {
    text-align: center;
}

.blueprint-stack-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--bs-body-color);
}

.blueprint-stack-info {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.blueprint-stack-card--skeleton .blueprint-stack-visual,
.blueprint-stack-card--skeleton .blueprint-stack-title {
    background: var(--bs-secondary-bg);
    animation: pulse 1.5s ease-in-out infinite;
}

.blueprint-stack-card--skeleton .blueprint-stack-title {
    height: 1.25rem;
    border-radius: 4px;
    width: 70%;
    margin-inline: auto;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.bg-gradient-to-t {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.2) 100%);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 767px) {
    .blueprint-gallery-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .gallery-card-title {
        font-size: 1rem;
    }
}
