/* Hepson Theme Modal / Lightbox */
html.hepson-modal-open,
body.hepson-modal-open { overflow: hidden; }

.hepson-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(0, 0, 0, .86);
}
.hepson-modal-overlay.is-open { display: flex; }
.hepson-modal-dialog {
    position: relative;
    width: min(920px, 100%);
    max-height: 90vh;
    overflow: auto;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0,0,0,.32);
}
.hepson-modal-dialog.is-lightbox {
    width: min(1400px, 100%);
    height: min(90vh, 1000px);
    max-height: none;
    overflow: visible;
    background: transparent;
    box-shadow: none;
}
.hepson-modal-content { padding: 34px; }
.hepson-modal-dialog.is-lightbox .hepson-modal-content {
    width: 100%; height: 100%; padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.hepson-modal-close,
.hepson-modal-nav {
    position: absolute;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.62);
    color: #fff;
    cursor: pointer;
    line-height: 1;
}
.hepson-modal-close { top: 10px; right: 10px; font-size: 34px; }
.hepson-modal-dialog:not(.is-lightbox) .hepson-modal-close { top: 14px; right: 14px; }
.hepson-modal-nav { top: 50%; transform: translateY(-50%); font-size: 28px; }
.hepson-modal-prev { left: 0; }
.hepson-modal-next { right: 0; }
.hepson-modal-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
.hepson-modal-counter {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0,0,0,.62);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.hepson-modal-source { display: none !important; }
.hepson-modal-content .hepson-modal-source,
.hepson-modal-content > .gform_wrapper { display: block !important; }
.hepson-modal-content .gform_wrapper { margin: 0; }
.hepson-modal-content .gform_wrapper form { margin-bottom: 0; }

@media (max-width: 767px) {
    .hepson-modal-overlay { padding: 16px; }
    .hepson-modal-dialog { max-height: 92vh; }
    .hepson-modal-dialog.is-lightbox { height: 88vh; }
    .hepson-modal-content { padding: 26px 20px; }
    .hepson-modal-close,
    .hepson-modal-nav { width: 42px; height: 42px; }
}


/* Navigation belongs only to image galleries. Content/form modals never show it. */
.hepson-modal-dialog:not(.is-lightbox) .hepson-modal-nav,
.hepson-modal-dialog:not(.is-lightbox) .hepson-modal-counter,
.hepson-modal-nav[hidden],
.hepson-modal-counter[hidden] {
    display: none !important;
}
