/* AB Detailing Hero Widget v1.2.0 - animated "site vs. Tekla model" hero
   PERFORMANCE RULES used in this file (so it stays smooth on cheap phones):
   - only `transform` and `opacity` are ever animated (GPU compositor, no layout / repaint per frame)
   - no `filter: blur()` and no `backdrop-filter` anywhere (these are the usual cause of lag)
   - no Ken-Burns scaling of the photo; no animated box-shadow, background-position, clip-path, or `left`
   Layout:
   - Desktop / tablet : text on top, full-width panorama (photo | 3D model) below with a live scan line.
   - Mobile           : the same image becomes one frame that auto-reveals photo -> 3D model (nothing is cropped). */

.ab-hero-section {
    --ab-title: #ffffff;
    --ab-subtitle: #cbd5e1;
    --ab-desc: #9fb0c6;
    --ab-accent: #38bdf8;
    --ab-primary: #2563eb;
    --ab-dim: 0.25;
    --ab-bg: #0b1220;

    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 90vh;
    min-height: 90svh;
    overflow: hidden;
    background-color: var(--ab-bg);
    color: var(--ab-subtitle);
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.ab-hero-section *,
.ab-hero-section *::before,
.ab-hero-section *::after {
    box-sizing: border-box;
}

/* ========================================
   KEYFRAMES  (transform + opacity only)
   ======================================== */

@keyframes abRise {
    from { opacity: 0; transform: translate3d(0, 28px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes abFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes abOrbA {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(-6%, 8%, 0); }
}

@keyframes abOrbB {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(7%, -6%, 0); }
}

@keyframes abCoverZoom {
    from { transform: scale(1.08); }
    to   { transform: scale(1); }
}

/* desktop scan line: the full-size .ab-scan layer slides left -> right, its right edge is the beam */
@keyframes abScan {
    0%   { transform: translate3d(-100%, 0, 0); opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { transform: translate3d(0, 0, 0);     opacity: 0; }
}

@keyframes abRing {
    0%   { transform: scale(0.85); opacity: 0.7; }
    100% { transform: scale(1.8);  opacity: 0; }
}

@keyframes abShine {
    0%, 62%  { transform: translate3d(-170%, 0, 0) skewX(-20deg); }
    100%     { transform: translate3d(330%, 0, 0) skewX(-20deg); }
}

@keyframes abDot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* mobile reveal. The model pane slides in from the left while its picture slides the opposite way,
   so the picture stays still and only the "window" moves (pure transform = smooth). */
@keyframes abRevealPane {
    0%, 10%   { transform: translate3d(-100%, 0, 0); }
    38%, 60%  { transform: translate3d(0, 0, 0); }
    88%, 100% { transform: translate3d(-100%, 0, 0); }
}

@keyframes abRevealImg {
    0%, 10%   { transform: translate3d(100%, 0, 0); }
    38%, 60%  { transform: translate3d(0, 0, 0); }
    88%, 100% { transform: translate3d(100%, 0, 0); }
}

@keyframes abBeamMobile {
    0%, 10%   { transform: translate3d(-100%, 0, 0); opacity: 0; }
    13%       { opacity: 1; }
    35%       { opacity: 1; }
    38%       { transform: translate3d(0, 0, 0);     opacity: 0; }
    60%       { transform: translate3d(0, 0, 0);     opacity: 0; }
    63%       { opacity: 1; }
    85%       { opacity: 1; }
    88%, 100% { transform: translate3d(-100%, 0, 0); opacity: 0; }
}

@keyframes abTagSite {
    0%, 12%   { opacity: 1; }
    20%, 80%  { opacity: 0; }
    92%, 100% { opacity: 1; }
}

@keyframes abTagModel {
    0%, 30%   { opacity: 0; }
    42%, 60%  { opacity: 1; }
    72%, 100% { opacity: 0; }
}

/* ========================================
   AMBIENT BACKGROUND (gradient, soft glow orbs, static blueprint grid)
   ======================================== */

.ab-hero-ambient {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 82% 8%, rgba(37, 99, 235, 0.38), transparent 62%),
        radial-gradient(700px 480px at 6% 92%, rgba(14, 165, 233, 0.16), transparent 65%),
        linear-gradient(165deg, #0b1220 0%, #10224d 52%, #0b1220 100%);
}

/* orbs are pre-blurred radial gradients (no filter: blur) and only move with transform */
.ab-orb {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
    backface-visibility: hidden;
}

.ab-orb-1 {
    width: 40vmax; height: 40vmax;
    top: -15vmax; right: -9vmax;
    background: radial-gradient(circle closest-side, rgba(37, 99, 235, 0.42), rgba(37, 99, 235, 0));
    animation: abOrbA 22s ease-in-out infinite;
}

.ab-orb-2 {
    width: 32vmax; height: 32vmax;
    bottom: -13vmax; left: -9vmax;
    background: radial-gradient(circle closest-side, rgba(56, 189, 248, 0.26), rgba(56, 189, 248, 0));
    animation: abOrbB 26s ease-in-out infinite;
}

.ab-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 60px 60px;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 40%, #000 30%, transparent 100%);
            mask-image: radial-gradient(ellipse 85% 75% at 50% 40%, #000 30%, transparent 100%);
}

/* "Split image OFF" mode: classic full-cover background */
.ab-hero-bg {
    position: absolute;
    inset: 0;
    background-image: var(--ab-img);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: abCoverZoom 9s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    will-change: transform;
}

.ab-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(11, 18, 32, 0.9) 0%, rgba(16, 34, 77, 0.7) 52%, rgba(11, 18, 32, 0.88) 100%);
}

/* ========================================
   CONTENT
   ======================================== */

.ab-hero-content-wrap {
    position: relative;
    z-index: 3;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 90px 30px 56px;
}

.ab-hero-content {
    max-width: 800px;
}

.ab-hero-section .ab-hero-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 22px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: var(--ab-accent);
    animation: abRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.ab-hero-label::before {
    content: '';
    width: 34px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--ab-accent));
}

