/* Sort Puzzle - Nuts and Bolts Game CSS */
/* SEO Optimized and Responsive Design */

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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: #ffd700;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 0 80px;
    margin-top: 80px;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-button {
    background: #ff6b6b;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255,107,107,0.3);
}

.cta-button:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,107,107,0.4);
}

.secondary-button {
    background: transparent;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    border: 2px solid white;
    transition: all 0.3s ease;
}

.secondary-button:hover {
    background: white;
    color: #667eea;
}

/* Game Section */
.game-section {
    padding: 80px 0;
    background: white;
}

.game-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.game-section p {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.game-iframe-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.game-iframe-wrapper iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-info {
    padding: 2rem;
}

.game-info h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #333;
}

.game-info p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    color: #666;
}

.game-features h4 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
}

.game-features ul {
    list-style: none;
}

.game-features li {
    padding: 0.5rem 0;
    font-size: 1rem;
    color: #666;
}

/* Game Fallback Content */
.game-fallback {
    display: none;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    border: 2px dashed #667eea;
}

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

.game-fallback p {
    color: #666;
    margin-bottom: 1.5rem;
}

.fallback-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.fallback-button {
    background: #667eea;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.fallback-button:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.game-tips {
    text-align: left;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.game-tips h4 {
    color: #333;
    margin-bottom: 1rem;
}

.game-tips ul {
    color: #666;
    padding-left: 1.5rem;
}

.game-tips li {
    margin-bottom: 0.5rem;
}

/* Show fallback when iframe fails */
.game-iframe-wrapper:has(iframe:not([src*="game-proxy.html"])) .game-fallback {
    display: block;
}

.game-iframe-wrapper:has(iframe[sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-top-navigation"]) .game-fallback {
    display: none;
}

/* How to Play Section */
.how-to-play {
    padding: 80px 0;
    background: #f8f9fa;
}

.how-to-play h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.how-to-play p {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.step {
    display: flex;
    align-items: flex-start;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.step-number {
    background: #667eea;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.step-content p {
    text-align: left;
    margin-bottom: 0;
    color: #666;
}

.tips-section h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.tip {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.tip h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.tip p {
    text-align: center;
    margin-bottom: 0;
    color: #666;
}

/* Benefits Section */
.benefits {
    padding: 80px 0;
    background: white;
}

.benefits h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.benefits p {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.benefit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.benefit h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.benefit p {
    color: rgba(255,255,255,0.9);
    margin-bottom: 0;
}

/* Related Games Section */
.related-games {
    padding: 80px 0;
    background: #f8f9fa;
}

.related-games h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.related-games p {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.game-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.game-card h3 {
    font-size: 1.3rem;
    margin: 1rem;
    color: #333;
}

.game-card p {
    margin: 0 1rem 1rem;
    color: #666;
}

/* FAQ Section */
.faq {
    padding: 80px 0;
    background: white;
}

.faq h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.faq p {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.faq-items {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.faq-item h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
}

.faq-item p {
    text-align: left;
    margin-bottom: 0;
    color: #666;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: white;
}

.footer-section p {
    color: rgba(255,255,255,0.8);
    margin-bottom: 0;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #ffd700;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 2rem;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255,255,255,0.6);
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .game-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .game-iframe-wrapper iframe {
        height: 400px;
    }
    
    .steps-container {
        grid-template-columns: 1fr;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-button, .secondary-button {
        display: block;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 100px 0 60px;
    }
    
    .game-section, .how-to-play, .benefits, .related-games, .faq {
        padding: 60px 0;
    }
    
    .game-iframe-wrapper iframe {
        height: 300px;
    }
    
    .step, .tip, .benefit, .game-card, .faq-item {
        padding: 1.5rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus Styles for Accessibility */
a:focus, button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Skip to Main Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
    top: 0;
}

/* Image placeholder styles for missing images */
img {
    background-color: #f0f0f0;
    border: 2px dashed #ccc;
}

/* Fallback for broken images */
img::before {
    content: "🖼️";
    display: block;
    text-align: center;
    padding: 20px;
    font-size: 2rem;
    color: #666;
}

img::after {
    content: attr(alt);
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
    color: #666;
    background-color: rgba(255, 255, 255, 0.8);
}

/* Specific image placeholder styles */
.hero-image img {
    min-height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    text-align: center;
}

.game-card img {
    min-height: 200px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1rem;
    text-align: center;
}

/* Image loading animation */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}