/* File: css/product_gallery.css */
/* Shared product-detail gallery and modal styling. */

.product-gallery-trigger {
    position: relative;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #e09dff;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.product-gallery-trigger:hover,
.product-gallery-trigger:focus-visible {
    outline: none;
    box-shadow:
            inset 2px 2px 4px #000,
            inset -2px -2px 4px #1a1a1a,
            0 0 18px rgba(0,255,213,0.72);
}

.product-gallery-trigger:focus-visible {
    border-color: #00FFD5;
}

.product-gallery-trigger-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;

    padding: 7px 12px;
    background: rgba(0,0,0,0.38);
    border: 1px solid rgba(0,255,213,0.38);
    border-radius: 10px;

    color: #00FFD5;
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1.02;
    opacity: 0.82;
    text-align: center;
    text-shadow:
            0 0 6px rgba(0,0,0,1),
            0 0 10px rgba(0,0,0,1),
            1px 1px 0 rgba(0,0,0,1);
    white-space: nowrap;
}

.product-gallery-trigger-hint span {
    display: block;
}

.product-gallery-trigger-hint span:first-child,
.product-gallery-trigger-hint span:last-child {
    font-size: 1.08rem;
    letter-spacing: 0.04em;
}

.product-gallery-dialog {
    --product-gallery-viewport-height: 100vh;

    width: min(1120px, calc(100vw - 28px));
    max-height: calc(var(--product-gallery-viewport-height) - 28px);
    padding: 0;
    overflow: visible;

    background: rgba(6,0,18,0.98);
    border: 2px solid #e09dff;
    border-radius: 14px;
    color: #ffffff;

    box-shadow:
            0 0 24px rgba(210,0,255,0.72),
            0 18px 48px rgba(0,0,0,0.92);
}

@supports (height: 100dvh) {
    .product-gallery-dialog {
        --product-gallery-viewport-height: 100dvh;
    }
}

.product-gallery-dialog::backdrop {
    background: rgba(0,0,0,0.78);
}

.product-gallery-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;

    max-height: calc(var(--product-gallery-viewport-height) - 36px);
    padding:
            clamp(16px, 2.4vw, 28px)
            clamp(16px, 2.4vw, 28px)
            clamp(36px, 5vh, 56px);
    overflow-y: auto;
    overflow-x: hidden;
}

.product-gallery-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
}

.product-gallery-title {
    margin: 0;
    color: #f0c8ff;
    font-size: clamp(1.45rem, 3vw, 2.25rem);
    line-height: 1.12;
}

.product-gallery-close {
    flex: 0 0 auto;
    padding: 8px 16px;
    font-size: 0.95rem;
}

.product-gallery-description {
    max-width: 920px;
    flex: 0 0 auto;
}

.product-gallery-description p {
    margin: 0 0 12px;
    font-size: 1.1rem;
    line-height: 1.58;
}

.product-gallery-description p:last-child {
    margin-bottom: 0;
}

.product-gallery-description h3 {
    margin: 18px 0 7px;
    color: #00FFD5;
    font-size: 1.16rem;
    line-height: 1.25;
}

.product-gallery-description h3:first-child {
    margin-top: 0;
}

.product-gallery-stage {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
}

.product-gallery-image-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 180px;
    padding: 10px;

    background: rgba(0,0,0,0.58);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 12px;
}

.product-gallery-main-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(58vh, 640px);
    object-fit: contain;
    border-radius: 8px;
}

.product-gallery-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 1.45rem;
    line-height: 1;
}

.product-gallery-thumbnails {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex: 0 0 auto;
    max-width: 100%;
    min-height: max-content;
    padding: 4px 2px 22px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
}

.product-gallery-thumbnail {
    flex: 0 0 auto;
    padding: 5px;
    background: rgba(0,0,0,0.68);
    border: 2px solid rgba(224,157,255,0.58);
    border-radius: 8px;
    cursor: pointer;
}

.product-gallery-thumbnail img {
    width: auto;
    height: 68px;
    max-width: none;
    object-fit: contain;
    border-radius: 5px;
}

.product-gallery-thumbnail[aria-current="true"] {
    border-color: #00FFD5;
    box-shadow: 0 0 12px rgba(0,255,213,0.78);
}

.product-gallery-thumbnail:focus-visible {
    outline: 3px solid #00FFD5;
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .product-gallery-header {
        flex-direction: column;
        align-items: stretch;
    }

    .product-gallery-close {
        align-self: flex-end;
    }

    .product-gallery-stage {
        grid-template-columns: 1fr 1fr;
    }

    .product-gallery-image-frame {
        grid-column: 1 / -1;
        grid-row: 1;
        min-height: 150px;
    }

    .product-gallery-main-image {
        max-height: 46vh;
    }

    .product-gallery-description p {
        font-size: 1.04rem;
        line-height: 1.58;
    }

    .product-gallery-nav {
        width: 100%;
        min-height: 44px;
        font-size: 1.25rem;
    }

    .product-gallery-prev {
        grid-column: 1;
        grid-row: 2;
    }

    .product-gallery-next {
        grid-column: 2;
        grid-row: 2;
    }

    .product-gallery-thumbnail img {
        height: 56px;
    }
}

@media (max-width: 420px) {
    .product-gallery-dialog {
        width: calc(100vw - 16px);
        max-height: calc(var(--product-gallery-viewport-height) - 16px);
    }

    .product-gallery-shell {
        max-height: calc(var(--product-gallery-viewport-height) - 24px);
        padding: 14px 14px 38px;
    }

    .product-gallery-trigger-hint {
        font-size: 0.72rem;
        padding: 6px 10px;
    }

    .product-gallery-trigger-hint span:first-child,
    .product-gallery-trigger-hint span:last-child {
        font-size: 0.98rem;
    }

    .product-gallery-thumbnail img {
        height: 50px;
    }
}
