@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;1,8..60,300;1,8..60,400&family=DM+Mono:wght@400;500&display=swap');

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

html {
    scroll-behavior: smooth;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    line-height: 1.7;
    color: #ffffff;
    background-color: #0f172a;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Subtle texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.03) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

header {
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.75rem 0 1.25rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    z-index: 3000;
    min-height: 6rem;
}

.main-nav {
    max-width: 100%;
    margin: 0;
    padding: 0 2rem;
}

.nav-container {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
    position: relative;
    padding-bottom: 0.15rem;
    min-height: 6.5rem;
}

.nav-container .nav-left {
    flex: 0 0 auto;
    order: 1;
}

.nav-container .site-title {
    flex: 0 0 auto;
    order: 2;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-container .nav-right {
    flex: 0 0 auto;
    order: 3;
    margin-left: auto;
}

.nav-container .nav-hamburger {
    order: 4;
}

.site-title {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    display: flex;
    align-items: center;
}

.logo-text-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: #ffffff;
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-line {
    display: block;
    font-size: 1.4rem;
    color: #ffffff;
}

.logo-ai {
    color: #808080;
}

.logo-tagline {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.03em;
    white-space: nowrap;
    margin-top: 0.5rem;
}

.site-title img {
    height: 180px;
    width: auto;
    max-width: 720px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: clamp(0.75rem, 2vw, 2rem);
    flex-wrap: nowrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    font-size: clamp(0.78rem, 1.2vw, 0.95rem);
    white-space: nowrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
    position: relative;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #14b8a6;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #14b8a6;
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    padding-top: 5rem;
    padding-bottom: 6rem;
    overflow: hidden;
    background: #0f172a;
}

.hero-banner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    filter: brightness(0.7) saturate(1) blur(0);
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(
            to bottom,
            transparent 50%,
            rgba(15, 23, 42, 0.4) 75%,
            #0f172a 100%
        ),
        linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.7) 0%,
            rgba(0, 0, 0, 0.35) 40%,
            rgba(0, 0, 0, 0.12) 100%
        );
    pointer-events: none;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.15em;
    color: #ffffff;
    margin-bottom: 1.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 0, 0, 0.2);
}

.hero-title .hero-logo-line {
    display: block;
}

.hero-title .hero-logo-ai {
    color: #808080;
}

.hero-description {
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.75rem;
    background-color: #14b8a6;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.2s;
}

.hero-cta:hover {
    background-color: #0d9488;
    transform: translateY(-2px);
}

.hero-cta-arrow {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.hero-cta:hover .hero-cta-arrow {
    transform: translate(4px, -4px);
}

.hero-cta-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-cta-outline {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.hero-cta-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.25rem;
    }
    .hero-description {
        font-size: 1rem;
    }
}

/* Map Section - platform-style viewport (global critical minerals pattern) */
.map-section-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: #0a0f1e;
}

.map-section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.map-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #0f172a;
}

.map-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    background: #0f172a;
    z-index: 1;
    overflow: hidden;
}

/* Subtle texture on map container */
.map-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        radial-gradient(circle at 2px 2px, rgba(255,255,255,0.02) 1px, transparent 0);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 1;
}

#gcc-map {
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    background-color: #e2e8f0;
}

/* Leaflet needs explicit height on container for tiles to load */
.map-container {
    height: 100vh !important;
    min-height: 400px;
}

.country-path {
    fill: #334155;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
}

.country-path:hover {
    fill: #14b8a6;
    opacity: 1;
    stroke: #14b8a6;
    stroke-width: 2;
    filter: brightness(1.1);
}

.country-path.active {
    fill: #0d9488;
    stroke: #14b8a6;
    stroke-width: 2;
    opacity: 1;
    filter: brightness(1.2);
}

/* Map text labels */
#gcc-map text {
    pointer-events: none;
    user-select: none;
    font-family: 'Source Serif 4', Georgia, serif;
    transition: fill 0.3s ease;
}

#gcc-map .country-path:hover + text,
#gcc-map .country-path.active + text {
    fill: #14b8a6 !important;
    font-weight: 700;
}

/* Country tooltip - readable on light basemap */
.country-tooltip {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 0.4rem 0.75rem !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12) !important;
}

.country-tooltip::before {
    border-top-color: #e2e8f0 !important;
}

/* Base layer switcher + map actions (platform-style controls) */
.leaflet-control-layers {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    overflow: hidden;
}

.leaflet-control-layers-expanded {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    padding: 0.5rem !important;
}

.leaflet-control-layers label {
    color: rgba(255,255,255,0.9) !important;
    font-size: 0.9rem !important;
}

.leaflet-control-layers-toggle {
    background: #1e293b !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
}

.gcc-map-controls {
    background: #1e293b !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    overflow: hidden;
    margin-top: 0.5rem !important;
}

.gcc-map-controls .gcc-control-btn {
    display: block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: #1e293b;
    color: #fff;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
}

.gcc-map-controls .gcc-control-btn:last-child {
    border-bottom: none;
}

.gcc-map-controls .gcc-control-btn:hover {
    background: #14b8a6;
    color: #0f172a;
}

/* Position map controls below fixed header when map is in view */
.map-container .leaflet-top.leaflet-right {
    top: 80px;
}

