/* Modern Light Theme Custom Styles */

/* Typography polish */
h1, h2, h3 {
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

/* Noise Texture Overlay - optimized with GPU layer */
.bg-noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    /* Force GPU compositing - prevents repaint on scroll */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Fade in animation (Base) */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fade-in-up {
    opacity: 1; /* Default visible for no-JS fallback */
    animation-fill-mode: forwards;
}

/* Only hide elements when JS is ready to animate them */
.js-ready .fade-in-up {
    opacity: 0;
}

.fade-in-up.visible,
.js-ready .fade-in-up.visible {
    animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fallback: show content if animation doesn't trigger within 3s */
@media (prefers-reduced-motion: reduce) {
    .fade-in-up,
    .js-ready .fade-in-up {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

/* Staggered Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* Spotlight Effect */
.spotlight-card {
    position: relative;
    overflow: hidden;
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.9); /* slate-200 */
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.spotlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 1px;
    width: 100%;
    background: radial-gradient(
        700px circle at var(--mouse-x) var(--mouse-y),
        rgba(59, 130, 246, 0.28),
        transparent 45%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.spotlight-card:hover::before {
    opacity: 1;
}

.spotlight-card:hover {
    transform: translateY(-2px);
    border-color: rgba(148, 163, 184, 0.7); /* slate-400 */
    box-shadow: 0 18px 45px -18px rgba(2, 6, 23, 0.18), 0 1px 0 rgba(2, 6, 23, 0.04);
}

/* Shimmer Button */
@keyframes shimmer {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.shimmer-btn {
    background: linear-gradient(110deg, #0f172a 45%, #1e293b 55%, #0f172a);
    background-size: 200% 100%;
    animation: shimmer 4s linear infinite;
    animation-play-state: paused;
    will-change: background-position, transform;
}

.shimmer-btn:hover {
    animation-play-state: running;
}

/* Tech Grid Background */
.bg-grid-pattern {
    /* Disabled: grid pattern removed from design */
    background-image: none !important;
    mask-image: none;
    -webkit-mask-image: none;
}

/* Aurora Hero Effect */
@keyframes aurora {
    0% { background-position: 50% 50%, 50% 50%; }
    100% { background-position: 350% 50%, 350% 50%; }
}

.aurora-bg {
    background-image:
        radial-gradient(at 10% 20%, rgba(59, 130, 246, 0.35) 0, transparent 55%),
        radial-gradient(at 60% 10%, rgba(29, 78, 216, 0.26) 0, transparent 55%),
        radial-gradient(at 90% 30%, rgba(2, 6, 23, 0.10) 0, transparent 60%);
    filter: blur(60px); /* Reduced from 80px */
    opacity: 0.35;
    contain: layout style paint;
}

/* Hero animated background (AI-ish mesh blobs, subtle) */
@keyframes hero-blob-1 {
    0% { transform: translate3d(-10%, -8%, 0) scale(1); }
    40% { transform: translate3d(8%, -12%, 0) scale(1.08); }
    70% { transform: translate3d(-6%, 10%, 0) scale(0.96); }
    100% { transform: translate3d(-10%, -8%, 0) scale(1); }
}

@keyframes hero-blob-2 {
    0% { transform: translate3d(12%, 6%, 0) scale(1); }
    35% { transform: translate3d(-8%, 12%, 0) scale(1.06); }
    75% { transform: translate3d(6%, -10%, 0) scale(0.94); }
    100% { transform: translate3d(12%, 6%, 0) scale(1); }
}

@keyframes hero-blob-3 {
    0% { transform: translate3d(0%, 0%, 0) scale(1); }
    50% { transform: translate3d(6%, -6%, 0) scale(1.04); }
    100% { transform: translate3d(0%, 0%, 0) scale(1); }
}

.hero-ai-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* keep background behind content but above page */
    z-index: 0;
    opacity: 0.7;
    isolation: isolate;
}

.hero-network {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.7;
    mix-blend-mode: normal;
    filter: blur(0px);
    z-index: 2;
}

/* Retro overlay (CRT scanlines + subtle VHS drift) */
@keyframes hero-scanlines {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 140px, 0 0; }
}

/* VHS drift without hue-rotate (saves GPU) */
@keyframes hero-vhs-drift {
    0% { transform: translate3d(0, 0, 0); }
    33% { transform: translate3d(0.6px, -0.4px, 0); }
    66% { transform: translate3d(-0.5px, 0.3px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.hero-retro {
    /* Fully disabled for scroll performance */
    display: none !important;
}

.hero-retro::after {
    /* tiny “RGB edge” feel, extremely subtle */
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.14;
    mix-blend-mode: color;
    background:
        linear-gradient(90deg,
            rgba(59,130,246,0.10),
            rgba(255,255,255,0) 18%,
            rgba(255,255,255,0) 82%,
            rgba(2,6,23,0.10)
        );
}

.hero-ai-blob {
    position: absolute;
    width: 720px;
    height: 520px;
    border-radius: 9999px;
    filter: blur(70px); /* Reduced from 90px for GPU perf */
    mix-blend-mode: multiply;
    will-change: transform;
    z-index: 1;
    contain: layout style paint; /* Isolate repaints */
}

.hero-ai-blob-1 {
    top: -18%;
    left: 12%;
    background: radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.35), transparent 62%);
    animation: hero-blob-1 18s ease-in-out infinite;
}

.hero-ai-blob-2 {
    top: -12%;
    right: 8%;
    background: radial-gradient(circle at 30% 30%, rgba(29, 78, 216, 0.26), transparent 62%);
    animation: hero-blob-2 22s ease-in-out infinite;
}

.hero-ai-blob-3 {
    bottom: -22%;
    left: 42%;
    background: radial-gradient(circle at 35% 30%, rgba(2, 6, 23, 0.16), transparent 62%);
    animation: hero-blob-3 26s ease-in-out infinite;
}

@media (max-width: 1023px) {
    .hero-ai-bg { opacity: 0.55; }
    .hero-ai-blob { filter: blur(50px); } /* Reduced for mobile GPU */
    .hero-retro { opacity: 0.22; }
}

@media (max-width: 767px) {
    .hero-ai-blob { 
        filter: blur(40px);
        width: 400px;
        height: 300px;
    }
    .hero-retro {
        animation: none; /* Disable on mobile for battery */
        opacity: 0.15;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* GPU acceleration for fixed/sticky elements */
header {
    transform: translateZ(0);
    backface-visibility: hidden;
    /* Semi-transparent without blur for smooth scrolling */
    background: rgba(255, 255, 255, 0.90) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Reduce backdrop-blur cost */
.will-change-transform {
    will-change: transform;
    transform: translateZ(0);
}

/* Hero section GPU layer */
#hero {
    transform: translateZ(0);
    contain: layout style;
}

/* Skip rendering off-screen sections */
#why-us, #team, #services, #testimonials, #how-we-work, #contact {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
}

.hero-ai-bg {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Tab buttons */
.tab-btn {
    transition: all 0.3s ease;
    color: #64748b;
}

.tab-btn:hover {
    color: #0f172a;
}

.tab-btn.active {
    background: white;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

/* Segmented control (product-style tabs) */
.tabs-pill .tab-btn.active {
    background: transparent;
    box-shadow: none;
}

.tabs-pill .tab-btn {
    border-radius: 0.75rem;
}

.tabs-pill-indicator {
    width: 0px;
    transform: translateX(0px);
}

/* Team avatars with image fallback */
.team-avatar {
    width: 112px;
    height: 112px;
    min-width: 112px;
    min-height: 112px;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.15), transparent 55%),
                radial-gradient(circle at 80% 60%, rgba(99, 102, 241, 0.12), transparent 55%),
                #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
    display: grid;
    place-items: center;
}

.team-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.team-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

@media (max-width: 430px) {
    .team-avatar {
        width: 88px;
        height: 88px;
        min-width: 88px;
        min-height: 88px;
    }
}

/* Content tab transitions */
.content-tab {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.content-tab.active {
    display: grid;
    animation: tabFadeIn 0.4s ease forwards;
}

/* Mobile-first grid for tabs */
@media (max-width: 767px) {
    .content-tab.active {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form focus effects */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Bento Grid Classes */
.bento-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading { animation: spin 1s linear infinite; }

/* Footer contacts - увеличенный шрифт */
.footer-contacts {
    font-size: 1.125rem; /* ~18px, 1.5x от базового sm */
}
.footer-contacts a {
    font-size: inherit;
}
@media (max-width: 767px) {
    .footer-contacts {
        font-size: 1rem;
    }
}

/* ===========================================
   MOBILE RESPONSIVE STYLES
   iPhone 12/13/14: 390px width
   iPhone SE: 375px width
   Small Android: 360px width
   =========================================== */

/* Extra small screens (iPhone SE and smaller) */
@media (max-width: 389px) {
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Small mobile screens (up to iPhone 14) */
@media (max-width: 430px) {
    /* Reduce container padding */
    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    /* Hero section adjustments */
    #hero h1,
    .text-6xl {
        font-size: 2.25rem !important; /* 36px */
        line-height: 1.1 !important;
    }
    
    /* Reduce section padding on mobile */
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    /* Form adjustments */
    form {
        padding: 1.25rem !important;
    }
    
    /* Card padding */
    .spotlight-card,
    .bento-card {
        padding: 1.25rem !important;
    }
    
    /* Button full width on very small screens */
    form button[type="submit"] {
        width: 100%;
        margin-top: 1rem;
    }
    
    /* Privacy checkbox flex fix */
    form .flex-wrap {
        flex-direction: column;
        align-items: stretch;
    }
}

/* General mobile styles */
@media (max-width: 767px) {
    /* Header */
    header nav {
        padding: 0.75rem 1rem;
    }
    
    /* Hero section */
    #hero {
        padding-top: 6rem;
        padding-bottom: 3rem;
    }
    
    #hero h1 {
        font-size: 2.5rem;
        line-height: 1.1;
    }
    
    #hero p {
        font-size: 1rem;
    }
    
    /* Bento grid - single column on mobile */
    #why-us .grid {
        display: flex;
        flex-direction: column;
        height: auto !important;
    }
    
    #why-us .grid > div {
        height: auto !important;
        min-height: auto !important;
    }
    
    /* Section headings */
    h2.text-4xl,
    h2.text-5xl,
    .text-4xl {
        font-size: 1.75rem !important;
    }
    
    h2.text-3xl,
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    /* Results grid on stats sections */
    .grid-cols-3,
    .md\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    /* Numbers/Stats */
    .text-4xl.font-bold {
        font-size: 2rem;
    }
    
    /* Footer */
    footer .flex-col {
        gap: 0.5rem;
    }
    
    /* Tab buttons container */
    #services .bg-slate-100 {
        width: 100%;
    }
    
    #services .bg-slate-100 button {
        flex: 1;
        text-align: center;
    }
    
    /* Mobile menu animation */
    #mobile-menu {
        animation: slideDown 0.2s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Testimonials cards */
    #testimonials .grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* How we work section */
    #how-we-work .sticky {
        position: relative;
        top: 0;
    }
    
    /* Contact form */
    #contact form {
        padding: 1.5rem;
        border-radius: 1.5rem;
    }
    
    #contact h2 {
        font-size: 1.75rem !important;
    }
    
    /* Breadcrumbs wrap */
    nav.flex.mb-8 {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* Medium tablets */
@media (min-width: 768px) and (max-width: 1023px) {
    #hero h1 {
        font-size: 3.5rem;
    }
    
    .grid.md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ensure touch targets are large enough (44px minimum) */
@media (pointer: coarse) {
    button,
    a,
    input,
    textarea,
    select {
        min-height: 44px;
    }
    
    nav ul li a {
        padding: 0.75rem 1rem;
    }
    
    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* Hover/mouse effects don't translate well to touch */
    .spotlight-card::before {
        display: none;
    }
    .spotlight-card:hover {
        transform: none;
    }
}

/* Fix for iOS Safari 100vh issue */
@supports (-webkit-touch-callout: none) {
    #hero {
        min-height: -webkit-fill-available;
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Ensure images don't overflow */
img, video, svg {
    max-width: 100%;
    height: auto;
}

/* Reduce motion: disable decorative animations */
@media (prefers-reduced-motion: reduce) {
    .shimmer-btn {
        animation: none !important;
    }
    .hero-network {
        animation: none !important;
    }
    .hero-retro {
        animation: none !important;
    }
    .hero-ai-blob {
        animation: none !important;
    }
    .spotlight-card,
    .spotlight-card:hover {
        transition: none !important;
        transform: none !important;
    }
}

/* Pause animations during scroll (toggled by JS) */
.is-scrolling .hero-ai-blob,
.is-scrolling .hero-retro {
    animation-play-state: paused !important;
}

.is-scrolling .hero-network {
    opacity: 0.3;
}
