/* ========================================================================
   Case List Page — Card Grid Layout
   ======================================================================== */

/* page background: the manila tan used inside the homepage carousel panels
   (--nyn-manila from siteChrome.css); loaded after siteChrome.css so this wins
   over the body.base-layout paper default */
body.gl-page {
    background: var(--nyn-manila, #E9E2CF);
}

/* --- Toolbar --- */
.caseListToolbar {
    background: #f8f9fa;
}

.caseListToolbar .form-select-sm,
.caseListToolbar .form-control-sm {
    min-width: 120px;
}

.caseListToolbar .gl-active {
    border-color: #dc3545;
    background-color: #fff5f5;
    color: #dc3545;
}

.caseListToolbar label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
}

/* --- Card Grid — Gallery Mode (default) --- */
.caseCardGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.caseCard {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.caseCard:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
}

.caseCard a {
    text-decoration: none;
    color: inherit;
}

.caseCard__imageWrap {
    width: 100%;
    aspect-ratio: 5 / 6;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    /* anchor for the visibility badge overlay (.caseCard__badgeStack) */
    position: relative;
}

.caseCard__imageWrap img.caseThumbnail {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: none;
    margin: 0;
}

.caseCard__info {
    padding: 0.5rem 0.6rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.caseCard__title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.25;
}

.caseCard__title a {
    color: var(--bs-body-color);
}

.caseCard__title a:hover {
    color: var(--bs-primary);
}

.caseCard__subtitle {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.35rem;
}

.caseCard__rating {
    font-size: 0.8rem;
}

.caseCard__thumbsCount {
    font-weight: bold;
    font-size: 1.15rem;
}

/* match the icon size used on the case detail page (default body text size) */
.caseCard__thumbsIcon {
    font-size: 1rem;
}

.caseCard__features {
    margin-top: 0.3rem;
}

/* footer (feature icons + rating): pushed to the bottom of the flex-column info
   area so these rows line up across cards regardless of text length above */
.caseCard__footer {
    margin-top: auto;
    padding-top: 0.3rem;
}

/* Detail section is hidden in gallery mode */
.caseCard__details {
    display: none;
}

/* Visibility badges (Private / Hidden): semi-transparent overlay stacked in the
   top-right corner of the thumbnail */
.caseCard__badgeStack {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.caseCard__badgeOverlay {
    font-size: 0.7rem;
    padding: 0.2em 0.45em;
    opacity: 0.75;
}


/* --- Card Grid — Detail Mode --- */
.caseCardGrid--detail {
    grid-template-columns: 1fr;
}

.caseCardGrid--detail .caseCard {
    flex-direction: row;
}

.caseCardGrid--detail .caseCard__imageWrap {
    width: 240px;
    min-width: 240px;
    aspect-ratio: auto;
    max-height: 320px;
}

.caseCardGrid--detail .caseCard__imageWrap img.caseThumbnail {
    object-fit: contain;
}

.caseCardGrid--detail .caseCard__info {
    padding: 0.6rem 0.8rem;
}

.caseCardGrid--detail .caseCard__details {
    display: block;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-top: 0.35rem;
    color: #444;
}

.caseCard__details b {
    color: #333;
}

.caseCard__summary {
    margin-bottom: 0.35rem;
    color: #555;
}


/* --- Group Headers --- */
.caseCardGrid__groupHeader {
    grid-column: 1 / -1;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 0.4rem 0;
    border-bottom: 2px solid #dee2e6;
    margin-top: 0.75rem;
    color: #333;
}

.caseCardGrid__groupHeader:first-child {
    margin-top: 0;
}

/* --- Result count --- */
.caseListResultCount {
    font-size: 0.85rem;
    color: #666;
    padding: 0.25rem 0;
}


/* --- Case Detail Fields --- */
.caseCard__details a,
.caseDetailModal a {
    text-decoration: none;
}

/* --- Case Detail Modal --- */
.caseDetailModal__imageWrap img.caseThumbnail {
    max-width: 100% !important;
    max-height: none !important;
    width: 100%;
    height: auto;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 2px 8px;
}


/* --- Responsive --- */
@media (max-width: 767px) {
    .caseCardGrid:not(.caseCardGrid--detail) {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.6rem;
    }

}

@media (max-width: 550px) {
    .caseCardGrid--detail .caseCard {
        flex-direction: column;
    }

    .caseCardGrid--detail .caseCard__imageWrap {
        width: auto;
        min-width: 0;
        max-height: none;
        text-align: center;
    }

    .caseCardGrid--detail .caseCard__imageWrap img.caseThumbnail {
        width: auto;
        height: auto;
        max-width: 200px !important;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    .caseCardGrid:not(.caseCardGrid--detail) {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.5rem;
    }
}
