.global-alert-modal-link svg {
    vertical-align: baseline;
    display: block;
    width: 16px;
    height: 16px;
    overflow: visible; /* the ring touches the viewBox edge; keep its stroke from being clipped */
}

.global-alert picture svg,
.global-alert picture img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* When the modal is open, ensure the image inside the global alert is not broken. */
.modal-open .global-alert img {
    width: 100%;
}

/* stylelint-disable */
body.ups-appPage .global-alert img {
    width: 100%;
}
/* stylelint-enable */

/* The banner is always one line, matching the header space reserved via --global-alert-height. */
.global-alert {
    background-color: #ffc400;
    color: #121212;
    text-align: center;
    padding: 10px var(--section-inline-padding);
    font-size: 15px;
    height: var(--global-alert-height, 40px);
}

.global-alert picture {
    height: 24px;
    width: 24px;
    flex: 0 0 auto;
    display: block;
}

.yellow-alert-wrapper .global-alert.hide {
    display: none;
}

.global-alert-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0 0 0 / 50%);
}

.global-alert-modal-content {
    background-color: #fefefe;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    text-align: left;
    position: absolute;
    display: flex;
    gap: 10px;
    flex-direction: row-reverse;
}

.global-alert .global-alert-text {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.global-alert-close-button {
    color: #aaa;
    margin-top: -10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    height: fit-content;
}

.global-alert-close-button:hover,
.global-alert-close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.global-alert button {
    background-color: #000;
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

.global-alert button:hover {
    background-color: #333;
}

.global-alert .more-details {
    text-decoration: underline;
    cursor: pointer;
}

.global-alert .more-details:hover {
    color: #333;
}

.global-alert p.global-alert-title {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin: 0;
    width: 100%;
    min-width: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

/* Legacy alerts render the details as <p>, multi-alert items as <div> (rich text). */
.global-alert .global-alert-modal-content .modal-content-text {
    display: block;
    text-align: center;
}

[dir='rtl'] .global-alert .global-alert-modal-content .modal-content-text {
    margin-right: 0;
    text-align: right;
}

.global-alert .hide {
    display: none;
}

/* The "?" details link: pt's question-circle SVG (in #121212), 18px high as on pt. */
.global-alert-modal-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    cursor: pointer;
    flex: 0 0 auto;
}

/* Match the banner text (black) instead of the global link colour, which is low-contrast on yellow. */
.global-alert .global-alert-modal-link {
    color: inherit;
}

/* Multiple alerts (global-alert-item children): "N Alerts" | < alert > | counter, one line,
   rotating vertically. */
.global-alert.global-alert-slider.hide {
    display: none;
}

.global-alert.global-alert-carousel,
.global-alert-authoring-preview.global-alert-carousel {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--global-alert-height, 40px);
    padding: 0 var(--section-inline-padding);
}

.global-alert-carousel .global-alert-count {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding-inline-end: 16px;
    border-inline-end: 1px solid currentcolor;
    font-size: 14px;
    font-weight: 500;
    line-height: 24px;
    white-space: nowrap;
}

.global-alert-carousel .global-alert-count .icon,
.global-alert-carousel .global-alert-count .icon img {
    display: block;
    width: 16px;
    height: 16px;
}

.global-alert-carousel .global-alert-rotator {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.global-alert-carousel .global-alert-viewport {
    flex: 0 1 auto;
    min-width: 0;
    height: 24px;
    overflow: hidden;
}

/* Slides share one grid cell (width of the longest alert) and slide horizontally. */
.global-alert-carousel .global-alert-track {
    display: grid;
}

.global-alert-carousel .global-alert-slide {
    display: flex;
    grid-area: 1 / 1;
    align-items: center;
    justify-content: center;
    height: 24px;
    min-width: 0;
    transition: transform 0.4s ease-in-out;
}

.global-alert-carousel picture {
    width: 20px;
    height: 20px;
}

.global-alert-carousel .global-alert-counter {
    flex: 0 0 auto;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.global-alert-carousel .global-alert-nav,
.global-alert-carousel .global-alert-nav:hover {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
}

/* The shared chevron points down; turn it into left/right arrows. */
.global-alert-carousel .global-alert-next i.symbol-chevron::after {
    transform: rotate(45deg);
}

.global-alert-carousel .global-alert-prev i.symbol-chevron::after {
    transform: rotate(225deg);
}

[dir='rtl'] .global-alert-carousel .global-alert-next i.symbol-chevron::after {
    transform: rotate(225deg);
}

[dir='rtl'] .global-alert-carousel .global-alert-prev i.symbol-chevron::after {
    transform: rotate(45deg);
}

/* UE: keep the authored item rows editable but hidden, and show the carousel preview instead. */
.global-alert.global-alert-slider-authoring {
    padding: 0;
    height: auto;
}

.global-alert-slider-authoring > div:not(.global-alert-authoring-preview) {
    display: none;
}

/* UE only: shown above the preview while "Show carousel on site" is off. */
.global-alert-slider-authoring .global-alert-authoring-note {
    margin: 0;
    padding: 6px var(--section-inline-padding);
    border-bottom: 1px dashed currentcolor;
    background: #fff;
    font-size: 13px;
    line-height: 18px;
}

@media (width < 770px) {
    .global-alert-modal-content {
        max-height: 400px;
        overflow-y: auto;
    }
}

/* Tablet */
@media (width < 1024px) {
    .global-alert p.global-alert-title {
        gap: 12px;
        font-size: 15px;
    }

    .global-alert picture {
        height: 20px;
        width: 20px;
    }
}

/* Mobile */
@media (width < 640px) {
    .global-alert {
        font-size: 14px;
    }

    .global-alert p.global-alert-title,
    .global-alert-carousel p.global-alert-title {
        gap: 8px;
        font-size: 14px;
    }

    .global-alert picture,
    .global-alert-carousel picture {
        height: 18px;
        width: 18px;
    }

    .global-alert.global-alert-carousel,
    .global-alert-authoring-preview.global-alert-carousel {
        gap: 8px;
    }

    .global-alert-carousel .global-alert-count {
        display: none;
    }

    .global-alert-carousel .global-alert-rotator {
        justify-content: center;
        gap: 4px;
    }

    .global-alert-modal-content {
        width: 90%;
        max-width: none;
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .global-alert-carousel .global-alert-slide {
        transition: none;
    }
}
