/*!
 * Weekly sale banners — front end.
 *
 * Self-contained, like products.css: these land inside somebody else's theme,
 * so every rule is scoped under .wkb or .wkb-slot and nothing leaks outward.
 *
 * The banner pictures carry no text and are made for it: the wide one has its
 * products on the right and an empty left, the tall one has them in the top half
 * and an empty lower half. The text (name, "Up to N% off", countdown, button) is
 * drawn over that empty area, the way the web storefront draws its sale hero:
 * light text on a dark scrim that fades out over the products. The scrim is what
 * keeps the text at WCAG AA on a light, a bright or a dark picture.
 *
 * Which picture shows is decided by the width of the SLOT (a container query),
 * not the screen: a wide picture in a 500px column leaves no room for the text.
 * Without container queries the tall picture shows, which works at every width.
 *
 * A slot is `hidden` and empty while no sale is live and takes no space.
 */

.wkb-slot[hidden] { display: none !important; }

.wkb-slot { display: block; width: 100%; margin: 1.5em 0; container: wkb / inline-size; }
.wkb-slot--top-bar { margin: 0; container-type: normal; }
.wkb-notice {
    margin: 1em 0;
    padding: 12px 14px;
    border: 1px dashed #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
    color: #78350f;
    font-size: 13px;
}