.countries-sidebar {
    position: fixed;
    top: 70px;
    left: 2rem;
    width: 320px;
    max-height: calc(100vh - 90px);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 2000;
    overflow-y: auto;
    border-left: 4px solid #14b8a6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.countries-sidebar.sidebar-visible {
    opacity: 1;
    pointer-events: auto;
}

.countries-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.02) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.5;
}

.countries-sidebar h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #ffffff;
    font-weight: 600;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 1;
}

.country-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.country-card {
    background: rgba(30, 41, 59, 0.8);
    padding: 1rem;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid #14b8a6;
    position: relative;
    overflow: hidden;
}

.country-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transform: translateX(4px);
    border-left-color: #0d9488;
    background: rgba(51, 65, 85, 0.9);
}

.country-card h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #ffffff;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.country-card p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
    margin: 0;
}

/* Country info panel - Global Conflict Tracker style: white card, shadow, arrow strip */
.country-info-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #ffffff;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    max-width: 360px;
    min-width: 280px;
    z-index: 2001;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.country-info-panel .close-btn {
    position: absolute;
    top: 0.5rem;
    right: 52px;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #64748b;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    z-index: 3;
}

.country-info-panel .close-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.info-panel-category {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
    padding: 1rem 1.25rem 0 1.25rem;
    width: 100%;
}

.country-info-panel .info-panel-title {
    margin: 0 0 0.5rem 0;
    padding: 0 1.25rem 0 1.25rem;
    padding-right: 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.country-info-panel .info-panel-description {
    margin: 0;
    padding: 0 1.25rem 0 1.25rem;
    padding-right: 3rem;
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
}

.info-panel-stats {
    width: 100%;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
    padding-right: 44px;
}

.info-panel-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.info-panel-stat-label {
    font-size: 0.85rem;
    color: #475569;
}

.info-panel-stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
}

.info-panel-stat-value.ai-type-frontier {
    color: #1e40af;
}

.info-panel-stat-value.ai-type-inference {
    color: #0f766e;
}

.info-panel-arrow {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 100%;
    background: #1e40af;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s;
}

.info-panel-arrow:hover {
    background: #1e3a8a;
    color: #fff;
}

.info-panel-arrow-icon {
    font-size: 1.25rem;
    font-weight: 700;
}

.methodology-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 3000;
    border-left: 4px solid #14b8a6;
    display: none;
    overflow-y: auto;
}

.methodology-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.02) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.5;
}

.methodology-panel h2 {
    color: #ffffff;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
    padding-right: 2rem;
}

.methodology-content {
    position: relative;
    z-index: 1;
}

.methodology-content p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.methodology-content p:last-child {
    margin-bottom: 0;
}

.view-article-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #14b8a6;
    color: white;
    text-decoration: none;
    border-radius: 0;
    transition: all 0.3s;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.view-article-btn:hover {
    background-color: #0d9488;
    transform: translateX(4px);
}

/* Responsive design */
@media (max-width: 968px) {
    .countries-sidebar {
        width: 280px;
        left: 1rem;
        top: 1rem;
        padding: 1rem;
    }
    
    .country-info-panel {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* ── Hamburger menu ─────────────────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 4000;
    grid-column: 3;
    justify-self: end;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile nav drawer ──────────────────────────────────────────── */
@media (max-width: 768px) {
    header {
        padding: 0.5rem 0;
    }

    .nav-container {
        flex-wrap: wrap;
    }

    .nav-container .site-title {
        position: static;
        transform: none;
        order: 1;
        flex: 1 1 auto;
    }

    .nav-container .nav-left,
    .nav-container .nav-right {
        display: none;
        order: 3;
        width: 100%;
    }

    .nav-container.mobile-open .nav-left,
    .nav-container.mobile-open .nav-right {
        display: block;
    }

    .nav-container .nav-left .nav-links,
    .nav-container .nav-right .nav-links {
        flex-direction: column;
        gap: 0;
        width: 100%;
        background: #0a0f1e;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding: 0.5rem 0 1rem;
        margin-top: 0;
    }

    .nav-container .nav-right .nav-links {
        border-top: none;
        padding-top: 0;
    }

    .nav-links li a {
        display: block;
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        white-space: nowrap;
        border-left: 3px solid transparent;
    }

    .nav-links li a:hover {
        border-left-color: #14b8a6;
        background: rgba(255,255,255,0.04);
    }

    .nav-links a::after { display: none; }

    .nav-hamburger {
        display: flex;
        order: 2;
    }

    .logo-line { font-size: 1.1rem; }
    .logo-tagline { display: none; }

    /* Hero */
    .hero-section {
        padding: 1.5rem 1.25rem;
        padding-top: 5rem;
        min-height: auto;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    /* Map */
    .map-container {
        height: 60vh;
        min-height: 320px;
    }

    .countries-sidebar {
        width: 100%;
        left: 0;
        top: 0;
        max-height: 35vh;
        position: relative;
        border-left: none;
        border-bottom: 4px solid #14b8a6;
    }

    .map-section {
        flex-direction: column;
    }

    .country-info-panel {
        bottom: 1rem;
        right: 0.75rem;
        left: 0.75rem;
        max-width: none;
    }

    /* AI Stack teaser */
    #ai-stack-teaser {
        padding: 2rem 1.25rem !important;
    }

    #ai-stack-teaser > div {
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
}
