/* ================================================================
   DESIGN-SPELLS.CSS — Magical Micro-interactions Layer
   Premium polish: cursor glow, tilt hover, parallax, scroll progress,
   animated gradients, grain texture, ripple, spring animations
   ================================================================ */

/* === 1. SCROLL PROGRESS BAR === */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #dc2626, #9333ea, #2563eb);
    z-index: 10000;
    transition: width 0.1s linear;
    pointer-events: none;
    border-radius: 0 2px 2px 0;
}

.scroll-progress::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 80px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(147, 51, 234, 0.4));
    filter: blur(3px);
}


/* === 2. HERO TEXT GRADIENT SHIMMER === */
@keyframes gradientShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

section.hero .title-accent {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: #c4333c !important;
    color: #c4333c !important;
    animation: none !important;
}


/* === 3. MAGNETIC CURSOR GLOW (hero section) === */
.hero-cursor-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(220, 38, 38, 0.06) 0%,
        rgba(147, 51, 234, 0.03) 40%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    filter: blur(40px);
    will-change: transform;
}


/* === 4. SPRING ENTRANCE ANIMATIONS === */
@keyframes springIn {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(-8px) scale(1.02);
    }
    80% {
        transform: translateY(3px) scale(0.99);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes springInLeft {
    0% {
        opacity: 0;
        transform: translateX(-60px) scale(0.95);
    }
    60% {
        opacity: 1;
        transform: translateX(6px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.reveal.revealed {
    /* Без springIn: его forwards оставлял transform: scale(1) навсегда,
       из-за чего текст уходил на GPU-слой и размывался в Chrome.
       Появление делает плавный transition из polish.css. */
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
}


/* === 5. 3D TILT CARD EFFECT === */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    will-change: transform;
}

.tilt-card .program-card-header,
.tilt-card .program-preview {
    transform: translateZ(20px);
}

/* Program cards - enhanced hover */
.program-card {
    position: relative;
    overflow: clip;
}

.program-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(220, 38, 38, 0.06),
        transparent 40%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.program-card:hover::after {
    opacity: 1;
}


/* === 6. RIPPLE CLICK EFFECT === */
.btn .ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: rippleExpand 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleExpand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.btn {
    position: relative;
    overflow: hidden;
}


/* === 7. PARALLAX FLOATING ELEMENTS IN HERO === */
@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

@keyframes floatMedium {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(-1.5deg); }
}

@keyframes floatFast {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.float-card-main {
    animation: none !important;
}

.float-card-stat-1 {
    animation: none !important;
}

.float-card-stat-2 {
    animation: none !important;
}

.float-card-check {
    animation: none !important;
}


/* === 8. GRAIN TEXTURE OVERLAY === */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.025;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}


/* === 9. CARD SPOTLIGHT HOVER === */
.why-choose-card,
.about-feature-card,
.news-card,
.testimonial-card {
    position: relative;
    overflow: hidden;
}

.why-choose-card::after,
.about-feature-card::after,
.news-card::after,
.testimonial-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(220, 38, 38, 0.04),
        transparent 40%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.why-choose-card:hover::after,
.about-feature-card:hover::after,
.news-card:hover::after,
.testimonial-card:hover::after {
    opacity: 1;
}


/* === 10. LOGO BREATHING ANIMATION === */
@keyframes logoBreathe {
    0%, 100% { filter: drop-shadow(0 0 0 transparent); }
    50% { filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.15)); }
}

.header.header-shadow .logo-img {
    animation: logoBreathe 4s ease-in-out infinite;
}


/* === 11. EYEBROW DOT — ENHANCED PULSE === */
.eyebrow-dot {
    position: relative;
}

.eyebrow-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid rgba(220, 38, 38, 0.3);
    animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.8); opacity: 0; }
}


/* === 12. STAGGER DELAYS (fine-grained) === */
.stagger-1  { transition-delay: 0.05s !important; }
.stagger-2  { transition-delay: 0.1s !important; }
.stagger-3  { transition-delay: 0.15s !important; }
.stagger-4  { transition-delay: 0.2s !important; }
.stagger-5  { transition-delay: 0.25s !important; }
.stagger-6  { transition-delay: 0.3s !important; }
.stagger-7  { transition-delay: 0.35s !important; }
.stagger-8  { transition-delay: 0.4s !important; }
.stagger-9  { transition-delay: 0.45s !important; }
.stagger-10 { transition-delay: 0.5s !important; }


