/* ==========================================================================
   Holy Apostles - Gutenberg Modal Block Frontend Stylesheet
   ========================================================================== */

/* Modal Backdrop & Outer Overlay wrapper */
.holy-apostles-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Modal Open Transition State */
.holy-apostles-modal-wrapper.is-open {
    opacity: 1;
}

/* Semi-transparent backdrop with modern blur effect */
.holy-apostles-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Modal Container (Main Modal Dialog box) */
.holy-apostles-modal-container {
    position: relative;
    background-color: var(--wp--preset--color--base, #ffffff);
    color: var(--wp--preset--color--contrast, #1e1e1e);
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    z-index: 100000;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    /* Contain scroll within container boundaries */
}

/* Modal Width Sizes */
.holy-apostles-modal-container.modal-size-sm {
    max-width: 400px;
}

.holy-apostles-modal-container.modal-size-md {
    max-width: 600px;
}

.holy-apostles-modal-container.modal-size-lg {
    max-width: 900px;
}

/* Centered container scaling on modal open */
.holy-apostles-modal-wrapper.is-open .holy-apostles-modal-container {
    transform: scale(1);
}

/* Close Button (X icon top-right) */
.holy-apostles-modal-close.is-inside {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    z-index: 100002;
}

.holy-apostles-modal-close.is-inside:hover {
    background-color: #f1f3f5;
    color: #212529;
}

.holy-apostles-modal-close.is-outside {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 100002;
}

.holy-apostles-modal-close.is-outside:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #ffffff;
    color: #ffffff;
}

.holy-apostles-modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Modal Internal Scrollable Content Body */
.holy-apostles-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    /* Allow content container to fill height and handle scrolling */
    width: auto;
    box-sizing: border-box;
}

/* Scroll Lock on body when modal is active */
body.modal-open {
    overflow: hidden !important;
}

/* Constrain images and figure wrappers within the modal body to prevent overflow/bleeding while preserving inline aspect ratios */
.holy-apostles-modal-body .wp-block-image {
    max-width: 100% !important;
}

.holy-apostles-modal-body img {
    max-width: 100% !important;
    display: block;
}

/* Standard styling adjustments inside modal content */
.holy-apostles-modal-body h1,
.holy-apostles-modal-body h2,
.holy-apostles-modal-body h3,
.holy-apostles-modal-body h4,
.holy-apostles-modal-body h5,
.holy-apostles-modal-body h6 {
    margin-top: 0;
    color: inherit;
}

.holy-apostles-modal-body p:last-child {
    margin-bottom: 0;
}