/**
 * TPP Gallery Styles - Compact Mode (Homepage)
 *
 * @package TPP_Custom_Theme
 * @subpackage Gallery
 */

/* ==========================================================================
   Gallery Compact - Section
   ========================================================================== */

.tpp-gallery-compact {
    background: var(--gallery-bg, #ffffff);
    margin-top: var(--gallery-margin-top, 0);
    padding: var(--gallery-padding-top, 60px) 0 var(--gallery-padding-bottom, 60px);
    overflow: hidden;
}

/* ==========================================================================
   Header
   ========================================================================== */

.tpp-gallery-compact__header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.tpp-gallery-compact__title {
    font-family: var(--gallery-title-font, 'Montserrat', sans-serif);
    font-size: var(--gallery-title-size, 42px);
    font-weight: 700;
    color: var(--gallery-title-color, #1a1a2e);
    margin: 0 0 15px;
    line-height: 1.2;
}

.tpp-gallery-compact__line {
    width: 60px;
    height: 4px;
    background: var(--gallery-line-color, #05d38f);
    margin: 0 auto 15px;
    border-radius: 2px;
}

.tpp-gallery-compact__subtitle {
    font-family: var(--gallery-subtitle-font, 'Open Sans', sans-serif);
    font-size: var(--gallery-subtitle-size, 16px);
    color: var(--gallery-subtitle-color, #666666);
    margin: 0;
    line-height: 1.6;
}

/* ==========================================================================
   Carousel Container
   ========================================================================== */

.tpp-gallery-compact__carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    width: 80%;
    margin: 0 auto;
    position: relative;
}

/* ==========================================================================
   Navigation Arrows
   ========================================================================== */

.tpp-gallery-compact__arrow {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gallery-title-color, #1a1a2e);
    transition: all 0.2s ease;
    margin: 0 15px;
}

.tpp-gallery-compact__arrow:hover {
    background: var(--gallery-line-color, #05d38f);
    color: #fff;
    transform: scale(1.1);
}

.tpp-gallery-compact__arrow svg {
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   Viewport & Track
   ========================================================================== */

.tpp-gallery-compact__viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tpp-gallery-compact__track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    grid-auto-flow: column; /* Flow horizontally for carousel */
    gap: var(--gallery-gap-v, 15px) var(--gallery-gap-h, 15px);
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ==========================================================================
   Gallery Item
   ========================================================================== */

.tpp-gallery-compact__item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--gallery-radius, 10px);
    overflow: hidden;
    cursor: pointer;
    background: #f0f0f0;
}

.tpp-gallery-compact__item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.3), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tpp-gallery-compact__item:hover::after {
    opacity: 1;
}

.tpp-gallery-compact__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tpp-gallery-compact__item:hover .tpp-gallery-compact__image {
    transform: scale(1.08);
}

/* ==========================================================================
   Responsive: 1200px - 3 columns
   ========================================================================== */

@media (max-width: 1200px) {
    .tpp-gallery-compact__carousel {
        width: 90%;
    }

    .tpp-gallery-compact__track {
        grid-template-columns: repeat(3, 1fr);
    }

    .tpp-gallery-compact__title {
        font-size: calc(var(--gallery-title-size, 42px) * 0.85);
    }
}

/* ==========================================================================
   Responsive: 992px
   ========================================================================== */

@media (max-width: 992px) {
    .tpp-gallery-compact__arrow {
        width: 40px;
        height: 40px;
        margin: 0 10px;
    }

    .tpp-gallery-compact__arrow svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   Responsive: 768px - Hide arrows, single card view
   ========================================================================== */

@media (max-width: 768px) {
    .tpp-gallery-compact {
        padding: 40px 0;
    }

    .tpp-gallery-compact__carousel {
        width: 100%;
        padding: 0;
    }

    .tpp-gallery-compact__arrow {
        display: none;
    }

    .tpp-gallery-compact__viewport {
        width: 90%;
        margin: 0 auto;
    }

    .tpp-gallery-compact__track {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        display: flex;
        gap: 20px;
    }

    .tpp-gallery-compact__item {
        flex: 0 0 100%;
        min-width: 100%;
    }

    .tpp-gallery-compact__title {
        font-size: calc(var(--gallery-title-size, 42px) * 0.7);
    }

    .tpp-gallery-compact__subtitle {
        font-size: calc(var(--gallery-subtitle-size, 16px) * 0.9);
    }

    .tpp-gallery-compact__header {
        margin-bottom: 25px;
    }
}

/* ==========================================================================
   Responsive: 480px - Small mobile
   ========================================================================== */

@media (max-width: 480px) {
    .tpp-gallery-compact__title {
        font-size: calc(var(--gallery-title-size, 42px) * 0.6);
    }

    .tpp-gallery-compact__header {
        padding: 0 15px;
    }
}

/* ==========================================================================
   Gallery Full Mode (Shortcode)
   ========================================================================== */

.tpp-gallery-full {
    padding: 40px 0;
}

.tpp-gallery-full__title {
    font-family: var(--tpp-font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--tpp-secondary);
    margin: 0 0 30px;
    text-align: center;
}

.tpp-gallery-full__grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-columns, 4), 1fr);
    gap: var(--gallery-gap, 20px);
}

.tpp-gallery-full__item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--gallery-radius, 10px);
    overflow: hidden;
    cursor: pointer;
    background: #f0f0f0;
}

.tpp-gallery-full__item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.3), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tpp-gallery-full__item:hover::after {
    opacity: 1;
}

.tpp-gallery-full__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tpp-gallery-full__item:hover .tpp-gallery-full__image {
    transform: scale(1.08);
}

/* Pagination */
.tpp-gallery-full__pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.tpp-gallery-full__page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 15px;
    border: 2px solid var(--tpp-gray-300);
    background: transparent;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--tpp-gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tpp-gallery-full__page-btn:hover {
    border-color: var(--tpp-primary);
    color: var(--tpp-primary);
}

.tpp-gallery-full__page-btn.active {
    background: var(--tpp-primary);
    border-color: var(--tpp-primary);
    color: #fff;
}

.tpp-gallery-full__page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading state */
.tpp-gallery-full__loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.tpp-gallery-full__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tpp-gray-200);
    border-top-color: var(--tpp-primary);
    border-radius: 50%;
    animation: tpp-gallery-spin 0.8s linear infinite;
}

@keyframes tpp-gallery-spin {
    to { transform: rotate(360deg); }
}

/* Responsive: Full Mode */
@media (max-width: 1200px) {
    .tpp-gallery-full__grid {
        --gallery-columns: 3;
    }
}

@media (max-width: 768px) {
    .tpp-gallery-full__grid {
        --gallery-columns: 2;
    }

    .tpp-gallery-full__title {
        font-size: 26px;
    }
}

@media (max-width: 480px) {
    .tpp-gallery-full__grid {
        --gallery-columns: 1;
        --gallery-gap: 15px;
    }

    .tpp-gallery-full__title {
        font-size: 22px;
    }

    .tpp-gallery-full__pagination {
        flex-wrap: wrap;
    }
}
