/* ========================================
   TRUSTED RESOURCES POPUP STYLES
   ======================================== */

.trusted-resource-popup {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    padding: 0;
    margin: 0;
}

.trusted-resource-popup.flex {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.trusted-resource-popup.show {
    opacity: 1;
}

.popup-content {
    /* Mobile (default) */
    height: 90%;
    width: 90%;
    padding-bottom: 35px;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
}

.trusted-resource-popup.show .popup-content {
    transform: scale(1);
}

/* Mobile: add right margin */
@media (max-width: 767px) {
    .trusted-resource-popup.show .popup-content {
        margin-right: 15px;
    }
}

/* Tablet */
@media (min-width: 768px) {
    .popup-content {
        width: 80%;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .popup-content {
        width: 75%;
    }
}

/* Ensure popup body scrolls correctly */
.popup-body {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for popup body */
.popup-body::-webkit-scrollbar {
    width: 8px;
}

.popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.popup-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.popup-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Popup close button */
.popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 20;
    cursor: pointer;
    border: none;
    padding: 0;
}

.popup-close:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.popup-close:active {
    transform: scale(0.95);
}

.popup-close svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #374151;
    pointer-events: none;
}

/* ========================================
   VIDEO / OEMBED INSIDE POPUP
   ======================================== */

/* Let WordPress keep each video's native aspect ratio (the .wp-has-aspect-ratio
   wrapper handles 16:9 landscape, 9:16 portrait shorts, etc.). We only shrink the
   OUTER width and center it — never the iframe directly, otherwise the
   absolutely-positioned iframe gets stretched. Height follows the ratio. */
.popup-content-text .wp-block-embed,
.popup-content-text figure {
    width: 100%;
    max-width: 560px;       /* shrink from full width; ratio kept by WP */
    margin-left: 0;
    margin-right: auto;     /* keep left-aligned with the rest of the content */
}

/* Portrait videos: cap width tighter so they don't become extremely tall. */
.popup-content-text .wp-embed-aspect-9-16,
.popup-content-text .wp-embed-aspect-1-2,
.popup-content-text .wp-embed-aspect-2-3,
.popup-content-text .wp-embed-aspect-3-4 {
    max-width: 320px;
}

.popup-content-text iframe,
.popup-content-text video {
    border: 0;
    border-radius: 16px;
}

/* Fallback for bare iframes/videos NOT wrapped in a WP aspect-ratio figure
   (e.g. classic-editor autoembed): give them a responsive 16:9 and center. */
.popup-content-text > iframe,
.popup-content-text > p > iframe,
.popup-content-text > video {
    display: block;
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    height: auto;
    margin-left: 0;
    margin-right: auto;
}
