/*
 * ELM DALE OBJECT CABINET V2.0
 * The Living Schoolhouse
 *
 * Decorative elements remain behind content.
 * Product photographs and purchasing controls remain functional.
 */

body.single-product .elmdale-object-archive {
    position: relative;
    isolation: isolate;
    min-width: 0;

    padding: clamp(18px, 2.5vw, 36px);

    border: 1px solid rgba(243,224,172,.15);
    border-radius: 20px;

    background:
        radial-gradient(
            ellipse at 80% 4%,
            rgba(112,147,105,.16),
            transparent 42%
        ),
        radial-gradient(
            ellipse at 3% 62%,
            rgba(191,112,65,.10),
            transparent 42%
        ),
        linear-gradient(
            155deg,
            #203d33 0%,
            #172f29 52%,
            #1c382f 100%
        );

    box-shadow:
        0 28px 70px rgba(4,18,12,.22),
        inset 0 1px rgba(255,255,255,.07);
}

/* Keep actual content above the decorative environment. */

body.single-product
.elmdale-object-archive > :not(.elmdale-scene) {
    position: relative;
    z-index: 2;
}

/* Full-page decorative environment. */

body.single-product .elmdale-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}

/* Very subtle geometric background. */

body.single-product .elmdale-scene::before {
    content: "";
    position: absolute;
    inset: 0;

    background:
        repeating-linear-gradient(
            0deg,
            transparent 0 74px,
            rgba(255,255,255,.012) 75px 76px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0 94px,
            rgba(255,255,255,.009) 95px 96px
        );
}

/* Illustrated books at different depths. */

body.single-product .elmdale-scene-books {
    position: absolute;
    width: min(57%, 680px);
    aspect-ratio: 760 / 460;

    background:
        url('../svg/elmdale-schoolhouse-books.svg')
        center / contain no-repeat;

    filter:
        drop-shadow(13px 19px 9px rgba(0,0,0,.24));

    opacity: .25;
}

body.single-product .elmdale-scene-books--one {
    top: 30px;
    right: -9%;
    transform: rotate(8deg);
}

body.single-product .elmdale-scene-books--two {
    top: 37%;
    left: -17%;
    transform: rotate(-13deg) scale(.9);
    opacity: .15;
}

body.single-product .elmdale-scene-books--three {
    bottom: 2%;
    right: -14%;
    transform: rotate(12deg) scale(.82);
    opacity: .17;
}

/* Faint geometric circles. */

body.single-product .elmdale-scene-orbit {
    position: absolute;
    border: 1px solid rgba(235,198,112,.11);
    border-radius: 50%;
}

body.single-product .elmdale-scene-orbit--one {
    width: 440px;
    height: 440px;
    top: 18%;
    right: -190px;
}

body.single-product .elmdale-scene-orbit--two {
    width: 290px;
    height: 290px;
    bottom: 12%;
    left: -145px;
}

/* Paperclips: dimensional, decorative, and non-interactive. */

body.single-product .elmdale-scene-clip {
    position: absolute;

    width: 19px;
    height: 52px;

    border: 3px solid #d5c8a8;
    border-radius: 12px;

    box-shadow:
        2px 4px 3px rgba(0,0,0,.23),
        inset 1px 0 rgba(255,255,255,.24);

    opacity: .62;
    transform: rotate(var(--clip-angle, 25deg));
}

body.single-product .elmdale-scene-clip::after {
    content: "";

    position: absolute;
    left: 5px;
    top: 8px;

    width: 8px;
    height: 33px;

    border: 2.5px solid #d5c8a8;
    border-radius: 8px 8px 5px 5px;
    border-bottom: 0;
}

body.single-product
.elmdale-scene-clip:nth-of-type(odd) {
    border-color: #c49a64;
}

/* Existing collection identity. */

body.single-product .elmdale-cabinet-heading {
    border-bottom-color: rgba(255,239,200,.28);
}

/* Elevated photographic exhibit. */

body.single-product .elmdale-archive-exhibit {
    position: relative;

    background: rgba(13,35,27,.85);
    border-color: rgba(240,218,170,.24);

    box-shadow:
        0 22px 45px rgba(0,0,0,.26),
        inset 0 1px rgba(255,255,255,.08);

    transform: translateZ(0);
}

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__wrapper {
    box-shadow: 0 12px 32px rgba(0,0,0,.28);
}

body.single-product .elmdale-archive-record {
    position: relative;
}

body.single-product
.elmdale-archive-record .summary {
    position: relative;
    z-index: 1;
}

/*
 * Desktop gallery:
 * Native WooCommerce thumbnails arranged vertically
 * beside the primary photograph.
 */

