/* ==========================================================================
   Magnified Center Exhibition Card Modal (On-Click Lightbox)
   ========================================================================== */

body.pew-modal-open {
    overflow: hidden !important;
}

.pew-card-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.pew-card-modal.is-active {
    opacity: 1;
    visibility: visible;
}

/* Dark Backdrop with Blur */
.pew-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 17, 12, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.28s ease;
}

.pew-card-modal.is-active .pew-modal-backdrop {
    opacity: 1;
}

/* Floating Navigation Arrows */
.pew-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(56, 34, 24, 0.22);
    color: #382218;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.18s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pew-modal-nav.prev {
    left: max(12px, calc((100vw - 940px) / 2 - 58px));
}

.pew-modal-nav.next {
    right: max(12px, calc((100vw - 940px) / 2 - 58px));
}

.pew-modal-nav:hover {
    background: #a85c48;
    border-color: #8c4633;
    color: #ffffff;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Center Magnified Card - FIXED SIZE & SMOOTH POP TRANSITION */
.pew-modal-card {
    position: relative;
    z-index: 5;
    width: 940px;
    height: 640px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 24px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42), 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(12px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease;
    box-sizing: border-box;
}

.pew-card-modal.is-active .pew-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Topbar */
.pew-modal-card-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    flex: 0 0 48px;
    padding: 0 16px;
    background: linear-gradient(180deg, #faf5f2 0%, #f3eae4 100%);
    border-bottom: 1px solid rgba(56, 34, 24, 0.14);
    box-sizing: border-box;
}

.pew-modal-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pew-modal-badge {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8c4633;
    background: rgba(168, 92, 72, 0.14);
    border: 1px solid rgba(168, 92, 72, 0.3);
    border-radius: 9999px;
    padding: 2px 8px;
}

.pew-modal-id {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #382218;
}

.pew-modal-group-subcounter {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #8c4633;
    background: rgba(168, 92, 72, 0.12);
    border: 1px solid rgba(168, 92, 72, 0.28);
    border-radius: 6px;
    padding: 2px 7px;
    white-space: nowrap;
}

.pew-modal-counter {
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: #382218;
    background: rgba(56, 34, 24, 0.08);
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid rgba(56, 34, 24, 0.12);
}

.pew-modal-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pew-modal-action-btn,
.pew-modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(56, 34, 24, 0.18);
    color: #382218;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pew-modal-action-btn:hover,
.pew-modal-close-btn:hover {
    background: #a85c48;
    border-color: #8c4633;
    color: #ffffff;
}

.pew-modal-action-btn.is-active {
    background: #a85c48;
    border-color: #8c4633;
    color: #ffffff;
}

/* Card Body: 2 Columns (Image Stage & Details Column) with Slide/Fade Transition */
.pew-modal-card-body {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    height: calc(100% - 48px - 74px);
    min-height: 0;
    overflow: hidden;
    position: relative;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    box-sizing: border-box;
    will-change: transform, opacity;
}

/* Smooth Slide Transitions for Prev / Next Navigation */
.pew-modal-card-body.slide-out-left {
    transform: translateX(-32px);
    opacity: 0;
    transition: transform 0.12s ease-in, opacity 0.12s ease-in;
}

.pew-modal-card-body.slide-out-right {
    transform: translateX(32px);
    opacity: 0;
    transition: transform 0.12s ease-in, opacity 0.12s ease-in;
}

.pew-modal-card-body.slide-in-right {
    transform: translateX(32px);
    opacity: 0;
    transition: none !important;
}

.pew-modal-card-body.slide-in-left {
    transform: translateX(-32px);
    opacity: 0;
    transition: none !important;
}

/* Left Image Column - FIXED 54% PROPORTION */
.pew-modal-image-col {
    flex: 0 0 54%;
    width: 54%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(circle at center, #ffffff 40%, #faf4f0 100%);
    border-right: 1px solid rgba(56, 34, 24, 0.12);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.pew-modal-image-viewport {
    flex: 1 1 auto;
    width: 100%;
    height: calc(100% - 44px);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;
    border-radius: 8px;
}

.pew-modal-image-viewport.is-zoomed {
    cursor: zoom-out;
}

.pew-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Group thumbnails switcher */
.pew-modal-thumb-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 4px 6px;
    max-width: 95%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 92, 72, 0.4) transparent;
}

.pew-modal-thumb-strip::-webkit-scrollbar {
    height: 5px;
}

.pew-modal-thumb-strip::-webkit-scrollbar-thumb {
    background: rgba(168, 92, 72, 0.4);
    border-radius: 3px;
}

.pew-modal-thumb-btn {
    position: relative;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    padding: 2px;
    border-radius: 6px;
    border: 2px solid rgba(56, 34, 24, 0.2);
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.15s ease;
    outline: none;
    box-sizing: border-box;
}

.pew-modal-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}

