/* ============================================================================
   animations.css — High-end animation & visual-effect layer for Fartash Laser
   Additive only. Auto-targets existing classes via animations.js.
   RTL-aware. Fully neutralized under prefers-reduced-motion.
   ========================================================================== */

:root {
    /* Brand palette (extracted from site.css) */
    --fx-blue: #03A9F4;
    --fx-blue2: #2F5BEA;
    --fx-blue3: #2C57E4;
    --fx-green: #4CAF50;
    --fx-green2: #00C853;
    --fx-navy: #081D43;
    --fx-gray: #6C7890;

    /* Motion tokens (refined siblings of the site's 0.3s ease language) */
    --fx-dur: .6s;
    --fx-dur-fast: .3s;
    --fx-ease: cubic-bezier(.22, .61, .36, 1);
    --fx-step: 60ms;
    --fx-shift: 28px;
    --fx-zoom-from: .94;
}

/* ---------------------------------------------------------------------------
   1. Scroll-reveal engine — hidden pre-state + variants
   --------------------------------------------------------------------------- */

.fx {
    opacity: 0;
    transition:
        opacity var(--fx-dur) var(--fx-ease),
        transform var(--fx-dur) var(--fx-ease);
    transition-delay: var(--fx-delay, 0ms);
}

.fx-up    { transform: translateY(var(--fx-shift)); }
.fx-zoom  { transform: scale(var(--fx-zoom-from)); }
.fx-in    { transform: none; }            /* opacity-only reveal */

/* Revealed state */
.fx.fx-in-view {
    opacity: 1;
    transform: none;
}

/* ---------------------------------------------------------------------------
   2. Animated gradient underline on section titles (RTL: grows from right)
   --------------------------------------------------------------------------- */

.works__title,
.portfolio__title,
.person-comments__title,
.header-content__title {
    position: relative;
}

.works__title::after,
.portfolio__title::after,
.person-comments__title::after,
.header-content__title::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: -.45rem;
    width: clamp(3rem, 18%, 7rem);
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--fx-blue), var(--fx-green2));
    transform: scaleX(0);
    transform-origin: right;          /* RTL reading start */
    transition: transform var(--fx-dur) var(--fx-ease);
    transition-delay: calc(var(--fx-delay, 0ms) + 120ms);
}

.fx-in-view.works__title::after,
.fx-in-view.portfolio__title::after,
.fx-in-view.person-comments__title::after,
.fx-in-view.header-content__title::after {
    transform: scaleX(1);
}

/* Subtle navy→blue gradient text on the big hero headline only.
   Guarded by @supports so the text never disappears where unsupported. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .header-content__title {
        background: linear-gradient(120deg, var(--fx-navy) 35%, var(--fx-blue3));
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* ---------------------------------------------------------------------------
   3. Card lift + brand glow (additive to existing hovers)
   --------------------------------------------------------------------------- */

.works-content__item,
.comment,
.service-box,
.portfolio__item,
.flex-item {
    transition:
        transform var(--fx-dur-fast) var(--fx-ease),
        box-shadow var(--fx-dur-fast) var(--fx-ease);
}

.works-content__item:hover,
.service-box:hover,
.flex-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(3, 169, 244, .18);
}

.comment:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 200, 83, .20);
}

.portfolio__item:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 34px rgba(8, 29, 67, .22);
}

/* ---------------------------------------------------------------------------
   4. Ken-Burns image zoom on hover (frames already clip overflow)
   --------------------------------------------------------------------------- */

.portfolio__item,
.works-img {
    overflow: hidden;
}

.portfolio__item .portfolio__img,
.works-img .works-img__img {
    transition: transform .55s var(--fx-ease);
    will-change: transform;
}

.portfolio__item:hover .portfolio__img,
.works-img:hover .works-img__img {
    transform: scale(1.08);
}

/* ---------------------------------------------------------------------------
   5. Button shine sweep
   --------------------------------------------------------------------------- */

