/* Home page slider (_HeroSlider.cshtml, hero-slider.js). Prefixed with hs-.
   Change: "Windows tiles". The new image is cut into a grid of tiles (built by hero-slider.js) that flip in over the
   old slide in a diagonal wave, each tinted for a moment with one of the four Microsoft colors. No zoom.
   The active dot fills over the slide's time and drives autoplay. */

.hs {
    --hs-radius: 18px;
    --hs-tile-time: 750ms;
    --hs-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --hs-interval: 6500ms;
    position: relative;
    width: 100%;
    aspect-ratio: 20 / 7;
    border-radius: var(--hs-radius);
    overflow: hidden;
    background: #0E1117;
    isolation: isolate;
    clear: both;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.hs-track {
    position: absolute;
    inset: 0;
}

.hs-slide {
    position: absolute;
    inset: 0;
    visibility: hidden;
    z-index: 0;
}

    .hs-slide.is-active {
        visibility: visible;
        z-index: 2;
    }

.hs-link {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
}

.hs-media {
    position: absolute;
    inset: 0;
    display: block;
}

    .hs-media picture, .hs-media img {
        display: block;
        width: 100%;
        height: 100%;
    }

    .hs-media img {
        object-fit: cover;
    }

/* ---------- Tile transition ---------- */

.hs-tiles {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    perspective: 1400px;
    pointer-events: none;
}

.hs-tile {
    position: relative;
    overflow: hidden;
    transform-origin: var(--hs-origin, 0% 50%);
    backface-visibility: hidden;
    opacity: 0;
    animation: hs-tile-in var(--hs-tile-time) var(--hs-ease) var(--hs-delay, 0ms) forwards;
}

/* A container-sized copy of the new image, shifted so each tile shows its own piece */
.hs-tile-img {
    position: absolute;
    background-position: center;
    background-size: cover;
}

/* Microsoft color flash while the tile turns */
.hs-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--hs-tint);
    animation: hs-tint var(--hs-tile-time) ease-out var(--hs-delay, 0ms) forwards;
}

.hs-tile:nth-child(4n+1) { --hs-tint: #F25022; }
.hs-tile:nth-child(4n+2) { --hs-tint: #7FBA00; }
.hs-tile:nth-child(4n+3) { --hs-tint: #00A4EF; }
.hs-tile:nth-child(4n+4) { --hs-tint: #FFB900; }

@keyframes hs-tile-in {
    0% { opacity: 1; transform: rotateY(var(--hs-turn, -95deg)); }
    100% { opacity: 1; transform: rotateY(0deg); }
}

@keyframes hs-tint {
    0% { opacity: 0.95; }
    55% { opacity: 0.35; }
    100% { opacity: 0; }
}

/* Light sweep over the new slide once it is in place */
.hs-link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.16) 50%, transparent 65%);
    transform: translateX(-120%);
    pointer-events: none;
}

.hs-slide.is-shining .hs-link::after {
    animation: hs-shine 1.2s ease-out;
}

@keyframes hs-shine {
    to { transform: translateX(120%); }
}

/* ---------- Glitch transition (shop) ---------- */

.hs-glitch {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

    /* Scanlines and a light flash over the whole change */
    .hs-glitch::before, .hs-glitch::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 2;
        pointer-events: none;
    }

    .hs-glitch::before {
        background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px 4px);
        animation: hs-fade-out 900ms ease-out forwards;
    }

    .hs-glitch::after {
        background: radial-gradient(ellipse at center, rgba(155, 240, 11, 0.35), transparent 70%);
        mix-blend-mode: screen;
        opacity: 0;
        animation: hs-flash 900ms ease-out 120ms forwards;
    }

.hs-strip {
    position: absolute;
    left: 0;
    width: 100%;
    overflow: hidden;
    background: #000;
    isolation: isolate;
    opacity: 0;
    animation: hs-strip-in 560ms cubic-bezier(0.2, 0.9, 0.2, 1) var(--hs-delay, 0ms) forwards;
}

/* Red-only and cyan-only copies of the image; screen-blended and aligned they give back the original colors */
.hs-strip-img {
    position: absolute;
    left: 0;
    width: 100%;
    background-position: center;
    background-size: cover;
    background-blend-mode: multiply;
}

    .hs-strip-img.is-r {
        background-color: #F00;
        animation: hs-rgb-r 700ms steps(1, end) var(--hs-delay, 0ms) forwards, hs-settle-x 700ms ease-out var(--hs-delay, 0ms) forwards;
        --hs-from: var(--hs-rgb);
    }

    .hs-strip-img.is-c {
        background-color: #0FF;
        mix-blend-mode: screen;
        animation: hs-settle-x 700ms ease-out var(--hs-delay, 0ms) forwards;
        --hs-from: calc(var(--hs-rgb) * -1);
    }