@media (min-width: 1051px) {

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery {
        display: grid;
        grid-template-columns: 82px minmax(0, 1fr);
        gap: 14px;
        align-items: start;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-viewport,

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        width: 100%;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs {
        grid-column: 1;
        grid-row: 1;

        display: flex !important;
        flex-direction: column;

        gap: 10px;

        width: 82px !important;
        max-height: 610px;

        overflow-y: auto;
        overflow-x: hidden;

        margin: 0;
        padding: 2px;

        scrollbar-width: thin;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs li {
        width: 100% !important;
        flex: 0 0 auto;
        float: none !important;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs li img {
        width: 100% !important;
        height: 78px;
        object-fit: cover;
    }
}

/* Tablet: restore thumbnails below the photograph. */

@media (max-width: 1050px) {

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery {
        display: block;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));

        gap: 10px;

        width: 100% !important;
        margin: 14px 0 0;

        max-height: none;
        overflow: visible;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs li {
        width: 100% !important;
    }
}

/* Mobile refinements. */

@media (max-width: 760px) {

    body.single-product .elmdale-object-archive {
        padding: 12px;
        border-radius: 12px;
    }

    body.single-product .elmdale-scene-books {
        width: 92%;
        opacity: .13;
    }

    body.single-product .elmdale-scene-books--one {
        right: -38%;
        top: 12%;
    }

    body.single-product .elmdale-scene-books--two {
        left: -42%;
    }

    body.single-product .elmdale-scene-clip {
        opacity: .4;
    }

    body.single-product .elmdale-archive-exhibit {
        box-shadow: 0 12px 25px rgba(0,0,0,.22);
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs li img {
        height: 68px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.single-product .elmdale-archive-exhibit {
        transition: none;
    }
}


/* ELM DALE OBJECT CABINET V2.1 — PHOTO REFINEMENT */

/*
 * Balance the left thumbnail rail with matching space
 * on the right, centering the photograph in the exhibit.
 */

@media (min-width: 1051px) {

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery {
        grid-template-columns:
            82px minmax(0, 1fr) 82px;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-viewport,

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
        grid-column: 2;
        grid-row: 1;
    }
}

/* Soft, dimensional photograph mounting. */

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__wrapper {
    box-sizing: border-box;

    border-radius: 17px;
    overflow: hidden;

    border: 1px solid rgba(245, 237, 218, .20);

    box-shadow:
        0 18px 36px rgba(0, 0, 0, .28),
        0 3px 8px rgba(0, 0, 0, .15),
        inset 0 0 0 1px rgba(255, 255, 255, .07);
}

/* Keep the actual image corners softly rounded. */

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image,
body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image a,
body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image img {
    border-radius: 13px;
}

/* A translucent edge around the photographic surface. */

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .09);
}

/* Give the photographic exhibit a little breathing room. */

@media (min-width: 1051px) {

    body.single-product
    .elmdale-archive-exhibit {
        padding: clamp(18px, 2.2vw, 30px);
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery {
        gap: 16px;
    }
}

/* On smaller screens, prioritize photograph size. */

@media (max-width: 1050px) {

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery__wrapper {
        border-radius: 14px;
    }
}


/* ELM DALE V2.3 — GALLERY IMAGE FIT */

/*
 * WooCommerce FlexSlider sets inline dimensions.
 * Ensure the photograph scales within its visible slide.
 */

body.single-product
.elmdale-archive-exhibit
.flex-viewport {
    min-width: 0;
    max-width: 100%;
}

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Allow the photograph to fit the available viewing area. */

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image {
    box-sizing: border-box;
    max-width: 100%;
}

/* Preserve rounded edges without cropping the photograph. */

body.single-product
.elmdale-archive-exhibit
.woocommerce-product-gallery__image img {
    border-radius: 12px;
}


/* ELM DALE V2.4 — FLEXSLIDER LAYOUT CORRECTION */

/*
 * Keep the thumbnail rail beside the photograph without
 * using CSS Grid on FlexSlider's gallery container.
 */

@media (min-width: 1051px) {

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery {
        display: block !important;
        position: relative;
        box-sizing: border-box;
        padding-left: 94px;
        width: 100% !important;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-viewport {
        display: block;
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs {
        position: absolute;
        top: 0;
        left: 0;
        width: 76px !important;
        margin: 0;
        display: flex !important;
        flex-direction: column;
        gap: 12px;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs li {
        width: 100% !important;
        flex: 0 0 auto;
    }

    body.single-product
    .elmdale-archive-exhibit
    .woocommerce-product-gallery > .flex-control-thumbs li img {
        width: 100% !important;
        height: 76px;
        object-fit: cover;
    }
}
