/* ==========================================================================
   Click-to-Expand (Lightbox) & Magnifier Badge Styles
   ========================================================================== */

/* Wrapper for positioning the badge correctly */
.zoomable-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.zoomable-image-wrapper img,
img.zoomable,
img.expandable {
    display: block; /* Removes descender gap below image */
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.zoomable-image-wrapper img:hover,
img.zoomable:hover,
img.expandable:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

/* Magnifying Glass Indicator Badge */
.zoomable-image-wrapper::after {
    content: "";
    position: absolute;
    bottom: 22px; /* Positioned to comfortably clear standard 28px border-radius */
    right: 22px;
    width: 36px;
    height: 36px;
    background-color: rgba(18, 18, 18, 0.6);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'></circle><line x1='21' y1='21' x2='16.65' y2='16.65'></line></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
    border-radius: 50%;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    pointer-events: none; /* Let clicks pass through to the image */
    z-index: 5;
}

/* Hover effect for the badge (triggers when hovering the image wrapper) */
.zoomable-image-wrapper:hover::after {
    opacity: 1;
    transform: scale(1.1);
    background-color: rgba(233, 92, 36, 0.95); /* Theme Orange */
}

/* Lightbox Overlay */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
}

.image-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.image-lightbox img {
    width: 95vw;
    height: 95vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 3px solid #414141;
    background: #ffffff;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.image-lightbox.active img {
    transform: scale(1);
}

/* Lightbox Caption */
.image-lightbox-caption {
    color: #ffffff;
    font-size: 16px;
    margin-top: 20px;
    max-width: 80%;
    text-align: center;
    font-family: "neue-haas-unica", "Helvetica Neue", Helvetica, sans-serif;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 0.5px;
}

/* Lightbox Close Button */
.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 44px;
    font-weight: 200;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

.image-lightbox-close:hover {
    color: #e95c24; /* Theme orange */
    transform: scale(1.1);
}

/* Layout overrides to ensure wrapper matches image dimensions exactly in visual-chart-lists */
.chart-image .zoomable-image-wrapper {
    display: inline-block;
    max-width: 650px;
    width: 100%;
    margin-bottom: 50px;
}

/* Make the first image wrapper in each chart column peek over the top of the grey bar BFC */
.chart-image .zoomable-image-wrapper:first-child {
    margin-top: -40px;
}

section.visual-chart-list .section-columns > li .column-content > div .chart-image .zoomable-image-wrapper img {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: 100%;
    max-width: 100%;
    display: block;
}

/* ==========================================================================
   WordPress Standard Image Alignment Classes
   ========================================================================== */

.alignleft,
.zoomable-image-wrapper.alignleft {
    float: left;
    margin: 0.5em 1.5em 1.5em 0;
}

.alignright,
.zoomable-image-wrapper.alignright {
    float: right;
    margin: 0.5em 0 1.5em 1.5em;
}

.aligncenter,
.zoomable-image-wrapper.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    clear: both;
}

/* Ensure parents clear floated images correctly */
.body-content::after,
.section-content::after,
.column-content::after,
.node__content::after {
    content: "";
    display: table;
    clear: both;
}

/* Helper classes to restrict full-size/large images to specific widths on the page */
/* Default size for editor-inserted zoomable images (unless they have a specific hi-res-thumb override) */
.body-content img.zoomable:not([class*="hi-res-thumb"]),
.body-content img.expandable:not([class*="hi-res-thumb"]) {
    width: 50% !important;
    height: auto !important;
    max-width: 100% !important;
}

img.hi-res-thumb {
    width: 50% !important;
    height: auto !important;
}

img.hi-res-thumb-300 {
    width: 300px !important;
    height: auto !important;
}

img.hi-res-thumb-350 {
    width: 350px !important;
    height: auto !important;
}

img.hi-res-thumb-400 {
    width: 400px !important;
    height: auto !important;
}

img.hi-res-thumb-450 {
    width: 450px !important;
    height: auto !important;
}
