/*
 * Wimakeit_Promo — the campaign banner.
 *
 * One bar, one message, one link. It sits above everything the visitor came
 * for, so it earns its height and no more.
 *
 * Plain CSS, loaded from the two position layouts, rather than the LESS
 * partials the house usually ships. Those reach Luma through its auto-bundle
 * and Hyvä through a Tailwind rebuild in the theme — and on a Hyvä storefront
 * with no rebuild the bar rendered as bare text across the top of the page.
 * Thirty lines with no theme coupling do not justify a companion module and an
 * `npm run build-prod` on six sites; this file is served identically by Luma,
 * Breeze and Hyvä, and only on the pages that carry a banner.
 *
 * Every colour and size is a custom property, so a theme rethemes the bar by
 * redeclaring them on `.wm-promo` — no rebuild anywhere. A campaign's own
 * settings arrive the same way, through the `style` attribute, and so win over
 * the theme for that campaign only.
 */
.wm-promo {
    --wm-promo-bg: #111;
    --wm-promo-ink: #fff;
    --wm-promo-accent: #f04e23;
    --wm-promo-size: 14px;
    --wm-promo-note-ink: var(--wm-promo-ink);
    /* Resolved where it is used, so 0.75em is three quarters of the promo text. */
    --wm-promo-note-size: 0.75em;

    background: var(--wm-promo-bg);
    color: var(--wm-promo-ink);
    font-size: var(--wm-promo-size);
    line-height: 1.4;
    overflow: hidden;
    padding: 8px 16px;
    text-align: center;
}

.wm-promo__track {
    display: grid;
    /* A grid column sizes to its widest content by default, which on a phone
       is wider than the screen; minmax(0, 1fr) pins it to the bar's width so
       the promo wraps instead of running off the edge. */
    grid-template-columns: minmax(0, 1fr);
}

.wm-promo__slide {
    align-items: center;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    justify-content: center;
}

/* Pasted markup brings its own paragraphs; none of them should add vertical
   rhythm to a bar that is one line tall. */
.wm-promo__text,
.wm-promo__text > * {
    margin: 0;
}

/* A flex item does not shrink below its content by default: without this a
   long promo pushes past the right edge on a phone instead of wrapping. */
.wm-promo__text {
    max-width: 100%;
    min-width: 0;
}

/* Headings pasted into the field — an <h2> copied from a slide, typically —
   arrive with the theme's heading styles: 30px, its own font and colour, a
   2.5rem top margin. In a one-line bar they read as emphasis, nothing more:
   the bar's size, font and colour, in bold. */
.wm-promo__text h1,
.wm-promo__text h2,
.wm-promo__text h3,
.wm-promo__text h4,
.wm-promo__text h5,
.wm-promo__text h6,
.wm-promo__text p {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    margin: 0;
    padding: 0;
    text-transform: inherit;
}

.wm-promo__text h1,
.wm-promo__text h2,
.wm-promo__text h3,
.wm-promo__text h4,
.wm-promo__text h5,
.wm-promo__text h6 {
    font-weight: 700;
}

/* Every link is scoped under .wm-promo, :visited included: themes colour
   `a:visited` (Luma ships `a:visited { color: #006cb6 }`), and a visited
   link outranks a single class — on a blue bar it vanished into the blue. */
.wm-promo .wm-promo__text a,
.wm-promo .wm-promo__text a:visited {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The small print — "*Valid until 31/10/2026". Present, legible, and quieter
   than the offer it qualifies. */
.wm-promo__note {
    color: var(--wm-promo-note-ink);
    font-size: var(--wm-promo-note-size);
}

.wm-promo .wm-promo__link,
.wm-promo .wm-promo__link:visited {
    color: var(--wm-promo-ink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wm-promo .wm-promo__link:hover {
    color: var(--wm-promo-accent);
}

/* The bar is the only thing on the page at this point; a focus ring borrowing
   the background colour is a focus ring nobody sees. */
.wm-promo .wm-promo__link:focus-visible {
    color: var(--wm-promo-accent);
    outline: 2px solid var(--wm-promo-accent);
    outline-offset: 2px;
}

/*
 * Two promos: a carousel, driven by js/promo.js.
 *
 * Both promos share one grid cell, so the bar is as tall as the taller of the
 * two and never jumps when they swap. The script marks the visible one with
 * `data-active` and the bar with `is-ready`; until then — or without
 * JavaScript at all — only the first promo shows and the arrows stay hidden.
 */
.wm-promo--slider {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Sized to the wider promo, not to the bar: the arrows sit beside the
   message, as on Kit & Ride, rather than at the far edges of a wide screen. */
.wm-promo--slider .wm-promo__track {
    flex: 0 1 auto;
    min-width: 0;
}

.wm-promo--slider .wm-promo__slide {
    grid-area: 1 / 1;
}

.wm-promo--slider:not(.is-ready) .wm-promo__slide:not(:first-child) {
    visibility: hidden;
}

/* The hidden promo fades and drops out; `visibility` waits for the fade so
   it is still drawn while it leaves, then leaves the tab order. */
.wm-promo--slider.is-ready .wm-promo__slide {
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s linear 0.4s;
}

.wm-promo--slider.is-ready .wm-promo__slide:not([data-active]) {
    opacity: 0;
    transform: translateY(0.35rem);
    visibility: hidden;
}

.wm-promo--slider.is-ready .wm-promo__slide[data-active] {
    transition-delay: 0s;
}

.wm-promo .wm-promo__arrow {
    align-items: center;
    background: none;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    color: inherit;
    cursor: pointer;
    display: grid;
    flex: 0 0 auto;
    height: 24px;
    justify-content: center;
    margin: 0;
    opacity: 0.75;
    padding: 0;
    width: 24px;
}

/* Themes style every <button>; the [hidden] attribute must still win. */
.wm-promo .wm-promo__arrow[hidden] {
    display: none;
}

.wm-promo .wm-promo__arrow:hover,
.wm-promo .wm-promo__arrow:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
    opacity: 1;
}

.wm-promo .wm-promo__arrow:focus-visible {
    outline: 2px solid var(--wm-promo-accent);
    outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
    .wm-promo--slider.is-ready .wm-promo__slide {
        transform: none;
        transition: none;
    }
}
