/* =============================================
   CP4U Gallery Page
   ============================================= */

/* ---- Astra overrides ---- */
#primary,
.ast-page-builder-template #primary { display: block !important; width: 100% !important; max-width: 100% !important; float: none !important; padding: 0 !important; }
#secondary, .widget-area { display: none !important; }
.ast-row, .ast-flex, .ast-container { display: block !important; width: 100% !important; max-width: 100% !important; padding: 0 !important; }
.entry-content, .ast-article-single { margin: 0 !important; padding: 0 !important; max-width: 100% !important; width: 100% !important; }
#content, .site-content { padding: 0 !important; width: 100% !important; }

/* ---- Hero ---- */
.cp4u-gallery-hero {
    background: linear-gradient(135deg, #0d1f12 0%, #1a3a22 100%);
    padding: 64px 24px 56px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cp4u-gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 80% at 50% 110%, rgba(0,184,67,.18) 0%, transparent 70%);
    pointer-events: none;
}

.cp4u-gallery-hero-inner {
    max-width: 680px;
    margin: 0 auto;
    position: relative;
}

.cp4u-gallery-badge {
    display: inline-block;
    background: rgba(0,184,67,.15);
    color: #00b843;
    border: 1px solid rgba(0,184,67,.3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
}

.cp4u-gallery-title {
    font-size: clamp(28px, 4vw, 46px) !important;
    font-weight: 800 !important;
    color: #fff !important;
    margin: 0 0 14px !important;
    line-height: 1.15 !important;
    letter-spacing: -.5px !important;
}

.cp4u-gallery-subtitle {
    font-size: 15px;
    color: #6ee7b7;
    margin: 0;
    line-height: 1.65;
}

/* ---- Filters ---- */
.cp4u-gallery-filters-wrap {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 50;
}

.cp4u-gallery-filters {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cp4u-gallery-filters::-webkit-scrollbar { display: none; }

.cp4u-gallery-filter-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    padding: 16px 16px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    line-height: 1;
}

.cp4u-gallery-filter-btn:hover {
    color: #00b843;
}

.cp4u-gallery-filter-btn.active {
    color: #00b843;
    border-bottom-color: #00b843;
}

/* ---- Gallery body ---- */
.cp4u-gallery-body {
    background: #f3f4f6;
    padding: 40px 24px 80px;
}

.cp4u-gallery-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

/* ---- Gallery item ---- */
.cp4u-gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #e5e7eb;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}

.cp4u-gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,.14);
}

.cp4u-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s;
}

.cp4u-gallery-item:hover img {
    transform: scale(1.05);
}

/* Overlay */
.cp4u-gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(13,31,18,.85) 0%, transparent 55%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 14px 16px;
    opacity: 0;
    transition: opacity .2s;
}

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

.cp4u-gallery-overlay-label {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .08em;
    line-height: 1;
    background: rgba(0,184,67,.8);
    padding: 4px 10px;
    border-radius: 20px;
}

.cp4u-gallery-overlay-zoom {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

/* ---- Empty state ---- */
.cp4u-gallery-empty {
    display: none;
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: #6b7280;
    font-size: 15px;
}

/* ---- Count bar ---- */
.cp4u-gallery-count {
    max-width: 1280px;
    margin: 0 auto 20px;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 500;
}

.cp4u-gallery-count span {
    color: #00b843;
    font-weight: 700;
}

/* ---- Lightbox ---- */
.cp4u-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

.cp4u-lightbox.open {
    opacity: 1;
    pointer-events: all;
}

.cp4u-lb-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.cp4u-lb-img-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
}

#cp4u-lb-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.cp4u-lb-caption {
    font-size: 13px;
    font-weight: 600;
    color: #d1fae5;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin: 0;
    text-align: center;
}

/* Lightbox buttons */
.cp4u-lb-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    backdrop-filter: blur(6px);
}

.cp4u-lb-close:hover { background: rgba(255,255,255,.2); }

.cp4u-lb-prev,
.cp4u-lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50%;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    backdrop-filter: blur(6px);
}

.cp4u-lb-prev { left: 16px; }
.cp4u-lb-next { right: 16px; }
.cp4u-lb-prev:hover,
.cp4u-lb-next:hover { background: rgba(0,184,67,.4); border-color: #00b843; }

/* Counter badge */
.cp4u-lb-counter {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,.6);
    letter-spacing: .05em;
}

/* ---- Hidden items ---- */
.cp4u-gallery-item[hidden] {
    display: none;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .cp4u-gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
    .cp4u-gallery-hero { padding: 40px 16px 36px; }
    .cp4u-gallery-body { padding: 24px 12px 48px; }
    .cp4u-gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .cp4u-lb-prev { left: 8px; }
    .cp4u-lb-next { right: 8px; }
}

@media (max-width: 420px) {
    .cp4u-gallery-grid { gap: 8px; }
    .cp4u-gallery-item { border-radius: 8px; }
}