@keyframes hs-strip-in {
    0% { opacity: 0; transform: translateX(var(--hs-sx)) skewX(-24deg); }
    35% { opacity: 1; }
    70% { transform: translateX(calc(var(--hs-sx) * -0.06)) skewX(5deg); }
    100% { opacity: 1; transform: none; }
}

@keyframes hs-settle-x {
    0% { transform: translateX(var(--hs-from)); }
    30% { transform: translateX(calc(var(--hs-from) * -0.6)); }
    55% { transform: translateX(calc(var(--hs-from) * 0.35)); }
    80% { transform: translateX(calc(var(--hs-from) * -0.12)); }
    100% { transform: translateX(0); }
}

/* A couple of hard color jumps on the red copy for a digital flicker */
@keyframes hs-rgb-r {
    0%, 100% { filter: none; }
    20% { filter: hue-rotate(60deg) saturate(1.6); }
    45% { filter: none; }
    60% { filter: brightness(1.4); }
}

@keyframes hs-flash {
    0% { opacity: 0; }
    25% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes hs-fade-out {
    to { opacity: 0; }
}

/* The old slide shakes and shifts colors as it is cut away */
.hs-slide.is-glitching .hs-media {
    animation: hs-shake 420ms steps(2, end) both;
}

@keyframes hs-shake {
    0% { transform: translate(0, 0); filter: none; }
    20% { transform: translate(-8px, 2px); filter: hue-rotate(80deg) saturate(1.8) contrast(1.2); }
    40% { transform: translate(6px, -3px); filter: hue-rotate(-60deg) saturate(1.5); }
    60% { transform: translate(-4px, 1px); filter: brightness(1.3) contrast(1.3); }
    80% { transform: translate(3px, 0); filter: brightness(0.6); }
    100% { transform: translate(0, 0); filter: brightness(0.45); }
}

.ShopHero {
    margin: 24px auto 10px;
}

/* ---------- Gaming look (shop): Xbox green, HUD corners, counter, angled controls ---------- */

.hs--game {
    --hs-radius: 14px;
    --hs-green: #107C10;
    --hs-lime: #9BF00B;
    aspect-ratio: 12 / 5;
    box-shadow: 0 0 0 1px rgba(16, 124, 16, 0.55), 0 22px 50px -24px rgba(16, 124, 16, 0.75);
}

.hs-hud {
    position: absolute;
    inset: 14px;
    z-index: 4;
    pointer-events: none;
    --c: var(--hs-lime);
    background:
        linear-gradient(var(--c), var(--c)) top left / 28px 3px,
        linear-gradient(var(--c), var(--c)) top left / 3px 28px,
        linear-gradient(var(--c), var(--c)) top right / 28px 3px,
        linear-gradient(var(--c), var(--c)) top right / 3px 28px,
        linear-gradient(var(--c), var(--c)) bottom left / 28px 3px,
        linear-gradient(var(--c), var(--c)) bottom left / 3px 28px,
        linear-gradient(var(--c), var(--c)) bottom right / 28px 3px,
        linear-gradient(var(--c), var(--c)) bottom right / 3px 28px;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 6px rgba(155, 240, 11, 0.7));
    opacity: 0.85;
    transition: inset 0.35s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.35s;
}

.hs--game:hover .hs-hud {
    inset: 8px;
    opacity: 1;
}

