/*
 * CASSIOPEIA + PHOCA GALLERY
 * Joomla 5.3.2 custom stylesheet
 *
 * Categories View (/exhibitions):
 *   .pg-categories-items-box = exhibition/category cards
 *   First card is featured (2 columns x 2 rows) on desktop.
 *
 * Category View (/exhibitions/1-stardust):
 *   .pg-category-items-box = photographs inside one exhibition
 *   Three-column image grid; kept separate from Categories View.
 */

/* ============================================================
   1. HIDE UNWANTED PHOCA GALLERY CONTROLS AND COUNTERS
   ============================================================ */

#phocagallery .pg-category-box-title svg,
#phocagallery .pg-category-box-title i,
#phocagallery .pg-cv-name svg,
#phocagallery .pg-cv-name i,
#phocagallery .pg-cv-name img,
#phocagallery .pg-cv-count,
#phocagallery .pg-category-box-count,
#phocagallery small,
#phocagallery .feed-link,
#phocagallery .pg-top-icons,
#phocagallery .pg-category-view-options,
#phocagallery .pg-item-box-info,
#phocagallery-poweredby,
.pg-poweredby {
    display: none !important;
}

#phocagallery div:has(> a[href*="phoca.cz"]) {
    display: none !important;
}


/* ============================================================
   2. PAGE HEADINGS
   ============================================================ */

#phocagallery h1,
#phocagallery h2 {
    font-family: 'Comfortaa', sans-serif !important;
    color: #5b3679 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 2.2rem !important;
    margin: 0 0 30px 0 !important;
    border: 0 !important;
}


/* ============================================================
   3. CATEGORIES VIEW — EXHIBITION CARDS
   Page: /exhibitions

   Important: use .pg-categories-items-box here. This is the
   Categories View wrapper from your original Joomla 5.3.2 CSS.
   Do NOT apply these rules to .pg-category-items-box.
   ============================================================ */

#phocagallery .pg-categories-items-box,
.com-phocagallery .pg-categories-items-box {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    gap: 30px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: start !important;
    justify-content: stretch !important;
    box-sizing: border-box !important;
}

/* Each direct child of the grid is one category card/cell. */
#phocagallery .pg-categories-items-box > *,
.com-phocagallery .pg-categories-items-box > * {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
    flex: none !important;
    box-sizing: border-box !important;
}

/* Also remove Bootstrap sizing if the component wraps cards in columns. */
#phocagallery .pg-categories-items-box > div,
.com-phocagallery .pg-categories-items-box > div {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    flex: none !important;
    box-sizing: border-box !important;
}

