/**
 * SALE landing page (the `sale` product category archive).
 * Hero, perks strip, admin note, empty state, fine print.
 * Grid, filters and cards are the regular PLP styles in style.css.
 *
 * @package Mesa
 * @since 2.9.0
 */

/* ============================================
   Hero
   ============================================ */
/* Wrapper: holds the hero card and the stripes that run BEHIND it on the
   white page. Both stripe layers share one geometry (--sale-stripe-*), so
   the part on the photo and the part on the page line up as one shape. */
.mesa-sale-hero-wrap {
    --sale-stripes: linear-gradient(115deg, transparent 0 4%, var(--mesa-lime, #CEFE65) 4% 9.5%, transparent 9.5% 12%, rgba(206, 254, 101, 0.45) 12% 14%, transparent 14%);
    --sale-stripe-size: 100% 100%;
    --sale-stripe-inset: -56px 0 -56px -64px;
    position: relative;
    isolation: isolate;
    margin: 0 0 var(--space-lg);
}

.mesa-sale-hero__backdrop {
    position: absolute;
    inset: var(--sale-stripe-inset);
    z-index: 0;
    pointer-events: none;
    background: var(--sale-stripes);
    background-size: var(--sale-stripe-size);
    background-repeat: no-repeat;
}

.mesa-sale-hero {
    position: relative;
    z-index: 1;
    isolation: isolate;
    overflow: hidden;
    direction: rtl;
    min-height: clamp(300px, 30vw, 460px);
    background-color: var(--mesa-black, #08050C);
    color: var(--mesa-white, #FFFFFF);
    display: flex;
    box-shadow: 0 26px 50px -18px rgba(8, 5, 12, 0.55);
}

/* The sale page has its own stripes; drop the generic PLP corner shape. */
.mesa-plp--sale .mesa-shop__deco-svg {
    display: none;
}

.mesa-sale-hero__media {
    position: absolute;
    inset: 0;
    z-index: -2;
}

/* Pinned to the hero box: a global img { height: auto } otherwise keeps the
   photo's own aspect ratio and leaves the bottom of a tall (mobile) hero bare. */
.mesa-sale-hero__img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: left center;
}

/* Scrim: dark on the text side (right in RTL), clear on the image side. */
.mesa-sale-hero--image::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(270deg, rgba(8, 5, 12, 0.88) 0%, rgba(8, 5, 12, 0.6) 45%, rgba(8, 5, 12, 0.05) 80%);
}

/* In-card stripes: same box and gradient as the backdrop, clipped by the
   card, painted above the photo scrim. */
.mesa-sale-hero__deco {
    position: absolute;
    inset: var(--sale-stripe-inset);
    z-index: -1;
    pointer-events: none;
    background: var(--sale-stripes);
    background-size: var(--sale-stripe-size);
    background-repeat: no-repeat;
}

/* No photo: a soft lime glow on the black card. */
.mesa-sale-hero--plain {
    background-image: radial-gradient(circle at 15% 50%, rgba(206, 254, 101, 0.12), transparent 55%);
}

.mesa-sale-hero__inner {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg) clamp(1.25rem, 5vw, 4.5rem) clamp(2rem, 4vw, 3.5rem);
}

/* Breadcrumbs on dark */
.mesa-sale-hero__breadcrumbs {
    margin: 0 0 auto;
    direction: rtl;
}

.mesa-sale-hero__breadcrumbs .mesa-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.875rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.75);
}

.mesa-sale-hero__breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.mesa-sale-hero__breadcrumbs a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
}

.mesa-sale-hero__breadcrumbs a:hover {
    color: var(--mesa-lime, #CEFE65);
}

.mesa-sale-hero__breadcrumbs .mesa-breadcrumb-sep {
    display: inline-flex;
    margin: 0 0.25rem;
}

.mesa-sale-hero__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
    max-width: 620px;
    padding-top: var(--space-xl);
}

.mesa-sale-hero__eyebrow {
    margin: 0 0 var(--space-sm);
}

