/* Misc.Sales plugin. Colours set per campaign in admin arrive as ".sale-c{id}" rules in a <style> block
   (Head.cshtml); the values here are only fallbacks. Uses the revamp tokens (revamp.tokens.css).
   Phones = up to 767px, the theme's own breakpoint. */

.sale-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
}

/* ---- sale label: badges, and buttons styled like the label ---- */
.sale-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--ap-radius, 2px);
    background: #c8102e;
    color: #fff;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-badge-lg, 12px);
    font-weight: 600;
    line-height: 16px;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
}

/* product page: right above "Your Price" */
.sale-badge--details {
    margin: 0 0 8px;
    font-size: var(--ap-text-micro, 13px);
}

/* catalog card: in the card's fixed badge row (24px; 20px on phones), next to a condition badge if there is
   one - same box as the theme's condition badge */
.revamp-product-badgerow .sale-badge--card {
    display: inline-flex;
    align-items: center;
    height: 24px;
    margin: 0;
    padding: 0 10px;
    line-height: normal;
}

.revamp-product-badgerow .revamp-product-badge + .sale-badge--card {
    margin-left: 6px;
}

/* ---- catalog card price line: sale price, pre-sale price struck through, "% OFF" on the right ---- */
.revamp-product-price .sale-card-oldprice {
    margin-left: 6px;
    font-size: var(--ap-text-fine, 14px);
    font-weight: 400;
    color: var(--ap-placeholder, #9a9a9a);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    white-space: nowrap;
}

.revamp-product-pricerow .sale-badge--off {
    align-self: center;
    margin-left: auto;
    padding: 2px 8px;
    font-size: 11px;
    line-height: 16px;
}

/* ---- product page: "You save" in the savings colour (not during the pre-sale: the pre-sale label's class
   "sale-pre-c{id}" leaves the line in the theme's own colour) ---- */
.product-price-saving.sale-saving:not([class*="sale-pre-c"]) {
    color: #c8102e;
}

/* ---- header menu item: same type as its neighbours, set apart by the label colours ---- */
.header-menu > ul > li.sale-menu-item > a > span {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--ap-radius, 2px);
    background: #c8102e;
    color: #fff;
}

.header-menu > ul > li.sale-menu-item:hover > a > span {
    filter: brightness(.9);
}

/* ---- top bar: above the header on every page (under nop's admin bar for admins) ---- */
.sale-topbar {
    display: block;
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-fine, 14px);
    font-weight: 600;
    line-height: 20px;
    letter-spacing: .02em;
}

.sale-topbar:hover .sale-topbar__text {
    text-decoration: underline;
}

/* ---- banner pictures (homepage banner and sale page hero) ----
   The pictures arrive as CSS variables (SalesDefaults.HeroBackground): --sale-bg for desktop and, if the campaign
   has one, --sale-bg-phone for phones. Without a phone picture a campaign picture is cropped to the frame; the
   default two-planes banner is zoomed out over its sky instead, as the theme does, so the aircraft stay whole. */
.sale-hero {
    background-image: var(--sale-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (max-width: 767px) {
    .sale-hero.sale-hero--phone {
        background-image: var(--sale-bg-phone);
        background-size: cover;
    }

    .sale-hero.sale-hero--default {
        background-size: 160% auto;
    }
}

/* ---- homepage banner: the sale page hero's frame - full width, 376px (303px on phones) ---- */
.sale-banner {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 376px;
    margin: 0;
    padding: 0 var(--ap-gutter, 24px) 40px;
    background-color: var(--ap-header, #16628f);
    text-decoration: none;
    color: var(--ap-white, #fff);
}

/* same scrim as the category hero, so white text stays legible on any picture; none when nothing sits on it */
.sale-banner:before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 26, 44, 0.72) 0%, rgba(0, 26, 44, 0.35) 38%, rgba(0, 26, 44, 0) 70%);
    pointer-events: none;
}

.sale-banner--bare:before,
.revamp-cat-hero.sale-page-hero--bare:before {
    display: none;
}

.sale-banner__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    width: 100%;
}

