/* assets/css/main.css */

:root {
    --bg-color: #050505;
    --accent-color: #5d65d5;
    --primary-text: #ffffff;
    --secondary-text: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(93, 101, 213, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
}

/* ─── Content Protection ────────────────────────────────────────────────── */
/* Disable text selection across the entire page */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Prevent images from being dragged/saved via drag */
img {
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Re-enable pointer events only for interactive elements */
a,
button,
input,
textarea,
select,
.card-show-more,
.btn-dive-in,
.btn-back {
    pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────────────────── */

body {
    background-color: var(--bg-color);
    color: var(--primary-text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
    cursor: none;
    /* Custom cursor */
}

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

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Glassmorphism Cards with Thin Edge Glow */
.glass-card {
    position: relative;
    background:
        /* Glow spot behind top-right line center */
        radial-gradient(ellipse 200px 60px at 66% -2%, rgba(93, 101, 213, 0.4) 0%, transparent 70%),
        /* Glow spot behind bottom-left line center */
        radial-gradient(ellipse 200px 60px at 33% calc(100% + 2px), rgba(93, 101, 213, 0.4) 0%, transparent 70%),
        /* Base card background */
        linear-gradient(145deg, rgba(15, 15, 20, 0.98) 0%, rgba(5, 5, 5, 1) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    overflow: visible;
    transition: background 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    z-index: 1;
}

/* Dimmed state for non-hovered cards — desktop only */
@media (min-width: 768px) {

    .expertise-card.dimmed,
    .card-wrapper.dimmed .card-number {
        opacity: 0.3;
        filter: grayscale(0.5) brightness(0.7);
        transform: scale(0.98);
    }
}

/* Top line — right 2/3 of top edge */
.glass-card::before {
    content: "";
    position: absolute;
    top: -1px;
    right: 20px;
    /* start after the border-radius curve */
    width: calc(66% - 20px);
    height: 1px;
    background: linear-gradient(to left, transparent, var(--accent-color) 20%, #fff 50%, var(--accent-color) 80%, transparent);
    box-shadow: 0 -10px 40px 2px rgba(93, 101, 213, 0.7),
        0 -3px 15px 1px rgba(165, 180, 252, 0.5);
    pointer-events: none;
    z-index: 2;
}

/* Bottom line — left 2/3 of bottom edge */
.glass-card::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 20px;
    /* start after the border-radius curve */
    width: calc(66% - 20px);
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-color) 20%, #fff 50%, var(--accent-color) 80%, transparent);
    box-shadow: 0 10px 40px 2px rgba(93, 101, 213, 0.7),
        0 3px 15px 1px rgba(165, 180, 252, 0.5);
    pointer-events: none;
    z-index: 2;
}

/* Vertical shift moved to GSAP in animations.js to avoid property conflicts */

@media (min-width: 768px) {
    .glass-card:hover::before {
        box-shadow: 0 -15px 50px 5px rgba(93, 101, 213, 0.9),
            0 -5px 20px 2px rgba(165, 180, 252, 0.6);
    }

    .glass-card:hover::after {
        box-shadow: 0 15px 50px 5px rgba(93, 101, 213, 0.9),
            0 5px 20px 2px rgba(165, 180, 252, 0.6);
    }
}

/* Large Decorative Card Numbers */
.card-wrapper {
    position: relative;
    height: 100%;
}

.card-wrapper .glass-card {
    height: 100%;
}

.card-number {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 12rem;
    font-variant-numeric: lining-nums;
    /* Force same height baseline if supported */
    line-height: 1;
    color: rgba(93, 101, 213, 0.5);
    pointer-events: none;
    user-select: none;
    z-index: 2;
    /* In front of the card */
    will-change: transform, opacity;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-number-left {
    left: -50px;
}

.card-number-right {
    right: -50px;
}

.card-number-top {
    font-size: 12rem;
    /* Compensating for font's optical height difference for 1 & 2 */
    top: -70px;
}

.card-number-bottom {
    bottom: -40px;
}

/* Detailed Section Decorative Numbers - Base Styles */
.detail-section-number {
    position: absolute;
    font-size: 14rem;
    line-height: 1;
    color: rgba(93, 101, 213, 0.5);
    top: 2rem;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.detail-number-left {
    left: -7rem;
}

.detail-number-right {
    right: -7rem;
}


/* Card Icon Styling */
.card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(93, 101, 213, 0.1);
    border-radius: 12px;
    color: var(--accent-color);
    transition: all 0.4s ease;
    border: 1px solid rgba(93, 101, 213, 0.2);
    box-shadow: 0 0 15px rgba(93, 101, 213, 0.1);
}

@media (min-width: 768px) {
    .expertise-card:hover .card-icon {
        transform: scale(1.1) rotate(5deg);
        background: rgba(93, 101, 213, 0.2);
        color: #fff;
        box-shadow: 0 0 25px rgba(93, 101, 213, 0.4);
    }
}

.card-icon svg {
    filter: drop-shadow(0 0 5px rgba(93, 101, 213, 0.4));
}

/* Show More Button */
.card-show-more,
.card-show-more *,
.btn-dive-in,
.btn-dive-in * {
    cursor: pointer !important;
}

.card-show-more {
    position: absolute;
    bottom: 10px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #a5b4fc;
    background: rgba(93, 101, 213, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 100px;
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 3;
    cursor: pointer !important;
}

.card-show-more:hover {
    color: #fff;
    background: rgba(93, 101, 213, 0.25);
    border-color: rgba(93, 101, 213, 0.7);
    box-shadow: 0 0 20px rgba(93, 101, 213, 0.3);
}

.card-show-more:hover svg {
    transform: translateX(3px);
}

.card-show-more svg {
    transition: transform 0.3s ease;
}

@media (max-width: 767px) {
    .card-show-more {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
        /* base style has pointer-events:none for desktop hover logic */
    }

    /* Reserve space at the bottom of each card so the
       absolute-positioned "Show more" button never overlaps text.
       Button height ≈ 28px + 10px bottom offset + 6px breathing room = 44px */
    #expertise .expertise-card {
        padding-bottom: 44px;
    }

    /* ── Detailed Expertise Sections — Mobile Layout ────────────────────── */

    /* 1. Make sections visible (GSAP scroll animations don't run on mobile) */
    .detail-text-content,
    .detail-visual {
        opacity: 1 !important;
        transform: none !important;
    }

    /* 2. Exactly screen height per section */
    .expertise-detail-section {
        height: 100vh;
        /* fallback */
        height: 100svh;
        /* real visible viewport on mobile */
        overflow: hidden;
        /* clip anything that exceeds the screen */
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Inner container fills the available flex space */
    .expertise-detail-section .max-w-6xl {
        flex: 1;
        min-height: 0;
        /* crucial: lets flex child shrink below content size */
        display: flex !important;
        flex-direction: column;
        justify-content: center;
    }

    /* 4. Image becomes absolute background on the right 2/3 of the section */
    .detail-visual {
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 66.666% !important;
        height: 100% !important;
        z-index: 0 !important;
        pointer-events: none;
    }

    /* 4a. Inner wrapper fills the visual div */
    .detail-visual>.relative {
        width: 100%;
        height: 100%;
    }

    /* 4b. Image fills the container as a cover */
    .detail-visual img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        opacity: 0.35;
    }

    /* 4c. Hide the glow blur element */
    .detail-visual>.relative>div.absolute {
        display: none;
    }

    /* 4d. Gradient fade: dark on left → transparent on right */
    .detail-visual::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(to right,
                rgba(5, 5, 5, 0.95) 5%,
                rgba(5, 5, 5, 0.4) 40%,
                transparent 100%);
        z-index: 1;
        pointer-events: none;
    }

    /* 5. Text content sits above the image */
    .detail-text-content {
        position: relative !important;
        z-index: 2;
        width: 100% !important;
    }

    /* 6. Section title smaller on mobile */
    .expertise-detail-section h2 {
        font-size: 1.9rem !important;
        line-height: 1.25 !important;
        margin-bottom: 1.5rem !important;
    }

    /* 7. Feature cards — single column on mobile */
    .expertise-detail-section .grid {
        grid-template-columns: 1fr !important;
    }

    /* 8. btn-back — in document flow, below the 4th feature card, right-aligned */
    .btn-back {
        display: inline-flex !important;
        position: static !important;
        /* out of absolute positioning, into flow */
        top: auto !important;
        bottom: auto !important;
        right: auto !important;
        left: auto !important;
        width: auto !important;
        margin-top: 1.25rem;
        margin-left: auto;
        /* right-align via auto left margin */
        pointer-events: auto !important;
        cursor: pointer !important;
        z-index: auto;
    }

    /* Wrap the btn-back in a flex row so margin-left: auto works */
    .detail-text-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    /* btn-back sits at the end of that flex column, pinned to the right */
    .detail-text-content .btn-back {
        align-self: flex-end;
    }

    .detail-section-number {
        display: block !important;
        opacity: 0.25 !important;
        color: #ffffff !important;
        font-size: 9rem !important;
        top: 1.2rem !important;
        right: -1.5rem !important;
        left: auto !important;
        z-index: 2 !important;
        transform: translateY(-50%) !important;
    }

    /* 9. Compact detail-feature cards: reduce vertical padding */
    .expertise-detail-section .detail-feature {
        padding: 0.75rem 1rem 0.75rem 2rem;
    }

    /* 10. Left accent bar: stretches to match title + text height at reduced padding */
    .expertise-detail-section .detail-feature::before {
        top: 0.75rem;
        bottom: 0.75rem;
        height: auto;
    }
}

/* Custom Cursor Halo (Follows real cursor) */
.cursor-dot {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    background-color: var(--accent-color);
    box-shadow: 0 0 12px 1px rgba(255, 255, 255, 0.4), 0 0 6px var(--accent-color);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9998;
    /* Just below real cursor interactions */
    opacity: 0.6;
    /* Semi-transparent so it doesn't block the real cursor */
    transition: opacity 0.3s ease;
}

/* Mouse Follower */
#mouse-follower {
    position: fixed;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, rgba(93, 101, 213, 0.08) 25%, rgba(93, 101, 213, 0) 60%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    transform: translate(-50%, -50%);
    transition: opacity 0.5s ease;
}

/* Hero Section Styles */
.hero-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.hero-shape {
    position: absolute;
    background: var(--accent-color);
    filter: blur(120px);
    opacity: 0.2;
    border-radius: 50%;
}

/* Typography Enhancements */
h1 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.text-secondary {
    color: var(--secondary-text);
}

.text-glow-accent {
    color: #a5b4fc;
    /* Lighter indigo/lavender */
    filter: drop-shadow(0.5px 0.5px 0px rgba(255, 255, 255, 0.4)) drop-shadow(-0.5px -0.5px 0px rgba(255, 255, 255, 0.4)) drop-shadow(0.5px -0.5px 0px rgba(255, 255, 255, 0.4)) drop-shadow(-0.5px 0.5px 0px rgba(255, 255, 255, 0.4));
}

/* Data Stream Particles */
.data-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--accent-color);
    border-radius: 50%;
    filter: blur(1px);
    box-shadow: 0 0 10px 2px var(--accent-color), 0 0 20px 4px rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
}

.data-line {
    position: absolute;
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color), 0 0 5px #fff;
    pointer-events: none;
    z-index: 0;
    border-radius: 2px;
}

