



.buffering-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9e9e9;
    transition: opacity .5s ease;
}
.buffering-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}
.buffering-count {
    font-family: monospace, sans-serif;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    color: #000;
}


.main-container.gallery-container {
    position: static;
    padding: 0 0 var(--pad-bottom-pct) 0;
}

.gallery-container {
    padding: 0 0 var(--pad-bottom-pct) 0;
    max-width: var(--max-content);
    margin-left: auto;
    margin-right: auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-5);
}


.gallery-load-more-sentinel {
    grid-column: 1 / -1;
    min-height: 24px;
    height: 24px;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}


@media (min-width: 1700px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.gallery-card {
    width: 100%;
    min-width: 0;
    aspect-ratio: 4 / 5;
    background: #fff;
    border: 1px solid #000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.gallery-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    background: #f0f0f0;
}

.gallery-card:focus,
.gallery-card:focus-visible {
    outline: none;
}

.gallery-card-image {
    overflow: hidden;
    background: #f5f5f5;
    flex: 1;
    min-height: 0;
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: 500px;
    max-height: 70vh;
}

.gallery-card-body {
    flex: 1 1 0;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.gallery-card-row--2 {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
}


.gallery-card-row--2:has(.gallery-card-comment):not(:has(.gallery-card-image)) {
    justify-content: flex-start;
    align-items: center;
}


.gallery-card-row--2:has(.gallery-card-image):has(.gallery-card-comment) {
    position: relative;
    overflow: hidden;
}

.gallery-card-row--2:has(.gallery-card-image):has(.gallery-card-comment) .gallery-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    flex: none;
}

.gallery-card-row--2:has(.gallery-card-image):has(.gallery-card-comment) .gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #727272;
}

.gallery-card-row--2:has(.gallery-card-image):has(.gallery-card-comment) .gallery-card-comment {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--space-3) var(--space-5);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.92);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.gallery-card:hover .gallery-card-row--2:has(.gallery-card-image):has(.gallery-card-comment) .gallery-card-comment,
.gallery-card:focus-visible .gallery-card-row--2:has(.gallery-card-image):has(.gallery-card-comment) .gallery-card-comment {
    opacity: 1;
    pointer-events: auto;
}

.gallery-card-row--2 .gallery-card-image {
    flex: 1 1 auto;
    min-height: 0;
}

.gallery-card-row--2 .gallery-card-comment {
    font-size: 1rem;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
    width: 100%;
    text-align: center;
    -webkit-overflow-scrolling: touch;
}

@media screen and (max-width: 768px) {
    .gallery-card-row--2 {
        text-align: center;
        justify-content: center;
        align-items: center;
    }

    .gallery-card-row--2 .gallery-card-comment {
        display: flex;
        font-size: 1rem;
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        text-align: center;
        -webkit-overflow-scrolling: touch;
        padding: var(--space-3) var(--space-12);
    }

    .gallery-card:first-child {
        margin-left: 50%;
    }

    .gallery-card:last-child {
        margin-right: 50%;
    }
}

.gallery-card-body .gallery-card-image {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.gallery-card-to {
    font-size: 0.75rem;
    padding: var(--space-2) var(--space-3);
    border-bottom: var(--border);
    flex-shrink: 0;
}

.gallery-card-comment {
    word-break: break-word;
    width: 100%;
    padding: var(--space-3) var(--space-3);
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: center;
    box-sizing: border-box;
}

@media screen and (max-width: 768px) {
.gallery-card-comment {
    justify-content: center;
    align-items: center;
}
}

.gallery-card-comment a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.gallery-card-meta {
    font-size: 0.5rem;
    padding: var(--space-2) var(--space-3);
    border-top: var(--border);
    flex-shrink: 0;
}


.gallery-carousel-arrow {
    display: none;
}

.gallery-empty {
    text-align: center;
}

.gallery-fab-group {
    padding: 0;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: var(--space-3);
    z-index: 1000;
    font-family: var(--font-ui);
}

.gallery-fab-group--busy {
    pointer-events: none;
    opacity: 0.7;
}

.gallery-fab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    font: inherit;
}

.gallery-fab-item .gallery-fab {
    width: 3.5rem;
    height: 3.5rem;
    min-width: var(--touch-target, 44px);
    min-height: var(--touch-target, 44px);
    border-radius: 50%;
    border: var(--border-width) solid #000;
    background: #000;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gallery-fab-item:hover .gallery-fab {
    background: #fff;
    color: #000;
    border-color: var(--border-color);
}

.gallery-fab-item:hover .gallery-fab img {
    filter: none;
}

.gallery-fab-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text, #111);
    white-space: nowrap;
    background: #fff;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--btn-radius, 4px);
    border: var(--border);
}

