/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Header and Navigation */
header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav h1 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

nav a:hover,
nav a:focus {
    background-color: rgba(255, 255, 255, 0.2);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 4rem;
}

h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* Example Cards */
.example-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.example-card h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Animation Demos */
.animation-demo {
    height: 200px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CSS Animations */

/* 1. Bounce Ball Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -50px, 0);
    }
    70% {
        transform: translate3d(0, -25px, 0);
    }
    90% {
        transform: translate3d(0, -10px, 0);
    }
}

.bounce-ball {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 50%;
    animation: bounce 2s infinite;
    animation-play-state: running;
}

.bounce-ball.paused {
    animation-play-state: paused;
}

/* 2. Color Cycle Animation */
@keyframes colorCycle {
    0% { background-color: #ff6b6b; transform: scale(1); }
    25% { background-color: #4ecdc4; transform: scale(1.2); }
    50% { background-color: #45b7d1; transform: scale(1); }
    75% { background-color: #f9ca24; transform: scale(1.2); }
    100% { background-color: #ff6b6b; transform: scale(1); }
}

.color-cycle {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    animation: colorCycle 3s infinite;
    animation-play-state: running;
}

.color-cycle.paused {
    animation-play-state: paused;
}

/* 3. Custom Easing Animation */
@keyframes easingDemo {
    0% { 
        transform: translateX(-100px);
        opacity: 0;
    }
    100% { 
        transform: translateX(100px);
        opacity: 1;
    }
}

.easing-demo {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #a8edea, #fed6e3);
    border-radius: 50%;
    animation: easingDemo 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite alternate;
    animation-play-state: running;
}

.easing-demo.paused {
    animation-play-state: paused;
}

/* CSS Transforms */

/* 3D Cube */
.cube-container {
    perspective: 800px;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1s;
}

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.front { transform: rotateY(0deg) translateZ(100px); background-color: #ff6b6b; }
.back { transform: rotateY(180deg) translateZ(100px); background-color: #4ecdc4; }
.right { transform: rotateY(90deg) translateZ(100px); background-color: #45b7d1; }
.left { transform: rotateY(-90deg) translateZ(100px); background-color: #f9ca24; }
.top { transform: rotateX(90deg) translateZ(100px); background-color: #a55eea; }
.bottom { transform: rotateX(-90deg) translateZ(100px); background-color: #26de81; }

/* Transform Origin Demo */
.origin-demo {
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    margin: 50px auto;
    transition: transform 0.5s ease;
    transform-origin: center center;
}

.origin-demo:hover {
    transform: rotate(45deg) scale(1.2);
}

/* JavaScript Controlled Animation */
.js-animated-element {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    border-radius: 50%;
    margin: 50px auto;
    transition: all 0.3s ease;
}

.js-animated-element.animated {
    transform: translateX(100px) rotate(360deg) scale(1.5);
    background: linear-gradient(45deg, #a8edea, #fed6e3);
}

/* Scroll Animations */
.scroll-demo {
    height: 400px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2rem;
}

.scroll-item {
    height: 100px;
    margin: 2rem 0;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.6s ease;
}

.scroll-item.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-item.fade-in {
    transform: translateY(50px);
}

.scroll-item.slide-in-left {
    transform: translateX(-100px);
}

.scroll-item.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-item.slide-in-right {
    transform: translateX(100px);
}

.scroll-item.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .bounce-ball,
    .color-cycle,
    .easing-demo {
        animation: none;
    }
    
    .respect-motion-preference {
        background: #4ecdc4;
        color: white;
        padding: 1rem;
        border-radius: 8px;
        text-align: center;
    }
    
    .respect-motion-preference::after {
        content: " ✓ Motion reduced";
        font-weight: bold;
    }
    
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .respect-motion-preference {
        background: linear-gradient(45deg, #ff6b6b, #ee5a24);
        color: white;
        padding: 1rem;
        border-radius: 8px;
        text-align: center;
        animation: colorCycle 2s infinite;
    }
    
    .respect-motion-preference::after {
        content: " ↻ Motion enabled";
        font-weight: bold;
    }
}

/* Focus Management */
.focus-demo {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.focusable-element {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.focusable-element:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.focusable-element:focus {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
    transform: scale(1.05);
}

.focusable-element:active {
    transform: scale(0.98);
}

/* GSAP Demo */
.gsap-demo {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    height: 150px;
}

.gsap-element {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.gsap-box1 { background: #ff6b6b; }
.gsap-box2 { background: #4ecdc4; }
.gsap-box3 { background: #45b7d1; }

/* Buttons */
button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    margin: 0.5rem;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button:focus {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

button:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .example-card {
        padding: 1rem;
    }
    
    .focus-demo {
        flex-direction: column;
    }
    
    h2 {
        font-size: 2rem;
    }
}
