/* ============================================
   HUB HERO - Верхній блок з анімацією
   ============================================ */

.hub-hero-section {
    padding: var(--spacing-xl);
}

/* Grid Layout - 3 колонки x 2 рядки */
.hub-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--spacing-lg);
}

/* Слайдер - на всю ширину 3 колонок */
.hub-hero-main {
    position: relative;
    min-height: 450px;  /* Desktop - менша висота */
    border-radius: 12px;
    overflow: hidden;
    grid-row: 1;
    grid-column: 1 / -1;
}

.hub-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hub-hero-bg img,
.hub-hero-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

.hub-hero-bg video {
    position: absolute;
    top: 0;
    left: 0;
}

.hub-hero-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.88) 0%,
            rgba(0, 0, 0, 0.85) 25%,
            rgba(0, 0, 0, 0.78) 35%,
            rgba(0, 0, 0, 0.65) 45%,
            rgba(0, 0, 0, 0.45) 55%,
            rgba(0, 0, 0, 0.15) 70%,
            transparent 85%);
}

/* Fallback для старих Android браузерів - тільки для mobile */
@media (max-width: 767px) {
    @supports not (aspect-ratio: 16 / 9) {
        .hub-hero-main::before {
            content: '';
            display: block;
            padding-top: 56.25%; /* 16:9 = 9/16 * 100% */
        }
        
        .hub-hero-bg {
            position: absolute;
            top: 0;
            left: 0;
        }
    }
}

.hub-hero-content {
    position: relative;
    z-index: 1;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 450px;  /* Desktop - менша висота */
}

.hub-hero-logo {
    width: 150px;
    margin-bottom: 0;
    padding-top: 40px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.hub-hero-logo img {
    width: 100%;
    height: auto;
}

/* Стилі для динамічних елементів JS (синхронізовані з experts-section) */
.hero-title {
    color: #FFFFFF;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: left;
    margin-top: 5px;
    padding-top: 40px;
    margin-bottom: -20px;
    text-shadow: none;
    min-height: 80px;
    overflow: hidden;
}

.hero-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0;
    margin-bottom: -30px;
    text-align: left;
    text-shadow: none;
    min-height: 50px;
    overflow: hidden;
    padding-top: 40px;
}

/* Нижня лінія: точки (ліворуч) + кнопка (праворуч) */
.hero-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--spacing-md);
    flex-shrink: 0;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: 0;
    margin-left: auto;
    flex-shrink: 0;
}

/* Слайдер-точки (синхронізовані з home.css) */
.hero-slider-dots {
    display: flex;
    justify-content: flex-start;
    gap: var(--spacing-sm);
    margin-top: 0;
    margin-left: 0;
    flex-shrink: 0;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--accent-dark);
    background: var(--silver-white);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    width: 32px;
    border-radius: 6px;
}

/* Картка статистики */
.hub-stat-card {
    background: #2A2A2A;
    border-radius: 8px;
    padding: var(--spacing-lg);
    text-align: center;
    text-decoration: none !important;
    transition: all 0.3s ease;
    cursor: pointer;
}

.hub-stat-card-2 {
    grid-row: 2;
    grid-column: 3;
    background: #000000;
}

.hub-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--hub-shadow);
    text-decoration: none !important;
}

.hub-stat-label {
    font-size: 0.875rem;
    color: #B3B3B3;
    margin-bottom: 0.5rem;
}

.hub-stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 0.25rem;
}

.hub-stat-desc {
    font-size: 0.875rem;
    color: #B3B3B3;
}

/* Чорний слоган - другий рядок, 2 колонки */
.hub-hero-slogan {
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 3rem;
    font-weight: 600;
    color: #FFFFFF;
    border-radius: 8px;
    grid-row: 2;
    grid-column: 1 / 3;
}