.wkb {
    --wkb-ink: #ffffff;
    --wkb-soft: #ffffff;
    --wkb-up: #fde047;
    --wkb-chip: rgba(255, 255, 255, 0.12);
    --wkb-scrim: 8, 12, 24;
    --wkb-cta: linear-gradient(135deg, #0f766e 0%, #0369a1 50%, #1d4ed8 100%);
    --wkb-on-cta: #ffffff;
    --wkb-bar: linear-gradient(90deg, #0f766e 0%, #0369a1 100%);
    --wkb-on-bar: #ffffff;
    --wkb-focus: #ffffff;
    --wkb-plain: linear-gradient(135deg, #0f172a 0%, #134e4a 100%);

    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0;
    border-radius: 16px;
    color: var(--wkb-ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    text-align: start;
    -webkit-font-smoothing: antialiased;
}

.wkb *,
.wkb *::before,
.wkb *::after { box-sizing: border-box; }

.wkb :where(p) { margin: 0; padding: 0; }
.wkb :where(img) { display: block; max-width: 100%; height: auto; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.wkb :where(b) { font-weight: 700; }

/* Campaign themes: the button, the bar, the "up to" colour and the plain ground. */
.wkb[data-campaign-theme="default"] { --wkb-up: #67e8f9; }
.wkb[data-campaign-theme="black-friday"] {
    --wkb-up: #facc15;
    --wkb-cta: #facc15;
    --wkb-on-cta: #111827;
    --wkb-bar: #0b0b0f;
    --wkb-on-bar: #fde047;
    --wkb-plain: linear-gradient(135deg, #0b0b0f 0%, #27272a 100%);
}
.wkb[data-campaign-theme="christmas"] {
    --wkb-up: #fecaca;
    --wkb-cta: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    --wkb-bar: linear-gradient(90deg, #991b1b 0%, #166534 100%);
    --wkb-plain: linear-gradient(135deg, #14532d 0%, #7f1d1d 100%);
}
.wkb[data-campaign-theme="spring"] {
    --wkb-up: #bbf7d0;
    --wkb-cta: linear-gradient(135deg, #15803d 0%, #0f766e 100%);
    --wkb-bar: linear-gradient(90deg, #166534 0%, #9d174d 100%);
    --wkb-plain: linear-gradient(135deg, #14532d 0%, #831843 100%);
}

/* The whole banner is one link; its accessible name is on the anchor. */
.wkb-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    border-radius: inherit;
    text-decoration: none;
    background: none;
}
.wkb-link:focus-visible {
    outline: 3px solid var(--wkb-focus);
    outline-offset: -5px;
    box-shadow: inset 0 0 0 6px rgba(15, 23, 42, 0.85);
}

/* ── the picture and its scrim ─────────────────────────────────────── */

.wkb-media { position: relative; }
.wkb-img { width: 100%; height: auto; }
.wkb-img--wide { display: none; }
.wkb--art-wide .wkb-img--wide { display: block; }

/* Under the text: dark at the bottom (tall picture), fading out upward. */
.wkb-media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to top,
        rgba(var(--wkb-scrim), 0.92) 0%,
        rgba(var(--wkb-scrim), 0.84) 28%,
        rgba(var(--wkb-scrim), 0.45) 46%,
        rgba(var(--wkb-scrim), 0) 62%);
}

/* The panel: over the empty lower half of the tall picture. */
.wkb-copy {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
    color: var(--wkb-ink);
}
.wkb-head { min-width: 0; }
.wkb-name { font-size: 20px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.wkb-up { margin-block-start: 2px; font-size: 15px; font-weight: 700; color: var(--wkb-up); }

.wkb-cta {
    display: inline-block;
    flex: 0 0 auto;
    padding: 9px 18px;
    border-radius: 999px;
    background: var(--wkb-cta);
    color: var(--wkb-on-cta);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

/* The countdown reads the existing .wkp/.wkw unit vocabulary. */
.wkb-count { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.wkb-ends { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--wkb-soft); }
.wkb-units { display: inline-flex; gap: 6px; }
.wkb-unit { display: inline-flex; flex-direction: column; align-items: center; min-width: 38px; padding: 4px 6px; border-radius: 8px; background: var(--wkb-chip); }
.wkb-unit b { font-size: 16px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.wkb-unit-label { font-size: 10px; line-height: 1.2; color: var(--wkb-soft); }

/* A narrow slot: the sidebar, a phone. The button is the width of the card. */
.wkb--sidebar .wkb-cta { align-self: stretch; }
.wkb--sidebar .wkb-copy { gap: 6px; padding: 14px; }
.wkb--sidebar .wkb-name { font-size: 18px; }
.wkb--sidebar .wkb-unit { min-width: 34px; padding: 3px 5px; }
@container wkb (max-width: 479px) {
    .wkb--horizontal .wkb-cta { align-self: stretch; }
}

/* ── a wide slot: the wide picture, the text on its empty left ─────── */

@container wkb (min-width: 720px) {
    .wkb--horizontal.wkb--art-both .wkb-img--wide { display: block; }
    .wkb--horizontal.wkb--art-both .wkb-img--tall { display: none; }
    /* Not a constrained mobile picture in a wide slot: a capped, cropped one. */
    .wkb--horizontal.wkb--art-tall .wkb-img--tall { max-height: 560px; object-fit: cover; object-position: top; }

    .wkb--horizontal.wkb--art-both .wkb-media::after,
    .wkb--horizontal.wkb--art-wide .wkb-media::after {
        /* Physical left on purpose: the picture is not mirrored for RTL, its empty area stays on the left. */
        background: linear-gradient(to right,
            rgba(var(--wkb-scrim), 0.9) 0%,
            rgba(var(--wkb-scrim), 0.82) 30%,
            rgba(var(--wkb-scrim), 0.46) 48%,
            rgba(var(--wkb-scrim), 0) 66%);
    }
    .wkb--horizontal.wkb--art-both .wkb-copy,
    .wkb--horizontal.wkb--art-wide .wkb-copy {
        inset: 0 auto 0 0;
        width: 46%;
        justify-content: center;
        gap: clamp(8px, 1.6cqw, 16px);
        padding: 0 clamp(20px, 4cqw, 56px);
    }
    /* RTL: hug the left edge too, where the scrim is darkest. */
    [dir="rtl"] .wkb--horizontal.wkb--art-both .wkb-copy,
    [dir="rtl"] .wkb--horizontal.wkb--art-wide .wkb-copy { align-items: flex-end; }
    .wkb--horizontal.wkb--art-both .wkb-name,
    .wkb--horizontal.wkb--art-wide .wkb-name { font-size: clamp(20px, 3cqw, 40px); }
    .wkb--horizontal.wkb--art-both .wkb-up,
    .wkb--horizontal.wkb--art-wide .wkb-up { font-size: clamp(14px, 1.7cqw, 20px); }
    .wkb--horizontal.wkb--art-both .wkb-cta,
    .wkb--horizontal.wkb--art-wide .wkb-cta { padding: clamp(8px, 1.1cqw, 12px) clamp(18px, 2.2cqw, 28px); font-size: clamp(14px, 1.5cqw, 17px); }
}

/* Only a wide picture, and a narrow slot: no room over it, so the text sits under it. */
@container wkb (max-width: 719px) {
    .wkb--art-wide .wkb-media::after { display: none; }
    .wkb--art-wide .wkb-copy {
        position: relative;
        inset: auto;
        background: #0b1220;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px 16px;
        padding: 14px 16px;
    }
    .wkb--art-wide .wkb-head { flex: 1 1 140px; }
}

/* ── no picture: the panel is the banner (also the old strip look) ─── */

.wkb--plain { background: var(--wkb-plain); }
.wkb--plain .wkb-copy {
    position: relative;
    inset: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    padding: 18px 20px;
}
.wkb--plain .wkb-head { flex: 1 1 160px; }
.wkb--plain.wkb--sidebar .wkb-copy { flex-direction: column; align-items: flex-start; }

/* ── the top bar ───────────────────────────────────────────────────── */

.wkb--bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 16px;
    min-height: 44px;
    padding: 8px 48px 8px 16px;
    border-radius: 0;
    background: var(--wkb-bar);
    color: var(--wkb-on-bar);
    font-size: 14px;
}
.wkb--bar .wkb-bar-text { font-weight: 700; text-align: center; }
.wkb--bar .wkb-ends,
.wkb--bar .wkb-unit-label { color: inherit; opacity: 0.9; }
.wkb--bar .wkb-unit { flex-direction: row; align-items: baseline; gap: 3px; min-width: 0; padding: 2px 6px; background: rgba(0, 0, 0, 0.24); }
.wkb--bar .wkb-unit b { font-size: 14px; }
.wkb--bar .wkb-cta { padding: 6px 14px; background: #ffffff; color: #0f172a; }
.wkb--bar[data-campaign-theme="black-friday"] .wkb-cta { background: #facc15; color: #111827; }
.wkb--bar .wkb-compact,
.wkb--bar .wkb-cta-arrow { display: none; }
.wkb--bar .wkb-close {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: 8px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.wkb--bar .wkb-close:hover { background: rgba(255, 255, 255, 0.2); }
.wkb--bar .wkb-close:focus-visible { outline: 3px solid #ffffff; outline-offset: 1px; }

/* A phone: one line. "{name}: up to N% off", a compact countdown, an arrow, the close button. */
@media (max-width: 599px) {
    .wkb--bar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
        min-height: 44px;
        padding: 6px 44px 6px 12px;
        font-size: 13px;
    }
    .wkb--bar .wkb-bar-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-align: start; text-overflow: ellipsis; white-space: nowrap; }
    .wkb--bar .wkb-count { display: none; }
    .wkb--bar .wkb-compact { display: inline-block; flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .wkb--bar .wkb-cta { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 4px 8px; }
    .wkb--bar .wkb-cta-text { display: none; }
    .wkb--bar .wkb-cta-arrow { display: block; }
}

/* ── motion ────────────────────────────────────────────────────────── */

.wkb-slot.is-entering .wkb { animation: wkb-in 0.25s ease-out; }
@keyframes wkb-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .wkb-slot.is-entering .wkb { animation: none; }
}

@media (forced-colors: active) {
    .wkb-link:focus-visible { outline-color: Highlight; box-shadow: none; }
    .wkb-cta { border: 1px solid ButtonText; }
}