.hs-count {
    position: absolute;
    z-index: 5;
    top: 22px;
    left: 26px;
    direction: ltr;
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 14px;
    font-family: Consolas, "Cascadia Mono", "Segoe UI", monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(10, 12, 10, 0.55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transform: skewX(-14deg);
    border-left: 3px solid var(--hs-lime);
}

    .hs-count b {
        font-size: 20px;
        font-weight: 700;
        color: var(--hs-lime);
        text-shadow: 0 0 10px rgba(155, 240, 11, 0.6);
    }

.hs--game .hs-arrow {
    width: 54px;
    height: 46px;
    margin-top: -23px;
    border: 0;
    border-radius: 0;
    background: rgba(16, 124, 16, 0.85);
    clip-path: polygon(18% 0, 100% 0, 82% 100%, 0 100%);
}

    .hs--game .hs-arrow:hover {
        background: var(--hs-lime);
        color: #0A0A0A;
    }

.hs--game .hs-dots {
    right: auto;
    left: 26px;
    bottom: 22px;
    transform: none;
    gap: 5px;
    padding: 0;
    border-radius: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.hs--game .hs-dot {
    width: 22px;
    height: 6px;
    border-radius: 0;
    transform: skewX(-24deg);
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

    .hs--game .hs-dot.is-active {
        width: 56px;
        background: rgba(255, 255, 255, 0.25);
    }

    .hs--game .hs-dot span {
        --hs-fill: linear-gradient(90deg, var(--hs-lime), var(--hs-green));
        border-radius: 0;
        box-shadow: 0 0 8px rgba(155, 240, 11, 0.8);
    }

/* ---------- Arrows ---------- */

.hs-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.28);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s, background 0.2s;
}

    .hs-arrow svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.4;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .hs-arrow.is-prev {
        right: 18px;
        transform: translateX(10px);
    }

    .hs-arrow.is-next {
        left: 18px;
        transform: translateX(-10px);
    }

.hs:hover .hs-arrow, .hs:focus-within .hs-arrow {
    opacity: 1;
    transform: none;
}

.hs-arrow:hover {
    background: rgba(0, 120, 212, 0.75);
    border-color: transparent;
}

/* ---------- Progress dots ---------- */

.hs-dots {
    position: absolute;
    z-index: 5;
    bottom: 16px;
    right: 50%;
    transform: translateX(50%);
    display: flex;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.28);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.hs-dot {
    position: relative;
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    cursor: pointer;
    transition: width 0.45s var(--hs-ease), background 0.3s;
}

    .hs-dot:hover {
        background: rgba(255, 255, 255, 0.8);
    }

    .hs-dot.is-active {
        width: 40px;
        background: rgba(255, 255, 255, 0.35);
    }

    /* Fills over the slide's time in the slide's Microsoft color; its end moves to the next slide */
    .hs-dot span {
        position: absolute;
        inset: 0 0 0 auto;
        width: 0;
        border-radius: inherit;
        background: var(--hs-fill, #fff);
    }

    .hs-dot:nth-child(4n+1) { --hs-fill: #F25022; }
    .hs-dot:nth-child(4n+2) { --hs-fill: #7FBA00; }
    .hs-dot:nth-child(4n+3) { --hs-fill: #00A4EF; }
    .hs-dot:nth-child(4n+4) { --hs-fill: #FFB900; }

    .hs-dot.is-active span {
        animation: hs-progress var(--hs-interval) linear forwards;
    }

.hs.is-paused .hs-dot.is-active span {
    animation-play-state: paused;
}

@keyframes hs-progress {
    to { width: 100%; }
}

.hs-arrow:focus-visible, .hs-dot:focus-visible, .hs-link:focus-visible {
    outline: 2px solid #60CDFF;
    outline-offset: -4px;
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
    .hs--game {
        aspect-ratio: 20 / 11;
    }

    .hs-hud {
        inset: 8px;
        --c: rgba(155, 240, 11, 0.9);
        background-size: 18px 2px, 2px 18px, 18px 2px, 2px 18px, 18px 2px, 2px 18px, 18px 2px, 2px 18px;
    }

    .hs-count {
        top: 14px;
        left: 14px;
        padding: 2px 10px;
    }

        .hs-count b {
            font-size: 16px;
        }

    .hs--game .hs-dots {
        left: 16px;
        bottom: 14px;
    }

    .hs--game .hs-dot.is-active {
        width: 36px;
    }

    .hs {
        --hs-radius: 14px;
        aspect-ratio: 20 / 11;
    }

    .hs-arrow {
        display: none;
    }

    .hs-dots {
        bottom: 10px;
        padding: 6px 8px;
    }

    .hs-dot.is-active {
        width: 28px;
    }
}

/* ---------- Reduced motion: a short cross-fade instead of tiles ---------- */

@media (prefers-reduced-motion: reduce) {
    .hs-slide.is-fading {
        animation: hs-fade 0.4s ease both;
    }

    .hs-slide.is-shining .hs-link::after,
    .hs-slide.is-glitching .hs-media {
        animation: none;
    }

    @keyframes hs-fade {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}
