/* ==========================================================================
   TemplateCore Log Engine Frontend Styles — Layouts, Lightbox & Universe Presets
   ========================================================================== */

.tc-log-gallery {
    box-sizing: border-box !important;
    width: 100% !important;
    margin-bottom: 40px !important;
    position: relative !important;
}

.tc-gallery-header { margin-bottom: 24px !important; text-align: left !important; }
.tc-gallery-title { margin: 0 0 6px 0 !important; font-size: 2rem !important; line-height: 1.1 !important; }
.tc-gallery-desc { margin: 0 !important; opacity: 0.85 !important; font-size: 1rem !important; line-height: 1.5 !important; }

/* -------------------------------------------------------------------------
   1. LAYOUT ENGINES
   ------------------------------------------------------------------------- */

/* Grid Layout */
.tc-layout-grid .tc-gallery-items-wrap {
    display: grid !important;
    gap: 24px !important;
}
.tc-cols-1 .tc-gallery-items-wrap { grid-template-columns: 1fr !important; }
.tc-cols-2 .tc-gallery-items-wrap { grid-template-columns: repeat(2, 1fr) !important; }
.tc-cols-3 .tc-gallery-items-wrap { grid-template-columns: repeat(3, 1fr) !important; }
.tc-cols-4 .tc-gallery-items-wrap { grid-template-columns: repeat(4, 1fr) !important; }
.tc-cols-5 .tc-gallery-items-wrap { grid-template-columns: repeat(5, 1fr) !important; }

/* Dynamic Masonry Layout */
.tc-layout-masonry .tc-gallery-items-wrap {
    column-gap: 24px !important;
}
.tc-layout-masonry.tc-cols-2 .tc-gallery-items-wrap { column-count: 2 !important; }
.tc-layout-masonry.tc-cols-3 .tc-gallery-items-wrap { column-count: 3 !important; }
.tc-layout-masonry.tc-cols-4 .tc-gallery-items-wrap { column-count: 4 !important; }
.tc-layout-masonry.tc-cols-5 .tc-gallery-items-wrap { column-count: 5 !important; }
.tc-layout-masonry .tc-log-card { break-inside: avoid !important; margin-bottom: 24px !important; }

/* Horizontal Scroll Carousel */
.tc-layout-horizontal_scroll { position: relative !important; }
.tc-layout-horizontal_scroll .tc-gallery-items-wrap {
    display: flex !important;
    overflow-x: auto !important;
    gap: 20px !important;
    padding-bottom: 16px !important;
    scroll-snap-type: x mandatory !important;
    scrollbar-width: thin !important;
    -webkit-overflow-scrolling: touch !important;
}
.tc-layout-horizontal_scroll .tc-log-card {
    flex: 0 0 340px !important;
    scroll-snap-align: start !important;
}
.tc-carousel-nav {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
}
.tc-carousel-arrow {
    background: rgba(0, 0, 0, 0.4) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    width: 34px !important;
    height: 34px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}
.tc-carousel-arrow:hover {
    background: var(--tc-color-accent, #68B8FF) !important;
    color: #000 !important;
}

/* Scattered Offset Layout */
.tc-layout-scattered .tc-gallery-items-wrap {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 30px !important;
}
.tc-layout-scattered .tc-log-card { flex: 1 1 45% !important; min-width: 280px !important; }
.tc-layout-scattered .tc-log-card:nth-child(odd) { transform: rotate(-2deg) translateY(-8px) !important; }
.tc-layout-scattered .tc-log-card:nth-child(even) { transform: rotate(1.8deg) translateY(12px) !important; }

/* Vertical Stack Layout */
.tc-layout-stack .tc-gallery-items-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
}
.tc-layout-stack .tc-log-card { width: 100% !important; }

/* -------------------------------------------------------------------------
   2. MEDIA ASPECT RATIOS & VIEWPORT
   ------------------------------------------------------------------------- */
