/*
 * Geo shipping banner.
 *
 * Two variants with a different contract each:
 *
 *  - Header strip: structural skeleton only. The module ships just enough CSS that the markup
 *    holds together and the reveal works; colours, typography and spacing belong to the active
 *    theme (Netstore: 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.
 *
 *  - In content card (.geo-hero): the country banner designed in the banner-studio project.
 *    It is a finished piece of artwork with its own palette per country, the same in every
 *    theme, so all of it is here. A theme only sets the margin around the card.
 */
.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). */
.geo-banner--strip .geo-banner__message {
    text-wrap: balance;
}

/*
 * 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. */
.geo-banner__flag-group,
.geo-banner .geo-banner__flag-group > .geo-banner__country {
    white-space: nowrap;
}

/* 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;
}

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

@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;
    }
}

/* Opened before the first paint from the cached answer (inline script after the shell): no
   slide, or the page still moves. */
.geo-banner.geo-banner--instant {
    transition: none;
}

/* ── In content card: country banner ────────────────────── */

/*
 * Flag on the left with the headline over it, landmark on the right. Sizes follow the card's
 * own width, not the viewport's (container queries), as the same card sits in a full width
 * page, a category column and the checkout form:
 *
 *   over 850px   desktop   260px tall
 *   500-850px    tablet    233px tall
 *   up to 500px  mobile    240px tall, no landmark, the flag fills the card
 */