/* === 13. BUTTON HOVER GLOW === */
.btn-primary {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.btn-primary:hover {
    box-shadow:
        0 8px 24px rgba(220, 38, 38, 0.35),
        0 0 0 1px rgba(220, 38, 38, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.btn-secondary {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}


/* === 14. FOOTER LINK HOVER === */
.footer-nav li a {
    position: relative;
    padding-left: 0;
    transition: color 0.2s ease !important;
}

.footer-nav li a::before {
    content: none !important;
}

.footer-nav li a:hover {
    padding-left: 0 !important;
    transform: none !important;
    color: #ffffff !important;
}

.footer-nav li a:hover::before {
    content: none !important;
}


/* === 15. SECTION TITLE UNDERLINE REVEAL === */
.section-title {
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) scaleX(1);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #dc2626, #9333ea);
    border-radius: 4px;
    transition: none;
}

.section-title.revealed::after {
    transform: translateX(-50%) scaleX(1);
}

/* Фикс: на подстраницах программ конфликт corporate (margin влево) и
   design-spells (left:50% + translateX) уводил подчёркивание заголовка влево.
   Возвращаем ровное центрирование под центрированным заголовком. */
.program-overview .section-title::after,
.program-audience .section-title::after,
.program-features .section-title::after,
.program-benefits .section-title::after,
.program-pricing .section-title::after,
.program-gallery .section-title::after,
.program-docs .section-title::after,
.program-versions .section-title::after,
.program-overview .section-title.revealed::after,
.program-audience .section-title.revealed::after,
.program-features .section-title.revealed::after,
.program-benefits .section-title.revealed::after,
.program-pricing .section-title.revealed::after,
.program-gallery .section-title.revealed::after,
.program-docs .section-title.revealed::after,
.program-versions .section-title.revealed::after {
    position: relative !important;
    left: 0 !important;
    transform: none !important;
    margin: 16px auto 0 !important;
    width: 48px !important;
}


/* === 16. CTA SECTION PARTICLES === */
.program-cta {
    position: relative;
}

.cta-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    animation: sparkleFloat 4s ease-in-out infinite;
}

@keyframes sparkleFloat {
    0%, 100% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }
    80% {
        opacity: 0.5;
        transform: translateY(-80px) scale(0.5);
    }
}


/* === 17. SMOOTH PAGE TRANSITION === */
body {
    animation: pageIn 0.6s ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* === 18. HEADER GLASSMORPHISM ENHANCEMENT === */
.header.header-shadow {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 4px 20px rgba(0, 0, 0, 0.03) !important;
}


/* === 19. TESTIMONIAL QUOTE FLOAT === */
@keyframes quoteFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(2deg); }
}

.testimonial-card:hover::before {
    animation: quoteFloat 2s ease-in-out infinite;
    color: rgba(230, 57, 70, 0.2) !important;
}


/* === 20. NAV ACTIVE DOT — DISABLED (indicated by underline + color instead) */
/*
.nav-link.active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #dc2626;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}
*/


/* === PERFORMANCE: Reduce motion for prefers-reduced-motion === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-progress,
    .grain-overlay,
    .hero-cursor-glow,
    .cta-sparkle {
        display: none !important;
    }
}


/* === RESPONSIVE: disable heavy effects on mobile === */
@media (max-width: 768px) {
    .hero-cursor-glow {
        display: none !important;
    }

    .grain-overlay {
        display: none !important;
    }

    .float-card-main,
    .float-card-stat-1,
    .float-card-stat-2,
    .float-card-check {
        animation: none !important;
    }

    .nav-link.active::before {
        display: none;
    }
}


/* === AUDIT FIXES: Accessibility & Contrast === */

/* Fix #8: Minimum font sizes for readability (target: >=12px) */
.breadcrumbs-nav a,
.breadcrumbs-separator,
.breadcrumbs-current {
    font-size: 0.8125rem !important; /* 13px */
}

.form-privacy {
    font-size: 0.75rem !important; /* 12px */
}

.about-timeline__year {
    font-size: 0.8125rem !important; /* 13px */
}

.filter-count {
    font-size: 0.72rem !important; /* 11.5px — counter badges OK smaller */
}

/* Subpage body text minimum — ensure readable on internal pages */
.toc-link,
.calc-note,
.calc-line,
.pricing-note,
.partner-placeholder,
.case-stat-label,
.stat-desc {
    font-size: max(0.7875rem, 12px) !important;
}

/* Fix #6: contact-action-btn low contrast */
.contact-action-btn {
    color: var(--text-primary, #1e293b) !important;
    background: rgba(0, 0, 0, 0.06) !important;
}

.contact-action-btn:hover {
    background: rgba(0, 0, 0, 0.10) !important;
}

