/* Custom Animations & Styles for Samalytics */

/* ============================================
   PREMIUM TYPOGRAPHY
   ============================================ */

.font-heading {
    line-height: 0.92;
    letter-spacing: -0.03em;
}

h1, h2, h3 {
    letter-spacing: -0.02em;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

/* Spring easing curve */
:root {
    --spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.6%, 1);
}

.reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 1s var(--spring), transform 1s var(--spring);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 1s var(--spring), transform 1s var(--spring);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 1s var(--spring), transform 1s var(--spring);
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Clip-path text reveal (bottom to top) */
.reveal-clip {
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1.2s var(--spring);
}

.reveal-clip.visible {
    clip-path: inset(0 0 0 0);
}

/* Scale reveal */
.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s var(--spring), transform 0.8s var(--spring);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger children — each child gets a progressive delay */
.stagger > * {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--spring), transform 0.8s var(--spring);
}

.stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.stagger.visible > *:nth-child(2) { transition-delay: 0.08s; }
.stagger.visible > *:nth-child(3) { transition-delay: 0.16s; }
.stagger.visible > *:nth-child(4) { transition-delay: 0.24s; }
.stagger.visible > *:nth-child(5) { transition-delay: 0.32s; }
.stagger.visible > *:nth-child(6) { transition-delay: 0.4s; }

.stagger.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   PAGE-LEVEL AMBIENT BACKGROUND
   ============================================ */

.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Hero divider line */
.hero-divider {
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(95, 109, 227, 0.3) 30%, rgba(38, 188, 164, 0.3) 70%, transparent);
    z-index: 5;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(95, 109, 227, 0.5), 0 0 40px rgba(95, 109, 227, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(95, 109, 227, 0.8), 0 0 60px rgba(95, 109, 227, 0.5);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #5f6de3;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7d8ae8;
}

/* Glass Morphism Effects */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Service Card Hover Effects */
.service-card {
    perspective: 1000px;
}

.service-card:hover .glass-card {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #5f6de3 0%, #26bca4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Button Hover Effects */
button, a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
html:not(.dark) {
    background: #ffffff;
    color: #1a1a1a;
}

html:not(.dark) body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf2 100%);
    color: #1a1a1a;
}

html:not(.dark) header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

html:not(.dark) .glass-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

html:not(.dark) nav a {
    color: #1a1a1a;
}

html:not(.dark) .title-line {
    color: #1a1a1a;
}

html:not(.dark) .slide-description,
html:not(.dark) .slide-cta {
    color: #1a1a1a;
}

html:not(.dark) nav a:hover {
    color: #5f6de3;
}

html:not(.dark) .text-white {
    color: #1a1a1a !important;
}

html:not(.dark) .text-white\/80 {
    color: rgba(26, 26, 26, 0.8) !important;
}

html:not(.dark) .text-white\/70 {
    color: rgba(26, 26, 26, 0.7) !important;
}

html:not(.dark) .text-white\/60 {
    color: rgba(26, 26, 26, 0.6) !important;
}

/* Noise Texture Overlay */
.noise-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZmlsdGVyIGlkPSJub2lzZSI+PGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9IjAuOCIgbnVtT2N0YXZlcz0iNCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNub2lzZSkiIG9wYWNpdHk9IjAuMDUiLz48L3N2Zz4=');
    opacity: 0.5;
    pointer-events: none;
}

/* Custom Selection */
::selection {
    background: #5f6de3;
    color: white;
}

::-moz-selection {
    background: #5f6de3;
    color: white;
}

/* Focus States */
a:focus, button:focus {
    outline: 2px solid #5f6de3;
    outline-offset: 2px;
}

/* Responsive Typography */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
}

/* Loading Animation for Images */
img {
    opacity: 0;
    animation: fade-in 0.6s ease-out forwards;
}

