/* ==============================================
   Animated Map Section — "Middle East Trade Routes"
   Dark satellite-map background, neon title,
   glassmorphism info panel + 3 market cards
   ============================================== */

.animated-map-section {
    position: relative;
    min-height: 112vh;
    background-image: url('../images/trademap.jfif');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cinematic dark overlay */
.animated-map-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(2, 6, 18, 0.68) 0%,
            rgba(2, 6, 18, 0.42) 40%,
            rgba(2, 6, 18, 0.60) 70%,
            rgba(2, 6, 18, 0.82) 100%);
    z-index: 1;
    pointer-events: none;
}

/* ---- SVG Map — absolute, fills the section, transparent overlay only ---- */
.animated-map-container {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
}

.map-svg {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

.map-background {
    fill: none;
    opacity: 0;
}

.map-grid {
    stroke: rgba(100, 150, 200, 0.05);
    stroke-width: 0.5;
    opacity: 0;
    display: none;
}

/* Country borders are retained as a subtle overlay on top of the background image */
.country-border {
    transition: all 0.3s ease;
    opacity: 0.24;
    display: block;
    stroke-width: 1 !important;
    fill-opacity: 0.08;
}

.country-label {
    opacity: 0;
    display: none;
}

.water-label {
    opacity: 0;
    display: none;
}

.city-marker {
    opacity: 0;
}

.route-path {
    opacity: 1;
}

/* ---- Content overlay (z-index above SVG) ---- */
.map-content-overlay {
    position: absolute;
    top: 50%;
    right: clamp(18px, 3vw, 40px);
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    text-align: right;
    padding: 32px 24px;
    width: min(420px, 36vw);
    max-width: 420px;
    gap: 22px;
}

/* ---- Section Title ---- */
.map-hero-title {
    font-size: clamp(2.4rem, 6vw, 5rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1.1;
    text-transform: uppercase;
    color: #ffffff;
    margin: 0;
}


/* ---- Glassmorphism Info Panel ---- */
.map-info-panel {
    background: rgba(5, 15, 35, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 22px 22px 24px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: left;
}

.map-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.map-globe {
    font-size: 1.4rem;
    line-height: 1;
}

.map-panel-title {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.map-panel-desc {
    color: #90a4ae;
    font-size: 0.92rem;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* ---- Market Cards Grid ---- */
.market-cards {
    padding: 40px 20px 80px;
    background: transparent;
}

.trade-map-wrapper {
    position: relative;
    min-height: 260px;
    aspect-ratio: 16 / 9;
}

.trade-map-wrapper video {
    width: 100%;
    height: 100%;
    min-height: 260px;
    display: block;
    z-index: 1;
}

.market-cards-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 20px;
    pointer-events: auto;
    z-index: 2;
}

.market-cards-below {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.market-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.market-card {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 20px 22px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.market-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.market-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.country-code {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    line-height: 1.4;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.market-card h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.market-card p {
    margin: 0;
    color: #f8fafc;
    font-size: 0.9rem;
    line-height: 1.55;
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
}

/* ---- Route Paths ---- */
.route-path {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.6));
    stroke-dasharray: 10, 5;
    stroke: #ffffff;
}

/* ---- City Markers ---- */
.city-marker {
    opacity: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.6));
}

.city-marker:hover circle {
    r: 18;
}

.city-marker:hover .city-label-marker {
    opacity: 1;
    transform: translateY(-5px);
}

.city-circle {
    display: none !important;
}

/* Hide twinkling particle lights if present */
.particle-lights,
.particle-lights circle {
    display: none !important;
}
.city-label-marker {
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.city-label {
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.city-label-bg {
    fill: rgba(15, 20, 30, 0.95);
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
}

.city-label-text {
    fill: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
}

.city-label-country {
    fill: #bbbbbb;
    font-size: 11px;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* ---- Animations ---- */
@keyframes moveRoute {
    0% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -15;
    }
}

@keyframes routeFade {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

@keyframes routeFadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}



/* ---- Responsive ---- */
@media (max-width: 900px) {
    .market-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .market-card:nth-child(7) {
        grid-column: auto;
    }

    .map-info-panel {
        padding: 22px 20px 24px;
    }
}

@media (max-width: 768px) {
    .animated-map-section {
        min-height: 70vh;
    }

    .map-hero-title {
        font-size: 2rem;
    }

    .map-content-overlay {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        align-items: center;
        text-align: center;
        width: 100%;
        max-width: 760px;
        padding: 28px 18px;
        gap: 22px;
    }

    .route-path {
        stroke-width: 2;
    }
}

@media (max-width: 768px) {
    .trade-map-wrapper {
        overflow: visible !important;
        aspect-ratio: auto;
        min-height: auto;
        flex-direction: column;
        background: transparent;
        box-shadow: none;
        position: relative;
    }

    .trade-map-wrapper video {
        height: auto;
        aspect-ratio: 16 / 9;
        min-height: auto;
        width: 100%;
        border-radius: 16px;
        margin-bottom: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    }

    .market-cards-overlay {
        position: static !important;
        inset: auto;
        width: 100%;
        padding: 0;
        justify-content: center;
        align-items: center;
        gap: 16px;
    }

    .trade-map-wrapper .trade-map-header {
        position: absolute;
        top: 20px;
        left: 0;
        width: 100%;
        z-index: 10;
        padding: 0 20px;
    }

    .trade-map-wrapper .trade-map-header .section-tag {
        color: #ffffff;
        text-shadow: 0 2px 4px rgba(0,0,0,0.6);
        margin-bottom: 6px;
    }

    .trade-map-wrapper .trade-map-header .section-title {
        color: #ffffff;
        font-size: 22px;
        text-shadow: 0 2px 4px rgba(0,0,0,0.6);
        margin-bottom: 0;
    }

    .market-cards-below {
        padding: 0 20px;
        max-width: 100%;
        width: 100%;
    }

    .market-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        width: 100%;
    }

    .market-card {
        padding: 12px 14px;
        border-radius: 12px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .market-card-header {
        gap: 6px;
        margin-bottom: 6px;
    }

    .country-code {
        font-size: 0.6rem;
        padding: 2px 4px;
        background: #64748b;
        color: #ffffff;
        border: none;
        text-shadow: none;
    }

    .market-card h4 {
        font-size: 0.9rem;
        color: #1e293b;
        text-shadow: none;
    }

    .market-card p {
        font-size: 0.75rem;
        line-height: 1.4;
        color: #475569;
        text-shadow: none;
    }
}
