/* ==========================================================================
   Home hero - "live" layer
   --------------------------------------------------------------------------
   Loaded only on the home page, from home/include/__hero.blade.php
   (after styles.css and product-card.css). Behaviour lives in js/hero.js.

   - Background: colour glows that drift, a faint moving grid, rising
     particles and a soft light that follows the mouse.
   - Picture: floats, with a pulsing glow, sparkles and a small 3D tilt
     towards the mouse.
   - Content fades up in order. While the preloader is still showing, the
     section carries .hero-wait and nothing starts.
   - Only transform / opacity are animated. Everything pauses while the hero
     is off screen (.hero-paused) and stops for "reduce motion" users.
   ========================================================================== */

.hero-area.hero-live {
    --hero-accent: var(--td-primary, #ff5463);
    --hero-accent-rgb: var(--td-primary-rgb, 255, 84, 99);
    --hero-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --hero-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --mx: 0;
    --my: 0;
    position: relative;
    isolation: isolate;
    /* Shown until the background picture arrives */
    background-color: #4a2338;
}

.hero-live > .container {
    position: relative;
    z-index: 2;
}

/* ---------- 1. Background life ------------------------------------------ */

.hero-fx {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-fx > span {
    position: absolute;
    display: block;
}

/* Soft colour glows (radial gradients, no blur filter: cheap to move) */
.hero-fx-blob {
    aspect-ratio: 1;
    border-radius: 50%;
    will-change: transform;
    animation: heroDrift var(--t) ease-in-out infinite alternate;
}

.hero-fx-blob--1 {
    --t: 17s;
    --dx: 9%;
    --dy: 12%;
    width: min(50vw, 680px);
    top: -26%;
    left: -12%;
    background: radial-gradient(closest-side, rgba(var(--hero-accent-rgb), 0.55), rgba(var(--hero-accent-rgb), 0));
}

.hero-fx-blob--2 {
    --t: 21s;
    --dx: -10%;
    --dy: 9%;
    width: min(46vw, 640px);
    top: -12%;
    right: -8%;
    background: radial-gradient(closest-side, rgba(124, 58, 237, 0.42), rgba(124, 58, 237, 0));
}

.hero-fx-blob--3 {
    --t: 19s;
    --dx: 12%;
    --dy: -10%;
    width: min(38vw, 520px);
    bottom: -30%;
    left: 30%;
    background: radial-gradient(closest-side, rgba(255, 138, 61, 0.34), rgba(255, 138, 61, 0));
}

.hero-fx-blob--4 {
    --t: 25s;
    --dx: -8%;
    --dy: -12%;
    width: min(40vw, 560px);
    bottom: -28%;
    right: -6%;
    background: radial-gradient(closest-side, rgba(37, 99, 235, 0.38), rgba(37, 99, 235, 0));
}

@keyframes heroDrift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(var(--dx), var(--dy), 0) scale(1.14);
    }

    100% {
        transform: translate3d(calc(var(--dx) * -0.6), calc(var(--dy) * 0.5), 0) scale(0.92);
    }
}