.sale-banner__headline {
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-page-title, 48px);
    line-height: 1.1;
    font-weight: 400;
}

.sale-banner__text {
    flex: 1 1 260px;
    font-family: var(--ap-font-body, 'Inter', sans-serif);
    font-size: var(--ap-text-body, 16px);
}

/* button alone: bottom right, where it sits when the text is there */
.sale-banner__button:only-child {
    margin-left: auto;
}

.sale-banner__button,
.sale-popup__button {
    display: inline-block;
    padding: 12px 24px;
    background: #c8102e;
    color: #fff;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-button, 14px);
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}

.sale-banner:hover .sale-banner__button,
.sale-popup__button:hover {
    filter: brightness(.9);
}

@media (max-width: 767px) {
    .sale-banner {
        height: 303px;
        padding: 0 var(--ap-gutter-mobile, 16px) 20px;
    }

    .sale-banner__content {
        gap: 8px 16px;
    }

    .sale-banner__headline {
        flex: 1 1 100%;
        font-size: 32px;
    }

    .sale-banner__text {
        flex: 1 1 100%;
        font-size: 14px;
        line-height: 20px;
    }

    .sale-banner__button {
        padding: 10px 18px;
    }
}

/* ---- homepage popup ---- */
.sale-popup[hidden] {
    display: none;
}

.sale-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sale-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 26, 44, .6);
}

.sale-popup__card {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 40px 32px 32px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.sale-popup__close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: 0;
    background: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.sale-popup__headline {
    margin-bottom: 12px;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-title, 28px);
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.sale-popup__text {
    margin-bottom: 24px;
    font-family: var(--ap-font-body, 'Inter', sans-serif);
    font-size: var(--ap-text-body, 16px);
    line-height: var(--ap-leading-body, 24px);
}

@media (max-width: 767px) {
    .sale-popup__card {
        padding: 36px 20px 24px;
    }

    .sale-popup__headline {
        font-size: 22px;
    }

    .sale-popup__button {
        display: block;
        white-space: normal;
    }
}

/* ---- sale page: hero, then a full-width countdown band, then the products ---- */
.revamp-cat-hero.sale-page-hero--countdown {
    margin-bottom: 0;
}

/* label on the left, the clock centred on the page */
.sale-countdown {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px 32px;
    margin: 0 0 40px;
    padding: 24px var(--ap-gutter, 24px);
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
}

.sale-countdown__label {
    justify-self: start;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    text-transform: uppercase;
}

.sale-countdown__units {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.sale-countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 84px;
}

.sale-countdown__unit b {
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.sale-countdown__unit small {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .85;
}

.sale-countdown__sep {
    font-size: 48px;
    font-weight: 700;
    line-height: 64px;
    opacity: .6;
}

/* once it has ended there is only the message: centre it */
.sale-countdown--ended {
    grid-template-columns: 1fr;
    justify-items: center;
}

/* tablets: the label sits above the clock rather than squeezing it */
@media (max-width: 1100px) {
    .sale-countdown {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .sale-countdown__label {
        justify-self: center;
    }
}

@media (max-width: 767px) {
    .sale-countdown {
        gap: 10px;
        margin-bottom: 24px;
        padding: 16px var(--ap-gutter-mobile, 16px);
    }

    .sale-countdown__label {
        font-size: 18px;
    }

    .sale-countdown__units {
        gap: 4px;
    }

    .sale-countdown__unit {
        min-width: 56px;
    }

    .sale-countdown__unit b {
        font-size: 36px;
    }

    .sale-countdown__unit small {
        margin-top: 4px;
        font-size: 10px;
        letter-spacing: .06em;
    }

    .sale-countdown__sep {
        font-size: 28px;
        line-height: 36px;
    }

    /* the card's badge row is 20px on phones */
    .revamp-product-badgerow .sale-badge--card {
        height: 20px;
        padding: 0 8px;
        border-radius: 3px;
    }
}

/* ---- time gate: a banner or top bar waiting for the sale start (see Head.cshtml) stays hidden ---- */
.sale-banner[hidden],
.sale-topbar[hidden] {
    display: none !important;
}

/* ---- pre-sale ("coming soon") sale page: intro, then a greyed-out sneak peek of the products ---- */
.sale-preview__intro {
    max-width: 760px;
    margin: 0 auto 40px;
    text-align: center;
}

.sale-preview__label {
    margin-bottom: 16px;
}

.sale-preview__headline {
    margin: 0 0 12px;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-title, 28px);
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--ap-navy, #003053);
}

.sale-preview__text {
    margin: 0 0 16px;
    font-family: var(--ap-font-body, 'Inter', sans-serif);
    font-size: var(--ap-text-body, 16px);
    line-height: var(--ap-leading-body, 24px);
}

.sale-preview__facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 32px;
    margin: 0;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-fine, 14px);
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ap-navy, #003053);
}

