/* ============================================
   ReflexLab — Shared Styles
   ============================================ */

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

/* Design Tokens — aligned to in-app AppColors */
:root {
    /* Brand */
    --reflex-red: #E10600;
    --reflex-red-glow: rgba(225, 6, 0, 0.4);
    --lab-blue: #1D4ED7;
    --lab-blue-glow: rgba(29, 78, 215, 0.4);

    /* Studio Colors */
    --studio-wave-deep: #001e3c;
    --studio-wave: #2563EB;
    --studio-wave-glow: rgba(37, 99, 235, 0.35);

    /* Surfaces */
    --bg-dark: #020617;
    --bg-card: rgba(255, 255, 255, 0.015);
    --bg-card-hover: rgba(255, 255, 255, 0.03);
    --border-subtle: rgba(255, 255, 255, 0.03);
    --border-hover: rgba(255, 255, 255, 0.1);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #8888a0;
    --text-muted: #555570;

    /* Tier Colors (Classic mode — match AppColors exactly) */
    --tier-superhuman: #FFD700;
    --tier-insane: #00D9FF;
    --tier-elite: #00FF88;
    --tier-excellent: #0EA5E9;
    --tier-great: #3B82F6;
    --tier-sharp: #14B8A6;
    --tier-average: #F59E0B;
    --tier-steady: #FF8000;
    --tier-slow: #FF0000;
    --tier-sleepy: #880808;

    /* Phantom Ring tier colors */
    --pr-perfect: #10B981;
    --pr-great: #34D399;
    --pr-good: #6EE7B7;
    --pr-close: #F59E0B;
    --pr-miss: #EF4444;

    /* Stroop colors (stimulus ink) */
    --stroop-red: #EF4444;
    --stroop-blue: #3B82F6;
    --stroop-green: #22C55E;
    --stroop-yellow: #EAB308;

    /* Rank badge colors */
    --rank-gold: #FFD700;
    --rank-silver: #C0C0C0;
    --rank-bronze: #CD7F32;

    /* Mode Specific Colors */
    --mode-classic: #0EA5E9;
    --mode-classic-glow: rgba(14, 165, 233, 0.4);
    --mode-rf: #E10600;
    --mode-rf-glow: rgba(225, 6, 0, 0.4);
    --mode-stroop: #A855F7;
    --mode-stroop-glow: rgba(168, 85, 247, 0.4);
    --mode-pr: #10B981;
    --mode-pr-glow: rgba(16, 185, 129, 0.4);

    /* Mode Gradients */
    --grad-classic: linear-gradient(135deg, #38BDF8, #0EA5E9);
    --grad-rf: linear-gradient(135deg, #FF4D00, #E10600);
    --grad-stroop: linear-gradient(135deg, #C084FC, #A855F7);
    --grad-pr: linear-gradient(135deg, #34D399, #10B981);
}

html {
    scroll-behavior: smooth;
}

/* Typography */
body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 101vh; /* Force scrollbar to prevent horizontal jump */
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Shared Background Grid */
.bg-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Container */
.container {
    position: relative;
    z-index: 10;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    padding-left: calc(24px + env(safe-area-inset-left, 0px));
    padding-right: calc(24px + env(safe-area-inset-right, 0px));
}

.content-width {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* --- HEADER --- */
header {
    padding: 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
    text-decoration: none;
}

.logo img {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    border-radius: 8px;
}

.logo-reflex { color: var(--reflex-red); }
.logo-lab { color: var(--lab-blue); }

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a.active {
    color: var(--text-primary);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 12px;
    margin-right: -12px;
    z-index: 200; /* Stays above mobile-nav overlay (150) */
    position: relative;
}

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

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    background: rgba(2, 6, 23, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 150;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.mobile-nav.active { display: flex; }

.mobile-nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 24px;
    font-weight: 600;
    transition: color 0.2s;
}

.mobile-nav a:hover { color: var(--lab-blue); }

/* --- FOOTER --- */
footer {
    padding: 60px 0 40px; /* Fallback */
    padding: 60px 0 calc(40px + env(safe-area-inset-bottom, 0px));
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    padding: 8px; /* Better touch target */
}

.footer-links a:hover { color: var(--text-primary); }

.copyright {
    color: var(--text-secondary);
    font-size: 13px;
}

.copyright a {
    color: var(--text-secondary);
    text-decoration: none;
}

.copyright a:hover { color: var(--text-primary); }

/* --- GLASSMORPHIC CARD (reusable) --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 32px;
    transition: all 0.3s;
}

.glass-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
    cursor: pointer;
    border: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--reflex-red), #c62828);
    color: white;
    box-shadow: 0 4px 20px var(--reflex-red-glow);
}

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

.btn-secondary {
    background: rgba(255,255,255,0.02);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--border-hover);
}

/* --- RESPONSIVE --- */
@media (max-width: 640px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }

    .footer-links {
        flex-direction: column;
        gap: 16px;
    }

    .container {
        padding-left: calc(20px + env(safe-area-inset-left, 0px));
        padding-right: calc(20px + env(safe-area-inset-right, 0px));
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* --- ACCORDION (FAQ) --- */
.faq-section { margin-bottom: 48px; }
.faq-section h2 { 
    font-size: 22px; 
    font-weight: 700; 
    margin-bottom: 20px; 
    padding-bottom: 12px; 
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.faq-item {
    border-bottom: 1px solid var(--border-subtle);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
    user-select: none;
}

.faq-question h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    padding-right: 20px;
}

.faq-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer-inner {
    padding: 0 0 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.faq-answer-inner a {
    color: var(--lab-blue);
    text-decoration: none;
}

.faq-answer-inner a:hover {
    text-decoration: underline;
}
