/**
 * Discovery Core Styles
 * Shared CSS for all discovery experiences
 *
 * Each discovery sets these CSS variables:
 * --primary: Main accent color
 * --primary-dim: Darker shade for hover
 * --primary-glow: rgba() for shadows/glows
 */

:root {
    /* Universal dark theme (DO NOT CHANGE) */
    --bg-dark: #0a0a0f;
    --bg-card: #1a1a2e;
    --bg-panel: #252540;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===========================================
   START SCREEN
   =========================================== */

.start-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.start-back-link {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    z-index: 10;
    transition: color 0.2s;
}

.start-back-link:hover {
    color: var(--primary);
}

.start-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.3;
}

.start-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.start-icon {
    width: 200px;
    height: 150px;
    margin: 0 auto 2rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.start-screen h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.start-btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dim) 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

/* ===========================================
   EXPERIENCE SCREEN
   =========================================== */

.experience-screen {
    display: none;
    min-height: 100vh;
    padding-bottom: 4rem;
}

.experience-screen.active {
    display: block;
}

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

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

.done-btn {
    padding: 0.5rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.done-btn:hover {
    background: var(--primary-dim);
    transform: scale(1.05);
}

/* ===========================================
   DEMO SECTIONS
   =========================================== */

.demo-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-number {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1.5rem;
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* ===========================================
   COMMON COMPONENTS
   =========================================== */

/* Canvas Container */
.canvas-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.1);
}

canvas {
    display: block;
    border-radius: 8px;
    background: var(--bg-panel);
}

/* Canvases that need fixed dimensions for mouse tracking */
canvas.game-canvas {
    width: auto;
    max-width: 100%;
    cursor: crosshair;
}

/* Controls */
.controls,
.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
    justify-content: center;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.stats-row .stat-item {
    text-align: center;
    background: var(--bg-panel);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    min-width: 120px;
}

.stats-row .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

.stats-row .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

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

.control-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-group input[type="range"] {
    width: 150px;
    accent-color: var(--primary);
}

.control-group select {
    padding: 0.5rem;
    background: var(--bg-panel);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    font-size: 0.9rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

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

.btn-secondary {
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}

/* Info Cards */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.info-card {
    background: var(--bg-panel);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.info-card h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.info-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Fun Fact */
.fun-fact {
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 244, 63, 94), 0.1) 0%, rgba(var(--primary-rgb, 244, 63, 94), 0.05) 100%);
    border: 1px solid rgba(var(--primary-rgb, 244, 63, 94), 0.3);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-top: 1.5rem;
}

.fun-fact-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Frequency Display */
.freq-display {
    text-align: center;
    padding: 1rem;
    background: var(--bg-panel);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.freq-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

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

/* Formula Box */
.formula-box {
    background: var(--bg-panel);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
}

.formula-box .formula {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.formula-box .explanation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-family: inherit;
}

/* ===========================================
   END SCREEN
   =========================================== */

.end-screen {
    display: none;
    min-height: 100vh;
    padding: 4rem 2rem;
    text-align: center;
}

.end-screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.end-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.end-screen .summary {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    margin-bottom: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

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

/* Learnings */
.learnings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 2rem 0;
}

.learning-item {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: left;
}

.learning-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.learning-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* CTA Section */
.cta-section {
    margin-top: 3rem;
}

.cta-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.cta-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

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

.cta-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.cta-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dim) 100%);
    color: white;
}

.cta-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--primary-glow);
}

.cta-btn.secondary {
    background: var(--bg-panel);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.2);
}

.cta-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
}

/* Starter Project */
.starter-project {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 500px;
    margin: 1.5rem auto;
    text-align: left;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

.project-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.step strong {
    color: var(--primary);
    font-weight: 600;
}

.step-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
    .demo-section {
        padding: 2rem 1rem;
    }

    .sticky-header {
        padding: 0.75rem 1rem;
    }

    .header-title {
        font-size: 0.9rem;
    }

    .controls {
        flex-direction: column;
    }

    .chord-display {
        flex-direction: column;
        gap: 1rem;
    }

    .stats-grid {
        gap: 1.5rem;
    }

    .learnings {
        grid-template-columns: 1fr;
    }
}