/* Faint grid that slowly slides, faded out towards the edges */
.hero-fx-grid {
    inset: 0;
    -webkit-mask-image: radial-gradient(ellipse 55% 75% at 62% 50%, #000 10%, transparent 72%);
    mask-image: radial-gradient(ellipse 55% 75% at 62% 50%, #000 10%, transparent 72%);
}

.hero-fx-grid::before {
    content: "";
    position: absolute;
    inset: -64px;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 64px 64px;
    will-change: transform;
    animation: heroGrid 14s linear infinite;
}

@keyframes heroGrid {
    to {
        transform: translate3d(64px, 64px, 0);
    }
}

/* Light that follows the mouse (position set by hero.js) */
.hero-fx-spot {
    top: 0;
    left: 0;
    width: 760px;
    height: 760px;
    margin: -380px 0 0 -380px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transform: translate3d(var(--px, 50vw), var(--py, 50vh), 0);
    transition: opacity 0.6s ease;
    will-change: transform;
}

.hero-live.is-pointer .hero-fx-spot {
    opacity: 1;
}

/* Rising particles: each <i> is a full-height column that slides up,
   carrying its glowing dot (drawn at the top of its background) from the
   bottom edge to the top. One animation per particle, no pseudo-elements:
   measured, a second "twinkle" animation per dot doubled the idle cost. */
.hero-fx-particles {
    inset: 0;
}

.hero-fx-particles i {
    --g: calc(var(--s) * 4);
    position: absolute;
    bottom: 0;
    left: var(--x);
    width: var(--g);
    height: 100%;
    margin-left: calc(var(--g) / -2);
    background: radial-gradient(circle at 50% calc(var(--g) / 2),
            #fff 0, #fff calc(var(--s) * 0.5),
            rgba(255, 255, 255, 0.35) calc(var(--s) * 0.9),
            rgba(255, 255, 255, 0) calc(var(--g) / 2)) no-repeat;
    animation: heroRise var(--d) linear var(--dl) infinite;
}

@keyframes heroRise {
    0% {
        transform: translate3d(0, 100%, 0);
        opacity: 0;
    }

    10% {
        opacity: 0.9;
    }

    80% {
        opacity: 0.7;
    }

    100% {
        transform: translate3d(var(--drift), -4%, 0);
        opacity: 0;
    }
}

/* ---------- 2. Entrance -------------------------------------------------- */

.hero-live.hero-wait .hero-reveal {
    opacity: 0;
}

.hero-live:not(.hero-wait) .hero-reveal {
    animation: heroUp 0.8s var(--hero-ease) backwards;
    animation-delay: calc(var(--i, 0) * 110ms + 60ms);
}

.hero-live:not(.hero-wait) .hero-reveal--soft {
    animation-name: heroUpSoft;
}

.hero-live:not(.hero-wait) .hero-reveal--zoom {
    animation-name: heroZoom;
    animation-duration: 1.1s;
}

@keyframes heroUp {
    from {
        opacity: 0;
        translate: 0 26px;
    }
}

@keyframes heroUpSoft {
    from {
        opacity: 0;
        translate: 0 26px;
        filter: blur(6px);
    }
}

@keyframes heroZoom {
    from {
        opacity: 0;
        scale: 0.9;
        translate: 0 20px;
    }
}

/* ---------- 3. Title ----------------------------------------------------- */

/* A light sweeps across the title every few seconds. hero.js adds .is-shine
   for one sweep at a time: a background move can't run on the GPU, so it
   must not tick all the time. Both ends of the sweep are plain white, so
   the jump back after each sweep is invisible. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .hero-live .hero-title-text {
        background-image: linear-gradient(100deg,
                #fff 0%, #fff 44%,
                #ffd1d7 48%, #fff7ec 50%, #ffd9b8 52%,
                #fff 56%, #fff 100%);
        background-size: 300% 100%;
        background-position: 100% 0;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .hero-live .hero-title-text.is-shine {
        background-position: 0% 0;
        transition: background-position 1.8s ease-in-out;
    }

    /* Words marked [[color_text=...]] in Admin get a warm gradient */
    .hero-live .hero-title-text .highlight {
        background-image: linear-gradient(90deg, #ffd166, #ff8fa3 55%, #ffb36b);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* ---------- 4. Buttons --------------------------------------------------- */

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 32px;
}

.hero-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 54px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    isolation: isolate;
    overflow: hidden;
    transition:
        translate 0.3s var(--hero-ease),
        box-shadow 0.3s var(--hero-ease),
        background-color 0.3s var(--hero-ease),
        border-color 0.3s var(--hero-ease),
        color 0.3s var(--hero-ease);
}

.hero-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.hero-btn--primary {
    padding: 0 7px 0 26px;
    background-color: #fff;
    color: #1e1d25;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}

.hero-btn--primary,
.hero-btn--primary:hover,
.hero-btn--primary:focus {
    color: #1e1d25;
}

/* Light that passes over the main button now and then */
.hero-btn--primary::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: -50%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(var(--hero-accent-rgb), 0.2), transparent);
    transform: translateX(0) skewX(-20deg);
    animation: heroBtnShine 5s ease-in-out 2.6s infinite;
}

@keyframes heroBtnShine {
    0% {
        transform: translateX(0) skewX(-20deg);
    }

    28%,
    100% {
        transform: translateX(420%) skewX(-20deg);
    }
}

.hero-btn-arrow {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--hero-accent);
    color: #fff;
    box-shadow: 0 6px 16px -4px rgba(var(--hero-accent-rgb), 0.75);
    transition: rotate 0.4s var(--hero-spring), scale 0.4s var(--hero-spring);
}