/* Support both category-card class names used by Phoca layouts. */
#phocagallery .pg-categories-items-box .pg-cv-box,
#phocagallery .pg-categories-items-box .pg-category-box,
.com-phocagallery .pg-categories-items-box .pg-cv-box,
.com-phocagallery .pg-categories-items-box .pg-category-box {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

/* Make the image/figure wrappers fill the grid cell. */
#phocagallery .pg-categories-items-box .pg-cv-box figure,
#phocagallery .pg-categories-items-box .pg-category-box figure,
#phocagallery .pg-categories-items-box .pg-cv-box .pg-cv-box-image,
#phocagallery .pg-categories-items-box .pg-category-box .pg-category-box-image,
.com-phocagallery .pg-categories-items-box .pg-cv-box figure,
.com-phocagallery .pg-categories-items-box .pg-category-box figure,
.com-phocagallery .pg-categories-items-box .pg-cv-box .pg-cv-box-image,
.com-phocagallery .pg-categories-items-box .pg-category-box .pg-category-box-image {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

#phocagallery .pg-categories-items-box .pg-cv-box a,
#phocagallery .pg-categories-items-box .pg-category-box a,
.com-phocagallery .pg-categories-items-box .pg-cv-box a,
.com-phocagallery .pg-categories-items-box .pg-category-box a {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Category thumbnails: fill the card and keep the 4:3 crop. */
#phocagallery .pg-categories-items-box .pg-cv-box img,
#phocagallery .pg-categories-items-box .pg-category-box img,
.com-phocagallery .pg-categories-items-box .pg-cv-box img,
.com-phocagallery .pg-categories-items-box .pg-category-box img {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3 !important;
    object-fit: cover !important;
    border: 0 !important;
    border-radius: 15px !important;
    background: transparent !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.3s ease !important;
}

#phocagallery .pg-categories-items-box .pg-cv-box:hover img,
#phocagallery .pg-categories-items-box .pg-category-box:hover img,
.com-phocagallery .pg-categories-items-box .pg-cv-box:hover img,
.com-phocagallery .pg-categories-items-box .pg-category-box:hover img {
    transform: translateY(-5px) !important;
}

/* Category name: put it BELOW the image, not over a grey/black bar. */
#phocagallery .pg-categories-items-box .pg-cv-name,
#phocagallery .pg-categories-items-box .pg-category-box-title,
#phocagallery .pg-categories-items-box .pg-cv-box-title,
#phocagallery .pg-categories-items-box .pg-category-box-info,
.com-phocagallery .pg-categories-items-box .pg-cv-name,
.com-phocagallery .pg-categories-items-box .pg-category-box-title,
.com-phocagallery .pg-categories-items-box .pg-cv-box-title,
.com-phocagallery .pg-categories-items-box .pg-category-box-info {
    display: block !important;
    position: static !important;
    inset: auto !important;
    transform: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 10px 0 5px 0 !important;
    padding: 0 !important;
    color: #2C1F57 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-align: left !important;
    font-family: 'Comfortaa', sans-serif !important;
    box-sizing: border-box !important;
}

#phocagallery .pg-categories-items-box .pg-cv-name a,
#phocagallery .pg-categories-items-box .pg-category-box-title a,
#phocagallery .pg-categories-items-box .pg-cv-box-title a,
.com-phocagallery .pg-categories-items-box .pg-cv-name a,
.com-phocagallery .pg-categories-items-box .pg-category-box-title a,
.com-phocagallery .pg-categories-items-box .pg-cv-box-title a {
    display: inline-block !important;
    position: static !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #2C1F57 !important;
    background: transparent !important;
    font-family: 'Comfortaa', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.2rem !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

#phocagallery .pg-categories-items-box .pg-cv-name a:hover,
#phocagallery .pg-categories-items-box .pg-category-box-title a:hover,
#phocagallery .pg-categories-items-box .pg-cv-box-title a:hover,
.com-phocagallery .pg-categories-items-box .pg-cv-name a:hover,
.com-phocagallery .pg-categories-items-box .pg-category-box-title a:hover,
.com-phocagallery .pg-categories-items-box .pg-cv-box-title a:hover {
    color: #6a4991 !important;
}

/* Remove folder/overlay decorations used by the stock category theme. */
#phocagallery .pg-categories-items-box .pg-cv-name::before,
#phocagallery .pg-categories-items-box .pg-cv-name::after,
#phocagallery .pg-categories-items-box .pg-category-box-title::before,
#phocagallery .pg-categories-items-box .pg-category-box-title::after,
#phocagallery .pg-categories-items-box .pg-cv-box-info::before,
#phocagallery .pg-categories-items-box .pg-cv-box-info::after,
.com-phocagallery .pg-categories-items-box .pg-cv-name::before,
.com-phocagallery .pg-categories-items-box .pg-cv-name::after,
.com-phocagallery .pg-categories-items-box .pg-category-box-title::before,
.com-phocagallery .pg-categories-items-box .pg-category-box-title::after,
.com-phocagallery .pg-categories-items-box .pg-cv-box-info::before,
.com-phocagallery .pg-categories-items-box .pg-cv-box-info::after {
    display: none !important;
    content: none !important;
}

#phocagallery .pg-categories-items-box .pg-cv-box-info,
.com-phocagallery .pg-categories-items-box .pg-cv-box-info {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #888888 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    font-family: 'Comfortaa', sans-serif !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
}

/* FEATURED FIRST EXHIBITION — the special layout from your template.
   First card spans 2 of 3 columns and 2 rows on desktop. */
@media (min-width: 992px) {
    #phocagallery .pg-categories-items-box > :first-child,
    .com-phocagallery .pg-categories-items-box > :first-child {
        grid-column: 1 / span 2 !important;
        grid-row: 1 / span 2 !important;
        min-width: 0 !important;
    }

    #phocagallery .pg-categories-items-box > :first-child .pg-cv-name a,
    #phocagallery .pg-categories-items-box > :first-child .pg-category-box-title a,
    #phocagallery .pg-categories-items-box > :first-child .pg-cv-box-title a,
    .com-phocagallery .pg-categories-items-box > :first-child .pg-cv-name a,
    .com-phocagallery .pg-categories-items-box > :first-child .pg-category-box-title a,
    .com-phocagallery .pg-categories-items-box > :first-child .pg-cv-box-title a {
        font-size: 1.8rem !important;
    }
}


/* ============================================================
   4. CATEGORY VIEW — PHOTOS INSIDE ONE EXHIBITION
   Page: /exhibitions/1-stardust

   This is the working three-column photo grid. Keep it separate
   from .pg-categories-items-box above.
   ============================================================ */

#phocagallery .pg-category-items-box,
.com-phocagallery .pg-category-items-box {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 30px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: start !important;
    justify-content: stretch !important;
    box-sizing: border-box !important;
}

#phocagallery .pg-category-items-box .pg-item-box,
.com-phocagallery .pg-category-items-box .pg-item-box {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

#phocagallery .pg-category-items-box .pg-item-box figure,
.com-phocagallery .pg-category-items-box .pg-item-box figure {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

#phocagallery .pg-category-items-box .pg-item-box a.pg-photoswipe-button,
.com-phocagallery .pg-category-items-box .pg-item-box a.pg-photoswipe-button {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

#phocagallery .pg-category-items-box .pg-item-box-image,
.com-phocagallery .pg-category-items-box .pg-item-box-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    border-radius: 15px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

/* Keep the image's real proportions. Joomla/Phoca Gallery controls
   the generated thumbnail dimensions; CSS must not crop or stretch it. */
#phocagallery .pg-category-items-box .pg-item-box-image img.pg-image,
.com-phocagallery .pg-category-items-box .pg-item-box-image img.pg-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    border: 0 !important;
    border-radius: 15px !important;
    box-shadow: none !important;
    transition: transform 0.3s ease !important;
}

#phocagallery .pg-category-items-box .pg-item-box:hover img.pg-image,
.com-phocagallery .pg-category-items-box .pg-item-box:hover img.pg-image {
    transform: translateY(-5px) !important;
}

#phocagallery .pg-category-items-box .pg-item-box figcaption,
#phocagallery .pg-category-items-box .pg-item-box .pg-item-box-title,
#phocagallery .pg-category-items-box .pg-item-box .pg-item-box-info,
.com-phocagallery .pg-category-items-box .pg-item-box figcaption,
.com-phocagallery .pg-category-items-box .pg-item-box .pg-item-box-title,
.com-phocagallery .pg-category-items-box .pg-item-box .pg-item-box-info {
    display: none !important;
}


/* ============================================================
   5. RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 991px) {
    #phocagallery .pg-categories-items-box,
    .com-phocagallery .pg-categories-items-box,
    #phocagallery .pg-category-items-box,
    .com-phocagallery .pg-category-items-box {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 20px !important;
    }
}

@media (max-width: 575px) {
    #phocagallery .pg-categories-items-box,
    .com-phocagallery .pg-categories-items-box,
    #phocagallery .pg-category-items-box,
    .com-phocagallery .pg-category-items-box {
        grid-template-columns: 1fr !important;
        gap: 25px !important;
    }

    #phocagallery .pg-categories-items-box > :first-child,
    .com-phocagallery .pg-categories-items-box > :first-child {
        grid-column: auto !important;
        grid-row: auto !important;
    }
}

/* PhotoSwipe fullscreen: preserve the linked image's natural aspect ratio.
   Do not override width/height because PhotoSwipe calculates those itself. */
.pswp .pswp__img {
    aspect-ratio: auto !important;
    object-fit: contain !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}


/* ==========================================
   CATEGORY VIEW — RESTORE CATEGORY DESCRIPTION
   ========================================== */

#phocagallery .pg-category-box-info {
    display: block !important;
    position: static !important;

    visibility: visible !important;
    opacity: 1 !important;

    width: 100% !important;
    height: auto !important;
    max-height: none !important;

    overflow: visible !important;

    margin: 0 0 18px 0 !important;
    padding: 0 !important;

    color: #555555 !important;
    background: transparent !important;

    border: none !important;
    box-shadow: none !important;

    font-family: 'Comfortaa', sans-serif !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    text-align: left !important;
}

/* ============================================
   CATEGORIES VIEW — CATEGORY DESCRIPTIONS
   ============================================ */

/* Information container below the thumbnail */
#phocagallery.pg-categories-view
.pg-categories-items-box
.pg-category-box-info {
    display: block !important;
    position: static !important;

    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;

    margin: 10px 0 0 !important;
    padding: 0 !important;

    background: transparent !important;
    border: none !important;
    box-shadow: none !important;

    overflow: visible !important;
}

/* Category title */
#phocagallery.pg-categories-view
.pg-categories-items-box
.pg-category-box-title {
    display: block !important;
    position: static !important;

    margin: 0 0 4px 0 !important;
    padding: 0 !important;

    background: transparent !important;
}

/* Category description */
#phocagallery.pg-categories-view
.pg-categories-items-box
.pg-category-box-description {
    display: block !important;

    position: static !important;
    inset: auto !important;
    transform: none !important;

    width: 100% !important;
    height: auto !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    color: #888888 !important;
    background: transparent !important;

    border: none !important;
    box-shadow: none !important;

    font-family: 'Comfortaa', sans-serif !important;
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;

    text-align: left !important;
    overflow: visible !important;
}
