/* --- KyivProject Partners Section (Frosted Glass Static Backplate & Floating Dynamic Island Capsule) --- */

/* Page layout overrides to shift contents higher and ensure partners is fully visible */
.content {
    padding-top: 100px !important;
    transition: padding-top 0.3s ease;
}

.team-section {
    padding-top: 40px !important;
    padding-bottom: 20px !important;
}

.team-section .section-title {
    margin-bottom: 30px !important;
}

/* Full-width Viewport Collider wrapper to capture scroll gestures anywhere horizontally aligned with the partners card */
.partners-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

/* 1. Static Background Card (Perfect replica of .team-category, spanning two blocks) */
.partners-section {
    width: 100%;
    max-width: 580px;
    /* Aligns exactly with two columns of the team grid */
    margin: 30px auto 40px;
    /* Perfectly centered between the cards above and the footer below */

    /* KyivProject Signature Glassmorphism - EXACTLY matching .team-category */
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 16px 40px 24px;
    /* Shifted title higher inside the card (top padding reduced from 30px to 16px) */
    box-shadow: 0 10px 30px var(--shadow-color);
    box-sizing: border-box;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
    /* Essential for the ::after hover buffer */

    /* Transition for fluid, premium morphing curves AND native hover effects */
    transition:
        max-width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        padding 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 0.5s ease,
        border-color 0.5s ease,
        box-shadow 0.5s ease;
}

/* Invisible hover buffer to completely eliminate border hover jitter/twitching when card shifts up */
.partners-section::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -20px;
    /* Extends below the card so hover is preserved when card shifts up by -8px */
    pointer-events: auto;
    z-index: -1;
}

.partners-section.expanded {
    max-width: 740px;
    /* Fluidly expands to beautifully fit the detailed card */
    padding: 24px 32px;
}

[data-theme="dark"] .partners-section {
    background: rgba(41, 37, 36, 0.4);
    /* DARKER background, matching .team-category exactly! */
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Eliminate Chromium's sub-pixel rendering blur on text by forcing scale(1) instead of scale(1.02) during hover */
.partners-section:hover {
    transform: translateY(-8px) scale(1) !important;
    border-color: rgba(249, 134, 82, 0.35) !important;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.35),
        0 0 30px rgba(249, 134, 82, 0.12) !important;
}

/* Category specific colors for Partners (KyivProject brand warm orange gradient) */
.category-partners {
    --cat-color: #f98652;
    --cat-bg: rgba(249, 134, 82, 0.1);
}

/* 2. Dynamic Island Container (Sleek wrap-content layout) */
.dynamic-island-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 52px;
    /* Sleek collapsed height to keep it compact */
    perspective: 1000px;
}

/* 3. The KyivProject Glassmorphic Dynamic Island Capsule (Matching .team-card exactly!) */
.dynamic-island {
    /* Collapsed Pill Dimensions */
    width: 100%;
    max-width: 320px;
    /* Perfect sleek capsule width */
    height: 52px;
    /* Authentic iOS pill height */
    border-radius: 100px;
    /* Pure capsule shape */

    /* KyivProject Signature Glassmorphism for the Island - MATCHING .team-card */
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.05),
        inset 0 1px 1px rgba(255, 255, 255, 0.02);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6px 16px;
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;

    /* Spring transition for smooth pliant iOS morphing curves */
    transition:
        width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        max-width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        height 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        border-radius 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        background 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease,
        transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    z-index: 100;
    box-sizing: border-box;
}

[data-theme="dark"] .dynamic-island {
    /* Premium dark theme glassmorphism - MATCHING [data-theme="dark"] .team-card exactly! */
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

.dynamic-island:hover {
    transform: scale(1.03) translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(249, 134, 82, 0.35);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.25),
        0 0 15px rgba(249, 134, 82, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* Expanded state dimensions inside the backplate - MATCHING .team-card styling! */
.dynamic-island.expanded {
    max-width: 680px;
    height: 260px;
    /* Fits perfectly inside the 260px container height */
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    padding: 20px 24px;
    cursor: default;
    box-shadow:
        0 20px 50px var(--shadow-color),
        0 0 25px rgba(249, 134, 82, 0.12);
    transform: none;
}

[data-theme="dark"] .dynamic-island.expanded {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Liquid morph squeeze effect during scrolling */
.dynamic-island.squeezing {
    transform: scaleX(1.05) scaleY(0.93);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* --- Content Layouts --- */

/* Collapsed Content */
.di-collapsed-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(1);
    pointer-events: auto;
}

.dynamic-island.expanded .di-collapsed-content {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    height: 0;
    overflow: hidden;
}

/* Dynamic Sliding Partner Content centered horizontally */
.di-dynamic-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: visible;
    padding: 0 4px;
    box-sizing: border-box;
}

.di-collapsed-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.di-logo-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.di-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

/* Logo Fallback (Gradient Pill with Initials) */
.di-logo-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f98652 0%, #d946ef 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 11px;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.di-name {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.1px;
    transition: color 0.3s ease;
}

.di-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 6px rgba(249, 134, 82, 0.4);
    margin-right: 4px;
    animation: diPulse 2s infinite alternate;
}

