/**
 * Улучшенные стили для главной страницы
 * Современные анимации, 3D эффекты, градиенты
 */

/* ============= REVEAL АНИМАЦИИ ============= */
.reveal-hidden {
    /* Отключаем скрытие элементов, чтобы ничего не мигало */
    opacity: 1;
    transform: none;
}


/* ============= 3D КАРТОЧКИ ============= */
.card-3d {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
    will-change: transform;
}

.card-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.1) 0%, 
        rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: inherit;
    pointer-events: none;
}

.card-3d:hover::before {
    opacity: 1;
}

/* ============= УЛУЧШЕННЫЕ КАРТОЧКИ КАФЕДР ============= */
.program-card {
    position: relative;
    overflow: hidden;
}

.program-card::after {
    content: none; /* убираем свечение чтобы не перекрывалось с текстом */
}

.program-card:hover::after {
    opacity: 0; 
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.program-card:hover .program-icon {
    animation: bounceRotate 0.6s ease;
}

@keyframes bounceRotate {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.2) rotate(-10deg);
    }
    75% {
        transform: scale(1.2) rotate(10deg);
    }
}

/* ============= АНИМИРОВАННЫЙ ГРАДИЕНТ ============= */
.gradient-animated {
    background: linear-gradient(
        -45deg,
        #667eea,
        #764ba2,
        #f093fb,
        #4facfe
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============= TIMELINE ============= */
.timeline-section {
    position: relative;
    padding: 6rem 0;
}

.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, 
        var(--primary),
        var(--secondary),
        var(--accent)
    );
    transform: translateX(-50%);
}

.timeline-item {
    display: flex;
    align-items: center;
    margin-bottom: 4rem;
    opacity: 1; /* всегда видимы */
    transform: none;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-item.timeline-visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline-content {
    flex: 1;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    transition: all 0.3s;
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.timeline-dot {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 0 0 4px var(--primary);
    position: relative;
    z-index: 2;
    margin: 0 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.timeline-description {
    color: var(--gray-600);
    line-height: 1.6;
}

/* ============= ПЛАВАЮЩИЕ ЭЛЕМЕНТЫ ============= */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(5deg);
    }
    66% {
        transform: translateY(-10px) rotate(-5deg);
    }
}

.floating-element {
    animation: float 3s ease-in-out infinite;
}

/* ============= КНОПКА "НАВЕРХ" ============= */
#scrollToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

#scrollToTop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#scrollToTop:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
}

/* ============= ИНТЕРАКТИВНЫЕ ДОСТИЖЕНИЯ ============= */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

/* ============= СЕРТИФИКАТЫ - СЕРЬЁЗНЫЙ ДИЗАЙН ============= */
.achievement-card {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.achievement-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.achievement-card:hover::before {
    transform: scaleX(1);
}

.achievement-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: #3b82f6;
}

.achievement-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    transition: all 0.3s ease;
    position: relative;
}

.achievement-card:hover .achievement-icon {
    transform: scale(1.05);
}

.achievement-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 12px;
    background: inherit;
    opacity: 0.15;
    filter: blur(8px);
    z-index: -1;
}

.achievement-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.achievement-description {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============= CANVAS PARTICLES ============= */
#particlesCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ============= ГАЛЕРЕЯ С ЭФФЕКТАМИ ============= */
.gallery-enhanced {
    display: block; /* для masonry через column-count */
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: default;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item:hover img {
    transform: scale(1.1) rotate(2deg);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    opacity: 0;
    transition: opacity 0.4s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    color: white;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    transform: translateY(20px);
    transition: transform 0.4s 0.1s;
}

.gallery-item:hover .gallery-title {
    transform: translateY(0);
}

.gallery-description {
    font-size: 0.9rem;
    opacity: 0.9;
    transform: translateY(20px);
    transition: transform 0.4s 0.2s;
}

.gallery-item:hover .gallery-description {
    transform: translateY(0);
}

/* ============= СЕКЦИЯ НОВОСТЕЙ С ЭФФЕКТАМИ ============= */
.news-card-enhanced {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    position: relative;
}

.news-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 1;
}

.news-card-enhanced:hover::before {
    opacity: 1;
}

.news-card-enhanced:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

.news-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 250px;
}

.news-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.news-card-enhanced:hover .news-image-wrapper img {
    transform: scale(1.15);
}

.news-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.95);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    backdrop-filter: blur(10px);
    z-index: 2;
}

/* ============= МОБИЛЬНАЯ АДАПТАЦИЯ ============= */
@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item,
    .timeline-item:nth-child(even) {
        flex-direction: row;
        transform: translateX(0);
    }
    
    .timeline-dot {
        margin: 0 1rem 0 0;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    #scrollToTop {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ============= АНИМАЦИЯ ЗАГРУЗКИ ============= */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in-scale {
    animation: fadeInScale 0.6s ease-out;
}

/* ============= УЛУЧШЕННЫЕ TOOLTIPS ============= */
.tooltip-enhanced {
    position: relative;
}

.tooltip-enhanced::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.9);
    color: white;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

.tooltip-enhanced:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* ============= ПРОГРЕСС БАР ============= */
.progress-bar-animated {
    height: 4px;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    z-index: 9999;
    transition: width 0.1s ease;
}
