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

:root {
    /* Minimal Color Palette */
    --primary: #111827;
    --primary-light: #374151;
    --secondary: #6b7280;
    --accent: #f3f4f6;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: var(--font-family);
    background: var(--white);
    color: var(--gray-900);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

.nav-brand .brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: var(--space-sm);
}

.nav-item {
    text-decoration: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-weight: 500;
    color: var(--gray-600);
    transition: color 0.2s ease;
}

.nav-item:hover {
    color: var(--primary);
}

.nav-item.active {
    color: var(--primary);
    background: var(--gray-50);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: var(--gray-600);
    transition: all 0.3s ease;
}

/* Main Content */
.main-content {
    margin-top: 4rem;
    min-height: calc(100vh - 4rem);
}

.section {
    display: none;
    padding: var(--space-2xl) var(--space-md);
    max-width: 1200px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: center;
    min-height: 70vh;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
}

.hero-visual {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-card {
    position: absolute;
    width: 120px;
    height: 80px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    background: var(--gray-100);
}

.card-1 {
    top: 20%;
    right: 20%;
}

.card-2 {
    top: 50%;
    right: 40%;
}

.card-3 {
    top: 70%;
    right: 10%;
}

/* Buttons */
.btn {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.btn-game {
    background: var(--primary);
    color: var(--white);
    width: 100%;
    margin-top: auto;
}

.btn-game:hover {
    background: var(--primary-light);
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--primary);
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--gray-600);
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-xl);
}

.blog-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.blog-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.blog-image {
    height: 200px;
    overflow: hidden;
    background: var(--gray-100);
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 2rem;
}

.gradient-1::before { content: '📖'; }
.gradient-2::before { content: '🎨'; }
.gradient-3::before { content: '🎮'; }
.gradient-4::before { content: '🚀'; }

/* Featured blog post styling */
.blog-card.featured {
    border: 2px solid #fa709a;
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(249, 112, 154, 0.2);
}

.blog-card.featured .blog-category {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    font-weight: 600;
}

.blog-content {
    padding: var(--space-lg);
}

.blog-category {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--gray-900);
}

.blog-excerpt {
    color: var(--gray-600);
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.blog-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.blog-link:hover {
    color: inherit;
}

/* Individual Blog Post Styles */
.blog-post-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.blog-post-header {
    margin-bottom: var(--space-xl);
}

.back-button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: color 0.3s ease;
    text-decoration: none;
}

.back-button:hover {
    color: var(--primary-dark);
}

.blog-post-image {
    height: 400px;
    margin-bottom: var(--space-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.blog-post-meta {
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.blog-post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-xl);
    color: var(--gray-900);
}

.blog-post-content {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--gray-700);
}

.blog-post-content h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: var(--space-xl) 0 var(--space-lg) 0;
}

.blog-post-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: var(--space-lg) 0 var(--space-md) 0;
}

.blog-post-content p {
    margin-bottom: var(--space-md);
}

.blog-post-content ul, .blog-post-content ol {
    margin: var(--space-md) 0;
    padding-left: var(--space-lg);
}

.blog-post-content li {
    margin-bottom: var(--space-xs);
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.game-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.game-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

.game-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--gray-900);
}

.game-description {
    color: var(--gray-600);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
    flex-grow: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: var(--space-lg);
}

/* Game Styles */
.memory-game, .snake-game, .puzzle-game {
    max-width: 600px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--gray-200);
}

.game-stats {
    display: flex;
    gap: var(--space-lg);
}

.stat {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.3s;
    transform-style: preserve-3d;
}

.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-front {
    background: var(--gray-200);
    border: 2px solid var(--gray-300);
}

.card-back {
    background: var(--white);
    border: 2px solid var(--primary);
    transform: rotateY(180deg);
}

.memory-card.matched .card-back {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.game-message {
    text-align: center;
}

.win-message {
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.win-message h3 {
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: var(--space-md);
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--gray-200);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .blog-grid,
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .floating-card {
        width: 80px;
        height: 60px;
    }
    
    .game-stats {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .game-header {
        flex-direction: column;
        gap: var(--space-md);
    }
}

/* Snake Game Styles */
.snake-game canvas {
    display: block;
    margin: 0 auto;
    background: var(--gray-50);
}

.game-info {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

/* Puzzle Game Styles */
.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    max-width: 320px;
    margin: 0 auto;
    padding: var(--space-sm);
    background: var(--gray-300);
    border-radius: var(--radius-md);
}

.puzzle-tile {
    aspect-ratio: 1;
    background: var(--white);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.puzzle-tile:not(.empty):hover {
    background: var(--gray-50);
    transform: scale(0.95);
}

.puzzle-tile.empty {
    background: var(--gray-200);
    cursor: default;
}

/* Painting Game Styles */
.painting-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
}

.canvas-container {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker-container label {
    font-weight: 500;
    color: var(--primary);
}

#color-picker {
    width: 50px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.preset-colors {
    display: flex;
    gap: 0.5rem;
}

.color-preset {
    width: 25px;
    height: 25px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 2px solid transparent;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--gray-400);
}

.erase-button {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    margin-left: 1rem;
}

.erase-button:hover {
    background: #dc2626;
}

#painting-canvas {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    width: 320px;
    height: 320px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Game Page Styles */
.game-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.game-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    color: var(--primary);
}

.game-header p {
    font-size: 1.1rem;
    color: var(--gray-600);
    margin-bottom: var(--space-lg);
}

.back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease;
}

.back-link:hover {
    background-color: var(--gray-100);
}

.standalone-game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

/* Comments Section */
.comments-section {
    margin-top: var(--space-2xl);
    padding-top: var(--space-2xl);
    border-top: 1px solid var(--gray-200);
}

.comments-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    color: var(--primary);
}

.comment-form {
    background: var(--gray-50);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--gray-700);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.char-count {
    display: block;
    text-align: right;
    margin-top: var(--space-xs);
    font-size: 0.875rem;
    color: var(--gray-500);
}

.char-count.warning {
    color: #ef4444;
}

.comment-message {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
    font-weight: 500;
}

.comment-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.comment-message.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.comments-list {
    margin-top: var(--space-lg);
}

.comments-count {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    color: var(--gray-700);
}

.comment {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.comment-author {
    color: var(--primary);
    font-size: 0.9rem;
}

.comment-date {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.comment-text {
    color: var(--gray-700);
    line-height: 1.6;
    white-space: pre-wrap;
}

.no-comments {
    text-align: center;
    color: var(--gray-500);
    font-style: italic;
    padding: var(--space-xl);
}

.loading {
    text-align: center;
    color: var(--gray-500);
    padding: var(--space-lg);
}

@media (max-width: 768px) {
    .game-info {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }
    
    .puzzle-grid {
        max-width: 280px;
    }
    
    .comment-form {
        padding: var(--space-md);
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
}