.gallery-fab img {
    display: block;
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}


.gallery-fab-item.exhibition-fab {
    display: none;
}

.gallery-fab-item.exhibition-fab .gallery-fab img {
    width: 2rem;
    height: 2rem;
}

.gallery-fab-item.booking-fab .gallery-fab img {
    width: 2rem;
    height: 2rem;
}

.gallery-fab-item .gallery-fab {
    font-family: var(--font-ui);
}


body.gallery-fly-away-active .gallery-container,
body.gallery-fly-away-active .gallery-grid {
    overflow: visible !important;
}

body.gallery-cards-on-top .main-container.gallery-container {
    position: relative;
    z-index: 950;
}


@media (min-width: 769px) {
    .post-view-modal .modal-content {
        max-width: min(440px, 95%);
        max-height: 82vh;
    }
}
.post-view-modal .post-view-modal-content {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
}


.post-view-modal .modal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: var(--border);
}

.post-view-modal .modal-header-row .post-view-to {
    font-weight: bold;
    flex: 1;
    min-width: 0;
}

.post-view-image-wrap {
    width: 100%;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.post-view-image-wrap .post-view-image {
    width: 100%;
    height: 60vh;
    object-fit: contain;
    display: block;
    background: #f5f5f5;
}


.post-view-comment {
    word-break: break-word;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-3) 0;
    width: 100%;
    height: 100%;
    text-align: center;
}

.post-view-comment a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.post-view-meta {
    flex-shrink: 0;
    margin-top: auto;
    border-top: var(--border);
    padding: var(--space-2) 0;
    background: white;
    font-size: 0.9em;
}


.gallery-modal .gallery-modal-content {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    overflow: hidden;
}


.gallery-modal .gallery-modal-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.gallery-modal .gallery-modal-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.gallery-modal .gallery-modal-body {
    display: block;
    background: #fff;
}

.gallery-modal .gallery-modal-body .modal-content-end-pad {
    display: none;
}

.gallery-modal .gallery-post-form {
    display: block;
    min-height: 0;
}

.gallery-modal .modal-title {
    font-weight: normal;
    font-size: 1rem;
    margin-bottom: var(--space-5);
}

.gallery-post-form .gallery-form-two-col {
    display: flex;
    flex-direction: column;
    align-items: start;
    width: 100%;
    flex: 0 0 auto;
    min-height: 0;
    min-width: 0;
}

.gallery-post-form .gallery-form-two-col > * {
    width: 100%;
    min-width: 0;
}


.gallery-modal .exhibition-form-col-left {
    position: relative;
    flex: 0 0 auto;
    height: 10rem;
    min-height: 10rem;
    min-width: 0;
    overflow: hidden;
}

.gallery-modal .exhibition-form-col-left .exhibition-add-image-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border: 1px dashed var(--border-color);
    cursor: pointer;
    z-index: 0;
}

.gallery-modal .exhibition-form-col-left .exhibition-add-image-label:hover {
    background: #f5f5f5;
}

.gallery-modal .exhibition-add-image-icon {
    font-size: 1.25rem;
    font-family: var(--font-ui);
    font-weight: 500;
}

.gallery-modal .exhibition-form-col-left .exhibition-image-previews {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    justify-content: center;
    gap: var(--space-2);
    overflow: hidden;
    pointer-events: none;
}

.gallery-modal .exhibition-form-col-left .exhibition-image-previews .exhibition-preview-item {
    position: relative;
    pointer-events: auto;
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    border: var(--border);
    overflow: hidden;
}

.gallery-modal .exhibition-form-col-left .exhibition-image-previews .exhibition-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-modal .exhibition-image-previews .exhibition-preview-item button,
.gallery-modal .exhibition-preview-item button {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--btn-radius);
    background: rgba(0,0,0,0.7);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.gallery-modal .exhibition-image-previews .exhibition-preview-item button:hover,
.gallery-modal .exhibition-preview-item button:hover {
    background: #000;
    color: #fff;
}

.gallery-form-col-right {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
}

.gallery-form-col-right .form-group {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}