/* Word Cloud Section */
#toolstack {
    position: relative;
}

#toolstack::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-color) 20%, #fff 50%, var(--accent-color) 80%, transparent);
    box-shadow: 0 -10px 40px rgba(93, 101, 213, 0.6), 0 0 15px rgba(165, 180, 252, 0.3);
    z-index: 5;
    pointer-events: none;
}

.word-cloud-container {
    padding: 2rem;
    min-height: 400px;
}

.cloud-word {
    display: inline-block;
    cursor: none;
    user-select: none;
    transition: color 0.4s ease;
    white-space: nowrap;
    position: relative;
    will-change: transform, color;
    font-family: var(--font-heading);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.cloud-word:hover {
    z-index: 100 !important;
}

/* Expertise Grid Hover Logic — desktop only */
@media (min-width: 768px) {
    .expertise-grid:hover .expertise-card:not(:hover) {
        opacity: 0.5;
        filter: grayscale(0.5) blur(1px);
    }
}

.expertise-card {
    /* Transitions removed for GSAP compatibility */
    transition: filter 0.4s ease;
}

/* Lenis optimization */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-scrolling iframe {
    pointer-events: none;
}

.hero-section {
    position: relative;
    min-height: 100vh;
    /* fallback для старых браузеров */
    min-height: 100svh;
    /* реальная высота без адресной строки на мобильных */
}

.hero-section::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-color) 20%, #fff 50%, var(--accent-color) 80%, transparent);
    box-shadow: 0 -10px 40px rgba(93, 101, 213, 0.6), 0 0 15px rgba(165, 180, 252, 0.3);
    z-index: 5;
    pointer-events: none;
}