.hub-slogan-highlight {
    color: var(--hub-primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .hub-hero-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .hub-hero-main {
        grid-row: 1;
        grid-column: 1;
    }
    
    .hub-hero-slogan {
        grid-row: 2;
        grid-column: 1;
    }
    
    .hub-stat-card-2 {
        grid-row: 3;
        grid-column: 1;
    }
    
    .hub-stat-card,
    .hub-stat-card:hover {
        text-decoration: none !important;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 767px) {
    /* NEW DESIGN Mobile - CSS Grid Layout */
    .hub-hero-section .hub-hero-main .hub-hero-content.hero-new-design {
        left: 5px;
        transform: none;
        width: calc(100% - 5px);
        height: 100%;
        min-height: 0;  /* Скинути desktop min-height */
        background: transparent;
        z-index: var(--z-content);
        
        /* CSS Grid Structure */
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto 1fr auto auto;
        gap: var(--spacing-sm);
        padding: calc(var(--spacing-md) + env(safe-area-inset-top, 0px)) 
                 calc(var(--spacing-md) + env(safe-area-inset-right, 0px))
                 calc(var(--spacing-md) + max(env(safe-area-inset-bottom, 0px), 8px))
                 calc(var(--spacing-md) + env(safe-area-inset-left, 0px));
        
        /* Скинути попередні flex стилі */
        flex-direction: unset;
        justify-content: unset;
    }
    
    /* Логотип: ряд 1, колонка 1 (верхній лівий кут) */
    .hub-hero-content.hero-new-design .hub-hero-logo {
        grid-row: 1;
        grid-column: 1;
        justify-self: start;
        align-self: start;
        width: 80px;
        margin: 0;
        padding: 0;
    }
    
    .hub-hero-content.hero-new-design .hub-hero-logo img {
        width: 100%;
        height: auto;
    }
    
    /* Точки слайдера: ряд 1, колонка 2 (праворуч зверху) */
    .hub-hero-content.hero-new-design .hero-slider-dots {
        grid-row: 1;
        grid-column: 2;
        justify-self: end;
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 0;
    }
    
    /* Точки - мобільні розміри */
    .hub-hero-content.hero-new-design .slider-dot {
        width: 6px;
        height: 6px;
        border-width: 1px;
    }
    
    .hub-hero-content.hero-new-design .slider-dot.active {
        width: 12px;
        border-radius: 3px;
    }
    
    /* Заголовок: ряд 3, обидві колонки (окремий блок) */
    .hub-hero-content.hero-new-design .hero-title {
        grid-row: 3;
        grid-column: 1 / -1;
        font-size: clamp(1.5rem, 4vw, 3.5rem);
        margin: 0;
        padding-top: 0;
        margin-top: 0;
        margin-bottom: 0;
        line-height: 1.2;
        max-width: 70%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        min-height: auto;
        overflow: visible;
    }
    
    /* Підзаголовок: ряд 4, колонка 1 (ліворуч, в ряд з кнопкою) */
    .hub-hero-content.hero-new-design .hero-subtitle {
        grid-row: 4;
        grid-column: 1;
        font-size: clamp(0.8rem, 1.5vw, 1.25rem);
        margin: 0;
        padding-top: 0;
        margin-bottom: 0;
        line-height: 1.5;
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        align-self: end;
        min-height: auto;
        overflow: visible;
    }
    
    /* Кнопки: ряд 4, колонка 2 (праворуч, в ряд з підзаголовком) */
    .hub-hero-content.hero-new-design .hero-buttons {
        grid-row: 4;
        grid-column: 2;
        justify-self: end;
        align-self: end;
        gap: 0.25rem;
        margin: 0;
        display: flex;
        align-items: center;
        max-width: 100%;
    }
    
    /* Кнопка Hub - ідентична hero-btn-new на мобільних */
    .hub-hero-content.hero-new-design .hub-btn {
        background: #ffffff;
        color: #000000;
        padding: 6px 10px;
        font-size: 0.7rem;
        font-family: 'Roboto', sans-serif;
        min-height: auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .hub-hero-content.hero-new-design .hub-btn .btn-logo-space {
        width: 5px;
        height: 5px;
    }
    
    /* Інші елементи Hub Hero (не в hero-new-design) */
    .hub-hero-main {
        min-height: 0;  /* Скинути desktop min-height */
        aspect-ratio: 16 / 9;
    }
    
    .hub-stat-value {
        font-size: 2rem;
    }
    
    .hub-hero-slogan {
        font-size: 1rem;
    }
    
    .hub-stat-card,
    .hub-stat-card:hover,
    .hub-stat-card:focus,
    .hub-stat-card:active {
        text-decoration: none !important;
    }
}

/* Темна тема */
[data-theme="dark"] .hero-title,
[data-theme="dark"] .hero-subtitle {
    color: var(--color-text);
}

/* Градієнт залишається в темній темі (як на головній сторінці) */

/* Видалення тіней на картках статистики в темній темі */
[data-theme="dark"] .hub-stat-card,
[data-theme="dark"] .hub-stat-card:hover {
    box-shadow: none;
    text-decoration: none !important;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .hero-title,
    [data-theme="auto"] .hero-subtitle {
        color: var(--color-text);
    }
    
    /* Градієнт залишається для автоматичної теми (як на головній сторінці) */
    
    /* Видалення тіней на картках для автоматичної теми */
    [data-theme="auto"] .hub-stat-card,
    [data-theme="auto"] .hub-stat-card:hover {
        box-shadow: none;
        text-decoration: none !important;
    }
}

/* iOS Safari оптимізація */
@supports (-webkit-touch-callout: none) {
    /* Hero секція - backface visibility та GPU acceleration */
    .hub-hero-section {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
    }
    
    .hub-hero-main {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
    }
    
    .hub-hero-bg {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .hub-hero-bg::after {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Контент - smooth scrolling */
    .hub-hero-content,
    .hub-hero-content.hero-new-design {
        -webkit-overflow-scrolling: touch;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Текст - font smoothing */
    .hub-hero-content .hero-title,
    .hub-hero-content .hero-subtitle {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Кнопки та інтерактивні елементи */
    .slider-dot,
    .hub-btn {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        appearance: none;
        cursor: pointer;
    }
    
    /* Логотип */
    .hub-hero-logo {
        -webkit-user-drag: none;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Додатково для мобільних iOS */
    @media (max-width: 767px) {
        /* Viewport height fix - видалено, використовуємо aspect-ratio */
        .hub-hero-content.hero-new-design {
            height: 100%;
        }
        
        /* Font rendering на iOS */
        .hub-hero-content.hero-new-design .hero-title,
        .hub-hero-content.hero-new-design .hero-subtitle {
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            text-rendering: optimizeLegibility;
        }
        
        /* Кнопка - відключити масштабування при тапі */
        .hub-hero-content.hero-new-design .hub-btn {
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            touch-action: manipulation;
        }
    }
}

