﻿/* =====================================================================
   Portfolio gallery — masonry grid + fullscreen lightbox (shared)
   Used by: category pages + homepage grid
   ===================================================================== */

    .cat-gallery-title {
        font-weight: 700;
        letter-spacing: 0.02em;
        color: var(--text-main);
    }
    .cat-gallery-masonry {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 0.75rem;
        align-items: start;
    }

    .cat-gallery-column {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 0.75rem;
    }

    @media (min-width: 768px) {
        .cat-gallery-masonry {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 1rem;
        }

        .cat-gallery-column {
            gap: 1rem;
        }
    }

    @media (min-width: 992px) {
        .cat-gallery-masonry {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .cat-gallery-column {
            gap: 1.25rem;
        }
    }

    .cat-gallery-tile-wrap {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .cat-gallery-tile {
        display: block;
        width: 100%;
        padding: 0;
        border: none;
        background: transparent;
        border-radius: 0;
        overflow: hidden;
        cursor: pointer;
        box-shadow: var(--shadow-soft, 0 10px 30px rgba(0, 0, 0, 0.08));
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        text-align: left;
    }

    .cat-gallery-tile:focus-visible {
        outline: 2px solid var(--accent, #fff);
        outline-offset: 3px;
    }

    @media (min-width: 768px) {
        .cat-gallery-tile:hover {
            transform: translateY(-3px);
            box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
        }
    }

    .cat-gallery-tile-media {
        position: relative;
        display: block;
        line-height: 0;
        background: var(--bg-panel-soft);
    }

    .cat-gallery-tile-media img {
        width: 100%;
        height: auto;
        display: block;
        vertical-align: bottom;
    }

    .cat-gallery-tile-overlay {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: flex-end;
        justify-content: flex-start;
        padding: 0.55rem 0.65rem;
        text-align: left;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .cat-gallery-tile-name {
        font-size: clamp(0.85rem, 2.5vw, 1.05rem);
        font-weight: 600;
        line-height: 1.25;
    }


    @media (max-width: 767.98px) {
        .cat-gallery-tile-overlay {
            opacity: 1;
            background: transparent;
        }

        .cat-gallery-tile-name {
            color: #fff;
            text-shadow:
                0 0 1px rgba(0, 0, 0, 0.9),
                0 1px 3px rgba(0, 0, 0, 0.85),
                0 0 18px rgba(0, 0, 0, 0.55);
        }
    }


    @media (min-width: 768px) {
        .cat-gallery-tile-overlay {
            opacity: 0;
            background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.2) 40%, transparent 72%);
        }

        .cat-gallery-tile:hover .cat-gallery-tile-overlay {
            opacity: 1;
        }

        .cat-gallery-tile-name {
            color: #fff;
            text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
        }
    }

    .cat-photo-lightbox-content {
        background: #0a0a0a;
        color: #fff;
        border: none;
        border-radius: 0;
    }

    .cat-photo-lightbox-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        
        flex-shrink: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        position: relative;
        z-index: 1080;
    }

    .cat-photo-lightbox-heading {
        font-size: 0.95rem;
        font-weight: 600;
        flex: 1;
        min-width: 0;
    }

    .cat-photo-lightbox-toolbar-actions {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        flex-shrink: 0;
    }

    .cat-toolbar-desc-btn {
        width: 2.25rem;
        height: 2.25rem;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
    }

    .cat-toolbar-desc-btn:hover {
        background: rgba(255, 255, 255, 0.18);
    }

    .cat-toolbar-desc-btn.cat-toolbar-desc-btn--open {
        background: rgba(255, 255, 255, 0.28);
        border-color: rgba(255, 255, 255, 0.55);
    }

    .cat-toolbar-desc-btn-icon {
        font-size: 0.95rem;
        font-weight: 700;
        font-style: italic;
        font-family: Georgia, "Times New Roman", serif;
        line-height: 1;
    }

    .cat-toolbar-desc-btn-icon::before {
        content: "i";
    }

    .cat-photo-lightbox-body {
        flex: 1;
        min-height: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    .cat-lightbox-carousel {
        flex: 1;
        min-height: 0;
    }

    .cat-lightbox-carousel .carousel-inner {
        min-height: 0;
    }

    .cat-photo-lightbox .modal-dialog {
        margin: 0;
        max-width: 100%;
    }

    .cat-photo-lightbox .modal-content {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .cat-carousel-slide {
        position: relative;
        height: 100%;
        min-height: 50vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #0a0a0a;
    }

    .cat-carousel-img {
        max-width: 100%;
        max-height: min(85vh, 100%);
        width: auto;
        height: auto;
        object-fit: contain;
        user-select: none;
        -webkit-user-drag: none;
    }

    .cat-carousel-desc-layer {
        position: absolute;
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
        max-height: 44vh;
        overflow: auto;
        padding: 0.75rem 1rem;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.78);
        color: #fff;
        backdrop-filter: blur(8px);
        -webkit-overflow-scrolling: touch;
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.28s ease, transform 0.28s ease;
        pointer-events: none;
        z-index: 3;
    }

    .cat-carousel-desc-layer.cat-carousel-desc-layer--open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .cat-carousel-desc {
        font-size: 0.84rem;
        line-height: 1.5;
        color: rgba(255, 255, 255, 0.95);
    }


    @media (min-width: 768px) and (hover: hover) and (pointer: fine) {
        .cat-carousel-slide:hover .cat-carousel-desc-layer {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
    }

    .cat-carousel-ctrl {
        width: 12%;
        min-width: 44px;
        opacity: 0.85;
    }

    .cat-carousel-ctrl:focus {
        opacity: 1;
    }

    @media (max-width: 575.98px) {
        .cat-carousel-ctrl {
            width: 14%;
        }
    }
