/* Instagram-style artwork viewer. Colours are set once here; change to suit your site. */
.gm-modal {
    --gm-overlay: #493d3dd1;
    --gm-panel:   #fcf5f5;
    --gm-ink:     #111111;
    --gm-muted:   #737373;
    --gm-line:    #e6e6e6;
    --gm-accent:  #a72828;

    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 76px;
    background: var(--gm-overlay);
}
.gm-modal[hidden],
.gm-modal [hidden] { display: none !important; }

.gm-modal button { font: inherit; }

/* ---- The white box ---------------------------------------------------- */
.gm-dialog {
    display: flex;
    width: min(1200px, 100%);
    height: min(90vh, 880px);
    background: #000;          /* black, so any sub-pixel gap at the join doesn't show white */
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    outline: none;
}

/* ---- Media side: a horizontal strip of slides that snaps one per view - */
.gm-media {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    background: #000;
}
.gm-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.gm-track::-webkit-scrollbar { display: none; }
.gm-slide {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}
.gm-slide img,
.gm-slide video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;      /* whole artwork visible, letterboxed in black */
    background: #000;
}

/* Small round arrows inside the media */
.gm-slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 7px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #111;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.gm-slide-btn:hover { background: #fff; }
.gm-slide-prev { left: 12px; }
.gm-slide-next { right: 12px; }
.gm-slide-btn svg { width: 100%; height: 100%; display: block; }

/* Position dots */
.gm-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    display: flex;
    justify-content: center;
    gap: 5px;
    pointer-events: none;
}
.gm-media.on-video .gm-dots { bottom: auto; top: 16px; }   /* keep clear of video controls */
.gm-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    transition: background 0.2s;
}
.gm-dots span.active { background: #fff; }

/* ---- Details side ------------------------------------------------------ */
.gm-info {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--gm-panel);
    color: var(--gm-ink);
}
.gm-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--gm-line);
}
.gm-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}
.gm-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px;
}
.gm-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-line;    /* line breaks typed in the manager are kept */
}
.gm-more {
    display: inline-block;
    margin-top: 18px;
    padding: 7px 16px;
    border-radius: 8px;
    background: var(--gm-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.gm-more:hover { filter: brightness(1.08); }
.gm-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-top: 1px solid var(--gm-line);
    color: var(--gm-muted);
    font-size: 13px;
}
.gm-foot button {
    padding: 6px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--gm-ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.gm-foot button:hover:not(:disabled) { background: #fcf5f5; }
.gm-foot button:disabled { color: #000000; cursor: default; }

/* ---- Close and previous/next artwork (on the dark overlay) -------------- */
.gm-close {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 6px;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
}
.gm-close svg { width: 100%; height: 100%; display: block; }
.gm-post {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    cursor: pointer;
}
.gm-post:disabled { visibility: hidden; }
.gm-post svg { width: 100%; height: 100%; display: block; }
.gm-post-prev { left: 20px; }
.gm-post-next { right: 20px; }

/* ---- Phones and narrow windows: stack media above details --------------- */
@media (max-width: 900px) {
    .gm-modal { padding: 0; align-items: stretch; }
    .gm-dialog {
        flex-direction: column;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .gm-media { flex: 0 0 auto; height: min(58vh, 100vw); }
    .gm-info { flex: 1 1 auto; }
    .gm-post { display: none; }
    .gm-close {
        top: 8px;
        right: 8px;
        width: 34px;
        height: 34px;
        padding: 7px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.45);
    }
}

/* ---- Grid thumbnails: corner icon for multi-image and video artworks ---- */
.gallery-item { position: relative; }
.gm-badge {
    position: absolute;
    top: 20px;
    right: 8px;
    width: 22px;
    height: 22px;
    color: #fff;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.7));
    pointer-events: none;
}
.gm-badge svg { width: 100%; height: 100%; display: block; }