.tc-ratio-landscape .tc-card-media-viewport { height: 220px !important; }
.tc-ratio-square .tc-card-media-viewport { height: 320px !important; }
.tc-ratio-portrait .tc-card-media-viewport { height: 420px !important; }
.tc-ratio-original .tc-card-media-viewport { height: auto !important; max-height: 550px !important; }

.tc-card-media-viewport {
    position: relative !important;
    width: 100% !important;
    overflow: hidden !important;
    background: #08090B !important;
}
.tc-card-media-viewport img,
.tc-card-media-viewport video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.tc-log-card:hover .tc-card-media-viewport img,
.tc-log-card:hover .tc-card-media-viewport video {
    transform: scale(1.04) !important;
}

.tc-has-lightbox { cursor: pointer !important; }
.tc-card-zoom-badge {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(4px) !important;
    color: #fff !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
}
.tc-log-card:hover .tc-card-zoom-badge { opacity: 1 !important; }

/* -------------------------------------------------------------------------
   3. CAPTION & OVERLAY MODES
   ------------------------------------------------------------------------- */
.tc-card-caption { padding: 16px 0 !important; }
.tc-card-kicker { font-family: monospace !important; font-size: 11px !important; text-transform: uppercase !important; display: block !important; margin-bottom: 4px !important; }
.tc-card-title { margin: 0 0 6px 0 !important; font-size: 1.3rem !important; line-height: 1.2 !important; }
.tc-card-desc { margin: 0 0 10px 0 !important; opacity: 0.85 !important; font-size: 0.95rem !important; line-height: 1.4 !important; }
.tc-card-chips { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; margin: 10px 0 !important; }
.tc-chip-item { padding: 3px 8px !important; border-radius: 4px !important; font-size: 11px !important; font-family: monospace !important; }

.tc-title-pos-overlay .tc-card-overlay-caption {
    position: absolute !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    padding: 20px !important;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%) !important;
    color: #fff !important;
}
.tc-title-pos-hover .tc-card-overlay-caption {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    padding: 20px !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    color: #fff !important;
    opacity: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    transition: opacity 0.25s ease !important;
}
.tc-title-pos-hover:hover .tc-card-overlay-caption { opacity: 1 !important; }
.tc-title-pos-hidden .tc-card-caption { display: none !important; }

/* ==========================================================================
   4. Y2K UNIVERSE PRESET ARTIFACT STYLING
   ========================================================================== */

