/* ========================================
   STYLE.CSS - Main Styles
   ======================================== */

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-secondary);
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 8px 8px;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Visually Hidden (for screen readers) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo {
    font-size: 1.8rem;
}

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

.nav-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a:focus {
    background: var(--accent-gradient);
    color: white;
}

.nav-menu a:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Language Switcher */
.language-switcher select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-switcher select:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Icon Buttons */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--accent-gradient);
    color: white;
}

.icon-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

/* Sections */
.section {
    min-height: 100vh;
    padding: 6rem 2rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 10;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    margin-bottom: 1rem;
}

.hero-title .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--glow-color);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-outline:hover {
    background: var(--accent-primary);
    color: white;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Hero Stats */
.hero-stats {
    display: flex;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Hero Visual Canvas */
.hero-visual {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Visuals Section */
.visuals-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.three-container {
    width: 100%;
    max-width: 900px;
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow-strong);
}

#three-canvas {
    width: 100%;
    height: 100%;
}

.visual-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.control-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

input[type="range"] {
    width: 150px;
    height: 6px;
    border-radius: 3px;
    background: var(--input-bg);
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-gradient);
    cursor: pointer;
}

/* Game Section */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#snake-canvas {
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow-strong);
    background: var(--bg-secondary);
}

.game-info {
    display: flex;
    gap: 2rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.score-display,
.high-score {
    padding: 0.5rem 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.game-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mobile-row {
    display: flex;
    gap: 0.5rem;
}

.mobile-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--accent-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-btn:hover,
.mobile-btn:active {
    background: var(--accent-primary);
    color: white;
}

.game-instructions {
    color: var(--text-secondary);
    text-align: center;
    max-width: 500px;
}

/* Data Section */
.data-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.chart-wrapper {
    width: 100%;
    max-width: 800px;
    height: 400px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 40px var(--shadow-strong);
}

#sorting-canvas {
    width: 100%;
    height: 100%;
}

.data-controls {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 500;
    color: var(--text-secondary);
}

.control-group select,
.control-group input[type="range"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
}

.algorithm-info {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color);
    max-width: 600px;
    text-align: center;
}

.algorithm-info h3 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.algorithm-info p {
    color: var(--text-secondary);
}

/* Audio Section */
.audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 900px;
}

#audio-canvas {
    width: 100%;
    max-width: 800px;
    height: 250px;
    border-radius: 16px;
    background: var(--card-bg);
    box-shadow: 0 10px 40px var(--shadow-strong);
}

.synth-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.keyboard {
    display: flex;
    gap: 4px;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.key {
    width: 50px;
    height: 150px;
    border: 2px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
}

.key::after {
    content: attr(data-note);
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.key:hover,
.key.active {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    transform: translateY(2px);
}

.key.black {
    width: 35px;
    height: 100px;
    background: var(--text-primary);
    margin-left: -17px;
    margin-right: -17px;
    z-index: 10;
}

.key.black::after {
    color: white;
}

.synth-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.audio-hint {
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
}

.about-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--shadow-strong);
}

.about-card.full-width {
    grid-column: 1 / -1;
    text-align: center;
}

.about-card h3 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-list li {
    color: var(--text-secondary);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    padding: 0.5rem 1rem;
    background: var(--accent-gradient);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-year {
    font-size: 0.875rem;
}

/* Performance Indicator */
.performance-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0.75rem 1.5rem;
    background: var(--warning);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 20px var(--shadow-strong);
    z-index: 1000;
    display: none;
}

.performance-indicator.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--navbar-bg);
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .section {
        padding: 5rem 1rem 3rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }
    
    .hero-stats {
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .three-container {
        height: 300px;
    }
    
    #snake-canvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .keyboard {
        transform: scale(0.7);
    }
    
    .data-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        width: 100%;
    }
    
    .control-group input[type="range"] {
        width: 100%;
    }
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    .nav-controls,
    .game-controls,
    .data-controls,
    .synth-controls,
    .performance-indicator {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .section {
        min-height: auto;
        page-break-inside: avoid;
    }
}