[dir="rtl"] .hero-btn-arrow svg {
    scale: -1 1;
}

.hero-btn--ghost {
    padding: 0 26px;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.34);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.hero-btn--ghost,
.hero-btn--ghost:hover,
.hero-btn--ghost:focus {
    color: #fff;
}

.hero-btn--ghost svg {
    flex-shrink: 0;
    transition: rotate 0.5s var(--hero-spring);
}

/* ---------- 5. Stats ----------------------------------------------------- */

.hero-live .hero-stats {
    margin-top: 36px;
}

.hero-live .hero-stats .positive-review + .positive-review {
    padding-inline-start: 30px;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.22);
}

.hero-live .hero-stats .positive-review .right-content h6 {
    font-variant-numeric: tabular-nums;
}

.hero-live .hero-stats .positive-review,
.hero-live .hero-stats .left-content img {
    transition: translate 0.35s var(--hero-ease), scale 0.4s var(--hero-spring), filter 0.35s ease;
}

/* ---------- 6. Feature cards (base look is in product-card.css) --------- */

.hero-live .hero-features-wrap {
    margin-top: 36px !important;
}

.hero-live .hero-feature-card {
    position: relative !important;
}

/* Light sweep on hover */
.hero-live .hero-feature-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.24) 50%, transparent 65%) no-repeat;
    background-size: 250% 100%;
    background-position: 130% 0;
    pointer-events: none;
    transition: background-position 0.8s var(--hero-ease);
}

.hero-live .hero-feature-card .feature-icon-box {
    position: relative !important;
    transition: transform 0.45s var(--hero-spring) !important;
}

/* Ring that pings out of each icon in turn */
.hero-live .hero-feature-card .feature-icon-box::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid rgba(var(--fc), 0.85);
    opacity: 0;
    pointer-events: none;
    animation: heroPing 4.2s cubic-bezier(0, 0, 0.2, 1) infinite;
    animation-delay: calc((var(--i, 4) - 4) * 1.4s + 2.2s);
}

@keyframes heroPing {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }

    40%,
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}

/* ---------- 7. Picture --------------------------------------------------- */

.hero-visual {
    position: relative;
}

.hero-visual .hero-img {
    position: relative;
    z-index: 2;
    transform:
        perspective(1000px)
        rotateY(calc(var(--mx) * 7deg))
        rotateX(calc(var(--my) * -6deg))
        translate3d(calc(var(--mx) * -10px), calc(var(--my) * -8px), 0);
    transition: scale 0.6s var(--hero-ease);
}

.hero-visual .hero-img img {
    display: block;
    will-change: transform;
    animation: heroFloat 6.5s ease-in-out infinite;
}

@keyframes heroFloat {

    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(0, -16px, 0);
    }
}

/* Centring uses left/top/margin (not translate), so nothing can knock it */
.hero-visual-glow,
.hero-visual-shadow,
.hero-sparkle {
    position: absolute;
    display: block;
    pointer-events: none;
}

.hero-visual-glow {
    z-index: 0;
    width: 80%;
    left: 10%;
    top: 52%;
    margin-top: -40%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(closest-side,
            rgba(255, 138, 61, 0.55),
            rgba(var(--hero-accent-rgb), 0.3) 55%,
            rgba(var(--hero-accent-rgb), 0));
    translate: calc(var(--mx) * 14px) calc(var(--my) * 12px);
    transition: scale 0.6s var(--hero-ease), filter 0.6s ease;
    animation: heroGlow 6.5s ease-in-out infinite;
}

@keyframes heroGlow {

    0%,
    100% {
        transform: scale(0.92);
        opacity: 0.75;
    }

    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

/* Shadow under the floating picture: shrinks as the picture rises */
.hero-visual-shadow {
    z-index: 1;
    left: 30%;
    width: 40%;
    bottom: 1%;
    height: 5%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0));
    animation: heroShadow 6.5s ease-in-out infinite;
}

