/* Popup Manager frontend styles. */

.pm-overlay {
    position: fixed;
    inset: 0;
    background: var(--pm-overlay, rgba(0, 0, 0, 0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.pm-overlay[hidden] {
    display: none;
}

html.pm-lock {
    overflow: hidden;
}

.pm-popup {
    position: relative;
    box-sizing: border-box;
    width: min(calc(var(--pm-width, 480) * 1px), 100%);
    max-width: calc(var(--pm-max, 92) * 1%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: var(--pm-bg, #ffffff);
    color: var(--pm-text, #1f1f1f);
    border-radius: var(--pm-radius, 12px);
    padding: var(--pm-pad, 28px);
    text-align: var(--pm-align, center);
    font: inherit;
    line-height: 1.5;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.pm-popup:focus {
    outline: none;
}
.pm-popup:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

.pm-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pm-img-left .pm-inner {
    flex-direction: row;
    align-items: center;
}
.pm-img-right .pm-inner {
    flex-direction: row-reverse;
    align-items: center;
}
.pm-img-bottom .pm-image {
    order: 2;
}

.pm-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--pm-radius, 12px);
}
.pm-img-left .pm-image,
.pm-img-right .pm-image {
    flex: 0 0 40%;
    width: 40%;
}

.pm-content {
    flex: 1 1 auto;
    min-width: 0;
}

.pm-heading {
    margin: 0 0 0.5em;
    color: var(--pm-h, inherit);
    font-size: 1.6rem;
    line-height: 1.25;
    font-weight: 600;
}

.pm-body {
    margin: 0 0 1em;
    color: var(--pm-text, inherit);
    overflow-wrap: break-word;
}
.pm-body a {
    color: inherit;
    text-decoration: underline;
}
.pm-body ul,
.pm-body ol {
    text-align: left;
    padding-left: 1.4em;
}
.pm-body p:last-child {
    margin-bottom: 0;
}

.pm-actions {
    display: flex;
    justify-content: center;
}
.pm-btn-left .pm-actions {
    justify-content: flex-start;
}
.pm-btn-right .pm-actions {
    justify-content: flex-end;
}
.pm-btn-full .pm-button {
    display: block;
    width: 100%;
}

.pm-button {
    display: inline-block;
    padding: 0.75em 1.6em;
    background: var(--pm-btn-bg, #142626);
    color: var(--pm-btn-text, #ffffff);
    border-radius: var(--pm-radius, 12px);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
}
.pm-button:hover,
.pm-button:focus-visible {
    filter: brightness(1.1);
}
.pm-button:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

.pm-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: 0;
    color: inherit;
    font-size: 30px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
}
.pm-close:focus-visible,
.pm-close-text:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

.pm-close-text {
    display: block;
    margin: 14px auto 0;
    background: none;
    border: 0;
    color: inherit;
    opacity: 0.75;
    text-decoration: underline;
    font: inherit;
    cursor: pointer;
}
.pm-btn-left .pm-close-text {
    margin-left: 0;
}
.pm-btn-right .pm-close-text {
    margin-right: 0;
}

/* Entrance animations */
.pm-anim-fade {
    animation: pm-fade 0.25s ease-out;
}
.pm-anim-slide {
    animation: pm-slide 0.3s ease-out;
}
.pm-anim-zoom {
    animation: pm-zoom 0.25s ease-out;
}
@keyframes pm-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pm-slide {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
}
@keyframes pm-zoom {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .pm-popup {
        animation: none !important;
    }
}

/* Small screens: stack side images above the text */
@media (max-width: 640px) {
    .pm-img-left .pm-inner,
    .pm-img-right .pm-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .pm-img-left .pm-image,
    .pm-img-right .pm-image {
        flex: none;
        width: 100%;
    }
    .pm-img-bottom .pm-image {
        order: 2;
    }
    .pm-heading {
        font-size: 1.35rem;
    }
}