.geo-banner--inline {
    container-type: inline-size;
    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. */
.geo-banner--inline.geo-banner--visible {
    max-height: 60rem;
}

.geo-hero {
    --geo-hero-accent: #cfff7b;

    background: radial-gradient(ellipse at 82% 48%, #263043 0%, #141c2e 32%, #0b1323 66%);
    border-radius: 8px;
    color: #ffffff;
    height: 260px;
    isolation: isolate;
    overflow: hidden;
    position: relative;
    width: 100%;
}

/* Landmark side. The illustration takes the card's full height, keeps its proportions, and
   stands on the bottom edge, centred; its top is never cropped. The files are 3:2 with empty
   margins left and right, hence a box wider than the column. */
.geo-hero__art {
    inset: 0 0 0 46%;
    position: absolute;
    z-index: 1;
}

/* Two classes: themes ship `img { height: auto; max-width: 100% }`. */
.geo-banner .geo-hero__landmark {
    animation: geo-hero-reveal 0.55s ease-out;
    height: 100%;
    inset: 0 -12% 0;
    max-width: none;
    object-fit: contain;
    object-position: center bottom;
    position: absolute;
    width: 124%;
    z-index: 2;
}

/* The country's three letter code, barely there behind the landmark. */
.geo-hero__code {
    color: var(--geo-hero-accent);
    font-size: clamp(130px, 19cqw, 290px);
    font-weight: 900;
    inset: 35px 12px auto 0;
    letter-spacing: -0.07em;
    line-height: 1;
    opacity: 0.045;
    position: absolute;
    text-align: center;
    user-select: none;
}

.geo-hero__orbit {
    border: 1px solid color-mix(in srgb, var(--geo-hero-accent) 20%, transparent);
    border-radius: 50%;
    bottom: 13%;
    box-shadow: 0 0 55px color-mix(in srgb, var(--geo-hero-accent) 5%, transparent);
    height: 30%;
    left: 10%;
    position: absolute;
    transform: rotate(-12deg);
    width: 80%;
}

/* Flag side, fading out towards the landmark. */
.geo-hero__flag-zone {
    -webkit-mask-image: linear-gradient(90deg, #000 65%, transparent 100%);
    background: #111936;
    inset: 0 45% 0 0;
    mask-image: linear-gradient(90deg, #000 65%, transparent 100%);
    overflow: hidden;
    position: absolute;
}

.geo-hero__flag {
    animation: geo-hero-wave 6s ease-in-out infinite;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: saturate(0.9);
    inset: 0;
    opacity: 0.95;
    position: absolute;
    transform: scale(1.05);
}

/* Light running over the folds of the cloth. */
.geo-hero__flag::after {
    animation: geo-hero-cloth 6s ease-in-out infinite;
    background: repeating-linear-gradient(106deg, #0000 0%, #fff3 12%, #0007 25%, #ffffff08 38%, #0000 50%);
    background-size: 180% 100%;
    content: '';
    inset: 0;
    mix-blend-mode: hard-light;
    position: absolute;
}

/* Darkens the lower half of the flag, where the headline sits. */
.geo-hero__shade {
    background:
        linear-gradient(0deg, #071121ed 0%, #08132466 50%, #07102210),
        linear-gradient(90deg, #0001, transparent 50%, #0b132380);
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.geo-hero__grain {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.4' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
    inset: 0;
    mix-blend-mode: soft-light;
    opacity: 0.1;
    pointer-events: none;
    position: absolute;
    z-index: 2;
}

.geo-hero__copy {
    bottom: 44px;
    left: 34px;
    position: absolute;
    right: 54%;
    z-index: 3;
}

/* A div, not a p: themes set the size of paragraphs in page content with selectors that
   outrank anything here (Netstore/v3 does on category pages), and geo-banner.js reads this
   size as the starting point for fitting the country name (fitTitle). Two classes on the
   text rules for the same reason: themes style strong and a by element. */
.geo-banner .geo-hero__headline {
    color: #ffffff;
    font-size: clamp(40px, 6.7cqw, 92px);
    font-weight: 800;
    /* The studio set -0.055em for Inter; the theme's DM Sans is wider and its letters met. */
    letter-spacing: -0.04em;
    line-height: 1.02;
    margin: 0 0 21px;
    max-width: 100%;
    text-shadow: 0 4px 30px #0004;
    text-wrap: balance;
}

.geo-banner .geo-hero--long .geo-hero__headline {
    font-size: clamp(39px, 5.35cqw, 76px);
}

.geo-banner .geo-hero--very-long .geo-hero__headline {
    font-size: clamp(28px, 4.4cqw, 58px);
    overflow-wrap: normal;
}

.geo-hero--very-long .geo-hero__copy {
    right: 53%;
}

/* The small lines above and below the country name. */
.geo-hero__lead {
    color: var(--geo-hero-accent);
    display: block;
    font-size: clamp(16px, 2.1cqw, 26px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.35em;
}

.geo-hero__tail {
    margin: 0.3em 0 0;
}

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

.geo-hero__baseline {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
}

.geo-hero__tagline {
    color: #eff3f0c9;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

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

.geo-banner .geo-hero__cta {
    -webkit-backdrop-filter: blur(15px);
    align-items: center;
    backdrop-filter: blur(15px);
    background: #ffffff0f;
    border: 1px solid #ffffff3d;
    border-radius: 100px;
    color: #ffffff;
    display: inline-flex;
    font-size: 12px;
    font-weight: 500;
    gap: 18px;
    height: 37px;
    padding: 0 6px 0 16px;
    text-decoration: none;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.geo-banner .geo-hero__cta:hover,
.geo-banner .geo-hero__cta:focus {
    background: #ffffff25;
    color: #ffffff;
    text-decoration: none;
}

.geo-banner .geo-hero__cta:focus-visible {
    outline: 2px solid var(--geo-hero-accent);
    outline-offset: 2px;
}

.geo-hero__cta-icon {
    background: var(--geo-hero-accent);
    border-radius: 50%;
    color: #15230e;
    display: grid;
    font-size: 17px;
    height: 25px;
    place-items: center;
    width: 25px;
}

/* Name of the landmark and where it is, under the illustration. */
.geo-hero__caption {
    align-items: center;
    bottom: 18px;
    display: flex;
    gap: 10px;
    position: absolute;
    right: 25px;
    z-index: 3;
}

.geo-hero__caption[hidden] {
    display: none;
}

.geo-hero__caption-mark {
    color: var(--geo-hero-accent);
    flex-shrink: 0;
    height: 24px;
    width: 24px;
}

.geo-banner .geo-hero__caption-text strong {
    color: #ffffff;
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.geo-hero__caption-text span {
    color: #c0c8c6;
    display: block;
    font-size: 9px;
    letter-spacing: 0.5px;
    line-height: 1.2;
    margin-top: 5px;
}

/* A country without an illustration: the flag takes the whole card, as it does on a phone. */
.geo-hero--no-art .geo-hero__art {
    display: none;
}

.geo-hero--no-art .geo-hero__flag-zone {
    -webkit-mask-image: none;
    inset: 0;
    mask-image: none;
}

.geo-hero--no-art .geo-hero__shade {
    background: linear-gradient(0deg, #071121f5 0%, #071121a6 55%, #07112140);
}

.geo-hero--no-art .geo-hero__copy {
    right: 34px;
}

@keyframes geo-hero-wave {
    0%, 100% { transform: scale(1.05) translateX(-0.5%) skewY(-1deg); }
    50% { transform: scale(1.07) translateX(0.5%) skewY(1deg); }
}

@keyframes geo-hero-cloth {
    0%, 100% { background-position: 0% 0; }
    50% { background-position: 100% 0; }
}

@keyframes geo-hero-reveal {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Card: tablet width ─────────────────────────────────── */

@container (max-width: 850px) {
    .geo-hero {
        height: calc(700px / 3);
    }

    .geo-hero__art {
        left: 45%;
    }

    .geo-hero__flag-zone {
        inset: 0 40% 0 0;
    }

    .geo-hero__copy {
        bottom: 38px;
        left: 25px;
    }

    .geo-banner .geo-hero__headline {
        font-size: 7cqw;
    }

    .geo-banner .geo-hero--long .geo-hero__headline {
        font-size: 6cqw;
    }

    .geo-banner .geo-hero--very-long .geo-hero__headline {
        font-size: clamp(28px, 4.4cqw, 58px);
    }

    .geo-hero__baseline {
        gap: 12px;
    }

    .geo-hero__tagline {
        font-size: 13px;
    }

    .geo-hero__caption {
        max-width: 49%;
        right: 17px;
    }

    .geo-banner .geo-hero__caption-text strong {
        font-size: 10px;
    }

    .geo-hero__caption-text span {
        font-size: 8px;
    }
}

/* ── Card: mobile width ─────────────────────────────────── */

/* No landmark: the flag fills the card and the headline gets its full width. geo-banner.js
   does not download the illustration at this size (ART_MIN_WIDTH). */
@container (max-width: 500px) {
    .geo-hero {
        background: radial-gradient(ellipse at 65% 25%, #263043, #0b1323 65%);
        height: 240px;
    }

    .geo-hero__art,
    .geo-hero__caption {
        display: none;
    }

    .geo-hero__flag-zone {
        -webkit-mask-image: none;
        inset: 0;
        mask-image: none;
    }

    .geo-hero__shade {
        background: linear-gradient(0deg, #071121f5 0%, #071121a6 55%, #07112140);
    }

    .geo-hero__copy,
    .geo-hero--very-long .geo-hero__copy,
    .geo-hero--no-art .geo-hero__copy {
        bottom: 32px;
        left: 23px;
        right: 23px;
    }

    .geo-banner .geo-hero__headline {
        font-size: 14cqw;
        line-height: 1.03;
        margin-bottom: 15px;
    }

    .geo-banner .geo-hero--long .geo-hero__headline {
        font-size: 11.5cqw;
    }

    .geo-banner .geo-hero--very-long .geo-hero__headline {
        font-size: 9cqw;
        line-height: 1.08;
    }

    .geo-hero__baseline {
        gap: 12px 16px;
    }

    .geo-hero__tagline {
        max-width: 55%;
    }

    .geo-banner .geo-hero__cta {
        font-size: 11px;
        gap: 10px;
        height: 35px;
    }
}

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

    .geo-hero__flag,
    .geo-hero__flag::after,
    .geo-banner .geo-hero__landmark {
        animation: none;
    }
}