/* the sneak peek: picture and name only, faded and not clickable */
.sale-peek {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sale-peek__item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--ap-border, #e1e1e1);
    background: #fff;
    cursor: default;
    user-select: none;
}

/* every card gets the same square picture box; the picture is fitted inside it (a tall tyre or a wide mount
   no longer changes the card's height) */
.sale-peek__image {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--ap-surface, #f5f5f5);
}

.sale-peek__image img {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    max-width: none;
    max-height: none;
    object-fit: contain;
    filter: grayscale(1);
    opacity: .45;
    pointer-events: none;
}

.sale-peek__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-fine, 14px);
    font-weight: 600;
    line-height: 20px;
    min-height: 40px; /* always two lines tall, so "Available ..." lines up across a row */
    color: var(--ap-placeholder, #9a9a9a);
}

.sale-peek__soon {
    margin-top: auto;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ap-navy, #003053);
}

.sale-peek__more {
    margin: 32px 0 0;
    text-align: center;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-body, 16px);
    color: var(--ap-navy, #003053);
}

@media (max-width: 767px) {
    .sale-preview__intro {
        margin-bottom: 24px;
    }

    .sale-preview__headline {
        font-size: 22px;
    }

    .sale-preview__facts {
        flex-direction: column;
        gap: 4px;
    }

    .sale-peek {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .sale-peek__item {
        padding: 10px;
        gap: 8px;
    }

    .sale-peek__name {
        font-size: 13px;
        line-height: 18px;
    }

    .sale-peek__soon {
        font-size: 10px;
    }
}

/* ---- banners with an uploaded picture (homepage and sale page): the picture is shown whole at full width and its
   own height - the phone picture up to 767px - instead of being cropped to a fixed frame. Text, button and the
   darkening scrim sit on top of it. (The default two-planes banner keeps the fixed frame above.) ---- */
.sale-banner.sale-hero--image,
.revamp-cat-hero.sale-hero--image {
    display: block;
    height: auto;
    min-height: 0;
    padding: 0;
    background: none;
}

.sale-hero--image:before {
    z-index: 1;
}

.sale-hero__picture,
.sale-hero__picture img {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
}

.revamp-cat-hero.sale-hero--image > .sale-hero__picture {
    position: relative;
    z-index: 0;
}

.sale-banner.sale-hero--image .sale-banner__content {
    position: absolute;
    z-index: 2;
    left: var(--ap-gutter, 24px);
    right: var(--ap-gutter, 24px);
    bottom: 40px;
    width: auto;
}

.revamp-cat-hero.sale-hero--image > h1.revamp-cat-hero-title {
    position: absolute;
    z-index: 2;
    left: var(--ap-gutter, 24px);
    right: var(--ap-gutter, 24px);
    bottom: 47px;
}

@media (max-width: 767px) {
    .sale-banner.sale-hero--image .sale-banner__content {
        left: var(--ap-gutter-mobile, 16px);
        right: var(--ap-gutter-mobile, 16px);
        bottom: 20px;
    }

    .revamp-cat-hero.sale-hero--image > h1.revamp-cat-hero-title {
        left: var(--ap-gutter-mobile, 16px);
        right: var(--ap-gutter-mobile, 16px);
        bottom: 20px;
    }
}

/* ---- homepage countdown: the sale page's band, right under the banner ---- */
.sale-home-countdown {
    margin: 0 0 var(--ap-gap, 24px);
}

/* ---- homepage "View all": centred under the sale products; colours per campaign (white on navy by default) ---- */
.sale-home-viewall {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.sale-home-viewall__button {
    display: inline-block;
    min-width: 200px;
    padding: 14px 32px;
    text-align: center;
    font-family: var(--ap-font-heading, 'Archivo', sans-serif);
    font-size: var(--ap-text-button, 14px);
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: var(--ap-radius, 2px);
}

.sale-home-viewall__button:hover,
.sale-home-viewall__button:focus {
    filter: brightness(1.15);
    text-decoration: none;
}

/* ---- sale page products: the category grid is 3 stretching columns, sized for a page with a filter sidebar. The
   sale page has none, so the cards grew to ~450px. Same size as the homepage row instead: up to 305px each, as many
   per row as fit (4 on a desktop). Phones keep the theme's own layout. ---- */
@media (min-width: 768px) {
    .html-sale-page .revamp-catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(232px, 305px));
        justify-content: center;
    }

    .html-sale-page .revamp-catalog-grid .revamp-product-card {
        max-width: 305px;
    }
}

