/*
 * Site-wide announcement bar (template-parts/site/announcement.php).
 *
 * Enqueued only when the bar actually renders, so with the bar off the
 * site loads no extra CSS at all. In-flow (never fixed/sticky), so it
 * cannot cover content or interfere with the sticky header below it.
 *
 * Every class is prefixed "u-announce" so edd-widgets' stylesheets (which
 * style every <button>) cannot reach it; the close button is written as
 * `.u-site .u-announce__close` for the same reason.
 */

.u-site .u-announce {
    position: relative;
    display: block;
    background: var(--u-dark);
    color: #fff;
}

/* display:block above beats the browser's own [hidden] rule, so dismiss
   (and the out-of-window removal) must be stated explicitly. */
.u-site .u-announce[hidden] {
    display: none;
}

/* Wrapper keeps the text, link and close button on one balanced line at
   wide widths and wraps to two on narrow ones. */
.u-announce__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 16px;
    max-width: var(--u-container);
    min-height: 44px;
    margin: 0 auto;
    padding: 9px 44px;
    text-align: center;
}

.u-site .u-announce__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    color: #fff;
}

.u-site .u-announce__link {
    display: inline-flex;
    align-items: center;
    flex: none;
    padding: 5px 14px;
    border-radius: 999px;
    background: #fff;
    color: var(--u-dark);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.u-site .u-announce__link:hover,
.u-site .u-announce__link:focus-visible {
    background: var(--u-accent);
    color: var(--u-dark);
}

/* Close button. Hidden until the inline script marks the bar ready, so it
   is never an inert button without JS. */
.u-site .u-announce__close {
    position: absolute;
    top: 50%;
    inset-inline-end: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.u-announce--dismissible .u-announce__close {
    display: inline-flex;
}

.u-site .u-announce__close:hover,
.u-site .u-announce__close:focus-visible {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.u-announce__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Two lines on phones: the text can wrap, the pill drops below it. */
@media (max-width: 560px) {
    .u-announce__inner {
        gap: 8px;
        padding: 10px 40px;
        text-align: center;
    }

    .u-site .u-announce__text {
        font-size: 13px;
    }
}

/* RTL: translateY is vertical, so it is fine; the close button uses a
   logical inset (above). Nothing physical to mirror here. */