.ab-hero-label::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ab-accent);
    animation: abDot 2.4s ease-in-out infinite;
}

.ab-hero-section .ab-hero-title {
    margin: 0 0 24px;
    padding: 0;
    font-size: clamp(34px, 5.4vw, 62px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--ab-title);
    animation: abRise 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

/* gradient on the highlighted words (static: animating text gradients repaints every frame) */
.ab-hero-section .ab-hero-hl {
    color: var(--ab-accent);
    -webkit-box-decoration-break: clone;
            box-decoration-break: clone;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .ab-hero-section .ab-hero-hl {
        background-image: linear-gradient(100deg, var(--ab-accent) 0%, #e0f2fe 100%);
        -webkit-background-clip: text;
                background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }
}

.ab-hero-section .ab-hero-subtitle {
    margin: 0 0 18px;
    font-size: clamp(16px, 1.6vw, 20px);
    font-weight: 500;
    line-height: 1.65;
    color: var(--ab-subtitle);
    animation: abRise 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.27s both;
}

.ab-hero-section .ab-hero-desc {
    max-width: 660px;
    margin: 0 0 36px;
    font-size: clamp(15px, 1.35vw, 17px);
    line-height: 1.7;
    color: var(--ab-desc);
    animation: abRise 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.38s both;
}

.ab-hero-desc p { margin: 0 0 0.8em; color: inherit; }
.ab-hero-desc p:last-child { margin-bottom: 0; }

/* ========================================
   BUTTONS
   ======================================== */

.ab-hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    animation: abRise 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.48s both;
}

.ab-hero-section .ab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 15px 34px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.3px;
    text-align: center;
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s, color 0.3s, border-color 0.3s;
}

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