/* ---- homepage banner carousel (2+ pictures): the slides are stacked in one grid cell and fade, so the box is as tall
   as the tallest picture; same sizes for every picture keep it steady. Arrows and dots over the picture. ---- */
.sale-carousel {
    position: relative;
    overflow: hidden;
    background: var(--ap-header, #16628f);
}

.sale-carousel[hidden] {
    display: none;
}

.sale-carousel__track {
    display: grid;
}

.sale-carousel__slide {
    grid-area: 1 / 1;
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity .6s ease, visibility 0s linear .6s;
}

.sale-carousel__slide.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity .6s ease, visibility 0s;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .sale-carousel__slide,
    .sale-carousel__slide.is-active {
        transition: none;
    }
}

/* headline / text / button over the carousel (if switched on): same place and scrim as the single banner */
.sale-carousel__content {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    padding: 80px var(--ap-gutter, 24px) 40px;
    background: linear-gradient(to top, rgba(0, 26, 44, 0.72) 0%, rgba(0, 26, 44, 0) 100%);
    color: var(--ap-white, #fff);
    text-decoration: none;
}

.sale-carousel__content:hover,
.sale-carousel__content:focus {
    color: var(--ap-white, #fff);
    text-decoration: none;
}

.sale-carousel__arrow {
    position: absolute;
    z-index: 3;
    top: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 26, 44, 0.45);
    color: #fff;
    font-size: 30px;
    line-height: 40px;
    cursor: pointer;
    opacity: .85;
}

.sale-carousel__arrow:hover,
.sale-carousel__arrow:focus-visible {
    opacity: 1;
    background: rgba(0, 26, 44, 0.7);
}

.sale-carousel__arrow--prev {
    left: 16px;
}

.sale-carousel__arrow--next {
    right: 16px;
}

.sale-carousel__dots {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
}

.sale-carousel__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 2px rgba(0, 0, 0, .5);
    cursor: pointer;
    pointer-events: auto;
}

.sale-carousel__dot.is-active {
    background: #fff;
}

@media (max-width: 767px) {
    /* phones: swipe instead of arrows */
    .sale-carousel__arrow {
        display: none;
    }

    .sale-carousel__content {
        gap: 8px 16px;
        padding: 48px var(--ap-gutter-mobile, 16px) 28px;
    }

    .sale-carousel__content .sale-banner__headline {
        flex: 1 1 100%;
        font-size: 32px;
    }

    .sale-carousel__content .sale-banner__text {
        flex: 1 1 100%;
        font-size: 14px;
        line-height: 20px;
    }

    .sale-carousel__dots {
        bottom: 8px;
    }
}
