/* ================================================
   BRAZIL GOLD MINES - PREMIUM VISUAL EXPERIENCE
   ================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #050507;
    --bg-dark: #0a0a0f;
    --bg-card: rgba(15, 15, 20, 0.85);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-soft: #b4b4c0;
    --text-dim: #6b6b7a;
    
    /* Brazilian Flag Colors */
    --brazil-green: #009c3b;
    --brazil-green-light: #00c853;
    --brazil-green-glow: rgba(0, 156, 59, 0.4);
    --brazil-yellow: #ffdf00;
    --brazil-blue: #002776;
    --brazil-blue-light: #1e40af;
    --brazil-blue-glow: rgba(0, 39, 118, 0.4);
    
    /* Gold (primary accent) */
    --gold: #f7b731;
    --gold-light: #fed330;
    --gold-glow: rgba(247, 183, 49, 0.4);
    
    /* Secondary colors using Brazil palette */
    --blue: var(--brazil-blue-light);
    --blue-glow: var(--brazil-blue-glow);
    --green: var(--brazil-green);
    --green-glow: var(--brazil-green-glow);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Ambient Background - Brazilian flag colors */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 60% at 5% 15%, rgba(0, 156, 59, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 95% 85%, rgba(0, 39, 118, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 50% 50%, rgba(247, 183, 49, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ================================================
   LOADER
   ================================================ */
#loader {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--brazil-green);
    border-right-color: var(--brazil-yellow);
    border-bottom-color: var(--brazil-blue-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loader p {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ================================================
   HERO
   ================================================ */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse 100% 100% at 50% 20%, rgba(247, 183, 49, 0.08) 0%, transparent 50%);
}

#hero::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(247, 183, 49, 0.12) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    filter: blur(60px);
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 30px); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
    max-width: 700px;
}

.hero-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--brazil-green-light);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 28px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(0, 156, 59, 0.12) 0%, rgba(0, 39, 118, 0.08) 100%);
    border: 1px solid rgba(0, 156, 59, 0.25);
    border-radius: 100px;
}

.hero-label::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--brazil-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--brazil-green-glow);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#hero h1 {
    font-size: clamp(44px, 9vw, 88px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 20px;
}

#hero h1 span {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 18px;
    color: var(--text-soft);
    max-width: 500px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-bottom: 44px;
}

.hero-stat {
    text-align: center;
}

.hero-stat strong {
    display: block;
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.hero-stat span {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--brazil-green) 0%, var(--brazil-green-light) 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    border-radius: 100px;
    box-shadow: 0 4px 24px var(--brazil-green-glow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.hero-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 223, 0, 0.3), transparent);
    transition: left 0.5s ease;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--brazil-green-glow);
}

.hero-cta:hover::before {
    left: 100%;
}

.hero-cta svg {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* ================================================
   TOUR TOGGLE
   ================================================ */
.tour-toggle {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--text-soft);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(25, 25, 35, 0.95);
    border-color: rgba(255, 255, 255, 0.15);
}

.toggle-btn.active {
    background: linear-gradient(135deg, rgba(0, 156, 59, 0.15) 0%, rgba(0, 39, 118, 0.08) 100%);
    border-color: rgba(0, 156, 59, 0.35);
    color: var(--brazil-green-light);
}

.toggle-btn .icon-free {
    display: none;
}

.toggle-btn.active .icon-tour {
    display: block;
}

.toggle-btn.active .icon-free {
    display: none;
}

.toggle-btn:not(.active) .icon-tour {
    display: none;
}

.toggle-btn:not(.active) .icon-free {
    display: block;
}

.toggle-hint {
    font-size: 11px;
    color: var(--text-dim);
}

.toggle-hint .hint-free {
    display: none;
}

.toggle-btn.active ~ .toggle-hint .hint-tour {
    display: inline;
}

.toggle-btn.active ~ .toggle-hint .hint-free {
    display: none;
}

.toggle-btn:not(.active) ~ .toggle-hint .hint-tour {
    display: none;
}