@keyframes diPulse {
    0% {
        opacity: 0.65;
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* --- Expanded Content --- */
.di-expanded-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Balanced compact gaps for the 260px height */
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
    transition:
        opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 0;
    overflow: hidden;
}

.dynamic-island.expanded .di-expanded-content {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    height: 100%;
    overflow: visible;
}

/* Header Inside Expanded */
.di-expanded-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.di-logo-large-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 4px 15px var(--shadow-color);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.di-logo-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.di-title-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.di-title-text h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.2px;
}

.di-title-text p {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    color: var(--accent-color);
    font-weight: 600;
    margin: 0;
    opacity: 0.95;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Close Icon inside Header */
.di-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] .di-close-btn {
    background: rgba(255, 255, 255, 0.08);
}

.di-close-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    transform: scale(1.1);
}

/* Description Text inside Expanded */
.di-expanded-desc {
    font-family: 'Outfit', sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
    text-align: left;
    height: 74px;
    /* Sized perfectly for 3 lines of reading content */
    overflow-y: auto;
    padding-right: 8px;
    padding-top: 2px;
    padding-bottom: 2px;
    box-sizing: border-box;

    /* Cinematic Edge Fade Haze Effect */
    mask-image: linear-gradient(to bottom,
            transparent 0%,
            black 12px,
            black calc(100% - 12px),
            transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom,
            transparent 0%,
            black 12px,
            black calc(100% - 12px),
            transparent 100%);
}

/* Custom Scrollbar for Description */
.di-expanded-desc::-webkit-scrollbar {
    width: 3px;
}

.di-expanded-desc::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Expanded Buttons Grid */
.di-expanded-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.di-btn {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-sizing: border-box;
}

.di-btn i {
    font-size: 14px;
}

/* YouTube Button */
.di-btn.btn-youtube {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.di-btn.btn-youtube:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
    transform: translateY(-1.5px);
}

/* Website (Сайт) Button */
.di-btn.btn-site {
    background: rgba(249, 134, 82, 0.12);
    border: 1px solid rgba(249, 134, 82, 0.25);
    color: var(--accent-color);
}

.di-btn.btn-site:hover {
    background: var(--accent-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(249, 134, 82, 0.3);
    transform: translateY(-1.5px);
}

/* TikTok Button */
.di-btn.btn-tiktok {
    background: rgba(238, 29, 82, 0.12);
    border: 1px solid rgba(238, 29, 82, 0.25);
    color: #ee1d52;
}

.di-btn.btn-tiktok:hover {
    background: #ee1d52;
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(238, 29, 82, 0.3);
    transform: translateY(-1.5px);
}

/* Discord Button */
.di-btn.btn-discord {
    background: rgba(88, 101, 242, 0.12);
    border: 1px solid rgba(88, 101, 242, 0.25);
    color: #5865f2;
}

.di-btn.btn-discord:hover {
    background: #5865f2;
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(88, 101, 242, 0.3);
    transform: translateY(-1.5px);
}

/* Disabled button state */
.di-btn.disabled {
    opacity: 0.25;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #78716c !important;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none !important;
    transform: none !important;
}

/* Expanded Footer Guide */
.di-expanded-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: auto;
    /* Pushes the guide lines perfectly to the bottom edge */
}

.di-guide-item {
    font-family: 'Outfit', sans-serif;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-secondary);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.2px;
}

.di-guide-item i {
    font-size: 11px;
}

.di-guide-item.highlight {
    color: var(--accent-color);
    opacity: 0.85;
}

/* --- Slide Animation for Switching Partners --- */
@keyframes diSlideOutLeft {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(-30px) scale(0.9);
        opacity: 0;
    }
}

@keyframes diSlideInRight {
    0% {
        transform: translateX(30px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes diSlideOutRight {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(30px) scale(0.9);
        opacity: 0;
    }
}

@keyframes diSlideInLeft {
    0% {
        transform: translateX(-30px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.di-slide-out-left {
    animation: diSlideOutLeft 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.di-slide-in-right {
    animation: diSlideInRight 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.di-slide-out-right {
    animation: diSlideOutRight 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.di-slide-in-left {
    animation: diSlideInLeft 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .partners-section {
        margin-top: 25px;
        margin-bottom: 20px;
        padding: 20px;
    }

    .dynamic-island-container {
        min-height: 280px;
        /* plenty of space for vertical mobile layout */
    }

    .dynamic-island.expanded {
        width: 100%;
        max-width: 440px;
        height: auto;
        min-height: 340px;
        border-radius: 24px;
        padding: 18px;
    }

    .di-expanded-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .di-btn {
        width: 100%;
        padding: 10px 12px;
        font-size: 13px;
    }

    .di-expanded-desc {
        height: auto;
        max-height: 90px;
    }

    .di-expanded-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .partners-section {
        padding: 15px;
    }

    .dynamic-island {
        max-width: 290px;
        height: 48px;
        padding: 4px 12px;
    }

    .di-logo-wrapper {
        width: 28px;
        height: 28px;
    }

    .di-logo-fallback {
        font-size: 10px;
    }

    .di-name {
        font-size: 13.5px;
    }

    .dynamic-island.expanded {
        max-width: 310px;
        min-height: 350px;
    }
}