.pew-modal-thumb-btn:hover {
    border-color: #a85c48;
    transform: translateY(-1px);
}

.pew-modal-thumb-btn.is-active {
    border-color: #a85c48;
    box-shadow: 0 0 0 2px rgba(168, 92, 72, 0.35), 0 3px 8px rgba(168, 92, 72, 0.25);
    transform: scale(1.05);
}

.pew-modal-thumb-btn .sub-num {
    position: absolute;
    bottom: 1px;
    right: 2px;
    background: rgba(56, 34, 24, 0.85);
    color: #ffffff;
    font-size: 9px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    padding: 0 3px;
    border-radius: 3px;
    line-height: 12px;
}

.pew-modal-thumb-btn.is-active .sub-num {
    background: #a85c48;
}

.pew-modal-image-caption {
    font-size: 12px;
    font-weight: 700;
    color: #7d5e53;
    margin-top: 8px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95%;
}

.pew-modal-zoom-hint {
    font-size: 11px;
    color: #9c857c;
    margin-top: 3px;
    text-align: center;
}

/* Right Details Column - FIXED 46% PROPORTION WITH DEDICATED SCROLL */
.pew-modal-details-col {
    flex: 0 0 46%;
    width: 46%;
    height: 100%;
    padding: 18px 20px;
    background: #ffffff;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.pew-modal-details-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pew-modal-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: #faf5f2;
    border-radius: 6px;
    border: 1px solid rgba(56, 34, 24, 0.06);
    font-size: 12px;
    line-height: 1.4;
}

.pew-modal-meta-row .meta-label {
    font-family: 'Inter', -apple-system, sans-serif;
    color: #7d5e53;
    font-weight: 700;
    flex-shrink: 0;
}

.pew-modal-meta-row .meta-value {
    font-weight: 600;
    color: #382218;
    text-align: right;
    word-break: break-word;
}

.pew-modal-meta-empty {
    padding: 16px 10px;
    color: #9c857c;
    font-size: 12px;
    text-align: center;
}

/* Bottom Thumbnail Carousel Strip */
.pew-modal-card-carousel {
    display: flex;
    align-items: center;
    height: 74px;
    flex: 0 0 74px;
    background: linear-gradient(180deg, #faf5f2 0%, #f3eae4 100%);
    border-top: 1px solid rgba(56, 34, 24, 0.14);
    padding: 0 10px;
    box-sizing: border-box;
    gap: 8px;
    position: relative;
    z-index: 10;
}

.pew-carousel-arrow {
    width: 28px;
    height: 52px;
    flex: 0 0 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(56, 34, 24, 0.18);
    color: #382218;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.pew-carousel-arrow:hover {
    background: #a85c48;
    border-color: #8c4633;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pew-carousel-track {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    flex: 1 1 auto;
    height: 100%;
    padding: 6px 2px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 34, 24, 0.25) transparent;
}

.pew-carousel-track::-webkit-scrollbar {
    height: 4px;
}

.pew-carousel-track::-webkit-scrollbar-thumb {
    background: rgba(56, 34, 24, 0.25);
    border-radius: 4px;
}

.pew-carousel-thumb {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    padding: 2px;
    background: #ffffff;
    border: 2px solid rgba(56, 34, 24, 0.14);
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0.6;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.pew-carousel-thumb:hover {
    opacity: 0.92;
    border-color: #a85c48;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.pew-carousel-thumb.is-active {
    opacity: 1;
    border-color: #a85c48;
    box-shadow: 0 0 0 2px rgba(168, 92, 72, 0.4), 0 4px 10px rgba(0, 0, 0, 0.18);
    transform: scale(1.06);
}

.pew-carousel-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 3px;
    pointer-events: none;
    user-select: none;
}