.mesa-sale-hero__eyebrow span {
    display: inline-block;
    padding: 4px 22px;
    background: var(--mesa-lime, #CEFE65);
    color: var(--mesa-black, #08050C);
    font-family: 'Open Sans', sans-serif;
    font-weight: 800;
    font-style: italic;
    font-size: clamp(0.8125rem, 0.9vw, 1rem);
    white-space: nowrap;
    text-transform: uppercase;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.mesa-sale-hero__title {
    font-family: 'Open Sans', sans-serif !important;
    font-weight: 800;
    font-style: italic !important;
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    line-height: 1.05;
    color: var(--mesa-white, #FFFFFF) !important;
    margin: 0 0 var(--space-sm);
}

.mesa-sale-hero__max {
    font-family: 'Open Sans', sans-serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.25rem, 2.2vw, 2rem);
    line-height: 1.2;
    color: var(--mesa-white, #FFFFFF);
    margin: 0 0 var(--space-sm);
}

.mesa-sale-hero__max strong {
    color: var(--mesa-lime, #CEFE65);
    font-weight: 800;
    font-size: 1.25em;
}

.mesa-sale-hero__subtitle {
    font-family: 'Open Sans', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.1875rem);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 var(--space-lg);
    max-width: 480px;
}

.mesa-sale-hero__subtitle strong,
.mesa-sale-hero__subtitle b {
    color: var(--mesa-white, #FFFFFF);
    font-weight: 700;
}

/* CTA: same lime parallelogram as the home hero slider button. The shape is
   drawn on ::before so clip-path does not swallow the keyboard focus ring. */
.mesa-sale-hero__cta,
.mesa-sale-hero__cta:visited {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    height: 46px;
    padding: 0 calc(15px + 22px);
    background: none;
    color: var(--mesa-black, #08050C);
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(15px, 1.19vw, 18px);
    text-decoration: none;
}

.mesa-sale-hero__cta::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: var(--mesa-lime, #CEFE65);
    clip-path: polygon(15px 0, 100% 0, calc(100% - 15px) 100%, 0 100%);
    transition: background-color 0.2s ease;
}

.mesa-sale-hero__cta:hover,
.mesa-sale-hero__cta:focus-visible {
    color: var(--mesa-black, #08050C);
    text-decoration: none;
}

.mesa-sale-hero__cta:hover::before,
.mesa-sale-hero__cta:focus-visible::before {
    background-color: var(--mesa-white, #FFFFFF);
}

.mesa-sale-hero__cta:focus-visible {
    outline: 2px solid var(--mesa-lime, #CEFE65);
    outline-offset: 4px;
}

/* On the white empty-state background the focus ring must be dark */
.mesa-sale-empty .mesa-sale-hero__cta:focus-visible {
    outline-color: var(--mesa-black, #08050C);
}

.mesa-sale-empty .mesa-sale-hero__cta:hover::before {
    background-color: var(--mesa-black, #08050C);
}

.mesa-sale-empty .mesa-sale-hero__cta:hover {
    color: var(--mesa-lime, #CEFE65);
}

/* ============================================
   Countdown
   ============================================ */
.mesa-sale-countdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-md);
    margin: 0 0 var(--space-lg);
}

.mesa-sale-countdown[hidden] {
    display: none;
}

.mesa-sale-countdown__label {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
}

/* Clock order: days on the left -> seconds on the right (Chen, 2026-11-26) */
.mesa-sale-countdown__units {
    display: inline-flex;
    gap: 6px;
    direction: ltr;
}

.mesa-sale-countdown__unit {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
    padding: 6px 4px 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(206, 254, 101, 0.45);
}

.mesa-sale-countdown__unit b {
    font-family: 'Open Sans', sans-serif;
    font-weight: 800;
    font-style: italic;
    font-size: 1.375rem;
    line-height: 1.1;
    color: var(--mesa-lime, #CEFE65);
    font-variant-numeric: tabular-nums;
}

.mesa-sale-countdown__unit small {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.75);
}

/* ============================================
   Perks strip
   ============================================ */
.mesa-sale-perks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm) var(--space-xl);
    list-style: none;
    margin: 0 0 var(--space-lg);
    padding: var(--space-md);
    background: var(--mesa-light-gray, #F1F1F1);
    direction: rtl;
}

.mesa-sale-perks__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--mesa-black, #08050C);
}

.mesa-sale-perks__item svg {
    flex-shrink: 0;
    color: var(--mesa-black, #08050C);
    background: var(--mesa-lime, #CEFE65);
    border-radius: 50%;
    padding: 3px;
    width: 20px;
    height: 20px;
}

/* Grid anchor: clear the sticky header when the CTA scrolls here */
.mesa-sale-anchor {
    display: block;
    height: 0;
    scroll-margin-top: 110px;
}

/* ============================================
   Admin-only data note
   ============================================ */
.mesa-sale-admin-note {
    margin: 0 0 var(--space-lg);
    padding: var(--space-md);
    border: 1px dashed #B3261E;
    background: #FFF8F7;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--mesa-black, #08050C);
    direction: rtl;
}

.mesa-sale-admin-note p {
    margin: var(--space-xs) 0 0;
}

.mesa-sale-admin-note a {
    color: inherit;
    font-weight: 700;
}

/* ============================================
   Empty state + fine print
   ============================================ */
.mesa-sale-empty__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-md);
}

.mesa-sale-empty__link {
    font-weight: 700;
    color: var(--mesa-black, #08050C);
}

.mesa-sale-terms {
    margin: var(--space-2xl) 0 0;
    padding-top: var(--space-lg);
    border-top: 1px solid #E5E5E5;
    direction: rtl;
    text-align: right;
}

.mesa-sale-terms__title {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 var(--space-xs);
    color: var(--mesa-black, #08050C);
}

.mesa-sale-terms__text {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--mesa-gray-text, #6B7280);
    margin: 0;
    max-width: 860px;
}

/* ============================================
   Mobile
   ============================================ */
@media (max-width: 767px) {
    .mesa-sale-hero-wrap {
        --sale-stripes: linear-gradient(115deg, transparent 0 28%, var(--mesa-lime, #CEFE65) 28% 46%, transparent 46% 56%, rgba(206, 254, 101, 0.45) 56% 64%, transparent 64%);
        --sale-stripe-size: 150px 88px;
        --sale-stripe-inset: -24px 0 0 0;
        margin-left: calc(-1 * var(--container-padding));
        margin-right: calc(-1 * var(--container-padding));
    }

    .mesa-sale-hero {
        min-height: 0;
        box-shadow: 0 18px 30px -18px rgba(8, 5, 12, 0.5);
    }

    .mesa-sale-hero--image::before {
        background: linear-gradient(0deg, rgba(8, 5, 12, 0.9) 0%, rgba(8, 5, 12, 0.62) 45%, rgba(8, 5, 12, 0.35) 100%);
    }

    .mesa-sale-hero--image .mesa-sale-hero__breadcrumbs,
    .mesa-sale-hero--image .mesa-sale-hero__subtitle,
    .mesa-sale-hero--image .mesa-sale-countdown__label {
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    }

    .mesa-sale-hero__img {
        object-position: 30% center;
    }

    .mesa-sale-hero__inner {
        padding: var(--space-md) var(--container-padding) var(--space-xl);
    }

    .mesa-sale-hero__content {
        padding-top: var(--space-lg);
    }

    .mesa-sale-countdown__unit {
        min-width: 46px;
    }

    .mesa-sale-perks {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-sm) var(--space-md);
        padding: var(--space-md);
    }

    .mesa-sale-perks__item {
        font-size: 0.8125rem;
        align-items: flex-start;
    }
}

/* ============================================
   Motion (subtle; all off with prefers-reduced-motion)
   ============================================ */
@keyframes mesaSaleRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes mesaSaleStripesIn {
    from { opacity: 0; transform: translateX(-56px); }
    to   { opacity: 1; transform: none; }
}

@keyframes mesaSalePhotoSettle {
    from { transform: scale(1.07); }
    to   { transform: scale(1); }
}

@keyframes mesaSaleTick {
    from { opacity: 0.35; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}

/* Both stripe layers move together, so they stay aligned while animating. */
.mesa-sale-hero__backdrop,
.mesa-sale-hero__deco {
    animation: mesaSaleStripesIn 0.9s var(--ease-soft, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.mesa-sale-hero__img {
    animation: mesaSalePhotoSettle 1.6s var(--ease-soft, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.mesa-sale-hero__content > * {
    animation: mesaSaleRise 0.6s var(--ease-soft, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.mesa-sale-hero__content > :nth-child(1) { animation-delay: 0.1s; }
.mesa-sale-hero__content > :nth-child(2) { animation-delay: 0.18s; }
.mesa-sale-hero__content > :nth-child(3) { animation-delay: 0.26s; }
.mesa-sale-hero__content > :nth-child(4) { animation-delay: 0.34s; }
.mesa-sale-hero__content > :nth-child(5) { animation-delay: 0.42s; }

.mesa-sale-perks {
    animation: mesaSaleRise 0.6s var(--ease-soft, cubic-bezier(0.22, 1, 0.36, 1)) 0.45s both;
}

/* Seconds: a soft drop each tick (class toggled by mesa-sale-countdown.js) */
.mesa-sale-countdown__unit b.is-tick {
    animation: mesaSaleTick 0.35s ease-out;
}

/* Product cards fade up as they scroll into view (browsers with scroll-driven
   animations; elsewhere they simply show). */
@supports (animation-timeline: view()) {
    .mesa-plp--sale .mesa-product-grid > li {
        animation: mesaSaleRise linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 45%;
    }
}

.mesa-plp--sale .mesa-sale-ribbon {
    transition: transform 0.25s var(--ease-soft, cubic-bezier(0.22, 1, 0.36, 1));
}

.mesa-plp--sale .mesa-product-card:hover .mesa-sale-ribbon {
    transform: scale(1.08);
}

@media (prefers-reduced-motion: reduce) {
    html:has(.mesa-sale-hero) {
        scroll-behavior: auto;
    }

    .mesa-sale-hero__backdrop,
    .mesa-sale-hero__deco,
    .mesa-sale-hero__img,
    .mesa-sale-hero__content > *,
    .mesa-sale-perks,
    .mesa-sale-countdown__unit b.is-tick,
    .mesa-plp--sale .mesa-product-grid > li {
        animation: none !important;
    }

    .mesa-plp--sale .mesa-product-card:hover .mesa-sale-ribbon {
        transform: none;
    }
}