.toggle-btn:not(.active) ~ .toggle-hint .hint-free {
    display: inline;
}

/* ================================================
   PROGRESS BAR
   ================================================ */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 999;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        var(--brazil-green) 0%, 
        var(--brazil-yellow) 35%, 
        var(--gold) 65%, 
        var(--brazil-blue-light) 100%
    );
    transition: width 0.3s ease;
    box-shadow: 0 0 12px var(--gold-glow);
}

/* ================================================
   CHAPTER INDICATOR
   ================================================ */
.chapter-indicator {
    position: absolute;
    bottom: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    z-index: 10;
    border-left: 3px solid var(--brazil-green);
}

#chapter-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

#chapter-count {
    font-size: 12px;
    color: var(--text-dim);
    padding-left: 16px;
    border-left: 1px solid var(--glass-border);
}

/* ================================================
   SCROLLYTELLING
   ================================================ */
#scrolly {
    position: relative;
}

#map-wrap {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
}

#map-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        rgba(5, 5, 7, 0.85) 0%, 
        rgba(5, 5, 7, 0.4) 35%, 
        transparent 60%
    );
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#map-wrap.explore-mode::after {
    opacity: 0.2;
}

#map-ui {
    position: absolute;
    top: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    pointer-events: none;
}

/* ================================================
   MAP PANELS
   ================================================ */
.map-panel {
    pointer-events: auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 18px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease;
}

.map-panel.hidden {
    opacity: 0;
    transform: translateY(-15px);
    pointer-events: none;
}

.map-panel h4 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot.primary {
    background: var(--gold);
    box-shadow: 0 0 12px var(--gold-glow);
}

.dot.secondary {
    background: var(--brazil-blue-light);
    box-shadow: 0 0 12px var(--brazil-blue-glow);
}

.dot.brazil-green {
    background: var(--brazil-green);
    box-shadow: 0 0 12px var(--brazil-green-glow);
}

.legend-row span:last-child {
    font-size: 13px;
    color: var(--text-soft);
}

/* Mine Info */
#mine-info {
    max-width: 280px;
    position: relative;
}

#close-info {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#close-info:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

#mine-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-right: 36px;
    color: var(--text);
}

#mine-info table {
    width: 100%;
}

#mine-info td {
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

#mine-info td:first-child {
    color: var(--text-dim);
}

#mine-info td:last-child {
    color: var(--text-soft);
    text-align: right;
    font-weight: 500;
}

#mine-info tr:last-child td {
    border: none;
}

/* ================================================
   STORY CARDS
   ================================================ */
#story {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.step {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 80px 50px;
}

.card {
    pointer-events: auto;
    max-width: 400px;
    padding: 32px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.5s ease;
    position: relative;
    overflow: hidden;
}

/* Brazilian flag accent stripe on card */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        var(--brazil-green) 0%, 
        var(--brazil-green) 33%, 
        var(--brazil-yellow) 33%, 
        var(--brazil-yellow) 66%, 
        var(--brazil-blue-light) 66%, 
        var(--brazil-blue-light) 100%
    );
    opacity: 0.8;
}

.step.is-active .card {
    opacity: 1;
    transform: translateX(0);
}

.step-num {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--brazil-green-light);
    padding: 6px 14px;
    background: rgba(0, 156, 59, 0.15);
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 2px solid var(--brazil-green);
}

/* Alternate step number colors */
.step:nth-child(3n+2) .step-num {
    color: var(--gold);
    background: rgba(247, 183, 49, 0.12);
    border-left-color: var(--gold);
}

.step:nth-child(3n) .step-num {
    color: var(--brazil-blue-light);
    background: rgba(0, 39, 118, 0.15);
    border-left-color: var(--brazil-blue-light);
}

.card h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--text);
}

.region-subtitle {
    font-size: 14px;
    color: var(--gold);
    margin-bottom: 16px;
    font-weight: 500;
}

.card p {
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.7;
    margin-bottom: 8px;
}