.header-content__link,
.header__link,
.call__btn,
.felex-item-tag {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.header-content__link::before,
.header__link::before,
.call__btn::before,
.felex-item-tag::before {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(100deg,
            transparent,
            rgba(255, 255, 255, .55),
            transparent);
    transform: skewX(-18deg);
    transition: left .6s var(--fx-ease);
}

.header-content__link:hover::before,
.header__link:hover::before,
.call__btn:hover::before,
.felex-item-tag:hover::before {
    left: 140%;
}

/* ---------------------------------------------------------------------------
   6. Sticky shrink + frosted-blur header (reuses dead header.sticky rule)
   --------------------------------------------------------------------------- */

.header {
    transition:
        background-color var(--fx-dur-fast) var(--fx-ease),
        box-shadow var(--fx-dur-fast) var(--fx-ease);
}

.header-top {
    transition: padding var(--fx-dur-fast) var(--fx-ease);
}

.nav-logo__img {
    transition: max-width var(--fx-dur-fast) var(--fx-ease);
}

header.sticky {
    background-color: rgba(255, 255, 255, .96);
    box-shadow: 0 6px 20px rgba(8, 29, 67, .12);
}

/* Frosted blur only where the desktop menu is inline. On <=768px the .menu is
   an off-canvas `position:fixed` drawer inside the header, and backdrop-filter
   would make the header its containing block (drawer clipped to header height). */
@media only screen and (min-width: 769px) {
    header.sticky {
        background-color: rgba(255, 255, 255, .85);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
    }
}

header.sticky .header-top {
    padding-top: .55rem;
    padding-bottom: .55rem;
}

header.sticky .nav-logo__img {
    max-width: 9.5rem;
}

/* ---------------------------------------------------------------------------
   7. Branded preloader (laser-dot orbit) — element created by animations.js
   --------------------------------------------------------------------------- */

.fx-preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, #ffffff, #eef4ff);
    opacity: 1;
    transition: opacity .5s var(--fx-ease);
}

.fx-preloader--gone {
    opacity: 0;
    pointer-events: none;
}

.fx-spinner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid rgba(3, 169, 244, .18);
    border-top-color: var(--fx-blue);
    border-right-color: var(--fx-green2);
    animation: fx-spin .8s linear infinite;
    box-shadow: 0 0 22px rgba(3, 169, 244, .35);
}

@keyframes fx-spin {
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------------------
   8. Homepage hero laser-spark accent — span injected by animations.js
   --------------------------------------------------------------------------- */

.header-content__right {
    position: relative;
}

.fx-spark {
    position: absolute;
    top: 8%;
    inset-inline-start: 6%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 18px 6px rgba(3, 169, 244, .9);
    animation: fx-spark-pulse 2.6s var(--fx-ease) infinite;
}

.fx-spark::before,
.fx-spark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: linear-gradient(90deg, transparent, var(--fx-blue), transparent);
    transform: translate(-50%, -50%);
}

.fx-spark::before {
    width: 46px;
    height: 2px;
}

.fx-spark::after {
    width: 2px;
    height: 46px;
    background: linear-gradient(0deg, transparent, var(--fx-green2), transparent);
}

@keyframes fx-spark-pulse {
    0%, 100% { transform: scale(.7); opacity: .55; }
    50%      { transform: scale(1.15); opacity: 1; }
}

/* ---------------------------------------------------------------------------
   9. Accessibility — neutralize ALL motion for reduced-motion users
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .fx,
    .fx-up,
    .fx-zoom,
    .fx-in,
    .fx-in-view {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        transition-delay: 0ms !important;
    }

    .works__title::after,
    .portfolio__title::after,
    .person-comments__title::after,
    .header-content__title::after {
        transform: scaleX(1) !important;
        transition: none !important;
    }

    .fx-preloader,
    .fx-spark {
        display: none !important;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
    }
}