/* ==========================================================================
   Mobile Responsive Layout (max-width: 768px)
   ========================================================================== */
@media screen and (max-width: 768px) {
    #container {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        overflow: visible;
    }

    #layoutHeader {
        min-height: 80px;
        height: auto;
        max-height: 110px;
        background-position: center left;
        background-size: cover;
    }

    .maintitle {
        width: auto;
        max-width: 90%;
        font-size: clamp(16px, 4.5vw, 24px);
        right: 10px;
        bottom: 6px;
        text-align: right;
        white-space: normal;
        line-height: 1.15;
    }

    .maintitle br {
        display: inline;
    }

    #layoutCenterBody {
        display: block;
        margin: 8px 10px 0;
        padding-bottom: 12px;
    }

    #layoutNavigation {
        width: 100%;
        min-width: 100%;
        flex: none;
        float: none;
        margin: 0 0 12px 0;
        box-sizing: border-box;
    }

    #layoutNavigation .navTitle {
        cursor: pointer;
        padding: 9px 12px;
        font-size: 13.5px;
    }

    #layoutNavigation .topnav li {
        padding: 0;
    }

    #layoutNavigation .topnav ul {
        padding-left: 18px;
    }

    #layoutBodyContent {
        width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0;
        float: none;
    }

    /* Details Page & Cards on Mobile */
    .catalog-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 12px;
    }

    .catalog-header h1 {
        font-size: 1.25rem;
    }

    .catalog-count {
        font-size: 11.5px;
    }

    .catalog-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 2px 0 16px;
    }

    .catalog-card {
        border-radius: 10px;
    }

    .catalog-card-header {
        padding: 7px 9px 6px;
    }

    .card-badge-id {
        font-size: 11px;
    }

    .card-badge-group,
    .card-badge-fv {
        font-size: 10px;
        padding: 2px 6px;
    }

    .catalog-card-image {
        min-height: 120px;
        padding: 8px 6px;
    }

    .catalog-card-image img {
        max-height: 130px;
    }

    .catalog-card-hover-hint {
        display: none; /* touch device: prevent sticky hover state */
    }

    .catalog-card-body {
        padding: 8px 10px;
    }

    .card-meta-line {
        font-size: 11px;
        padding: 2px 0;
    }

    .catalog-card-footer {
        padding: 6px 10px;
    }

    .card-open-hint {
        font-size: 11px;
    }

    /* Card Magnified Modal on Mobile */
    .pew-modal-nav.prev {
        left: 6px;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.88);
    }

    .pew-modal-nav.next {
        right: 6px;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.88);
    }

    .pew-modal-card {
        width: calc(100vw - 16px);
        max-width: 100vw;
        height: min(640px, calc(100vh - 20px));
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .pew-modal-card-topbar {
        height: 44px;
        flex: 0 0 44px;
        padding: 0 12px;
    }

    .pew-modal-card-body {
        flex-direction: column;
        height: calc(100% - 44px);
    }

    .pew-modal-image-col {
        flex: 0 0 46%;
        width: 100%;
        height: 46%;
        border-right: none;
        border-bottom: 1px solid rgba(56, 34, 24, 0.12);
        padding: 8px;
    }

    .pew-modal-image-viewport {
        height: calc(100% - 36px);
    }

    .pew-modal-thumb-strip {
        margin-top: 4px;
        padding: 2px 4px;
        gap: 6px;
    }

    .pew-modal-thumb-btn {
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
    }

    .pew-modal-details-col {
        flex: 1 1 54%;
        width: 100%;
        height: 54%;
        padding: 10px 12px;
    }

    /* Intro Page on Mobile */
    .intro {
        padding: 6px 0 20px;
    }

    .intro-main-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .intro-header-card {
        padding: 16px 14px 14px;
    }

    .intro-lead {
        font-size: 0.98rem;
    }

    .intro-features-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .intro-about-card,
    .intro-contribute-card,
    .intro-thanks-card {
        padding: 16px 14px;
    }

    /* Contact Page on Mobile */
    .contact-page {
        padding: 10px 8px 20px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .contact-header-card,
    .contact-editor-card,
    .contact-guidelines-card {
        padding: 16px 14px;
    }

    /* Footer on Mobile */
    #layoutFooter {
        height: auto;
        min-height: 38px;
        padding: 8px 14px;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
}