.ab-hero-section .ab-btn-primary {
    color: #fff;
    border: 0;
    background: var(--ab-primary);
    background: linear-gradient(135deg, var(--ab-primary), color-mix(in srgb, var(--ab-primary) 72%, #000));
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.38);
}

/* light sweep that glides across the primary button every few seconds (transform only) */
.ab-btn-primary::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.34), transparent);
    transform: translate3d(-170%, 0, 0) skewX(-20deg);
    animation: abShine 5s ease-in-out 1.8s infinite;
    will-change: transform;
}

.ab-btn-primary::after {               /* arrow */
    content: '\2192';
    margin-left: 10px;
    font-size: 17px;
    transition: transform 0.3s;
}

.ab-hero-section .ab-btn-primary:hover,
.ab-hero-section .ab-btn-primary:focus-visible {
    color: #fff;
    transform: translate3d(0, -3px, 0);
}

.ab-btn-primary:hover::after  { transform: translate3d(5px, 0, 0); }

.ab-hero-section .ab-btn-secondary {
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.28);
    background-color: rgba(255, 255, 255, 0.08);
}

.ab-hero-section .ab-btn-secondary:hover,
.ab-hero-section .ab-btn-secondary:focus-visible {
    color: #0b1220;
    background-color: #fff;
    border-color: #fff;
    transform: translate3d(0, -3px, 0);
}

.ab-btn span { position: relative; z-index: 1; }

/* ========================================
   HIGHLIGHT CHIPS
   ======================================== */

.ab-hero-section .ab-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.ab-hero-section .ab-hero-chips li {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: #e2e8f0;
    border: 1px solid rgba(148, 197, 255, 0.24);
    border-radius: 999px;
    background: rgba(18, 34, 72, 0.7);
    animation: abRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) calc(0.6s + var(--i, 0) * 0.09s) both;
}

.ab-hero-chips li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ab-accent);
}

/* ========================================
   STAGE - the background image (split into "site" | "model")
   Desktop: both halves side by side = the whole image, never cropped.
   ======================================== */

.ab-hero-stage {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    aspect-ratio: 1224 / 313;
    margin-top: -10px;
    overflow: hidden;
    isolation: isolate;
    contain: layout paint;
    /* soft fade into the page background (the stage is small, so this mask is cheap) */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 32%);
            mask-image: linear-gradient(to bottom, transparent 0%, #000 32%);
    animation: abFade 1.2s ease 0.5s both;
}

.ab-pane {
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.ab-pane::before {                       /* the picture (one half of the image) */
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--ab-img);
    background-repeat: no-repeat;
    background-size: 200% 100%;
}

.ab-pane-site::before  { background-position: 0% 50%; }
.ab-pane-model::before { background-position: 100% 50%; }

.ab-pane::after {                        /* tint so the bright sky melts into the dark hero */
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(11, 18, 32, 0.55) 0%, rgba(11, 18, 32, calc(var(--ab-dim))) 45%, rgba(11, 18, 32, 0.55) 100%),
        linear-gradient(90deg, rgba(11, 18, 32, 0.35), transparent 30%, transparent 70%, rgba(11, 18, 32, 0.35));
}

/* scan beam: a full-size layer; its right edge (::after) is the glowing line */
.ab-scan {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(-100%, 0, 0);
    animation: abScan 10s cubic-bezier(0.45, 0, 0.55, 1) 1.2s infinite;
    will-change: transform, opacity;
}

.ab-scan::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    right: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--ab-accent) 20%, #fff 50%, var(--ab-accent) 80%, transparent);
    box-shadow: 0 0 20px 3px rgba(56, 189, 248, 0.5);
}

.ab-scan::before {                       /* soft glow trailing behind the beam */
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    right: 2px;
    width: clamp(70px, 10vw, 180px);
    background: linear-gradient(to left, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0));
}

