/* =========================================================
   St. Benedict's School — Full Image Home Modal
   ========================================================= */

.stbhm-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease;
}

.stbhm-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.stbhm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 16, 38, .78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.stbhm-dialog {
    position: relative;
    z-index: 2;
    width: min(1100px, 100%);
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 35px 100px rgba(0,0,0,.35);
    transform: translateY(22px) scale(.98);
    opacity: 0;
    transition: transform .42s cubic-bezier(.2,.75,.25,1), opacity .3s ease;
}

.stbhm-modal.is-open .stbhm-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Main purpose: the uploaded featured image fills the modal. */
.stbhm-image {
    position: relative;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    background: #071b42;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stbhm-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 40px);
    object-fit: contain;
    object-position: center;
}

.stbhm-image-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(
            180deg,
            rgba(3, 16, 38, .02) 35%,
            rgba(3, 16, 38, .08) 52%,
            rgba(3, 16, 38, .72) 100%
        );
}

.stbhm-image-content {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 80px 52px 38px;
    color: #fff;
}

.stbhm-label {
    margin-bottom: 9px;
    color: #e5a916;
    font: 800 11px/1.2 Arial, Helvetica, sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stbhm-image-content h2 {
    margin: 0 0 10px;
    color: #fff;
    font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    font-size: clamp(28px, 4vw, 52px);
    line-height: 1.05;
    letter-spacing: -.8px;
}

.stbhm-description {
    max-width: 680px;
    color: rgba(255,255,255,.94);
    font: 15px/1.6 Arial, Helvetica, sans-serif;
}

.stbhm-description p {
    margin: 0 0 8px;
}

.stbhm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    margin-top: 16px;
    padding: 12px 20px;
    border-radius: 7px;
    background: #e5a916;
    color: #081d45 !important;
    text-decoration: none !important;
    font: 800 14px/1.2 Arial, Helvetica, sans-serif;
    transition: transform .2s ease, background .2s ease;
}

.stbhm-button:hover {
    background: #f1b82d;
    color: #081d45 !important;
    transform: translateY(-2px);
}

.stbhm-button span {
    font-size: 19px;
    line-height: 1;
}

.stbhm-close {
    position: absolute;
    z-index: 10;
    top: 16px;
    right: 16px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 50%;
    background: rgba(5, 20, 45, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: transform .2s ease, background .2s ease;
}

.stbhm-close:hover {
    transform: rotate(90deg);
    background: #08204a;
}

.stbhm-close span {
    position: absolute;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.stbhm-close span:first-child {
    transform: rotate(45deg);
}

.stbhm-close span:last-child {
    transform: rotate(-45deg);
}

.stbhm-dismiss {
    position: absolute;
    z-index: 9;
    right: 26px;
    bottom: 20px;
    border: 0;
    padding: 4px 8px;
    background: rgba(4,18,43,.45);
    color: rgba(255,255,255,.85);
    border-radius: 5px;
    font: 13px/1.2 Arial, Helvetica, sans-serif;
    cursor: pointer;
}

.stbhm-dismiss:hover {
    color: #fff;
    background: rgba(4,18,43,.72);
}

.stbhm-no-image {
    padding: 70px 55px;
    min-height: 320px;
}

.stbhm-no-image h2 {
    margin: 0 0 15px;
    color: #08204a;
    font-family: Georgia, serif;
    font-size: clamp(32px, 4vw, 50px);
}

.stbhm-no-image .stbhm-description {
    color: #5d6778;
}

.stbhm-no-image .stbhm-button {
    color: #fff !important;
}

html.stbhm-modal-open,
body.stbhm-modal-open {
    overflow: hidden !important;
}

/* Tablet */
@media (max-width: 800px) {
    .stbhm-modal {
        padding: 12px;
    }

    .stbhm-dialog,
    .stbhm-image {
        max-height: calc(100vh - 24px);
        border-radius: 17px;
    }

    .stbhm-image img {
        max-height: calc(100vh - 24px);
    }

    .stbhm-image-content {
        padding: 75px 28px 30px;
    }

    .stbhm-image-content h2 {
        font-size: clamp(28px, 6vw, 42px);
    }
}

/* Mobile */
@media (max-width: 520px) {
    .stbhm-modal {
        padding: 0;
    }

    .stbhm-dialog,
    .stbhm-image {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .stbhm-image img {
        width: 100%;
        height: auto;
        max-height: 100vh;
        object-fit: contain;
    }

    .stbhm-image-content {
        padding: 90px 20px 24px;
    }

    .stbhm-image-content h2 {
        font-size: 29px;
        line-height: 1.08;
    }

    .stbhm-description {
        font-size: 13px;
        line-height: 1.5;
    }

    .stbhm-button {
        margin-top: 13px;
        padding: 11px 17px;
        font-size: 13px;
    }

    .stbhm-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .stbhm-dismiss {
        right: 16px;
        bottom: 14px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stbhm-modal,
    .stbhm-dialog,
    .stbhm-image img,
    .stbhm-button,
    .stbhm-close {
        transition: none !important;
    }
}


/* v1.2 mobile UX refinements */
@media (max-width: 520px) {
    .stbhm-modal {
        align-items: center;
        justify-content: center;
        padding:
            max(10px, env(safe-area-inset-top))
            max(10px, env(safe-area-inset-right))
            max(10px, env(safe-area-inset-bottom))
            max(10px, env(safe-area-inset-left));
    }

    .stbhm-dialog {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 20px);
        border-radius: 18px;
        overflow: hidden;
    }

    .stbhm-image {
        width: 100%;
        max-height: calc(100dvh - 20px);
        min-height: 0;
    }

    .stbhm-image img {
        width: 100%;
        height: auto;
        max-height: calc(100dvh - 20px);
        object-fit: contain;
    }

    .stbhm-image-overlay {
        background: linear-gradient(
            180deg,
            rgba(3,16,38,0) 40%,
            rgba(3,16,38,.12) 55%,
            rgba(3,16,38,.82) 100%
        );
    }

    .stbhm-image-content {
        padding: 100px 18px 24px;
    }

    .stbhm-image-content h2 {
        font-size: clamp(25px, 7.8vw, 34px);
        line-height: 1.08;
        letter-spacing: -.4px;
        margin-bottom: 8px;
    }

    .stbhm-label {
        font-size: 9px;
        letter-spacing: 1.4px;
    }

    .stbhm-description {
        font-size: 13px;
        line-height: 1.45;
    }

    .stbhm-button {
        min-height: 44px;
        padding: 11px 16px;
        border-radius: 7px;
        font-size: 13px;
    }

    .stbhm-close {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
        border-color: rgba(255,255,255,.7);
    }

    .stbhm-dismiss {
        right: 14px;
        bottom: 12px;
        min-height: 32px;
        padding: 6px 9px;
        font-size: 12px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .stbhm-image-content {
        padding: 75px 15px 19px;
    }

    .stbhm-image-content h2 {
        font-size: 24px;
    }

    .stbhm-description {
        font-size: 12px;
    }

    .stbhm-button {
        min-height: 42px;
        width: 100%;
    }
}
