/**
 * CSS for Modular Puzzle Landing Page
 * Responsive grid layout with animations and interactions
 */

/* CSS Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --background-color: #f8f9fa;
    --white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --container-max-width: 1200px;
    --grid-gap: 20px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.15"/><circle cx="10" cy="50" r="0.5" fill="white" opacity="0.15"/><circle cx="90" cy="30" r="0.5" fill="white" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.header-content {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    animation: bounce 2s infinite;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
.main {
    flex: 1;
    padding: 60px 0;
}

/* Puzzle Grid */
.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--grid-gap);
    margin-bottom: 60px;
}

/* Puzzle Piece */
.puzzle-piece {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: var(--animation-delay);
}

.puzzle-piece::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--piece-color);
    transition: var(--transition);
}

.puzzle-piece:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--piece-color);
}

.puzzle-piece:hover::before {
    height: 8px;
}

.piece-content {
    position: relative;
    z-index: 2;
}

.piece-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: block;
    filter: grayscale(0.3);
    transition: var(--transition);
}

.puzzle-piece:hover .piece-icon {
    filter: grayscale(0);
    transform: scale(1.1);
}

.piece-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
}

.piece-description {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Piece Overlay */
.piece-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--piece-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.puzzle-piece:hover .piece-overlay {
    opacity: 0.95;
}

.visit-text {
    color: var(--white);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.arrow-icon {
    color: var(--white);
    transform: translateX(-5px);
    transition: var(--transition);
}

.puzzle-piece:hover .arrow-icon {
    transform: translateX(0);
}

/* Stats Section */
.stats {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: var(--white);
    text-align: center;
    padding: 30px 0;
    margin-top: auto;
}

.footer p {
    opacity: 0.8;
    font-size: 0.95rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 40px 0;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .logo-icon {
        font-size: 2.5rem;
    }
    
    .main {
        padding: 40px 0;
    }
    
    .puzzle-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 40px;
    }
    
    .puzzle-piece {
        padding: 25px;
    }
    
    .stats {
        padding: 30px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .puzzle-piece {
        padding: 20px;
    }
    
    .piece-icon {
        font-size: 2rem;
    }
    
    .piece-title {
        font-size: 1.1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
.puzzle-piece:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header,
    .footer {
        background: none !important;
        color: black !important;
    }
    
    .puzzle-piece {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