/* centre badge: "reality <-> model" */
.ab-seam {
    position: absolute;
    top: 55%;
    left: 50%;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    color: #fff;
    background: rgba(11, 18, 32, 0.88);
    border: 1px solid var(--ab-accent);
}

.ab-seam::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px solid var(--ab-accent);
    animation: abRing 2.8s ease-out infinite;
}

/* corner tags */
.ab-tag {
    position: absolute;
    bottom: clamp(10px, 2.2vw, 28px);
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(11, 18, 32, 0.78);
}

.ab-tag::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fbbf24;
}

.ab-tag-model::before { background: var(--ab-accent); }

.ab-tag-site  { left: clamp(14px, 3vw, 44px); }
.ab-tag-model { left: calc(50% + clamp(14px, 3vw, 44px)); }

/* ========================================
   TABLET
   ======================================== */

@media (max-width: 991px) {
    .ab-hero-section { min-height: 0; }
    .ab-hero-content-wrap { padding: 70px 26px 44px; }
}

/* ========================================
   MOBILE - one frame, auto reveal (photo -> 3D model). Extra light on GPU.
   ======================================== */

@media (max-width: 767px) {
    .ab-hero-content-wrap { padding: 52px 20px 28px; }

    .ab-hero-section .ab-hero-label { font-size: 12px; letter-spacing: 2px; margin-bottom: 16px; }
    .ab-hero-section .ab-hero-title { margin-bottom: 18px; letter-spacing: -0.01em; }
    .ab-hero-section .ab-hero-desc { margin-bottom: 28px; }

    .ab-hero-buttons { flex-direction: column; gap: 12px; }
    .ab-hero-section .ab-btn { width: 100%; padding: 15px 26px; }

    .ab-hero-section .ab-hero-chips { gap: 8px; margin-top: 26px; }
    .ab-hero-section .ab-hero-chips li { padding: 7px 12px; font-size: 12px; }

    /* only one orb on phones */
    .ab-orb-2 { display: none; }

    .ab-hero-stage {
        display: block;
        aspect-ratio: 612 / 313;
        margin-top: 4px;
    }

    .ab-hero-stage {
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%);
                mask-image: linear-gradient(to bottom, transparent 0%, #000 18%);
    }

    .ab-pane {
        position: absolute;
        inset: 0;
    }

    .ab-pane-model {
        transform: translate3d(-100%, 0, 0);
        animation: abRevealPane 10s ease-in-out 1.4s infinite;
        will-change: transform;
    }

    .ab-pane-model::before {
        transform: translate3d(100%, 0, 0);
        animation: abRevealImg 10s ease-in-out 1.4s infinite;
        will-change: transform;
    }

    .ab-scan {
        animation: abBeamMobile 10s ease-in-out 1.4s infinite;
    }

    .ab-seam { display: none; }

    .ab-tag { bottom: 12px; padding: 6px 11px; font-size: 10px; letter-spacing: 1.3px; }
    .ab-tag-site,
    .ab-tag-model { left: 14px; }
    .ab-tag-site  { animation: abTagSite 10s ease-in-out 1.4s infinite; }
    .ab-tag-model { opacity: 0; animation: abTagModel 10s ease-in-out 1.4s infinite; }
}

/* ========================================
   REDUCED MOTION - everything static and fully visible
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .ab-hero-section *,
    .ab-hero-section *::before,
    .ab-hero-section *::after {
        animation: none !important;
        transition: none !important;
    }

    .ab-scan { display: none; }

    @media (max-width: 767px) {
        /* show both: left half photo, right half model */
        .ab-pane-model,
        .ab-pane-model::before { transform: none; }
        .ab-pane-model { clip-path: inset(0 0 0 50%); }
        .ab-scan { display: block; opacity: 1; transform: translate3d(-50%, 0, 0); }
        .ab-tag-site  { left: 14px; opacity: 1; }
        .ab-tag-model { left: auto; right: 14px; opacity: 1; }
    }
}
