:root {
    --s3ampp-navy: #0b2f4a;
    --s3ampp-navy-dark: #071f32;
    --s3ampp-burgundy: #8f1d3f;
    --s3ampp-border: #d7dee5;
    --s3ampp-surface: #ffffff;
    --s3ampp-muted: #617180;
    --s3ampp-shadow: 0 24px 70px rgba(3, 23, 38, 0.32);
}

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

.s3ampp-modal[hidden] {
    display: none !important;
}

.s3ampp-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 18px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.s3ampp-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 19, 31, 0.78);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
}

.s3ampp-modal__dialog {
    position: relative;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: min(1180px, 96vw);
    height: min(920px, 94vh);
    overflow: hidden;
    color: #172635;
    background: var(--s3ampp-surface);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 20px;
    box-shadow: var(--s3ampp-shadow);
}

.s3ampp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 82px;
    padding: 14px 18px 14px 20px;
    color: #ffffff;
    background: linear-gradient(125deg, var(--s3ampp-navy-dark), var(--s3ampp-navy));
    border-bottom: 4px solid var(--s3ampp-burgundy);
}

.s3ampp-modal__identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 14px;
}

.s3ampp-modal__brand {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 48px;
    height: 48px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: var(--s3ampp-burgundy);
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.s3ampp-modal__eyebrow {
    margin: 0 0 2px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.s3ampp-modal__title {
    max-width: 850px;
    margin: 0;
    overflow: hidden;
    color: #ffffff;
    font-size: clamp(17px, 2vw, 24px);
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.s3ampp-modal__close,
.s3ampp-toolbar button {
    font: inherit;
}

.s3ampp-modal__close {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #ffffff;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 12px;
    transition: background-color 160ms ease, transform 160ms ease;
}

.s3ampp-modal__close:hover,
.s3ampp-modal__close:focus-visible {
    background: var(--s3ampp-burgundy);
    transform: scale(1.03);
}

.s3ampp-modal__close svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.s3ampp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 54px;
    padding: 8px 18px;
    background: #f4f7f9;
    border-bottom: 1px solid var(--s3ampp-border);
}

.s3ampp-toolbar[hidden] {
    display: none !important;
}

.s3ampp-toolbar__group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.s3ampp-toolbar__button,
.s3ampp-toolbar__icon,
.s3ampp-toolbar__fit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    color: var(--s3ampp-navy);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #c9d3dc;
    border-radius: 9px;
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.s3ampp-toolbar__button {
    gap: 6px;
    padding: 6px 11px;
}

.s3ampp-toolbar__icon {
    width: 36px;
    padding: 0;
    font-size: 21px;
    line-height: 1;
}

.s3ampp-toolbar__fit {
    padding: 6px 12px;
}

.s3ampp-toolbar__button:hover:not(:disabled),
.s3ampp-toolbar__button:focus-visible:not(:disabled),
.s3ampp-toolbar__icon:hover:not(:disabled),
.s3ampp-toolbar__icon:focus-visible:not(:disabled),
.s3ampp-toolbar__fit:hover,
.s3ampp-toolbar__fit:focus-visible {
    color: #ffffff;
    background: var(--s3ampp-navy);
    border-color: var(--s3ampp-navy);
}

.s3ampp-toolbar button:disabled {
    color: #99a5af;
    cursor: not-allowed;
    background: #eef1f3;
    border-color: #dfe5e9;
}

.s3ampp-toolbar svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.s3ampp-toolbar__page {
    min-width: 72px;
    margin: 0;
    color: #314758;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    text-align: center;
}

.s3ampp-modal__body {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #e9eef2;
}

.s3ampp-status {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #243b4d;
    font-size: 15px;
    font-weight: 650;
    background: rgba(243, 246, 248, 0.92);
}

.s3ampp-status[hidden],
.s3ampp-error[hidden],
.s3ampp-image-stage[hidden] {
    display: none !important;
}

.s3ampp-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #cbd5dc;
    border-top-color: var(--s3ampp-burgundy);
    border-radius: 50%;
    animation: s3ampp-spin 800ms linear infinite;
}

@keyframes s3ampp-spin {
    to {
        transform: rotate(360deg);
    }
}

.s3ampp-error {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 50%;
    width: min(560px, calc(100% - 40px));
    padding: 22px;
    color: #72172f;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.55;
    text-align: center;
    background: #fff8fa;
    border: 1px solid #e5aabe;
    border-radius: 14px;
    box-shadow: 0 14px 35px rgba(40, 13, 22, 0.12);
    transform: translate(-50%, -50%);
}

.s3ampp-image-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.s3ampp-image-stage {
    overflow: auto;
    padding: 22px;
    text-align: center;
    overscroll-behavior: contain;
}

.s3ampp-image-stage img {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    margin: 0 auto;
    pointer-events: auto;
    user-select: none;
    background: #ffffff;
    border: 1px solid #c8d0d7;
    box-shadow: 0 8px 28px rgba(7, 31, 50, 0.17);
}

.s3ampp-modal__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 18px;
    color: var(--s3ampp-muted);
    background: #ffffff;
    border-top: 1px solid var(--s3ampp-border);
}

.s3ampp-modal__footer p {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.s3ampp-modal__footer svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--s3ampp-burgundy);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.s3ampp-modal button:focus-visible,
.s3ampp-modal__dialog:focus-visible {
    outline: 3px solid #f0b440;
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .s3ampp-modal {
        padding: 0;
    }

    .s3ampp-modal__dialog {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .s3ampp-modal__header {
        min-height: 72px;
        padding: 10px 12px;
    }

    .s3ampp-modal__brand {
        width: 42px;
        height: 42px;
        font-size: 11px;
    }

    .s3ampp-modal__title {
        max-width: calc(100vw - 132px);
        font-size: 17px;
    }

    .s3ampp-modal__close {
        width: 42px;
        height: 42px;
    }

    .s3ampp-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        min-height: 90px;
        padding: 7px 8px;
    }

    .s3ampp-toolbar__button span {
        display: none;
    }

    .s3ampp-toolbar__button {
        width: 38px;
        padding: 6px;
    }

    .s3ampp-image-stage {
        padding: 10px;
    }

    .s3ampp-modal__footer {
        min-height: 48px;
        padding: 7px 10px;
    }

    .s3ampp-modal__footer p {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .s3ampp-modal *,
    .s3ampp-modal *::before,
    .s3ampp-modal *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

@media print {
    .s3ampp-modal,
    .s3ampp-modal[aria-hidden="false"] {
        display: none !important;
    }
}