/* Card Grid Stagger Animation */
.service-card:nth-child(1) { animation-delay: 0.1s; }
.service-card:nth-child(2) { animation-delay: 0.2s; }
.service-card:nth-child(3) { animation-delay: 0.3s; }
.service-card:nth-child(4) { animation-delay: 0.4s; }
.service-card:nth-child(5) { animation-delay: 0.5s; }
.service-card:nth-child(6) { animation-delay: 0.6s; }
.service-card:nth-child(7) { animation-delay: 0.7s; }
.service-card:nth-child(8) { animation-delay: 0.8s; }
.service-card:nth-child(9) { animation-delay: 0.9s; }
.service-card:nth-child(10) { animation-delay: 1s; }
.service-card:nth-child(11) { animation-delay: 1.1s; }
.service-card:nth-child(12) { animation-delay: 1.2s; }

/* Glow Ring Effect */
@keyframes glow-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(95, 109, 227, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(95, 109, 227, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(95, 109, 227, 0);
    }
}

.glow-ring {
    animation: glow-ring 2s infinite;
}

/* Improved Mobile Menu Transition */
#mobile-menu {
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

#mobile-menu.active {
    max-height: 300px;
    opacity: 1;
}

/* Backdrop Blur Support Check */
@supports not (backdrop-filter: blur(10px)) {
    .glass-card {
        background: rgba(255, 255, 255, 0.15);
    }

    html:not(.dark) .glass-card {
        background: rgba(255, 255, 255, 0.95);
    }
}

/* Print Styles */
@media print {
    header {
        position: relative;
    }

    .no-print {
        display: none;
    }
}

/* ============================================
   HERO CAROUSEL STYLES
   ============================================ */

.hero-carousel-wrapper {
    position: relative;
    width: 100vw;
    overflow: hidden;
    padding-top: 4rem;
}

.hero-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(100%);
    transition: all 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    padding: 2rem 0 4rem;
}

.carousel-slide.active {
    opacity: 1;
    transform: translateX(0);
    z-index: 2;
}

.carousel-slide.prev {
    transform: translateX(-100%);
    opacity: 0;
    z-index: 1;
}

.slide-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.slide-content {
    position: relative;
    z-index: 10;
}

.slide-label {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.2s;
}

.carousel-slide.active .slide-label {
    opacity: 1;
    transform: translateY(0);
}

.title-line {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 1s cubic-bezier(0.65, 0, 0.35, 1);
}

.carousel-slide.active .title-line:nth-child(1) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.4s;
}

.carousel-slide.active .title-line:nth-child(2) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.6s;
}

.slide-description {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.8s;
}

.carousel-slide.active .slide-description {
    opacity: 1;
    transform: translateY(0);
}

.slide-cta {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.65, 0, 0.35, 1) 1s;
}

.carousel-slide.active .slide-cta {
    opacity: 1;
    transform: translateY(0);
}

.carousel-slide.active .glass-card {
    animation: fade-in 0.8s ease-out forwards;
    animation-delay: 1.2s;
}

/* Carousel Dots */
.carousel-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5rem;
    z-index: 100;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.65, 0, 0.35, 1);
    position: relative;
    padding: 0;
}

.dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5f6de3;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.dot.active {
    border-color: #5f6de3;
    transform: scale(1.3);
}

.dot.active::before {
    transform: translate(-50%, -50%) scale(1);
}

.dot:hover:not(.active) {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.15);
}

/* Progress Bar */
.carousel-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 99;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #5f6de3, #26bca4);
    width: 0%;
    transition: width 0.1s linear;
}

/* Responsive Carousel */
@media (max-width: 768px) {
    .hero-carousel-wrapper {
        padding-top: 4rem;
    }

    .carousel-slide {
        padding: 2rem 0;
    }

    .carousel-dots {
        bottom: 2rem;
        gap: 1rem;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    .dot::before {
        width: 5px;
        height: 5px;
    }
}

@media (max-width: 480px) {
    .slide-label {
        font-size: 0.75rem;
    }

    .carousel-dots {
        gap: 0.75rem;
    }
}