.expertise-detail-section {
    position: relative;
    /* Removed static border, will use glow pseudo-elements */
}

.expertise-detail-section::before,
.expertise-detail-section::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 1px;
    z-index: 5;
    pointer-events: none;
}

.expertise-detail-section::before {
    top: 0;
    background: linear-gradient(to left, transparent, var(--accent-color) 20%, #fff 50%, var(--accent-color) 80%, transparent);
    box-shadow: 0 10px 40px rgba(93, 101, 213, 0.6), 0 0 15px rgba(165, 180, 252, 0.3);
}

.expertise-detail-section::after {
    bottom: 0;
    background: linear-gradient(to right, transparent, var(--accent-color) 20%, #fff 50%, var(--accent-color) 80%, transparent);
    box-shadow: 0 -10px 40px rgba(93, 101, 213, 0.6), 0 0 15px rgba(165, 180, 252, 0.3);
}


.detail-feature {
    position: relative;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    transition: all 0.4s ease;
}

.detail-feature::before {
    content: "";
    position: absolute;
    left: 1rem;
    top: 1.5rem;
    /* Above the top of title text */
    bottom: 1.2rem;
    /* Below the bottom of content text */
    width: 4px;
    background: var(--accent-color);
    border-radius: 10px;
    opacity: 0.6;
    transition: all 0.4s ease;
}

.detail-feature:hover::before {
    opacity: 1;
    height: calc(100% - 2.5rem);
    top: 1.25rem;
    box-shadow: 0 0 10px var(--accent-color);
}

.detail-feature:hover {
    background: rgba(93, 101, 213, 0.05);
    border-color: rgba(93, 101, 213, 0.2);
    transform: translateY(-5px);
}

.btn-back {
    position: absolute;
    top: calc(100% + 1rem);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #a5b4fc;
    background: rgba(93, 101, 213, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer !important;
    z-index: 10;
}

.btn-back:hover {
    color: #fff;
    background: rgba(93, 101, 213, 0.25);
    border-color: rgba(93, 101, 213, 0.7);
    box-shadow: 0 0 20px rgba(93, 101, 213, 0.3);
}

.btn-back svg {
    transition: transform 0.3s ease;
}

.btn-back:hover svg {
    transform: translateY(-3px);
}

@media (min-width: 768px) and (max-width: 1024px) {
    .detail-section-number {
        font-size: 10rem;
        opacity: 0.1 !important;
        top: 1rem;
    }
}