/* ═════════════════════════════════════════════════
   site-common.css — Общие анимации и стили для всех страниц
   ═════════════════════════════════════════════════ */

/* ═══ Keyframes ═══ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(32px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.15);
    }

    50% {
        box-shadow: 0 0 24px 4px rgba(129, 140, 248, 0.08);
    }
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes draw-in {
    from {
        stroke-dashoffset: 100;
        opacity: 0;
    }

    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

/* ═══ Scroll reveal classes ═══ */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-24px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered children */
.stagger-children .reveal:nth-child(1) {
    transition-delay: 0ms;
}

.stagger-children .reveal:nth-child(2) {
    transition-delay: 80ms;
}

.stagger-children .reveal:nth-child(3) {
    transition-delay: 160ms;
}

.stagger-children .reveal:nth-child(4) {
    transition-delay: 240ms;
}

.stagger-children .reveal:nth-child(5) {
    transition-delay: 320ms;
}

.stagger-children .reveal:nth-child(6) {
    transition-delay: 400ms;
}

.stagger-children .reveal:nth-child(7) {
    transition-delay: 480ms;
}

.stagger-children .reveal:nth-child(8) {
    transition-delay: 560ms;
}

/* ═══ SVG Icon base ═══ */
.icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-svg svg {
    width: 100%;
    height: 100%;
}

/* Icon sizes */
.icon-sm {
    width: 20px;
    height: 20px;
}

.icon-md {
    width: 28px;
    height: 28px;
}

.icon-lg {
    width: 36px;
    height: 36px;
}

.icon-xl {
    width: 48px;
    height: 48px;
}

.icon-2xl {
    width: 64px;
    height: 64px;
}

.icon-hero {
    width: 80px;
    height: 80px;
}

/* ═══ Nav SVG Icons ═══ */
.nav-links a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.nav-links {
    align-items: center !important;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: inherit;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-links a:hover .nav-icon {
    transform: scale(1.2) rotate(-6deg);
    color: var(--primary-light, #a78bfa);
}

/* Icon container with gradient background */
.icon-box {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-box:hover {
    transform: scale(1.08) rotate(-2deg);
}

.icon-box svg {
    width: 28px;
    height: 28px;
}

.icon-box-sm {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

.icon-box-sm svg {
    width: 22px;
    height: 22px;
}

.icon-box-lg {
    width: 72px;
    height: 72px;
    border-radius: 20px;
}

.icon-box-lg svg {
    width: 36px;
    height: 36px;
}

/* Gradient backgrounds for icon boxes */
.icon-bg-purple {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(129, 140, 248, 0.1));
    border: 1px solid rgba(129, 140, 248, 0.15);
}

.icon-bg-blue {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(56, 189, 248, 0.15);
}

.icon-bg-green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.icon-bg-orange {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(251, 146, 60, 0.15);
}

.icon-bg-red {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.1));
    border: 1px solid rgba(248, 113, 113, 0.15);
}

.icon-bg-gradient {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(129, 140, 248, 0.2);
}

/* ═══ Animated header text ═══ */
.gradient-text-animated {
    background: linear-gradient(90deg, #fff 0%, #a78bfa 25%, #818cf8 50%, #a78bfa 75%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s ease-in-out infinite;
}

/* ═══ Glow card effect ═══ */
.glow-card {
    position: relative;
    overflow: hidden;
}

.glow-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(129, 140, 248, 0), rgba(129, 140, 248, 0.15), rgba(129, 140, 248, 0));
    opacity: 0;
    transition: opacity 0.4s;
    z-index: -1;
}

.glow-card:hover::after {
    opacity: 1;
}

/* ═══ Particle/dot background patterns ═══ */
.dot-pattern {
    position: relative;
}

.dot-pattern::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(129, 140, 248, 0.07) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

/* ═══ Animated stat numbers ═══ */
.stat-animated .number {
    animation: count-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ═══ Timeline animated ═══ */
.timeline-animated .timeline-item {
    opacity: 0;
    transform: translateX(-16px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-animated .timeline-item.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ═══ Smooth hover transitions for all interactive elements ═══ */
.smooth-hover {
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.smooth-hover:hover {
    transform: translateY(-4px);
}

/* ═══ Floating animation for decorative elements ═══ */
.floating {
    animation: float 4s ease-in-out infinite;
}

.floating-delay-1 {
    animation-delay: 0.5s;
}

.floating-delay-2 {
    animation-delay: 1s;
}

.floating-delay-3 {
    animation-delay: 1.5s;
}

/* ═══ Gradient border animation ═══ */
.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.3), rgba(99, 102, 241, 0.1), rgba(167, 139, 250, 0.3));
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s;
}

.gradient-border:hover::before {
    opacity: 1;
}

/* ═══ Pulse glow for important elements ═══ */
.pulse-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

/* ═══ Back to top ═══ */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(18, 18, 42, 0.9);
    border: 1px solid rgba(129, 140, 248, 0.2);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.3s;
    pointer-events: none;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.3);
    transform: translateY(-2px);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    stroke: #a78bfa;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ═══ Reading progress bar ═══ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #a78bfa, #818cf8, #6366f1);
    z-index: 101;
    width: 0;
    transition: width 0.1s linear;
}

/* ═══ Reduced motion ═══ */
@media (prefers-reduced-motion: reduce) {

    .reveal,
    .reveal-left,
    .reveal-scale {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .floating {
        animation: none;
    }

    .gradient-text-animated {
        animation: none;
    }

    .pulse-glow {
        animation: none;
    }
}

/* ═══ Mobile Ad Banner Responsiveness ═══ */
@media (max-width: 600px) {
    .ad-section {
        padding: 70px 12px 0 !important;
    }

    .ad-banner {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .ad-banner-content {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        text-align: left;
    }

    .ad-banner-content>a {
        align-self: stretch;
        text-align: center;
        justify-content: center;
    }

    /* Nav icon sizing on mobile */
    .nav-icon {
        width: 14px;
        height: 14px;
    }

    .nav-icon svg {
        width: 14px;
        height: 14px;
    }

    /* Footer mobile fixes */
    .footer-links {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 12px 16px !important;
    }

    .footer-inner {
        flex-direction: column !important;
        text-align: center !important;
        gap: 16px !important;
    }
}

@media (max-width: 400px) {
    .ad-section {
        padding: 64px 8px 0 !important;
    }

    .ad-banner {
        padding: 14px 12px !important;
    }
}