/*
 * EMC PRODUCT GALLERY — TIGER'S STYLING FILE
 * ---------------------------------------------------------------
 * Change the values below to match any brand. The active thumbnail
 * is marked with a visible outline. The WooCommerce product images
 * are never cropped: object-fit: contain is used throughout.
 *
 * Note: colors/sizes set in Elementor or WooCommerce plugin settings
 * override the corresponding CSS variables for that gallery.
 * v1.3 also locks zoom, navigation and lightbox controls to a 1:1 ratio.
 */
.emcpg {
    --emcpg-surface: #FFFFFF;           /* Main image background */
    --emcpg-accent: #5A3A15;            /* Arrow, zoom, lightbox buttons */
    --emcpg-active-outline: #C25A1C;    /* Selected thumbnail MARK / OUTLINE */
    --emcpg-outline-width: 2px;         /* Outline thickness */
    --emcpg-thumb-border: #E6DED3;      /* Inactive thumbnail border */
    --emcpg-thumb-background: #FFFFFF;  /* Thumbnail tile background (no selected fill) */
    --emcpg-control-border: #E6DED3;    /* Arrow and zoom button border */
    --emcpg-radius: 4px;                /* Corners; 0px = square */
    --emcpg-gap: 14px;                  /* Space between thumbnails and hero */
    --emcpg-thumb-width: 88px;         /* Desktop thumbnail width */
    --emcpg-arrow-size: 40px;          /* Round arrow / zoom button diameter */
    --emcpg-arrow-background: #FFFFFF; /* Arrow/zoom button surface */
    --emcpg-stage-ratio: 5 / 6;         /* Main frame aspect ratio */

    display: grid;
    grid-template-columns: var(--emcpg-thumb-width) minmax(0, 1fr);
    gap: var(--emcpg-gap);
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    color: var(--emcpg-accent);
    box-sizing: border-box;
}
.emcpg *, .emcpg *::before, .emcpg *::after { box-sizing: border-box; }
.emcpg button { font: inherit; cursor: pointer; }
.emcpg button:focus-visible { outline: 3px solid var(--emcpg-accent); outline-offset: 3px; }
.emcpg__thumbs {
    display: flex;
    flex-direction: column;
    gap: var(--emcpg-gap);
    max-height: 650px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    min-width: 0;
    padding: 3px;
}
.emcpg__thumb {
    flex: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 3px;
    border: 1px solid var(--emcpg-thumb-border);
    border-radius: var(--emcpg-radius);
    background: var(--emcpg-thumb-background);
    outline: var(--emcpg-outline-width) solid transparent;
    outline-offset: calc(-1 * var(--emcpg-outline-width));
    transition: outline-color .18s ease, border-color .18s ease;
}
.emcpg__thumb[aria-pressed="true"] {
    outline-color: var(--emcpg-active-outline); /* SELECTED THUMBNAIL */
    border-color: transparent;
}
.emcpg__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--emcpg-thumb-background);
}
.emcpg__stage {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: var(--emcpg-stage-ratio);
    border-radius: var(--emcpg-radius);
    background: var(--emcpg-surface);
    min-width: 0;
    touch-action: pan-y;
}
.emcpg__stage-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;  /* IMPORTANT: preserve Faith's original artwork */
    object-position: center;
    transition: opacity .12s ease;
}
.emcpg__stage.is-changing .emcpg__stage-img { opacity: .45; }
.emcpg__arrow, .emcpg__zoom {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--emcpg-arrow-size);
    height: var(--emcpg-arrow-size);
    color: var(--emcpg-accent);
    background: var(--emcpg-arrow-background);
    border: 1px solid var(--emcpg-control-border);
    border-radius: 50%;
    padding: 0;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(38,28,17,.08);
    transition: background .18s ease, transform .18s ease;
}
.emcpg__arrow { top: 50%; transform: translateY(-50%); }
.emcpg__arrow--prev { left: 8px; }
.emcpg__arrow--next { right: 8px; }
.emcpg__zoom { top: 12px; right: 12px; }
@media (hover: hover) and (pointer: fine) {
    .emcpg__arrow:hover { filter: brightness(.96); transform: translateY(-50%) scale(1.05); }
    .emcpg__zoom:hover { filter: brightness(.96); transform: scale(1.05); }
}
.emcpg__sr {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
/* Desktop option: thumbnails below hero */
.emcpg--bottom { grid-template-columns: minmax(0, 1fr); }
.emcpg--bottom .emcpg__stage { grid-row: 1; }
.emcpg--bottom .emcpg__thumbs {
    grid-row: 2;
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px;
}
.emcpg--bottom .emcpg__thumb { width: var(--emcpg-thumb-width); }
.emcpg--single { grid-template-columns: minmax(0, 1fr); }
/* Fullscreen image preview */
.emcpg__lightbox[hidden] { display: none !important; }
.emcpg__lightbox {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(16,19,19,.91);
}
.emcpg__lightbox-panel { position: relative; width: min(1100px, 100%); height: 100%; display: flex; justify-content: center; align-items: center; }
.emcpg__lightbox-image { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; background: transparent; }
.emcpg__lightbox-close, .emcpg__lightbox-nav {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #FFFFFF;
    color: #272727;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
}
.emcpg__lightbox-close { right: 0; top: 0; }
.emcpg__lightbox-nav { top: 50%; transform: translateY(-50%); }
.emcpg__lightbox-nav--prev { left: 0; }
.emcpg__lightbox-nav--next { right: 0; }
.emcpg__lightbox-count { position: absolute; bottom: 0; color: #FFFFFF; background: rgba(0,0,0,.45); padding: 4px 10px; border-radius: 20px; font-size: 13px; }
.emcpg__editor-note { padding: 15px; border: 1px dashed #aaa; color: #666; }
/* Tablet & phone: automatic horizontal thumbnails underneath main */
@media (max-width: 767px) {
    .emcpg, .emcpg--left { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .emcpg__stage { grid-row: 1; aspect-ratio: 5 / 6; }
    .emcpg__thumbs, .emcpg--left .emcpg__thumbs {
        grid-row: 2;
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 3px;
    }
    .emcpg__thumb, .emcpg--left .emcpg__thumb { width: clamp(65px, 19vw, var(--emcpg-thumb-width)); }
    .emcpg__arrow { --emcpg-arrow-size: 34px; }
    .emcpg__zoom { --emcpg-arrow-size: 36px; }
    .emcpg__lightbox { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .emcpg__stage-img, .emcpg__arrow, .emcpg__zoom, .emcpg__thumb { transition: none !important; }
}


/*
 * 1.2 — ISOLATED BUTTON PRESENTATION (Elementor / WordPress / theme-safe)
 * ---------------------------------------------------------------
 * Themes often declare global button:hover, button:focus and
 * .woocommerce button styles, sometimes using !important. Those
 * previously painted the pink thumbnail backgrounds / borders.
 * The visual-only resets below intentionally use !important; colors
 * ALWAYS come from per-widget CSS variables so Elementor's Style
 * controls still work. No global WooCommerce buttons are changed.
 */
.emcpg button.emcpg__thumb,
.emcpg button.emcpg__thumb:hover,
.emcpg button.emcpg__thumb:focus,
.emcpg button.emcpg__thumb:active {
    -webkit-appearance: none !important;
    appearance: none !important;
    background: var(--emcpg-thumb-background) !important;
    background-image: none !important;
    color: var(--emcpg-accent) !important;
    border: 1px solid var(--emcpg-thumb-border) !important;
    border-radius: var(--emcpg-radius) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    padding: 3px !important;
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    opacity: 1 !important;
    outline: var(--emcpg-outline-width) solid transparent !important;
    outline-offset: calc(-1 * var(--emcpg-outline-width)) !important;
}
/* Active = outline ONLY, without an unwanted pink filled tile. */
.emcpg button.emcpg__thumb[aria-pressed="true"],
.emcpg button.emcpg__thumb[aria-pressed="true"]:hover,
.emcpg button.emcpg__thumb[aria-pressed="true"]:active {
    background: var(--emcpg-thumb-background) !important;
    border-color: transparent !important;
    outline-color: var(--emcpg-active-outline) !important;
}
.emcpg .emcpg__thumb img {
    background: var(--emcpg-thumb-background) !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0;
}
.emcpg button.emcpg__arrow,
.emcpg button.emcpg__arrow:hover,
.emcpg button.emcpg__arrow:focus,
.emcpg button.emcpg__arrow:active,
.emcpg button.emcpg__zoom,
.emcpg button.emcpg__zoom:hover,
.emcpg button.emcpg__zoom:focus,
.emcpg button.emcpg__zoom:active {
    -webkit-appearance: none !important;
    appearance: none !important;
    color: var(--emcpg-accent) !important;
    background: var(--emcpg-arrow-background) !important;
    background-image: none !important;
    border: 1px solid var(--emcpg-control-border) !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 2px 8px rgba(38, 28, 17, .08) !important;
    text-shadow: none !important;
    text-decoration: none !important;
    opacity: 1 !important;
}
.emcpg button.emcpg__thumb::before,
.emcpg button.emcpg__thumb::after,
.emcpg button.emcpg__arrow::before,
.emcpg button.emcpg__arrow::after,
.emcpg button.emcpg__zoom::before,
.emcpg button.emcpg__zoom::after {
    content: none !important;
}
.emcpg button.emcpg__arrow svg,
.emcpg button.emcpg__zoom svg {
    display: block;
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px;
    color: inherit !important;
    stroke: currentColor !important;
    fill: none !important;
    pointer-events: none;
}
/* Modal buttons use the same isolation, keeping their own white theme. */
.emcpg button.emcpg__lightbox-close,
.emcpg button.emcpg__lightbox-close:hover,
.emcpg button.emcpg__lightbox-nav,
.emcpg button.emcpg__lightbox-nav:hover {
    -webkit-appearance: none !important;
    appearance: none !important;
    color: #272727 !important;
    background: #fff !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.emcpg button.emcpg__lightbox-close svg,
.emcpg button.emcpg__lightbox-nav svg {
    display: block;
    width: 20px !important;
    height: 20px !important;
    color: inherit !important;
    stroke: currentColor !important;
    fill: none !important;
}
/* Clear focus for keyboard users, even with the active image outlined. */
.emcpg button.emcpg__thumb:focus-visible,
.emcpg button.emcpg__arrow:focus-visible,
.emcpg button.emcpg__zoom:focus-visible,
.emcpg button.emcpg__lightbox-close:focus-visible,
.emcpg button.emcpg__lightbox-nav:focus-visible {
    outline: 3px solid var(--emcpg-accent) !important;
    outline-offset: 3px !important;
}


/*
 * 1.3 — CONTROL ASPECT RATIO (ALL THEMES / ELEMENTOR)
 * ---------------------------------------------------------------
 * Some theme/Elementor button presets specify width:auto, min-height,
 * max-width, flex-grow, etc., which can squeeze 40x40 controls into
 * narrow vertical ovals. The control size is governed by the existing
 * Elementor "Button Size" slider (--emcpg-arrow-size) and remains 1:1.
 * Overrides only the EMC gallery, never other buttons on the website.
 */
.emcpg button.emcpg__arrow,
.emcpg button.emcpg__zoom {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    width: var(--emcpg-arrow-size) !important;
    min-width: var(--emcpg-arrow-size) !important;
    max-width: var(--emcpg-arrow-size) !important;
    height: var(--emcpg-arrow-size) !important;
    min-height: var(--emcpg-arrow-size) !important;
    max-height: var(--emcpg-arrow-size) !important;
    aspect-ratio: 1 / 1 !important;
    line-height: 1 !important;
    text-indent: 0 !important;
    letter-spacing: normal !important;
    border-radius: 50% !important;
}
.emcpg button.emcpg__arrow svg,
.emcpg button.emcpg__zoom svg {
    display: block !important;
    flex: 0 0 20px !important;
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* The lightbox controls must remain perfect 44px circles, too. */
.emcpg button.emcpg__lightbox-close,
.emcpg button.emcpg__lightbox-nav {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    aspect-ratio: 1 / 1 !important;
    line-height: 1 !important;
    border-radius: 50% !important;
}