.gallery-form-col-right .form-group-comment {
    margin-bottom: 0;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gallery-form-col-right .form-group-comment textarea {
    flex: 1 1 0;
    min-height: 8rem;
    resize: none;
}

.gallery-form-col-right .form-group-comment .btn-submit {
    flex-shrink: 0;
    margin-bottom: var(--space-3);
}

.gallery-to-wrap {
    position: relative;
    width: 100%;
    overflow: visible;
}


.gallery-to-trigger {
    width: 100%;
    padding: 0.25rem 0.5rem;
    background: var(--bg-write, #fff);
    color: inherit;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--btn-radius);
    box-sizing: border-box;
    cursor: pointer;
    text-align: left;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 2.5rem;
    font-family: var(--font-ui);
    font-size: var(--font-ui-size);
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.gallery-to-trigger[aria-expanded="true"] {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.gallery-to-trigger:focus {
    outline: none;
    border-color: var(--border-color);
}

.gallery-to-trigger-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.85;
    transition: transform 0.2s ease, opacity 0.15s ease;
    display: block;
}

.gallery-to-trigger[aria-expanded="true"] .gallery-to-trigger-icon {
    transform: rotate(180deg);
}

.gallery-to-trigger:hover .gallery-to-trigger-icon,
.gallery-to-trigger:focus .gallery-to-trigger-icon {
    opacity: 1;
}


.gallery-to-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: calc(-1 * var(--border-width));
    padding: 0;
    border: var(--border-width) solid var(--border-color);
    border-radius: 0 0 var(--btn-radius) var(--btn-radius);
    background: #fff;
    max-height: 12rem;
    overflow-y: auto;
    z-index: 20;
    display: none;
    box-sizing: border-box;
}

.gallery-to-list.open {
    display: block;
}

.gallery-to-item {
    margin: 0 0 var(--space-1);
    padding: 0.25rem 0.5rem;
    border-bottom: var(--border);
    font-family: var(--font-gothic);
    cursor: pointer;
}

.gallery-to-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.gallery-to-item:hover {
    background: #f5f5f5;
}

.gallery-to-item.selected {
    background: #f0f0f0;
}

@media (max-width: 1280px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    
    .gallery-fab-group {
        bottom: var(--space-5);
    }

    
    .gallery-fab-item.exhibition-fab {
        display: flex;
    }

    
    html:has(.main-container.gallery-container),
    body:has(.main-container.gallery-container) {
        overflow-y: hidden;
    }
    html:has(.main-container.gallery-container) {
        height: 100%;
    }
    body:has(.main-container.gallery-container) {
        height: 100%;
        min-height: 100dvh;
    }

    

    
    .main-container.gallery-container {
        max-width: none;
        min-width: 0;
        overflow: visible;
        padding: 0;
        top: calc(var(--nav-height) + env(safe-area-inset-top, 0));
        height: calc(100dvh - var(--nav-height) - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
        position: fixed;
        left: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1;
    }

    .gallery-grid {
        display: flex;
        
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 0;
        min-width: 0;
        height: 100%;
        width: 100%;
        position: fixed;
        top: 0;
        height: calc(100dvh - var(--nav-height) - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
    }

    .gallery-load-more-sentinel {
        min-width: 24px;
        flex-shrink: 0;
    }

    .gallery-card {
        width: min(16rem, 80vw);
        min-width: min(16rem, 80vw);
        max-width: min(16rem, 80vw);
        aspect-ratio: 4 / 5;
        flex-shrink: 0;
        scroll-snap-align: center;
        box-sizing: border-box;
    }

    .gallery-card-body {
        text-align: center;
    }

    .gallery-card-to {
        padding: var(--space-2h) var(--space-4h);
        text-align: center;
    }

    .gallery-card-comment {
        padding: var(--space-3) var(--space-5) var(--space-2);
        text-align: center;
    }

    .gallery-card-meta {
        padding: var(--space-2h) var(--space-4h);
        text-align: center;
    }

    
    .gallery-carousel-arrow {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10000;
        pointer-events: auto;
        width: 3rem;
        height: 3rem;
        min-width: var(--touch-target, 44px);
        min-height: var(--touch-target, 44px);
        padding: 0;
        border: var(--border);
        background: #000;
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .gallery-carousel-prev {
        left: var(--space-5);
    }

    .gallery-carousel-next {
        right: var(--space-5);
    }

    .gallery-carousel-next img {
        transform: rotate(180deg);
    }

    .gallery-carousel-arrow img {
        display: block;
        width: 1.25rem;
        height: auto;
        max-height: 2rem;
        filter: brightness(0) invert(1);
    }

    .gallery-empty {
        font-size: 0.9rem;
    }

    .gallery-carousel-arrow:hover {
        background: #333;
        border-color: #000;
        color: #fff;
    }

    .gallery-carousel-arrow:hover img {
        filter: brightness(0) invert(1);
    }

    .gallery-carousel-arrow:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

    .gallery-carousel-arrow:disabled:hover {
        background: #000;
        border-color: var(--border-color);
    }

    .gallery-carousel-arrow:disabled:hover img {
        filter: brightness(0) invert(1);
    }
}


body.page-index .main-container:has(.exhibition-layout):not(.gallery-container) {
    position: static;
}


@media (max-width: 768px) {
    body.page-index .main-container:has(.exhibition-layout) {
        display: none !important;
    }
}

