/*
 * Geo shipping banner — structural skeleton only.
 *
 * The module ships just enough CSS that the markup holds together and the reveal works: the
 * collapse/reveal mechanics, the flex layout, and the positioning of the close button, the
 * route illustration and the destination chip. Everything visual — colours, typography,
 * backgrounds, borders, spacing — belongs to the active theme
 * (Netstore/default: web/css/source/_geo-banner.less).
 *
 * This file is linked between styles-m and styles-l, so theme rules of equal specificity win
 * over anything declared here — which is exactly the contract: the theme styles the banner,
 * the module only keeps it functional.
 */
.geo-banner,
.geo-banner *,
.geo-banner *::before {
    /* Declared rather than inherited from the theme reset so max-width and padding still add up
       correctly if this module is ever dropped into a theme without one. */
    box-sizing: border-box;
}

.geo-banner {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    position: relative;
    transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.geo-banner--visible {
    max-height: 12rem;
    opacity: 1;
}

.geo-banner__inner {
    align-items: center;
    display: flex;
    justify-content: center;
    position: relative;
}

.geo-banner__content {
    align-items: center;
    display: flex;
    gap: 9px;
    justify-content: center;
    margin: 0;
    text-align: center;
}

.geo-banner__icon {
    flex-shrink: 0;
}

/*
 * Set by geo-banner.js around the country name and any **marked** words of the message.
 *
 * font-size is pinned to inherit because the Netstore themes ship `strong, dt { font-size:
 * 0.85rem }`, which otherwise shrinks the country in the middle of the headline. No nowrap:
 * a marked phrase can be several words long.
 */
.geo-banner__country {
    font-size: inherit;
    line-height: inherit;
}

/* Per-country messages vary from a few words to a full sentence. The strip evens out its
   lines (only ever wraps on a phone). The hero headline fills each line instead: balancing
   it there halved a two line sentence and wrapped it in the first third of the card, so it
   only keeps a lone last word from dropping onto a line of its own. */
.geo-banner--strip .geo-banner__message {
    text-wrap: balance;
}

.geo-banner--inline .geo-banner__title {
    text-wrap: pretty;
}

/*
 * Visitor's flag, placed by the message's %flag% or in front of the country name.
 * Square corners, about a fifth taller than the type, centred on the capitals. Fixed size so
 * it never shifts the text once the SVG arrives. With word spaces either side and the same
 * margin on both, the gap either side of the flag is identical at every font size.
 */
.geo-banner__flag {
    border-radius: 0;
    display: inline-block;
    height: 1.2em;
    margin: 0 0.12em;
    object-fit: cover;
    vertical-align: -0.25em;
    width: 1.6em;
}

/* The flag and the words either side of it, kept on one line (see
   BannerMessage::bindFlags()). The bold runs inside are named too, as a theme may set its
   own white-space on .geo-banner__country (Netstore/v3 does, for the hero headline). */
.geo-banner__flag-group,
.geo-banner .geo-banner__flag-group > .geo-banner__country {
    white-space: nowrap;
}

/*
 * Visitor's flag faded into the card's background, added by geo-banner.js as the card's first
 * child: every later positioned child paints over it. A mask fades it into the background
 * towards the text.
 */
.geo-banner__bg-flag {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    bottom: 0;
    opacity: 0.4;
    pointer-events: none;
    position: absolute;
    top: 0;
}

/* Card: a wide band of the flag along the left edge, behind the headline, fading out to the
   right. Cover crops it top and bottom; at the card's own height (4:3) it was a stub. */
.geo-banner--inline .geo-banner__bg-flag {
    -webkit-mask-image: linear-gradient(to left, transparent 0%, #000 50%);
    mask-image: linear-gradient(to left, transparent 0%, #000 50%);
    left: 0;
    width: 45%;
}

/* One icon per strip: the flag takes over from the truck. Once the flag is gone again (file
   missing) :has() stops matching and the truck comes back. */
.geo-banner__content:has(.geo-banner__flag) .geo-banner__icon {
    display: none;
}

/* ── Header strip ───────────────────────────────────────── */

.geo-banner--strip {
    width: 100%;
}

.geo-banner--strip .geo-banner__inner {
    margin: 0 auto;
    /* Mirrors the Netstore container ladder (1280 → 1400 → 1600, see the wide screen media
       queries below) so the close button lands on the topbar's own vertical line. */
    max-width: 1280px;
    min-height: 36px;
    /* Symmetric so the message stays optically centred, and wide enough that a long message
       never runs underneath the absolutely positioned close button. */
    padding: 9px 64px;
}

.geo-banner__close {
    align-items: center;
    background: none;
    border: 0;
    cursor: pointer;
    display: flex;
    height: 26px;
    justify-content: center;
    margin: 0;
    padding: 0;
    position: absolute;
    /* Absolute offsets resolve against the padding box, so the inner's padding does not move
       this: the value has to match the topbar's own 24px gutter explicitly. */
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
}

/* ── In content hero card ───────────────────────────────── */

.geo-banner--inline {
    width: 100%;
}

/* The collapsed-to-open transition animates max-height, so it needs a ceiling the card can
   actually reach — the strip's 12rem would clip it to a sliver. */
.geo-banner--inline.geo-banner--visible {
    max-height: 60rem;
}

.geo-banner--inline .geo-banner__inner {
    justify-content: flex-start;
}

.geo-banner--inline .geo-banner__content {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
    max-width: 560px;
    position: relative;
    text-align: left;
    z-index: 3;
}

/* ── Route illustration ─────────────────────────────────── */

.geo-banner__route {
    bottom: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    width: 520px;
    z-index: 2;
}

.geo-banner__route svg {
    height: 100%;
    width: 100%;
}

/* Destination pill, pinned to the end of the route. */
.geo-banner__chip {
    left: 77%;
    position: absolute;
    top: 68%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.geo-banner__chip:empty {
    display: none;
}

/* ── Narrow screens ─────────────────────────────────────── */

/* The illustration needs roughly half the card; below this the headline would be squeezed into
   a column, so the two stack instead. */
@media (max-width: 900px) {
    .geo-banner--inline .geo-banner__inner {
        flex-direction: column;
        min-height: 0;
    }

    .geo-banner--inline .geo-banner__content {
        max-width: 100%;
    }

    .geo-banner__route {
        height: 180px;
        position: relative;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .geo-banner--strip .geo-banner__inner {
        padding: 8px 40px;
    }

    .geo-banner__content {
        gap: 7px;
    }

    /* The truck is decoration; on a narrow screen the words need the room. */
    .geo-banner__icon {
        display: none;
    }

    .geo-banner__close {
        height: 24px;
        right: 10px;
        width: 24px;
    }
}

/* ── Wide screens: follow the Netstore container ladder ─── */

@media only screen and (min-width: 1440px) {
    .geo-banner--strip .geo-banner__inner {
        max-width: 1400px;
    }
}

@media only screen and (min-width: 1920px) {
    .geo-banner--strip .geo-banner__inner {
        max-width: 1600px;
    }
}

/* The slide is decoration, not information. */
@media (prefers-reduced-motion: reduce) {
    .geo-banner,
    .geo-banner__close {
        transition: none;
    }
}