@keyframes heroShadow {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

/* Four-point sparkles that twinkle around the picture */
.hero-sparkle {
    z-index: 3;
    left: var(--sx);
    top: var(--sy);
    width: var(--ss);
    aspect-ratio: 1;
    background: radial-gradient(circle, #fff 30%, #ffe4ea 70%);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    translate: calc(var(--mx) * 18px) calc(var(--my) * 14px);
    animation: heroStar 3.6s ease-in-out var(--sd) infinite both;
}

@keyframes heroStar {

    0%,
    100% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        transform: scale(1) rotate(90deg);
        opacity: 1;
    }
}

/* ---------- 8. Hover (real mouse only) ----------------------------------- */

@media (hover: hover) and (pointer: fine) {

    .hero-btn:hover {
        translate: 0 -3px;
    }

    .hero-btn:active {
        translate: 0 -1px;
    }

    .hero-btn--primary:hover {
        box-shadow: 0 18px 38px -10px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(255, 255, 255, 0.16);
    }

    .hero-btn--primary:hover .hero-btn-arrow {
        rotate: -45deg;
        scale: 1.06;
    }

    [dir="rtl"] .hero-btn--primary:hover .hero-btn-arrow {
        rotate: 45deg;
    }

    .hero-btn--ghost:hover {
        background-color: rgba(255, 255, 255, 0.18);
        border-color: rgba(255, 255, 255, 0.7);
        box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.45);
    }

    .hero-btn--ghost:hover svg {
        rotate: 90deg;
    }

    .hero-live .hero-stats .positive-review:hover {
        translate: 0 -3px;
    }

    .hero-live .hero-stats .positive-review:hover .left-content img {
        scale: 1.08;
        filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
    }

    .hero-live .hero-feature-card:hover {
        transform: translateY(-6px) !important;
        background: rgba(255, 255, 255, 0.15) !important;
        border-color: rgba(var(--fc), 0.75) !important;
        box-shadow:
            0 18px 34px -10px rgba(0, 0, 0, 0.42),
            0 0 0 1px rgba(var(--fc), 0.35),
            0 0 28px -4px rgba(var(--fc), 0.6) !important;
    }

    .hero-live .hero-feature-card:hover::before {
        background-position: -30% 0;
    }

    .hero-live .hero-feature-card:hover .feature-icon-box {
        transform: scale(1.14) rotate(-8deg) !important;
    }

    .hero-visual:hover .hero-img {
        scale: 1.03;
    }

    .hero-visual:hover .hero-visual-glow {
        scale: 1.08;
        filter: brightness(1.2) saturate(1.15);
    }
}

/* ---------- 9. Smaller screens ------------------------------------------ */

@media (max-width: 991px) {
    .hero-fx-grid {
        -webkit-mask-image: radial-gradient(ellipse 80% 45% at 50% 72%, #000 10%, transparent 72%);
        mask-image: radial-gradient(ellipse 80% 45% at 50% 72%, #000 10%, transparent 72%);
    }

    .hero-visual {
        max-width: 480px;
        margin-inline: auto;
    }
}

@media (max-width: 767px) {

    /* Fewer particles on phones */
    .hero-fx-particles i:nth-child(n + 8) {
        display: none;
    }

    .hero-actions {
        margin-top: 24px;
        gap: 10px;
    }

    .hero-btn {
        flex: 1 1 auto;
        height: 50px;
        font-size: 15px;
    }

    .hero-btn--primary {
        padding-inline-start: 22px;
    }

    .hero-btn--ghost {
        padding: 0 20px;
    }

    .hero-btn-arrow {
        width: 36px;
        height: 36px;
    }

    .hero-live .hero-stats {
        margin-top: 28px;
    }

    .hero-live .hero-stats .positive-review + .positive-review {
        padding-inline-start: 22px;
    }
}

@media (max-width: 575px) {
    .hero-live .hero-features-wrap {
        margin-top: 24px !important;
    }
}

/* ---------- 10. Pause / reduce motion ----------------------------------- */

.hero-live.hero-paused,
.hero-live.hero-paused *,
.hero-live.hero-paused *::before,
.hero-live.hero-paused *::after {
    animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {

    .hero-live *,
    .hero-live *::before,
    .hero-live *::after {
        animation: none !important;
    }

    .hero-live.hero-wait .hero-reveal {
        opacity: 1;
    }

    .hero-fx-particles,
    .hero-fx-spot,
    .hero-sparkle {
        display: none !important;
    }

    .hero-visual .hero-img {
        transform: none;
    }
}