/* 1. METALHEARTS PRESET */
.tc-preset-metalhearts .tc-log-card {
    background: #111111 !important;
    border: 2px solid #8E1117 !important;
    box-shadow: 4px 4px 0px #1C1C1C !important;
    color: #E5E5E3 !important;
    padding: 16px !important;
    border-radius: 0px !important;
    font-family: "Georgia", serif !important;
}
.tc-preset-metalhearts .tc-gallery-title,
.tc-preset-metalhearts .tc-card-title {
    font-family: "Impact", sans-serif !important;
    text-transform: uppercase !important;
    color: #E5E5E3 !important;
    letter-spacing: 0.04em !important;
}
.tc-preset-metalhearts .tc-card-kicker { color: #8E1117 !important; }
.tc-preset-metalhearts .tc-chip-item { background: #080808 !important; border: 1px solid #292929 !important; color: #D6D0C4 !important; }
.tc-preset-metalhearts .tc-card-action-link { background: #8E1117 !important; color: #FFFFFF !important; font-family: monospace !important; padding: 6px 14px !important; text-decoration: none !important; font-weight: bold !important; font-size: 11px !important; display: inline-block !important; border-radius: 0px !important; }

/* 2. CHROMECORE PRESET */
.tc-preset-chromecore .tc-log-card {
    background: #15171A !important;
    border-top: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    border-bottom: 1px solid #292C31 !important;
    border-radius: var(--tc-card-radius, 12px) !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7) !important;
    color: #F3F5F7 !important;
    padding: 18px !important;
    font-family: "Trebuchet MS", sans-serif !important;
}
.tc-preset-chromecore .tc-gallery-title,
.tc-preset-chromecore .tc-card-title {
    font-family: "Trebuchet MS", sans-serif !important;
    text-transform: uppercase !important;
    color: #FFFFFF !important;
    letter-spacing: 0.08em !important;
}
.tc-preset-chromecore .tc-card-kicker { color: #68B8FF !important; }
.tc-preset-chromecore .tc-chip-item { background: #08090B !important; border: 1px solid #292C31 !important; color: #AEB4BC !important; }
.tc-preset-chromecore .tc-card-action-link { background: linear-gradient(135deg, #68B8FF 0%, #A88CFF 100%) !important; color: #FFFFFF !important; border-radius: 999px !important; padding: 6px 16px !important; text-decoration: none !important; font-weight: bold !important; font-size: 11px !important; display: inline-block !important; }

/* 3. CYBER Y2K / FUTURISM PRESET */
.tc-preset-y2kfuturism .tc-log-card {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #D8DCE3 !important;
    border-radius: var(--tc-card-radius, 20px) !important;
    box-shadow: 0 12px 40px rgba(38, 140, 255, 0.15) !important;
    color: #182338 !important;
    padding: 16px !important;
    font-family: "Space Grotesk", sans-serif !important;
}
.tc-preset-y2kfuturism .tc-gallery-title,
.tc-preset-y2kfuturism .tc-card-title { color: #268CFF !important; }
.tc-preset-y2kfuturism .tc-card-kicker { color: #7657D9 !important; }
.tc-preset-y2kfuturism .tc-chip-item { background: #E9F8FF !important; color: #268CFF !important; border-radius: 6px !important; }
.tc-preset-y2kfuturism .tc-card-action-link { background: #00E5FF !important; color: #182338 !important; border-radius: 999px !important; padding: 6px 16px !important; text-decoration: none !important; font-weight: bold !important; font-size: 11px !important; display: inline-block !important; }

/* 4. MCBLING PRESET */
.tc-preset-mcbling .tc-log-card {
    background: #FFFFFF !important;
    border: 2px solid #D4AF37 !important;
    border-radius: var(--tc-card-radius, 24px) !important;
    box-shadow: 0 12px 35px rgba(255, 20, 147, 0.25) !important;
    color: #080808 !important;
    padding: 20px !important;
    font-family: "Montserrat", sans-serif !important;
    text-align: center !important;
}
.tc-preset-mcbling .tc-gallery-title,
.tc-preset-mcbling .tc-card-title { font-family: "Playfair Display", serif !important; color: #FF1493 !important; }
.tc-preset-mcbling .tc-card-kicker { color: #D4AF37 !important; font-weight: bold !important; }
.tc-preset-mcbling .tc-chip-item { background: #FFF0F5 !important; border: 1px solid #FFC0CB !important; color: #FF1493 !important; border-radius: 999px !important; }
.tc-preset-mcbling .tc-card-action-link { background: #FF1493 !important; color: #FFFFFF !important; border-radius: 999px !important; padding: 8px 20px !important; text-decoration: none !important; font-weight: bold !important; font-size: 11px !important; display: inline-block !important; }

/* 5. INDUSTRIAL PRESET */
.tc-preset-industrialunderground .tc-log-card {
    background: #343638 !important;
    border: 2px solid #777777 !important;
    box-shadow: 5px 5px 0px #000000 !important;
    color: #E7E3D7 !important;
    padding: 16px !important;
    border-radius: 0px !important;
    font-family: "Consolas", monospace !important;
}
.tc-preset-industrialunderground .tc-gallery-title,
.tc-preset-industrialunderground .tc-card-title { font-family: "Impact", sans-serif !important; color: #E7E3D7 !important; text-transform: uppercase !important; }
.tc-preset-industrialunderground .tc-card-kicker { color: #E65B19 !important; }
.tc-preset-industrialunderground .tc-chip-item { background: #111111 !important; border: 1px solid #777777 !important; color: #D8B51F !important; }
.tc-preset-industrialunderground .tc-card-action-link { background: #E65B19 !important; color: #FFFFFF !important; padding: 6px 14px !important; text-decoration: none !important; font-weight: bold !important; font-size: 11px !important; display: inline-block !important; box-shadow: 2px 2px 0px #000000 !important; border-radius: 0px !important; }

/* 6. SCENE PRESET */
.tc-preset-scene .tc-log-card {
    background: #121212 !important;
    border: 2px solid #FF1493 !important;
    box-shadow: 5px 5px 0px #00A8FF !important;
    color: #FFFFFF !important;
    padding: 16px !important;
    border-radius: 0px !important;
    font-family: "Inter", sans-serif !important;
}
.tc-preset-scene .tc-gallery-title,
.tc-preset-scene .tc-card-title { font-family: "Impact", sans-serif !important; color: #FFFFFF !important; text-shadow: 2px 2px 0px #FF1493 !important; }
.tc-preset-scene .tc-card-kicker { color: #B6FF00 !important; }
.tc-preset-scene .tc-chip-item { background: #000000 !important; border: 1px solid #2A2A2A !important; color: #00A8FF !important; }
.tc-preset-scene .tc-card-action-link { background: #FF1493 !important; color: #FFFFFF !important; padding: 6px 14px !important; text-decoration: none !important; font-weight: bold !important; font-size: 11px !important; display: inline-block !important; box-shadow: 2px 2px 0px #00A8FF !important; border-radius: 0px !important; }

/* ==========================================================================
   5. BRAND LOGO SPECIFIC PRESENTATION
   ========================================================================== */
.tc-type-brand .tc-card-media-viewport {
    background: transparent !important;
    padding: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.tc-type-brand .tc-card-media-viewport img {
    object-fit: contain !important;
    max-height: 80% !important;
    width: auto !important;
    max-width: 100% !important;
    filter: grayscale(100%) opacity(0.7) !important;
    transition: filter 0.25s ease, transform 0.25s ease !important;
}
.tc-type-brand .tc-log-card:hover .tc-card-media-viewport img {
    filter: grayscale(0%) opacity(1) !important;
    transform: scale(1.06) !important;
}
.tc-type-brand.tc-ratio-landscape .tc-card-media-viewport { height: 130px !important; }
.tc-type-brand.tc-ratio-square .tc-card-media-viewport { height: 160px !important; }
.tc-type-brand .tc-card-caption { text-align: center !important; padding: 0 10px 15px 10px !important; }
.tc-type-brand .tc-card-title { font-size: 1.15rem !important; margin: 0 !important; }

/* ==========================================================================
   6. LIGHTBOX MODAL ARTIFACT ADAPTATIONS (STATE CONTROLLED)
   ========================================================================== */

/* Default State: Fully Hidden & Non-interactive */
.tc-log-lightbox {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 999999 !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

/* Active State: Displayed when triggered */
.tc-log-lightbox.is-open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.tc-lightbox-backdrop {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    background: rgba(0, 0, 0, 0.88) !important;
    backdrop-filter: blur(8px) !important;
    cursor: pointer !important;
}

.tc-lightbox-card {
    position: relative !important;
    z-index: 2 !important;
    background: #15171A !important;
    color: #F3F5F7 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
    max-width: 920px !important;
    width: 92% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9) !important;
}

.tc-lightbox-close {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: none !important;
    border: none !important;
    font-size: 30px !important;
    line-height: 1 !important;
    color: #ffffff !important;
    cursor: pointer !important;
    z-index: 3 !important;
    padding: 6px !important;
}
.tc-lightbox-close:hover {
    color: #68B8FF !important;
}

.tc-lightbox-content { display: flex !important; flex-direction: column !important; }
.tc-lightbox-viewport {
    width: 100% !important;
    max-height: 520px !important;
    overflow: hidden !important;
    background: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.tc-lightbox-viewport img,
.tc-lightbox-viewport video {
    max-width: 100% !important;
    max-height: 520px !important;
    object-fit: contain !important;
}
.tc-lightbox-meta { padding: 25px !important; }
.tc-lightbox-title { margin: 4px 0 10px 0 !important; font-size: 1.8rem !important; }
.tc-lightbox-btn {
    background: #68B8FF !important;
    color: #000 !important;
    padding: 10px 24px !important;
    border-radius: 999px !important;
    text-decoration: none !important;
    font-weight: bold !important;
    display: inline-block !important;
    margin-top: 15px !important;
}

/* Universe Overrides on Lightbox */
.tc-lightbox-preset-metalhearts .tc-lightbox-card { background: #111111 !important; border: 2px solid #8E1117 !important; border-radius: 0px !important; box-shadow: 5px 5px 0px #1C1C1C !important; }
.tc-lightbox-preset-metalhearts .tc-lightbox-title { font-family: "Impact", sans-serif !important; text-transform: uppercase !important; }
.tc-lightbox-preset-metalhearts .tc-lightbox-btn { background: #8E1117 !important; color: #fff !important; border-radius: 0px !important; }

.tc-lightbox-preset-mcbling .tc-lightbox-card { background: #FFFFFF !important; border: 2px solid #D4AF37 !important; border-radius: 24px !important; color: #080808 !important; }
.tc-lightbox-preset-mcbling .tc-lightbox-title { font-family: "Playfair Display", serif !important; color: #FF1493 !important; }
.tc-lightbox-preset-mcbling .tc-lightbox-btn { background: #FF1493 !important; color: #fff !important; }

.tc-lightbox-preset-scene .tc-lightbox-card { background: #121212 !important; border: 2px solid #FF1493 !important; border-radius: 0px !important; box-shadow: 5px 5px 0px #00A8FF !important; }
.tc-lightbox-preset-scene .tc-lightbox-title { font-family: "Impact", sans-serif !important; text-shadow: 2px 2px 0px #FF1493 !important; }
.tc-lightbox-preset-scene .tc-lightbox-btn { background: #B6FF00 !important; color: #000 !important; border-radius: 0px !important; }

/* -------------------------------------------------------------------------
   7. PAGINATION & SENTINEL
   ------------------------------------------------------------------------- */
.tc-gallery-pagination-nav { text-align: center !important; margin-top: 35px !important; }
.tc-load-more-btn {
    padding: 12px 30px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    border-radius: 999px !important;
    font-family: monospace !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    transition: transform 0.2s ease !important;
}
.tc-load-more-btn:hover { transform: scale(1.04) !important; }
.tc-infinite-sentinel { text-align: center !important; padding: 20px !important; }
.tc-loading-spinner { font-family: monospace !important; font-size: 12px !important; letter-spacing: 0.1em !important; color: var(--tc-color-accent, #68B8FF) !important; animation: tcSpinGlow 1.5s infinite ease-in-out !important; }

@keyframes tcSpinGlow { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* -------------------------------------------------------------------------
   8. ACCESSIBILITY & REDUCED MOTION SAFEGUARD
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .tc-log-card,
    .tc-card-media-viewport img,
    .tc-card-media-viewport video,
    .tc-load-more-btn,
    .tc-lightbox-card {
        transition: none !important;
        transform: none !important;
        animation: none !important;
    }
}

@media (max-width: 768px) {
    .tc-cols-2 .tc-gallery-items-wrap,
    .tc-cols-3 .tc-gallery-items-wrap,
    .tc-cols-4 .tc-gallery-items-wrap,
    .tc-cols-5 .tc-gallery-items-wrap {
        grid-template-columns: 1fr !important;
    }
    .tc-layout-masonry.tc-cols-2 .tc-gallery-items-wrap,
    .tc-layout-masonry.tc-cols-3 .tc-gallery-items-wrap,
    .tc-layout-masonry.tc-cols-4 .tc-gallery-items-wrap {
        column-count: 1 !important;
    }
    .tc-layout-scattered .tc-log-card { transform: none !important; flex: 1 1 100% !important; }
    .tc-layout-horizontal_scroll .tc-log-card { flex: 0 0 280px !important; }
}