.card p:last-of-type {
    margin-bottom: 0;
}

.card p strong {
    color: var(--text);
    font-weight: 600;
}

.card p em {
    color: var(--gold);
    font-style: normal;
}

.scroll-hint {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-dim);
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

/* Stat Highlight */
.stat-highlight {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 156, 59, 0.08) 0%, rgba(247, 183, 49, 0.08) 100%);
    border: 1px solid rgba(0, 156, 59, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.stat-highlight::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--brazil-green), var(--brazil-yellow));
}

.stat-highlight .big {
    font-size: 44px;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
}

.stat-highlight span:last-child {
    font-size: 14px;
    color: var(--text-soft);
}

/* Explore Card */
.explore-card {
    max-width: 380px;
}

.explore-tip {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-dim);
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    text-align: center;
}

/* Filters */
.filters {
    margin-top: 20px;
    display: grid;
    gap: 14px;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.filters select {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.filters select:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.filters select:focus {
    outline: none;
    border-color: var(--brazil-green);
    box-shadow: 0 0 0 2px var(--brazil-green-glow);
}

/* ================================================
   FOOTER
   ================================================ */
footer {
    padding: 50px 24px;
    text-align: center;
    background: var(--bg-deep);
    border-top: 1px solid var(--glass-border);
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        var(--brazil-green) 0%, 
        var(--brazil-green) 33%, 
        var(--brazil-yellow) 33%, 
        var(--brazil-yellow) 66%, 
        var(--brazil-blue-light) 66%, 
        var(--brazil-blue-light) 100%
    );
}

.footer-content p {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.footer-content p strong {
    color: var(--text-soft);
}

.brazil-flag-icon {
    display: inline-block;
    width: 24px;
    height: 16px;
    background: linear-gradient(180deg, var(--brazil-green) 50%, var(--brazil-green) 50%);
    border-radius: 2px;
    position: relative;
    margin-left: 8px;
    vertical-align: middle;
}

.brazil-flag-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--brazil-yellow);
}

.brazil-flag-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--brazil-blue-light);
    border-radius: 50%;
}

/* ================================================
   MAPBOX
   ================================================ */
.mapboxgl-ctrl-group {
    background: var(--bg-card) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 10px !important;
}

.mapboxgl-ctrl-group button {
    width: 34px !important;
    height: 34px !important;
}

.mapboxgl-ctrl-icon {
    filter: invert(1) opacity(0.6);
}

.mapboxgl-ctrl-attrib {
    background: rgba(5, 5, 7, 0.8) !important;
    font-size: 10px !important;
}

.mapboxgl-ctrl-attrib a {
    color: var(--text-dim) !important;
}

/* ================================================
   FREE EXPLORE MODE
   ================================================ */
body.free-mode #story {
    pointer-events: none;
    opacity: 0.3;
}

body.free-mode .card {
    opacity: 0.5 !important;
    transform: translateX(-20px) !important;
}

body.free-mode .chapter-indicator {
    opacity: 0.5;
}

body.free-mode .progress-bar {
    opacity: 0.3;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
    #map-wrap::after {
        background: linear-gradient(180deg, 
            transparent 0%, 
            transparent 40%,
            rgba(5, 5, 7, 0.95) 100%
        );
    }
    
    .step {
        padding: 30px 20px;
        padding-top: 50vh;
        min-height: auto;
        align-items: flex-end;
    }
    
    .card {
        max-width: 100%;
    }
    
    .tour-toggle {
        top: 12px;
    }
    
    .toggle-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    #map-ui {
        top: auto;
        bottom: 20px;
        right: 12px;
        left: 12px;
    }
    
    #mine-info {
        position: fixed;
        top: auto;
        bottom: 80px;
        left: 12px;
        right: 12px;
        max-width: none;
    }
    
    .chapter-indicator {
        left: 12px;
        bottom: 12px;
        padding: 10px 14px;
    }
    
    .hero-stats {
        gap: 28px;
    }
    
    .hero-stat strong {
        font-size: 32px;
    }
}
