/**
 * Kisma Estate — Frontend UI effects
 */

/* ── Navbar scroll state ── */
.kisma-navbar {
    transition: box-shadow 0.35s ease, padding 0.35s ease, background-color 0.35s ease;
}

.kisma-navbar--scrolled {
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.94) !important;
}

html[data-theme="dark"] .kisma-navbar--scrolled {
    background: rgba(15, 23, 42, 0.92) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ── Hero entrance & slideshow ── */
.kisma-hero {
    overflow: hidden;
    isolation: isolate;
}

.kisma-hero > .container {
    position: relative;
    z-index: 2;
    transform: translate(var(--hero-parallax-x, 0px), var(--hero-parallax-y, 0px));
    transition: transform 0.4s ease-out;
}

.kisma-hero-bg {
    position: absolute;
    inset: -4%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 1.2s ease-in-out;
    will-change: opacity, transform;
}

.kisma-hero-bg.is-active {
    opacity: 1;
    animation: kisma-hero-kenburns 18s ease-in-out infinite alternate;
}

.kisma-hero--has-slideshow::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.45) 100%);
    pointer-events: none;
}

@keyframes kisma-hero-kenburns {
    from { transform: scale(1.04); }
    to   { transform: scale(1.1); }
}

.kisma-hero:not(.kisma-hero--animated) h1,
.kisma-hero:not(.kisma-hero--animated) .lead,
.kisma-hero:not(.kisma-hero--animated) .btn {
    opacity: 0;
    transform: translateY(28px);
}

.kisma-hero--animated h1 {
    animation: kisma-hero-fade-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.kisma-hero--animated .lead {
    animation: kisma-hero-fade-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

.kisma-hero--animated .btn:nth-of-type(1) {
    animation: kisma-hero-fade-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

.kisma-hero--animated .btn:nth-of-type(2) {
    animation: kisma-hero-fade-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.52s both;
}

@keyframes kisma-hero-fade-up {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── About page hero entrance ── */
.kisma-about-hero__content > * {
    opacity: 0;
    transform: translateY(22px);
}
.kisma-about-hero--ready .kisma-about-hero__badge {
    animation: kisma-hero-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.kisma-about-hero--ready .kisma-about-hero__title {
    animation: kisma-hero-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}
.kisma-about-hero--ready .kisma-about-hero__subtitle {
    animation: kisma-hero-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

@media (prefers-reduced-motion: reduce) {
    .kisma-about-hero__content > * {
        opacity: 1;
        transform: none;
        animation: none !important;
    }
}

/* ── Property cards — enhanced hover ── */
.kisma-property-card,
.kisma-property-listing-card {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.kisma-property-card:hover,
.kisma-property-listing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
}

.kisma-property-card .card-img-top,
.kisma-property-listing-card .kisma-property-card-image-wrap img {
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.kisma-property-card:hover .card-img-top,
.kisma-property-listing-card:hover .kisma-property-card-image-wrap img {
    transform: scale(1.06);
}

.kisma-property-card .card-img-top,
.kisma-property-listing-card .kisma-property-card-image-wrap {
    overflow: hidden;
}

/* ── Image load fade ── */
.kisma-img-loading {
    opacity: 0;
    transform: scale(1.03);
}

.kisma-img-loaded {
    animation: kisma-img-reveal 0.55s ease forwards;
}

@keyframes kisma-img-reveal {
    from { opacity: 0; transform: scale(1.03); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Section titles underline draw ── */
.kisma-section-title h2,
.kisma-about-title {
    position: relative;
    display: inline-block;
}

[data-kisma-reveal].is-visible .kisma-section-title h2::after,
[data-kisma-reveal].is-visible .kisma-about-title::after,
.kisma-about-section.is-visible .kisma-about-title::after,
[data-kisma-reveal].is-visible.kisma-about-section .kisma-about-title::after {
    transform: scaleX(1);
}

.kisma-section-title h2::after,
.kisma-about-title::after {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    margin-top: 0.45rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--kisma-gold, #c9a227), transparent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

html[dir="rtl"] .kisma-section-title h2::after,
html[dir="rtl"] .kisma-about-title::after {
    transform-origin: right center;
}

/* ── Stats cards hover lift ── */
.kisma-home-stat-card {
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.kisma-home-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 36px rgba(15, 23, 42, 0.14);
}

/* ── Back to top ── */
.kisma-back-top {
    position: fixed;
    right: 1.25rem;
    bottom: 5.5rem;
    z-index: 1040;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--kisma-gold, #c9a227) 0%, #e8c547 100%);
    color: var(--kisma-navy, #0f172a);
    box-shadow: 0 8px 24px rgba(201, 162, 39, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.9);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s, box-shadow 0.25s;
}

.kisma-back-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.kisma-back-top:hover {
    box-shadow: 0 12px 28px rgba(201, 162, 39, 0.55);
    transform: translateY(-2px) scale(1.04);
}

.kisma-back-top:active {
    transform: translateY(0) scale(0.96);
}

/* ── Flash alerts ── */
.kisma-flash-alert {
    position: relative;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    padding-right: 2.75rem !important;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.kisma-flash-alert.is-shown {
    opacity: 1;
    transform: translateY(0);
}

.kisma-flash-alert.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.kisma-flash-close {
    position: absolute;
    top: 0.55rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    opacity: 0.55;
    cursor: pointer;
    padding: 0 0.25rem;
}

.kisma-flash-close:hover {
    opacity: 1;
}

/* ── Button ripple ── */
.kisma-btn-ripple {
    position: relative;
    overflow: hidden;
}

.kisma-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    animation: kisma-ripple-spread 0.65s ease-out forwards;
}

@keyframes kisma-ripple-spread {
    from { transform: scale(0); opacity: 0.65; }
    to   { transform: scale(2.6); opacity: 0; }
}

/* ── CTA section pulse glow ── */
.kisma-cta-section {
    position: relative;
    overflow: hidden;
}

.kisma-cta-section::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at 50% 50%, rgba(201, 162, 39, 0.18) 0%, transparent 55%);
    animation: kisma-cta-glow 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes kisma-cta-glow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%      { transform: scale(1.15); opacity: 1; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .kisma-hero-bg.is-active,
    .kisma-hero--animated h1,
    .kisma-hero--animated .lead,
    .kisma-hero--animated .btn,
    .kisma-img-loaded,
    .kisma-cta-section::before {
        animation: none !important;
    }

    .kisma-hero:not(.kisma-hero--animated) h1,
    .kisma-hero:not(.kisma-hero--animated) .lead,
    .kisma-hero:not(.kisma-hero--animated) .btn {
        opacity: 1;
        transform: none;
    }

    .kisma-property-card:hover,
    .kisma-property-listing-card:hover,
    .kisma-home-stat-card:hover {
        transform: none;
    }

    [data-kisma-reveal] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
