/**
 * CBP Lite Frontend Styles
 * 
 * @package CBP_Lite
 * @since 0.1.7
 */

/* ==========================================================================
   CSS Custom Properties (Variables)
   ========================================================================== */

.cbp-wrap {
    /* Color Variables */
    --cbp-bg: #fff;
    --cbp-text: #111318;
    --cbp-muted: #6c7079;
    --cbp-border: #e8e9ee;
    --cbp-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 10px 24px rgba(0, 0, 0, 0.06);
    
    /* Layout Variables */
    --cbp-ratio: 4/3;
    
    /* Animation Variables */
    --inlineDur: 560ms;
    --springDur: 900ms;
    --springCurve: cubic-bezier(0.22, 0.8, 0.28, 1);
    
    /* Responsive Breakpoints */
    --mobile-max: 560px;
    --tablet-max: 980px;
}
/* ==========================================================================
   Filter Buttons
   ========================================================================== */

.cbp-wrap .cbp-l-filters-button {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 24px;
}

.cbp-wrap .cbp-filter-item {
    cursor: pointer;
    padding: 8px 14px;
    border: 1px solid #d7d9e0;
    border-radius: 4px;
    background: transparent;
    color: var(--cbp-text);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-block;
}

.cbp-wrap .cbp-filter-item:hover {
    background: var(--cbp-text);
    color: #fff;
    border-color: var(--cbp-text);
    transform: translateY(-1px);
}

.cbp-wrap .cbp-filter-item-active {
    background: var(--cbp-text);
    color: #fff;
    border-color: var(--cbp-text);
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.cbp-wrap .cbp {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(var(--cbp-cols-d, 3), 1fr);
}

/* Tablet Responsive */
@media (max-width: 980px) {
    .cbp-wrap .cbp {
        grid-template-columns: repeat(var(--cbp-cols-t, 2), 1fr);
    }
}

/* Mobile Responsive */
@media (max-width: 560px) {
    .cbp-wrap .cbp {
        grid-template-columns: repeat(var(--cbp-cols-m, 1), 1fr);
        gap: 16px;
    }
    
    .cbp-wrap .cbp-l-filters-button {
        gap: 8px;
        margin: 8px 0 20px;
    }
    
    .cbp-wrap .cbp-filter-item {
        padding: 6px 12px;
        font-size: 11px;
    }
}
/* ==========================================================================
   Grid Items
   ========================================================================== */

.cbp-wrap .cbp-item {
    position: relative;
}

.cbp-wrap .cbp-item .cbp-item-wrapper {
    position: relative;
    overflow: hidden;
    background: #f7f8fb;
    border: 1px solid var(--cbp-border);
    box-shadow: var(--cbp-shadow);
    aspect-ratio: var(--cbp-ratio);
    border-radius: 4px;
    transition: box-shadow 0.3s ease;
}

.cbp-wrap .cbp-item:hover .cbp-item-wrapper {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 15px 35px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Caption System
   ========================================================================== */

.cbp-wrap .cbp-caption {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
}

.cbp-wrap .cbp-caption-defaultWrap {
    position: absolute;
    inset: 0;
    will-change: transform;
}

.cbp-wrap .cbp-caption-defaultWrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.48s cubic-bezier(0.2, 0.6, 0.2, 1), opacity 0.3s ease;
}

.cbp-wrap .cbp-caption-defaultWrap img.alt {
    opacity: 0;
}

.cbp-wrap .cbp-item:hover .cbp-caption-defaultWrap img {
    transform: translateX(8%) scale(1.03);
}

.cbp-wrap .cbp-caption-activeWrap {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 62%;
    background: var(--cbp-text);
    color: #fff;
    transform: translateX(-100%);
    transition: transform 0.32s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 18px 18px 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.cbp-wrap .cbp-item:hover .cbp-caption-activeWrap {
    transform: translateX(0%);
}

.cbp-wrap .cbp-l-caption-alignLeft {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.cbp-wrap .cbp-l-caption-body {
    width: 100%;
}

.cbp-wrap .cbp-l-caption-title {
    font-weight: 700;
    font-size: 16px;
    margin: 0 0 6px;
    line-height: 1.3;
}

.cbp-wrap .cbp-l-caption-desc {
    font-size: 12px;
    color: #cfd2da;
    line-height: 1.4;
    margin: 2px 0;
}
/* ==========================================================================
   Inline Gallery
   ========================================================================== */

.cbp-wrap .cbp-inline {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
    background: #fff;
    border: 1px solid var(--cbp-border);
    box-shadow: var(--cbp-shadow);
    padding: 22px;
    align-items: stretch;
    will-change: height, transform, opacity;
    border-radius: 8px;
    margin-top: 20px;
}

/* Tablet Inline Layout */
@media (max-width: 900px) {
    .cbp-wrap .cbp-inline {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 16px;
    }
}

/* Mobile Inline Layout */
@media (max-width: 560px) {
    .cbp-wrap .cbp-inline {
        padding: 12px;
        gap: 16px;
    }
}

/* Inline Left Panel (Gallery) */
.cbp-wrap .cbp-inline .inline-left {
    position: relative;
    min-height: 420px;
    background: #0b0c0f;
    border: 1px solid #1e1f24;
    border-radius: 6px;
    overflow: hidden;
}

.cbp-wrap .cbp-inline .inline-left.bg-white {
    background: #f7f8fb;
    border-color: #e8e9ee;
}

.cbp-wrap .cbp-inline .inline-left.bg-white .inline-slider {
    background: #f7f8fb;
}

/* Inline Right Panel (Content) */
.cbp-wrap .cbp-inline .inline-right {
    overflow: auto;
    padding: 4px 0;
}
/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes springIn {
    0% {
        transform: translateY(-6px) scaleY(0.985);
        opacity: 0;
    }
    55% {
        transform: translateY(3px) scaleY(1.012);
        opacity: 1;
    }
    80% {
        transform: translateY(-1px) scaleY(0.998);
    }
    100% {
        transform: translateY(0) scaleY(1);
    }
}

@keyframes springOut {
    0% {
        transform: translateY(0) scaleY(1);
        opacity: 1;
    }
    30% {
        transform: translateY(1px) scaleY(0.996);
    }
    100% {
        transform: translateY(-6px) scaleY(0.985);
        opacity: 0;
    }
}

.cbp-wrap .spring-in {
    animation: springIn var(--springDur) var(--springCurve) both;
}

.cbp-wrap .spring-out {
    animation: springOut var(--springDur) var(--springCurve) both;
}

/* ==========================================================================
   Inline Gallery Slider
   ========================================================================== */

.cbp-wrap .inline-slider {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0c0f;
    overflow: hidden;
}

.cbp-wrap .inline-slide {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.cbp-wrap .inline-slide.active {
    display: flex;
    z-index: 2;
}

.cbp-wrap .inline-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    display: block;
    /* Ensure images are always visible, even during loading */
    min-height: 200px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
    /* Force image to be on top and visible */
    position: relative;
    z-index: 1;
}

.cbp-wrap .inline-slide iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

/* ==========================================================================
   Inline Gallery Navigation
   ========================================================================== */

.cbp-wrap .inline-nav {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 5;
}

.cbp-wrap .inline-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #a0a3aa;
    border: 1px solid #7b7f87;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.cbp-wrap .inline-dot:hover {
    opacity: 1;
    transform: scale(1.1);
}

.cbp-wrap .inline-dot.active {
    background: #fff;
    opacity: 1;
    transform: scale(1.2);
}

.cbp-wrap .inline-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    border: 1px solid #2b2d36;
    background: #17181d;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

.cbp-wrap .inline-arrow:hover {
    background: #20222b;
    transform: translateY(-50%) scale(1.05);
}

.cbp-wrap .inline-arrow.prev {
    left: 10px;
}

.cbp-wrap .inline-arrow.next {
    right: 10px;
}
/* ==========================================================================
   Inline Content
   ========================================================================== */

.cbp-wrap .inline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cbp-wrap .inline-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--cbp-text);
}

