.steves-popup-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: auto;
    background: rgba(0, 0, 0, .9);
}

.steves-popup-overlay.active {
    display: block;
}

/* Visually hidden but accessible to screen readers */
.steves-popup-sr-only {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.steves-popup-modal {
    padding: 0px 10px;
    border: 1px solid #888;
    width: 900px;
    max-width: calc(100% - 20px);
    border-radius: 5px;
    margin: 10vh auto 50px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, .9);
    display: flex;
    flex-direction: column;
}

.steves-popup-modal:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.steves-popup-close {
    color: #fff;
    background: darkorange;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 33px;
    line-height: 0px;
    text-align: center;
    border-radius: 6px;
    order: -1;
    align-self: flex-end;
    z-index: 9999;
    margin: 5px 28px 10px 0;
}

.steves-popup-close:hover,
.steves-popup-close:focus {
    color: #000;
    text-decoration: none;
    outline: 2px solid #444;
}

/* Bottom close link — subtle text just below the modal */
.steves-popup-close-bottom {
    background: none;
    border: none;
    color: #999;
    font-size: 0.75em;
    cursor: pointer;
    padding: 0.4em 0;
    margin: 0 auto;
    display: block;
    text-align: center;
}
.steves-popup-close-bottom:hover,
.steves-popup-close-bottom:focus {
    color: #fff;
    text-decoration: underline;
    outline: none;
}

.steves-popup-content {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

button.steves-popup-trigger {
    width: auto;
}

.steves-popup-content iframe,
.steves-popup-content video {
    width: 100%;
    height: auto;
    max-width: 100%;
}

@media (max-width: 768px) {
    .steves-popup-modal {
        width: 90%;
        margin-top: 5vh;
    }
}

.steves-popup-content .wp-block-post-template.is-layout-grid {
    display: grid;
    gap: var(--wp--style--block-gap, 1.5rem);
}

.steves-popup-content .columns-1 { grid-template-columns: 1fr; }
.steves-popup-content .columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.steves-popup-content .columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.steves-popup-content .columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .steves-popup-content .wp-block-post-template.is-layout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.steves-popup-overlay.steves-popup-drawer {
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.steves-popup-overlay.steves-popup-drawer.active {
    opacity: 1;
    visibility: visible;
}

.steves-popup-overlay.steves-popup-drawer .steves-popup-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    margin: 0;
        padding: 0.1em .2em;
    border: none;
    border-radius: 0;
    background: var(--wp--preset--color--background, #fff);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}


.steves-popup-overlay.steves-popup-drawer .has-global-padding {padding: 0.1em .2em;}

.steves-popup-overlay.steves-popup-drawer nav a,
nav.steves-popup-overlay.steves-popup-drawer a {
    display: block;
    padding: .1em;
    text-decoration: none;

}


.steves-popup-overlay.steves-popup-drawer.active .steves-popup-modal {
    transform: translateX(0);
}

.steves-popup-overlay.steves-popup-drawer .steves-popup-close {
    display: block;
    margin: 0 0 10px auto;
}

.steves-popup-overlay.steves-popup-drawer .steves-popup-content {
    padding:4px;
}

/* Left-side drawer */
.steves-popup-overlay.steves-popup-drawer.steves-popup-drawer-left .steves-popup-modal {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
}

.steves-popup-overlay.steves-popup-drawer.steves-popup-drawer-left.active .steves-popup-modal {
    transform: translateX(0);
}

/* Navigation-specific styles */
.steves-popup-overlay nav ul,
nav.steves-popup-overlay ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.steves-popup-overlay nav li,
nav.steves-popup-overlay li {
    margin: 0;
    padding: 0;
}

.steves-popup-overlay nav a,
nav.steves-popup-overlay a {
    display: block;

    text-decoration: none;
    color: inherit;
}





/* Trigger button reset for nav links */
button.steves-popup-trigger {
    font: inherit;
    color: inherit;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

button.steves-popup-trigger:focus {
 
}

/* Reduced motion: disable animations for motion-sensitive users */
@media (prefers-reduced-motion: reduce) {
    .steves-popup-overlay.steves-popup-drawer {
        transition: none;
    }
    .steves-popup-overlay.steves-popup-drawer .steves-popup-modal {
        transition: none;
    }
}

/* Editor preview: keep popup in-document flow instead of fixed overlay */
.editor-styles-wrapper .steves-popup-overlay.active {
    position: relative;
    z-index: auto;
    height: auto;
    overflow: visible;
    background: rgba(0, 0, 0, .15);
    border: 1px dashed #999;
    margin: 8px 0;
}

.editor-styles-wrapper .steves-popup-overlay.steves-popup-drawer.active {
    background: transparent;
    border: none;
}

.editor-styles-wrapper .steves-popup-overlay.steves-popup-drawer .steves-popup-modal {
    position: relative;
    right: auto;
    height: auto;
    max-height: none;
    transform: none;
    border: 1px solid #ccc;
}

.editor-styles-wrapper .steves-popup-close,
.editor-styles-wrapper .steves-popup-close-bottom {
    pointer-events: none;
    opacity: 0.4;
}
