/* ==========================================================================
   WHITE BELT / AWREAi - ENHANCED ANIMATIONS
   Premium micro-interactions, scroll effects, and motion design
   ========================================================================== */

/* --------------------------------------------------------------------------
   Keyframe Animations - Core
   -------------------------------------------------------------------------- */

/* Hero gradient animation - slower, more elegant */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 50% 100%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 0%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Scroll indicator bounce - refined */
@keyframes scrollBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(45deg);
    }
    40% {
        transform: translateY(12px) rotate(45deg);
    }
    60% {
        transform: translateY(6px) rotate(45deg);
    }
}

/* Pulse animation for badge dot */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.5);
    }
}

/* Float animation for decorative elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Fade in animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Blur in */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Glow pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(114, 47, 55, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(114, 47, 55, 0.5);
    }
}

/* Shimmer effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Rotate subtle */
@keyframes rotateSlow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Spin for loading */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Line draw */
@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Underline animation */
@keyframes underlineExpand {
    from {
        width: 0;
        left: 50%;
    }
    to {
        width: 100%;
        left: 0;
    }
}

/* Wave animation */
@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}

/* Subtle bob */
@keyframes bob {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* --------------------------------------------------------------------------
   Hero Animations - Enhanced
   -------------------------------------------------------------------------- */

.fade-in {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fade-in-delay {
    opacity: 0;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

.fade-in-delay-2 {
    opacity: 0;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.fade-in-delay-3 {
    opacity: 0;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.fade-in-delay-4 {
    opacity: 0;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

/* Blur-in variant */
.blur-in {
    animation: blurIn 0.8s ease-out forwards;
}

.blur-in-delay {
    opacity: 0;
    filter: blur(10px);
    animation: blurIn 0.8s ease-out 0.2s forwards;
}

/* Scale-in variant */
.scale-in {
    animation: scaleIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --------------------------------------------------------------------------
   Scroll-Triggered Animations - Enhanced
   -------------------------------------------------------------------------- */

/* Base class for scroll animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade up variant */
.animate-fade-up {
    opacity: 0;
    transform: translateY(50px);
    transition:
        opacity 0.7s ease-out,
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade left variant */
.animate-fade-left {
    opacity: 0;
    transform: translateX(-40px);
    transition:
        opacity 0.7s ease-out,
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Fade right variant */
.animate-fade-right {
    opacity: 0;
    transform: translateX(40px);
    transition:
        opacity 0.7s ease-out,
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale on scroll */
.scale-on-scroll {
    opacity: 0;
    transform: scale(0.92);
    transition:
        opacity 0.7s ease-out,
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.scale-on-scroll.visible {
    opacity: 1;
    transform: scale(1);
}

/* Blur on scroll */
.blur-on-scroll {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(20px);
    transition:
        opacity 0.7s ease-out,
        filter 0.7s ease-out,
        transform 0.7s ease-out;
}

.blur-on-scroll.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

/* Staggered children animation - Enhanced */
.stagger-children .animate-on-scroll:nth-child(1) { transition-delay: 0ms; }
.stagger-children .animate-on-scroll:nth-child(2) { transition-delay: 80ms; }
.stagger-children .animate-on-scroll:nth-child(3) { transition-delay: 160ms; }
.stagger-children .animate-on-scroll:nth-child(4) { transition-delay: 240ms; }
.stagger-children .animate-on-scroll:nth-child(5) { transition-delay: 320ms; }
.stagger-children .animate-on-scroll:nth-child(6) { transition-delay: 400ms; }
.stagger-children .animate-on-scroll:nth-child(7) { transition-delay: 480ms; }
.stagger-children .animate-on-scroll:nth-child(8) { transition-delay: 560ms; }

/* Grid stagger (for card grids) */
.stagger-grid > *:nth-child(1) { transition-delay: 0ms; }
.stagger-grid > *:nth-child(2) { transition-delay: 100ms; }
.stagger-grid > *:nth-child(3) { transition-delay: 200ms; }
.stagger-grid > *:nth-child(4) { transition-delay: 150ms; }
.stagger-grid > *:nth-child(5) { transition-delay: 250ms; }
.stagger-grid > *:nth-child(6) { transition-delay: 350ms; }

/* Section header animation */
.section-header {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-header.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Interactive Hover Effects - Enhanced
   -------------------------------------------------------------------------- */

/* Button hover with micro-interactions */
.btn {
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease,
        background-color 0.3s ease,
        background 0.3s ease;
}

.btn:hover {
    transform: translateY(-3px);
}

.btn:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

/* Card hover effects - 3D tilt ready */
.tech-card,
.use-case-card,
.comparison-card {
    transition:
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.4s ease,
        border-color 0.3s ease,
        background 0.3s ease;
    transform-style: preserve-3d;
}

.tech-card:hover,
.use-case-card:hover {
    transform: translateY(-10px);
}

.comparison-card:hover {
    transform: translateY(-8px);
}

/* Icon hover effects */
.tech-icon,
.use-case-icon {
    transition:
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        color 0.3s ease;
}

.tech-card:hover .tech-icon,
.use-case-card:hover .use-case-icon {
    transform: scale(1.15) translateY(-2px);
}

/* Nav link hover - enhanced underline */
.nav-link {
    transition: color 0.2s ease;
}

.nav-link::after {
    transition:
        width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Footer link hover */
.footer-links a {
    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.footer-links a:hover {
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Architecture Diagram Animations
   -------------------------------------------------------------------------- */

.arch-node-group {
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.3s ease;
}

.arch-node-group:hover {
    transform: scale(1.03);
}

.arch-node-group rect {
    transition: filter 0.3s ease;
}

/* Line pulse animation */
@keyframes linePulse {
    0% {
        stroke-dashoffset: 100;
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0.3;
    }
}

/* Pipeline pulse for cognitive/emotional nodes */
@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(44, 62, 45, 0.1);
    }
    50% {
        box-shadow: 0 0 25px 8px rgba(44, 62, 45, 0.12);
    }
}

/* --------------------------------------------------------------------------
   Comparison Section Animations
   -------------------------------------------------------------------------- */

.comparison-list li {
    opacity: 0;
    transform: translateX(-15px);
    transition:
        opacity 0.5s ease-out,
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.comparison-card.visible .comparison-list li {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered list items */
.comparison-card.visible .comparison-list li:nth-child(1) { transition-delay: 0.1s; }
.comparison-card.visible .comparison-list li:nth-child(2) { transition-delay: 0.18s; }
.comparison-card.visible .comparison-list li:nth-child(3) { transition-delay: 0.26s; }
.comparison-card.visible .comparison-list li:nth-child(4) { transition-delay: 0.34s; }
.comparison-card.visible .comparison-list li:nth-child(5) { transition-delay: 0.42s; }

/* Divider animation */
.comparison-divider span {
    opacity: 0;
    transform: scale(0.5);
    transition:
        opacity 0.5s ease-out 0.3s,
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}

.comparison-grid.visible .comparison-divider span {
    opacity: 0.5;
    transform: scale(1);
}

/* --------------------------------------------------------------------------
   Form Input Animations
   -------------------------------------------------------------------------- */

.form-input {
    transition:
        border-color 0.3s ease,
        background-color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.2s ease;
}

.form-input:focus {
    transform: translateY(-1px);
}

/* Label float animation (if needed) */
.form-label {
    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

/* --------------------------------------------------------------------------
   Loading States
   -------------------------------------------------------------------------- */

.loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgba(232, 228, 201, 0.3);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   Overlay & Modal Animations
   -------------------------------------------------------------------------- */

/* Patent overlay fade */
.hero-patent-overlay,
.hero-radial-overlay {
    transition:
        opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.5s ease;
}

.hero-patent-overlay.active,
.hero-radial-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Content scale in when overlay opens */
.patent-content {
    transform: scale(0.95);
    opacity: 0;
    transition:
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.5s ease;
}

.hero-patent-overlay.active .patent-content {
    transform: scale(1);
    opacity: 1;
}

/* Close button rotation on hover */
.hero-radial-close,
.hero-patent-close {
    transition:
        background 0.3s ease,
        border-color 0.3s ease,
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
}

.hero-radial-close:hover,
.hero-patent-close:hover {
    transform: scale(1.1) rotate(90deg);
}

/* --------------------------------------------------------------------------
   Scroll Indicator Animation
   -------------------------------------------------------------------------- */

.scroll-indicator {
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

.scroll-indicator:hover {
    transform: translateX(-50%) translateY(-3px);
}

.scroll-indicator:hover .scroll-arrow {
    animation-duration: 1s;
}

/* --------------------------------------------------------------------------
   Badge Animations
   -------------------------------------------------------------------------- */

.badge {
    transition:
        background 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
}

.badge:hover {
    transform: translateY(-3px);
}

.badge::before {
    animation: pulse 2s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Page Load Animation
   -------------------------------------------------------------------------- */

body {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.1s forwards;
}

/* Prevent FOUC */
body.loaded {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Smooth Scroll Enhancement
   -------------------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   Reduced Motion Support - WCAG Compliance
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html {
        scroll-behavior: auto;
    }

    .hero-background {
        animation: none;
        background-position: 0% 50%;
    }

    .scroll-arrow {
        animation: none;
    }

    .badge::before {
        animation: none;
    }

    .animate-on-scroll,
    .scale-on-scroll,
    .blur-on-scroll,
    .animate-fade-up,
    .animate-fade-left,
    .animate-fade-right,
    .section-header {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .fade-in,
    .fade-in-delay,
    .fade-in-delay-2,
    .fade-in-delay-3,
    .fade-in-delay-4 {
        opacity: 1;
        animation: none;
    }

    .btn:hover,
    .tech-card:hover,
    .use-case-card:hover,
    .comparison-card:hover {
        transform: none;
    }

    .hero-radial-close:hover,
    .hero-patent-close:hover {
        transform: scale(1.05);
    }

    .center-pulse {
        animation: none;
        opacity: 0.5;
    }

    .pie-chart.playing .center-orb {
        animation: none;
        box-shadow: 0 0 50px rgba(114, 47, 55, 0.7);
    }

    .sub-slice-path.playing {
        animation: none;
        filter: drop-shadow(0 0 10px rgba(114, 47, 55, 0.6));
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */

@media print {
    .nav,
    .hero-background,
    .scroll-indicator,
    .pie-container,
    .wave-transition-overlay,
    .wave-bleed-overlay,
    .footer,
    .hero-radial-overlay,
    .hero-patent-overlay {
        display: none !important;
    }

    body {
        color: black;
        background: white;
        opacity: 1;
        animation: none;
    }

    .hero {
        min-height: auto;
        padding: var(--space-8) 0;
    }

    .hero-content {
        opacity: 1;
    }

    .hero-title,
    .section-title {
        color: black;
    }

    .section {
        padding: var(--space-8) 0;
        page-break-inside: avoid;
    }

    .animate-on-scroll,
    .section-header {
        opacity: 1;
        transform: none;
    }

    a {
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* --------------------------------------------------------------------------
   Performance Optimizations
   -------------------------------------------------------------------------- */

/* GPU acceleration for frequently animated elements */
.btn,
.tech-card,
.use-case-card,
.comparison-card,
.nav-link::after,
.hero-content,
.slice-group,
.sub-slice-group,
.center-orb {
    will-change: transform;
    backface-visibility: hidden;
}

/* Prevent layout thrashing */
.animate-on-scroll,
.scale-on-scroll,
.blur-on-scroll {
    contain: layout style paint;
}