.cbp-wrap .inline-close {
    appearance: none;
    border: 1px solid #d7d9e0;
    background: #fff;
    color: #111;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.cbp-wrap .inline-close:hover {
    background: #f3f4f7;
    transform: scale(1.05);
}

.cbp-wrap .inline-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 12px;
}

.cbp-wrap .inline-chip {
    font-size: 12px;
    background: #f3f4f7;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid #e8e9ee;
    color: #111;
    font-weight: 500;
    transition: all 0.2s ease;
}

.cbp-wrap .inline-chip:hover {
    background: #e8e9ee;
    transform: translateY(-1px);
}

.cbp-wrap .inline-body {
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

.cbp-wrap .inline-body p {
    margin: 0 0 12px 0;
}

.cbp-wrap .inline-body p:last-child {
    margin-bottom: 0;
}

.cbp-wrap .inline-body h1,
.cbp-wrap .inline-body h2,
.cbp-wrap .inline-body h3,
.cbp-wrap .inline-body h4,
.cbp-wrap .inline-body h5,
.cbp-wrap .inline-body h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.cbp-wrap .inline-body h1:first-child,
.cbp-wrap .inline-body h2:first-child,
.cbp-wrap .inline-body h3:first-child,
.cbp-wrap .inline-body h4:first-child,
.cbp-wrap .inline-body h5:first-child,
.cbp-wrap .inline-body h6:first-child {
    margin-top: 0;
}

/* ==========================================================================
   Error and Empty States
   ========================================================================== */

.cbp-error,
.cbp-empty {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    color: #6c757d;
    font-size: 14px;
    margin: 20px 0;
}

.cbp-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

.cbp-wrap .cbp-filter-item:focus,
.cbp-wrap .inline-arrow:focus,
.cbp-wrap .inline-dot:focus,
.cbp-wrap .inline-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cbp-wrap * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cbp-wrap .cbp-filter-item {
        border-width: 2px;
    }
    
    .cbp-wrap .cbp-item-wrapper {
        border-width: 2px;
    }
}


/* --- Chrome first-frame fix: ensure inline slide images are visible --- */
.inline-slide img {
    opacity: 1 !important;
    visibility: visible !important;
}

