/* --- APPLE "LIQUID MONOCHROME" DESIGN SYSTEM --- */
:root {
    --bg-color: #000000;
    --nav-bg: rgba(20, 20, 20, 0.4);     
    --card-bg: rgba(30, 30, 35, 0.3);    
    --accent: #ffffff;
    --accent-hover: #d1d1d6;
    --text-main: #ffffff;
    --text-muted: #86868b;
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.2);
    --font-stack: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { 
    box-sizing: border-box; 
    /* Removes the blue box on tap */
    -webkit-tap-highlight-color: transparent; 
}

/* --- SCROLLBAR FIX --- */
html {
    background-color: #000000;
    height: 100%;
    width: 100vw; 
    overflow-x: hidden; 
    overflow-y: scroll; 
    
    /* Hides scrollbar in Firefox, IE, and Edge */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html.lightbox-open { 
    overflow: hidden !important; 
}

/* Loading State Helpers */
html.loading-favs .maps-grid { 
    display: none !important; 
}

html.loading-favs #infoSection { 
    display: none !important; 
}

body {
    margin: 0;
    font-family: var(--font-stack);
    background-color: transparent;
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    
    /* 4. Ensure body is also full width so centering is accurate */
    width: 100vw;
    overflow-x: hidden; 
    
    /* DISABLING TEXT SELECTION */
    user-select: none;
    -webkit-user-select: none;
}

/* Re-enable typing in search bars */
input, textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* --- CUSTOM SCROLLBAR (Hidden) --- */
::-webkit-scrollbar { 
    display: none; /* Hides scrollbar in Chrome, Safari, and Opera */
}

::-webkit-scrollbar-track { 
    background: transparent; 
}

::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3); 
    border-radius: 20px;
    border: 4px solid transparent;
    background-clip: content-box; 
}

::-webkit-scrollbar-thumb:hover { 
    background-color: rgba(255, 255, 255, 0.5); 
}

/* --- AMBIENT BACKGROUND --- */
.ambient-background {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; overflow: hidden; background: #000;
}

.blob { 
    position: absolute; 
    border-radius: 50%; 
    filter: blur(80px); 
    opacity: 0.6; 
}

.blob-1 { 
    top: -10%; 
    left: -10%; 
    width: 70vw; 
    height: 70vh; 
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25), transparent 70%); 
    animation: blobMove1 12s infinite alternate ease-in-out; 
    opacity: 0.7; 
}

.blob-2 { 
    bottom: -20%; 
    right: -10%; 
    width: 80vw; 
    height: 80vh; 
    background: radial-gradient(circle, rgba(80, 80, 80, 0.5), transparent 60%); 
    animation: blobMove2 18s infinite alternate-reverse ease-in-out
    opacity: 0.5; 
}

.blob-3 { 
    top: 40%; 
    left: 40%; 
    width: 60vw; 
    height: 60vh; 
    background: radial-gradient(circle, rgba(120, 120, 120, 0.3), transparent 60%); 
    animation: blobMove3 25s infinite alternate ease-in-out; 
    opacity: 0.4; 
}

.blob-4 { 
    top: 10%; 
    right: 20%; 
    width: 40vw; 
    height: 40vh; 
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15), transparent 70%); 
    animation: blobMove4 15s infinite alternate-reverse ease-in-out;
    opacity: 0.6; 
}

@keyframes blobMove1 { 
    0% { 
        transform: translate(0, 0) scale(1); 
    } 
    100% { 
        transform: translate(10vw, 10vh) scale(1.1); 
    } 
}

@keyframes blobMove2 { 
    0% { 
        transform: translate(0, 0) scale(1); 
    } 
    100% { 
        transform: translate(-15vw, -10vh) scale(0.9); 
    } 
}

@keyframes blobMove3 { 
    0% { 
        transform: translate(-20vw, -10vh) rotate(0deg); 
    } 
    100% { 
        transform: translate(20vw, 20vh) rotate(20deg); 
    } 
}

@keyframes blobMove4 { 
    0% { 
        transform: translate(0, 0) scale(1); 
    } 
    50% { 
        transform: translate(-10vw, 20vh) scale(1.2); 
    } 
    100% { 
        transform: translate(10vw, -10vh) scale(0.9); 
    } 
}

/* =========================================
   1. DESKTOP STYLES (Your Official "Glass" Look)
   ========================================= */
@media (min-width: 901px) {
    .liquid-nav {
        /* Matches your old .topnav */
        background-color: var(--nav-bg);
        backdrop-filter: saturate(0%) blur(30px); -webkit-backdrop-filter: saturate(0%) blur(30px);
        background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
        border-top: 1px solid var(--glass-highlight); 
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
        
        display: flex; justify-content: space-between; align-items: center; 
        padding: 0 24px; height: 52px; 
        position: fixed; top: 0; left: 0; width: 100%; z-index: 10000;
    }

    .nav-content {
        display: flex; justify-content: space-between; align-items: center;
        width: 100%; position: relative;
    }

    /* Links Container */
    .nav-links-container {
        display: flex; gap: 28px; align-items: center; height: 100%;
    }

    /* Link Items */
    .nav-item {
        color: rgba(255, 255, 255, 0.6); 
        text-decoration: none;
        font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
        transition: all 0.3s ease; position: relative; padding: 6px 0;
        cursor: pointer;
    }

    .nav-item:hover, .nav-item.active { 
        color: #fff; 
        text-shadow: 0 0 12px rgba(255,255,255,0.8); 
    }

    /* Hide Mobile Pill Elements */
    .nav-blob, .search-trigger-item { display: none !important; }

    /* Search Bar (Right Side) */
    .nav-search { 
        position: relative; width: 300px; display: flex; align-items: center; 
        /* Pushed to the right naturally by flexbox */
    }

    .nav-search input { 
        width: 100%; background: rgba(255, 255, 255, 0.1); 
        border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px; 
        padding: 6px 12px 6px 32px; font-size: 13px; color: #fff; 
        transition: all 0.3s ease; outline: none; 
    } 
    .nav-search input::placeholder { color: rgba(255, 255, 255, 0.4); } 
    .nav-search input:focus { background: rgba(255, 255, 255, 0.2); border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15); } 

    .nav-search .search-icon { 
        position: absolute; left: 10px; top: 50%; transform: translateY(-50%); 
        width: 14px; height: 14px; border: 1.5px solid rgba(255, 255, 255, 0.5); 
        border-radius: 50%; pointer-events: none; 
    } 
    .nav-search .search-icon::after { 
        content: ''; position: absolute; width: 6px; height: 1.5px; 
        background: rgba(255, 255, 255, 0.5); bottom: -2px; right: -4px; transform: rotate(45deg); 
    } 

    /* Logo (Absolute Center) */
    .nav-logo { 
        height: 35px; width: auto; cursor: pointer; opacity: 0.9; 
        transition: opacity 0.3s ease; filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
        position: absolute; left: 50%; transform: translateX(-50%); z-index: 10;
    } 
    .nav-logo:hover { opacity: 1; }
}


/* =========================================
   2. MOBILE STYLES (New "Pill" Design)
   ========================================= */
@media (max-width: 900px) {
    /* Reset Wrappers */
    .liquid-nav {
        position: relative; top: 0; padding: 0; margin: 0;
        background: transparent; border: none; box-shadow: none;
        backdrop-filter: none; -webkit-backdrop-filter: none;
        margin-bottom: 80px; 
    }
    .nav-content { display: block; position: static; }

    /* Pill Container */
    .nav-links-container {
        position: fixed; top: 15px; left: 50%; transform: translateX(-50%);
        width: calc(100% - 30px); max-width: 500px;
        height: 60px; z-index: 20002;
        display: flex; align-items: center; justify-content: flex-start;
        overflow-x: auto; scrollbar-width: none;
        background: transparent !important; padding: 5px;
        
        /* --- ADD THESE LINES TO FIX CLIPPING --- */
        contain: paint;       /* Forces the browser to cut off anything outside this box */
        border-radius: 35px;  /* Defines the "Pill" shape for the clipping mask */
    }
    
    .nav-links-container::-webkit-scrollbar { display: none; }

    /* Mobile Links */
    .nav-item {
        position: relative; z-index: 1; color: rgba(255, 255, 255, 0.6);
        text-decoration: none; font-size: 13px; font-weight: 600;
        padding: 8px 16px; border-radius: 30px; white-space: nowrap;
        transition: color 0.3s ease;
    }
    .nav-item.active { color: #fff; text-shadow: 0 0 12px rgba(255,255,255,0.6); background: transparent; }
    .nav-item:hover { background: transparent; color: #fff; }

    /* The Blob Animation */
    .nav-blob {
        display: block;
        position: absolute; top: 5px; left: 5px; height: calc(100% - 10px); width: 0;
        background: rgba(255, 255, 255, 0.15); border-radius: 30px; z-index: 0;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(4px); transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1.2);
    }

    /* Search Icon */
    .search-trigger-item {
        display: flex !important; align-items: center; justify-content: center;
        padding: 8px 12px; margin-right: 5px; border-right: 1px solid rgba(255,255,255,0.15);
        cursor: pointer; pointer-events: auto; color: #fff;
    }
    .search-icon-svg { width: 18px; height: 18px; fill: #fff; pointer-events: none; }

    /* Expanding Search Bar */
    .nav-search {
        position: fixed; top: 15px; left: 50%; transform: translateX(-50%);
        width: calc(100% - 30px) !important; max-width: 500px;
        height: 60px; z-index: 20001; 
        opacity: 1; visibility: visible; pointer-events: auto;
        background: rgba(30, 30, 30, 0.3);
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.25); border-top: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 10px 30px rgba(0,0,0,0.4);
        border-radius: 30px; overflow: hidden; padding: 0; margin: 0;
        transition: height 0.3s cubic-bezier(0.2, 0.0, 0.0, 1.0);
    }
    
    .nav-search.open { height: 120px; box-shadow: 0 25px 50px rgba(0,0,0,0.5); }

    .nav-search input {
        position: absolute; bottom: 15px; left: 20px;
        width: calc(100% - 40px); font-size: 16px; color: #fff;
        background: transparent; border: none; outline: none;
        opacity: 0; transform: translateY(-5px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }
    .nav-search.open input { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
    
    .nav-search .search-icon { display: none; }
    .nav-logo { display: none !important; }
}

/* --- LAYOUT --- */
main { 
    /* Increased to 3000px to accommodate 10 columns comfortably */
    /* This ensures 10 cards on an Ultrawide look the same size as 7 cards on 1080p */
    max-width: 3000px; 
    
    padding: 0 22px; 
    margin: 48px auto 0 auto; 
    width: 100%; 
    position: relative; 
    z-index: 1; 
    flex-grow: 1; 
}
.content-width { 
    max-width: 800px; 
    margin: 0 auto; 
}

/* --- HEADERS --- */
h1, .wide-title {
    font-family: var(--font-stack); 
    font-weight: 700; 
    font-size: 56px; 
    line-height: 1.05;
    letter-spacing: -0.035em; 
    text-align: center; 
    margin-top: 40px; 
    margin-bottom: 20px;
    text-transform: none; 
    position: relative; 
    padding-bottom: 20px;
    background: linear-gradient(120deg, #d1d1d6 0%, #d1d1d6 30%, #fff 50%, #d1d1d6 70%, #d1d1d6 100%);
    background-size: 200% auto; 
    -webkit-background-clip: text; 
    background-clip: text;
    -webkit-text-fill-color: transparent; 
    color: transparent; 
    animation: shine 10s linear infinite;
}

.wide-title::after {
    content: attr(data-title); 
    position: absolute; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    z-index: -1;
    background: linear-gradient(120deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.2) 30%, rgba(255,255,255,0.5) 50%, rgba(255,255,255,0.2) 70%, rgba(255,255,255,0.2) 100%);
    background-size: 200% auto; 
    -webkit-background-clip: text; 
    background-clip: text;
    -webkit-text-fill-color: transparent; 
    filter: blur(12px); 
    animation: shine 10s linear infinite;
}

@keyframes shine { 
    from { 
        background-position: -100% center; 
    }
    to { 
        background-position: 100% center; 
    }
}

@media (max-width: 768px) { 
    h1, .wide-title { 
        font-size: 42px; 
        letter-spacing: -0.025em; 
    } 
}

h3 { 
    font-weight: 600; 
    font-size: 28px; 
    line-height: 1.2; 
    letter-spacing: -0.02em; 
    color: #fff; 
    margin-bottom: 12px; 
    transition: text-shadow 0.3s ease; 
}

h4 { 
    font-weight: 600; 
    font-size: 21px; 
    letter-spacing: -0.015em; 
    color: #fff; 
    margin-top: 35px; 
    text-decoration: none; 
}

p, li { 
    font-size: 17px; 
    line-height: 1.5; 
    font-weight: 400; 
    letter-spacing: -0.01em; 
    color: var(--text-muted); 
    margin-bottom: 24px; 
}

/* --- CARDS --- */
.card {
    background-color: var(--card-bg); backdrop-filter: saturate(0%) blur(35px); -webkit-backdrop-filter: saturate(0%) blur(35px);
    border-top: 1px solid var(--glass-highlight); 
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05); 
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 24px; 
    padding: 40px; 
    margin-bottom: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); 
    max-width: 1000px; 
    margin-left: auto; 
    margin-right: auto;
    transition: opacity 0.3s ease, height 0.3s ease, transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.2s;
}

/* Info Section Base Style */
#infoSection { 
    /* Match the map-item transition for consistency */
    transition: transform 0.3s ease-out, background-color 0.2s, box-shadow 0.3s ease; 
    cursor: pointer; /* Shows hand icon on entire card */
}

/* Info Section Hover Animation (Lift Only, No Pulse) */
@media (hover: hover) and (pointer: fine) {
    #infoSection:hover { 
        /* Lift & Expand */
        transform: translateY(-5px) scale(1.02); 
        background: rgba(255, 255, 255, 0.08); 
        box-shadow: 0 15px 35px rgba(0,0,0,0.5); 
        z-index: 2; 
    }
}

.card-compact { 
    padding: 25px; 
}

/* --- BUTTONS (Generic) --- */

/* --- CUSTOM SORT DROPDOWN --- */
.sort-wrapper {
    width: 100%; display: flex; justify-content: flex-end; margin-bottom: 24px; position: relative; 
    z-index: 9999; pointer-events: none; /* Stops the invisible wrapper from blocking other clicks */
}
.custom-select-container { 
    position: relative; width: 230px; user-select: none; -webkit-user-select: none; 
    pointer-events: auto; /* Re-enables clicks for just the button */
    z-index: 9999; 
}

.custom-select-trigger {
    background-color: rgba(255, 255, 255, 0.15); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: #fff; padding: 12px 20px; border-radius: 100px; font-size: 14px; font-weight: 600; font-family: var(--font-stack);
    border: 1px solid rgba(255, 255, 255, 0.2); cursor: pointer; transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); display: flex; justify-content: space-between; align-items: center;
}

.custom-select-trigger:hover, .custom-select-container.open .custom-select-trigger {
    background-color: #fff !important; color: #000 !important; transform: scale(1.03) !important; 
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2) !important; border-color: #fff !important;
}

.sort-arrow {
    width: 8px; height: 8px; border-right: 2px solid #fff; border-bottom: 2px solid #fff;
    transform: translateY(-2px) rotate(45deg); transition: all 0.3s ease;
}

.custom-select-trigger:hover .sort-arrow, .custom-select-container.open .sort-arrow { border-color: #000 !important; }
.custom-select-container.open .sort-arrow { transform: translateY(2px) rotate(-135deg) !important; }

.custom-select-options {
    position: absolute; top: calc(100% + 12px); right: 0; width: 100%;
    background: rgba(20, 20, 22, 0.85); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 18px; overflow: hidden;
    opacity: 0; visibility: hidden; transform: translateY(-10px) scale(0.95); transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5); z-index: 9999;
}

.custom-select-container.open .custom-select-options {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
}

.custom-option {
    padding: 14px 20px; color: rgba(255, 255, 255, 0.6); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}

.custom-option:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.custom-option.selected { color: #fff; font-weight: 600; background: rgba(255, 255, 255, 0.05); }



/* Mobile Sort Dropdown Fix */
@media (max-width: 768px) {
    .sort-wrapper {
        justify-content: center;
    }
    
    .custom-select-container {
        width: 100%; 
        max-width: 800px; /* Matches the max-width of your info box */
    }
}

.btn {
    display: inline-block; 
    background-color: rgba(255, 255, 255, 0.15); 
    backdrop-filter: blur(10px);
    color: #fff; 
    padding: 12px 26px; 
    border-radius: 100px; 
    font-size: 15px; 
    font-weight: 600;
    letter-spacing: -0.01em; 
    border: 1px solid rgba(255,255,255,0.2); 
    margin-top: 15px;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1); 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn:hover { 
    background-color: #fff; 
    color: #000; 
    transform: scale(1.03); 
    text-decoration: none; 
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2); 
    border-color: #fff; 
}

/* --- MAP CARD BUTTONS --- */
.favorite-btn, .share-btn, .download-btn {
    width: 30px; 
    height: 30px;
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(4px); 
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 14px; 
    color: rgba(255, 255, 255, 0.5); 
    border: 1px solid rgba(255,255,255,0.1); 
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1); 
    z-index: 10;
    position: relative; 
    user-select: none; 
    -webkit-user-select: none;
}

/* UNIFIED HOVER: Expand + White BG + Black Icon */
.favorite-btn:hover, .share-btn:hover, .download-btn:hover { 
    background-color: #fff; 
    color: #000; 
    transform: scale(1.1); 
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2); 
    border-color: #fff;
}

/* Force SVG Icons to Black on Hover */
.share-btn:hover .share-icon-svg, .download-btn:hover .download-icon-svg { 
    fill: #000; 
}

/* Heart Hover (Inactive): Fill in with Black */
.favorite-btn:hover::before {
    content: '♥' !important;
    color: #000 !important;
}

/* --- ACTIVE STATE (RED HEART) --- */
.favorite-btn.active { 
    background: rgba(255, 59, 48, 0.2); /* The "Darker Red" */
    color: #ff3b30; /* The "Lighter Red" */
    border-color: rgba(255, 59, 48, 0.5); 
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.3); 
}

.favorite-btn.active::before { 
    content: '♥'; 
    font-size: 16px; 
}

.favorite-btn:not(.active)::before { 
    content: '♡'; 
    font-size: 16px; 
}

/* --- ACTIVE HOVER: COLOR SWAP --- */
/* Background becomes Bright Red (#ff3b30) */
/* Icon becomes Dark Red/Black (#3d0b0b) */
.favorite-btn.active:hover {
    background-color: #ff3b30 !important;
    border-color: #ff3b30 !important;
    color: #3d0b0b !important; 
}
.favorite-btn.active:hover::before {
    color: #3d0b0b !important; 
}

/* Icon Positioning */
.share-icon-svg, .download-icon-svg {
    width: 16px; 
    height: 16px; 
    object-fit: contain;
    position: absolute; 
    top: 50%; 
    transform: translate(-50%, -50%);
    fill: rgba(255, 255, 255, 0.7); 
    transition: fill 0.3s ease;
}

/* Specific Shifts */
.share-icon-svg { 
    left: 47%; 
}

.download-icon-svg { 
    left: 50%; 
}

/* Hide old desktop absolute buttons */
.map-item > .favorite-btn, .map-item > .share-btn, .map-item > .download-btn { 
    display: none !important; 
}

/* --- COLLAPSIBLE --- */
.collapsible-header {
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding-bottom: 12px; 
    border-bottom: 1px solid var(--glass-border); 
    margin-bottom: 15px;
    user-select: none; 
    -webkit-user-select: none;
}

.collapsible-header h3 { 
    margin: 0; 
    font-size: 22px; 
}

/* Arrow Animation */
.collapsible-header::after {
    content: '›'; 
    font-family: var(--font-stack); 
    font-size: 28px; 
    font-weight: 300;
    color: var(--text-muted); 
    transform: rotate(90deg); /* Pointing Down initially */
    /* Smooth Snap Animation */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); 
}
.collapsible-header.active::after { 
    transform: rotate(-90deg); /* Flip Up */
    color: #fff; 
}

/* Content Animation */
.collapsible-content { 
    max-height: 0; 
    overflow: hidden; 
    opacity: 0; 
    margin-top: 0;
    
    /* Closing Animation: Fade out fast, then shrink */
    transition: 
        max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
        margin-top 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease-out; 
}

.collapsible-content.open { 
    max-height: 1000px; /* Large enough buffer */
    opacity: 1; 
    margin-top: 20px; 
    
    /* Opening Animation: Expand, then Fade in slightly later */
    transition: 
        max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
        margin-top 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s ease-in 0.1s; 
}

/* --- IMAGES --- */
.card img {
    max-width: 100%; 
    border-radius: 14px; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    margin: 25px auto; 
    display: block; 
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- FAVORITES MESSAGE --- */
#favorites-msg { 
    text-align: center; 
    padding: 0 20px; 
    width: 100%;
    
    /* Desktop: Keeps it vertically centered */
    margin-top: 22vh; 
}

/* Mobile: Pulls it up higher so it's not lost at the bottom */
@media (max-width: 768px) {
    #favorites-msg {
        margin-top: 10vh !important; 
    }
}

#fav-msg-title { 
    margin-bottom: 15px !important; 
    font-size: 26px; 
    color: #ffffff; 
    font-weight: 700;
    line-height: 1.4; 
}

#fav-msg-desc { 
    display: none; 
}

/* --- MAP GRID (CSS Grid Layout) --- */
.maps-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 24px; 
    width: 100%; 
}

/* 1080p / Standard Wide (1920px): 7 Columns */
@media (min-width: 1600px) { 
    .maps-grid { grid-template-columns: repeat(7, 1fr); } 
}

/* 1440p Standard / Wide (2560px range): 8 Columns */
@media (min-width: 2000px) { 
    .maps-grid { grid-template-columns: repeat(8, 1fr); } 
}

/* Ultrawide (3440px range) begins: 9 Columns */
@media (min-width: 2300px) { 
    .maps-grid { grid-template-columns: repeat(9, 1fr); } 
}

/* Super Ultrawide (5120px range): Max 10 Columns */
/* Since 'main' is capped at 3000px, this grid won't stretch forever. */
/* It will center in the middle of the super-wide screen, keeping cards normal sized. */
@media (min-width: 2600px) { 
    .maps-grid { grid-template-columns: repeat(10, 1fr); } 
}
.map-item {
    display: grid;
    grid-template-columns: max-content 1fr; 
    grid-template-rows: auto auto 1fr auto;
    column-gap: 12px; 
    align-items: center; 
    background: rgba(255, 255, 255, 0.03); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px; 
    padding: 16px; 
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    /* CHANGED: Simplified transition to match animation start */
    transition: transform 0.3s ease-out, background 0.2s; 
    
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    user-select: none; 
    -webkit-user-select: none;
}

@media (hover: hover) and (pointer: fine) {
    .map-item:hover { 
        /* 1. Initial Transition Target (Matches 0% of Keyframe) */
        transform: translateY(-5px) scale(1.02); 
        background: rgba(255, 255, 255, 0.08); 
        box-shadow: 0 15px 35px rgba(0,0,0,0.5); 
        z-index: 2; 
        
        /* 2. Pulse Animation */
        /* Delay must match the transition duration (0.3s) exactly */
        animation: cardPulse 3s infinite ease-in-out;
        animation-delay: 0.3s; 
    }
    
    .map-item:hover h3 { 
        text-shadow: 0 0 12px rgba(255, 255, 255, 0.8); 
    }
    
    .map-item:hover .map-number {
        color: #fff;
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.6); 
        transition: all 0.3s ease;
    }
}

/* 1. Map Number (Top Left) */
.map-number {
    grid-column: 1;
    grid-row: 1;
    font-size: 32px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    font-family: var(--font-stack);
    line-height: 1;
    user-select: none;
    padding-left: 4px; 
}

/* Map Number turns white on card hover */
.map-item:hover .map-number {
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease; /* Smooth transition */
}

/* 2. Title (Right of Number) */
.map-item h3 {
    grid-column: 2;
    grid-row: 1;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: center;
    padding-top: 4px;
    letter-spacing: -0.01em;
}

/* 3. Codes & Weather (Full Width Bar) */
.map-code-subtext, .weathers {
    grid-column: 1 / -1; 
    grid-row: 2;
    
    margin-top: 3px;
    margin-bottom: 12px;
    font-size: 13px; 
    color: rgba(255, 255, 255, 0.9); 
    font-weight: 500; 
    background: rgba(255,255,255,0.1); 
    padding: 6px 10px; 
    border-radius: 6px; 
    line-height: 1.4;
    
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}
.weathers b { color: #fff; }

/* 4. Image Container */
.image-container {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    min-height: 120px; 
    border-radius: 12px;
    overflow: hidden; 
    position: relative; 
    background: #111; 
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 0; 
    height: 100%;
}

/* Blurred Background */
.bg-blur {
    position: absolute; 
    top: 0; 
    left: 0;
    right: 0;
    bottom: 0; /* Ensures it locks to the bottom */
    width: 100%; 
    height: 100%; 
    
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat; /* Prevents tiling */
    
    /* Adjust blur pixels here */
    filter: blur(3px) brightness(0.8) saturate(1.2); 
    
    /* Scale up to hide the faded blur edges */
    transform: scale(1.2); 
    transform-origin: center center; /* Forces it to grow from the middle */
    
    z-index: 1; 
    display: block;
}

/* Main Image */
.main-img { 
    position: relative; 
    z-index: 2; 
    width: 100%; height: 100%; 
    object-fit: contain; 
    display: block; 
}

/* 5. Footer Buttons */
.card-footer {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex; 
    justify-content: center; 
    align-items: center;
    width: 100%; 
    margin-top: 7px; 
    margin-bottom: -8px;
}
.map-btn-bar {
    display: flex; 
    gap: 10px; 
    align-items: center; 
    flex-direction: row;
}

/* --- CONTACT --- */
.contact-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 24px; 
}

.contact-card {
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px; 
    padding: 50px 30px; 
    text-align: center;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
    text-decoration: none; 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    min-height: 300px; 
    backdrop-filter: blur(20px); 
}
.contact-card:hover { transform: translateY(-8px); background: rgba(255, 255, 255, 0.1); border-color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.contact-icon-img {
    width: 80px; height: 80px; object-fit: contain; margin-bottom: 25px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); transition: transform 0.2s;
}
.contact-card:hover .contact-icon-img { transform: scale(1.1); }
.contact-title { font-size: 24px; font-weight: 700; color: #fff; margin-bottom: 6px; letter-spacing: -0.02em; }
.contact-link { font-size: 17px; color: rgba(255,255,255,0.8); font-weight: 500; }

/* --- FOOTER --- */
.footer {
    margin-top: auto; padding: 20px; text-align: center;
    border-top: 1px solid var(--glass-border); background: rgba(0,0,0,0.8); backdrop-filter: blur(20px);
    position: relative; margin-top: 60px;
}
.footer p { font-size: 13px; color: #6e6e73; margin: 0; }
.footer img { 
    position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
    height: 50px; opacity: 1; z-index: 10;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); transition: transform 0.2s;
}
.footer img:hover { transform: translate(-50%, -50%) scale(1.1); }

/* --- LIGHTBOX --- */
.lightbox {
    display: none; position: fixed; z-index: 30000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); 
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    justify-content: center; align-items: center; padding: 20px; cursor: zoom-out;
    animation: fadeOpen 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}
.lightbox-content {
    background: rgba(30, 30, 35, 0.6); backdrop-filter: saturate(0%) blur(40px);
    -webkit-backdrop-filter: saturate(0%) blur(40px); border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 40px 80px rgba(0,0,0,0.6); border-radius: 24px; max-width: 900px;
    width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
    position: relative; cursor: default; animation: zoomOpen 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: rgba(0, 0, 0, 0.6);
}
.lightbox-img-wrapper {
    width: 100%; height: auto; max-height: 65vh; background: #000;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lightbox-content img { width: 100%; height: 100%; object-fit: contain; display: block; margin: 0; border: none; box-shadow: none; filter: none; }
.lightbox-details {
    padding: 30px; border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
    position: relative; padding-top: 60px;
}
/* Lightbox Elements */
.lb-title { 
    position: absolute; top: 20px; left: 30px; right: 170px; 
    margin-top: -15px;
    font-size: 28px; font-weight: 700; color: #fff; margin-bottom: 5px; opacity: 0; 
    animation: slideUpText 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; animation-delay: 0.2s; 
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8); 
}
@media (min-width: 769px) { .lb-code { margin-top: 10px; } }

/* New Keyframe: Uses 'top' instead of 'transform' so hover scaling works */
@keyframes slideUpPos { 
    from { top: 20px; opacity: 0; } 
    to { top: 0; opacity: 1; } 
}

.lb-code {
    /* Visual Style */
    background-color: rgba(255, 255, 255, 0.15); 
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    
    /* CHANGED: 12px makes it a rounded box instead of a pill */
    border-radius: 15px; 
    
    padding: 8px 20px; 
    
    font-family: var(--font-stack); 
    font-weight: 600; 
    font-size: 16px; 
    color: #fff;
    cursor: pointer; 
    display: inline-block; margin-bottom: 15px; line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    
    /* Animation Logic */
    position: relative; opacity: 0;
    animation: slideUpPos 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
    animation-delay: 0.3s;
    
    /* Smooth Hover Transition */
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1); 
    transform: scale(1); 
}

.lb-code:hover { 
    /* Expand & Light Up */
    background-color: #fff; 
    color: #000; 
    transform: scale(1.05); 
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2); 
    border-color: #fff;
}

.lb-desc { font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.8); max-width: 700px; opacity: 0; animation: slideUpText 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; animation-delay: 0.4s; }

/* Lightbox Buttons Wrapper (Desktop) */
.lb-buttons-wrapper {
    position: absolute; 
    top: 20px; /* Aligns visually with the Title */
    
    /* FIX: Changed from 60px to 30px to match the container padding */
    right: 20px; 
    
    display: flex; 
    gap: 10px;
    z-index: 100;
}

/* Lightbox Buttons (Shared Style) */
.lb-favorite-btn, .lb-share-btn, .lb-download-btn {
    position: relative; 
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255, 255, 255, 0.5); cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    user-select: none; -webkit-user-select: none;
}

/* UNIFIED HOVER */
.lb-favorite-btn:hover, .lb-share-btn:hover, .lb-download-btn:hover { 
    background-color: #fff; 
    color: #000; 
    transform: scale(1.1); 
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2); 
    border-color: #fff;
}

/* Force SVG Icons to Black on Hover */
.lb-share-btn:hover .lb-share-icon, .lb-download-btn:hover .lb-download-icon { 
    fill: #000; 
}

/* Heart Hover (Inactive): Fill in with Black */
.lb-favorite-btn:hover::before {
    content: '♥' !important;
    color: #000 !important;
}

/* --- ACTIVE STATE --- */
.lb-favorite-btn.active { 
    background: rgba(255, 59, 48, 0.2); 
    color: #ff3b30; 
    border-color: rgba(255, 59, 48, 0.5); 
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.3); 
}
.lb-favorite-btn.active::before { content: '♥'; font-size: 22px; }
.lb-favorite-btn:not(.active)::before { content: '♡'; font-size: 22px; }

/* --- ACTIVE HOVER: COLOR SWAP --- */
.lb-favorite-btn.active:hover {
    background-color: #ff3b30 !important;
    border-color: #ff3b30 !important;
    color: #3d0b0b !important;
}
.lb-favorite-btn.active:hover::before {
    color: #3d0b0b !important;
}

/* Icon Positioning */
.lb-share-icon, .lb-download-icon {
    width: 20px; height: 20px; object-fit: contain;
    position: absolute; top: 50%; 
    transform: translate(-50%, -50%);
    fill: rgba(255, 255, 255, 0.6); transition: fill 0.3s ease;
}

/* Specific Shifts */
.lb-share-icon { left: 47%; }
.lb-download-icon { left: 50%; }

/* --- FIXED CLOSE BUTTON --- */
.lightbox-close-btn {
    position: absolute; top: 15px; right: 15px;
    width: 38px; height: 38px; min-width: 38px; /* Prevents squishing */
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255, 255, 255, 0.7); font-size: 1.2em; cursor: pointer; z-index: 1001; opacity: 1; 
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    user-select: none; -webkit-user-select: none;
}

.lightbox-close-btn:hover { 
    background-color: #fff; 
    color: #000; 
    transform: scale(1.1); 
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2); 
    border-color: #fff;
}

@keyframes fadeOpen { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomOpen { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUpText { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- COPY ANIMATION (WHITE TEXT) --- */
#lb-code { overflow: visible !important; } /* Ensure "Copied!" text isn't clipped */
.copy-anim {
    position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
    margin-left: 12px; font-size: 14px; 
    color: #fff; /* WHITE TEXT */
    font-weight: 700;
    opacity: 0; pointer-events: none; white-space: nowrap;
    animation: copyFloat 1.2s ease-out forwards;
}
@keyframes copyFloat {
    0%   { opacity: 0; transform: translateY(-50%) translateX(-10px); }
    20%  { opacity: 1; transform: translateY(-50%) translateX(0); }
    80%  { opacity: 1; transform: translateY(-50%) translateX(0); }
    100% { opacity: 0; transform: translateY(-50%) translateX(10px); }
}

/* --- MOBILE TWEAKS --- */
@media (max-width: 768px) { 
    /* Lightbox Container adjustments */
    .lightbox-content { 
        max-height: 85vh; 
        overflow-y: auto; 
    } 
    
    .lightbox-details { 
        padding: 20px; 
        padding-top: 5px !important; 
    } 
    
    /* Title Positioning */
    .lb-title { 
        position: relative; 
        top: auto; 
        left: auto; 
        right: auto; 
        font-size: 22px; 
        margin-bottom: 10px; 
        margin-top: -15px !important;
        padding-right: 0 !important; 
    } 
    
    /* 1. LAYOUT CONTAINER (CSS GRID) */
    .lb-meta-container { 
        display: grid !important; 
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 10px !important; 
        
        width: 100% !important; 
        align-items: center !important; 
        margin-top: 10px !important; 
        margin-bottom: 10px !important;
    }
    
    /* 2. THE CODE BOX (Default Style - Matches "Multiple Weather" Look) */
    .lb-code { 
        margin: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        
        /* BASE STYLE: Fits multiple weathers perfectly (Small & Auto-scaling) */
        font-size: clamp(9px, 3.5vw, 11px) !important;
        
        /* Layout & Visuals */
        text-align: center !important;
        white-space: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 8px 10px !important; 
        
        display: block !important;
        background-color: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 12px;
        color: #fff;
        
        /* Hide Scrollbars */
        scrollbar-width: none; 
        -ms-overflow-style: none;
    }
    
    /* --- OVERRIDE: SINGLE CODE ONLY --- */
    /* If the box does NOT have a <br> tag, it means it's a single code. */
    /* Make ONLY these bigger. */
    .lb-code:not(:has(br)) {
        font-size: 14px !important; 
        padding: 10px 12px !important;
    }
    
    .lb-code::-webkit-scrollbar { display: none; }

    /* 3. THE BUTTONS */
    .lb-buttons-wrapper { 
        position: static !important; 
        display: flex !important; 
        gap: 6px !important; 
        margin: 0 !important;
        flex-shrink: 0 !important;
        
        opacity: 0;
        animation: slideUpText 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
        animation-delay: 0.5s; 
    }

    /* Button Sizing */
    .lb-favorite-btn, .lb-share-btn, .lb-download-btn { width: 30px; height: 30px; }
    
    /* Arrow & Close Button Positioning */
    .lightbox-img-wrapper { position: relative !important; }
    .lb-nav-btn {
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 40px; height: 40px; font-size: 20px;
        z-index: 1005; 
    }
    .lb-nav-btn.prev { left: 10px !important; }
    .lb-nav-btn.next { right: 10px !important; }
    .lightbox-close-btn { top: 10px; right: 10px; }
}

@media (max-width: 900px) {
    
    /* 1. SEARCH BAR: Fixed to top of screen */
    .search-wrapper {
        position: fixed !important;
        top: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        
        width: 92% !important;
        max-width: 400px;
        
        z-index: 20000 !important; /* Highest priority */
        margin: 0 !important;
        
        /* Visuals */
        background: rgba(20, 20, 20, 0.95); 
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 14px;
        padding: 8px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }

    /* 2. NAVBAR: Parent Container */
    .topnav {
        position: relative !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px;
        z-index: 10 !important; /* Sit above page content */
        
        /* CRITICAL: Keep these OFF on the parent to prevent trapping the Search Bar */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transform: none !important;
        background: transparent !important; 
        border: none !important;
        box-shadow: none !important;
        
        /* Spacing */
        padding-top: 75px !important; 
        padding-bottom: 20px !important;
        overflow: visible !important;
    }

    /* 3. FAKE BACKGROUND (The Fix) */
    /* We apply the blur/color here so it doesn't break the fixed search bar */
    .topnav::before {
        content: "";
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        
        /* Restore the original Glass Look */
        background-color: rgba(20, 20, 20, 0.4);
        background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
        backdrop-filter: saturate(0%) blur(30px);
        -webkit-backdrop-filter: saturate(0%) blur(30px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
        
        z-index: -1; /* Sit behind the logo/links */
    }

    /* 4. LOGO */
    .topnav .logo {
        order: 1;
        position: relative !important;
        left: auto !important;
        transform: none !important;
        margin: 0 auto !important;
        height: 28px !important;
        width: auto !important;
        display: block;
    }

    /* 5. LINKS */
    .nav-links {
        order: 2;
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* 6. PAGE CONTENT */
    main {
        margin-top: 20px !important; 
    }
    
    h1, .wide-title {
        font-size: 36px !important;
        margin-top: 10px !important;
    }
    
    .guide-sidebar { top: 140px !important; }
}

/* --- CARD MOBILE SIZING --- */
@media (max-width: 550px) {
    .maps-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .map-item { padding: 12px; column-gap: 8px; }
    .map-number { font-size: 24px; }
    .map-item h3 { font-size: 14px; }
    .map-code-subtext, .weathers { 
        font-size: 11px; 
        padding: 4px 8px; 
        margin-bottom: 10px;
    }
    .image-container { min-height: 90px; }
    .map-item h3 { white-space: normal; line-height: 1.2; }
    .card-footer { 
        margin-top: 5px; 
        margin-bottom: -7px;
    }
    .favorite-btn, .share-btn, .download-btn { width: 28px; height: 28px; }
}

/* PULSE ANIMATION */
@keyframes cardPulse {
    0%   { transform: translateY(-5px) scale(1.02); } /* Identical to hover state */
    50%  { transform: translateY(-5px) scale(1.035); } /* Pulse slightly larger */
    100% { transform: translateY(-5px) scale(1.02); } /* Return to hover state */
}

/* --- HERO ANIMATION TRANSITIONS --- */
/* This class allows the elements to fly smoothly */
.hero-transition {
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1) !important;
}

/* Ensure lightbox elements are ready to be transformed */
#lightbox-img, #lb-title, #lb-code {
    transform-origin: top left; /* Essential for accurate position mapping */
    backface-visibility: hidden;
}

/* --- INITIAL STATE --- */
/* Only hide elements on the Home Page (index.html) */
body.home-page h1, 
body.home-page #infoSection, 
body.home-page #sortWidget, /* Added this line */
body.home-page .map-item, 
body.home-page #suggestionBox {
    opacity: 0;
}

/* --- ANIMATION CLASS --- */
.fade-up-enter {
    animation: fadeInUpEnter 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    will-change: transform, opacity;
    pointer-events: none; 
}

@keyframes fadeInUpEnter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- PDF EMBED SIZING --- */
.pdf-embed {
    width: 100%;
    height: 85vh; /* Takes up 85% of the viewport height */
    min-height: 800px; /* Ensures it's always at least this tall */
    border: none;
    border-radius: 14px;
    margin-top: 20px;
    background-color: rgba(0,0,0,0.2); /* subtle background while loading */
}

/* --- GUIDE SPLIT LAYOUT (Fixed Pixel Sizing) --- */
@media (min-width: 1200px) {
    
    /* 1. Sidebar Container (The "Zone") */
    .guide-sidebar {
        position: fixed;
        
        /* Lock to available space below navbar */
        top: 52px; 
        bottom: 0; 
        left: 0;
        
        /* FIXED PIXEL WIDTH: Consistent size on all monitors */
        width: 320px; 
        
        display: flex;
        flex-direction: column;
        justify-content: center; 
        align-items: center;
        
        z-index: 100;
        pointer-events: none; 
    }

    /* 2. The Glass Box (The Menu) */
    .sticky-wrapper {
        pointer-events: auto; 
        
        /* Fixed Width Card */
        width: 260px; 
        
        height: auto; 
        max-height: 85vh; 
        overflow-y: auto; 
        
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        
        /* Fixed Padding & Radius */
        padding: 30px 30px 15px 30px; /* Top | Right | Bottom | Left */
        border-radius: 20px;
        
        scrollbar-width: none; 
        -ms-overflow-style: none;
    }
    .sticky-wrapper::-webkit-scrollbar { display: none; }

    .guide-sidebar h3 {
        font-size: 20px; 
        font-weight: 700;
        margin-top: 0;
        margin-bottom: 20px;
        color: #fff;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 15px;
    }

    .guide-sidebar a {
        display: block;
        color: var(--text-muted);
        text-decoration: none;
        margin-bottom: 14px; 
        font-size: 15px;
        line-height: 1.4;
        transition: 0.2s;
    }

    .guide-sidebar a:hover {
        color: #fff;
        transform: translateX(5px);
    }

    /* 3. Main Content Layout */
    .split-layout-wrapper {
        display: block; 
        position: relative;
        width: 100%;
        
        /* PADDING MATCHES FIXED SIDEBAR ZONE (320px) */
        padding-left: 320px; 
        padding-right: 320px; 
        
        box-sizing: border-box;
    }

    .split-layout-wrapper .content-width {
        margin: 0 auto; 
        max-width: 800px; 
    }
}

/* Reset for Mobile */
@media (max-width: 1199px) {
    .guide-sidebar { display: none; }
    
    .split-layout-wrapper { 
        max-width: 800px; 
        margin: 0 auto; 
        padding: 0; 
    }
}

/* --- EASTER EGG CARD STYLING --- */
.easter-egg {
    /* REMOVED 'display: block !important' so the search bar can control visibility */
    padding: 0 !important; 
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
    
    /* FIX: Force opacity to 1 so it is visible when searched */
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* (Keep the rest of the easter-egg CSS the same) */
.easter-egg .map-number,
.easter-egg h3,
.easter-egg .map-code-subtext,
.easter-egg .card-footer,
.easter-egg .weathers {
    display: none !important;
}

.easter-egg .image-container {
    width: 100%;
    height: 100%;
    min-height: 300px; 
    border-radius: 20px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

/* --- EASTER EGG LIGHTBOX (Full Image Fix) --- */
.lightbox.easter-egg-view .lightbox-details { display: none !important; }

.lightbox.easter-egg-view .lightbox-content {
    background: transparent !important; 
    border: none !important;
    box-shadow: none !important;
    max-height: 100vh !important; 
    max-width: 100vw !important; /* This fixes the off-center issue */
    width: 100% !important;
    height: 100% !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox.easter-egg-view .lightbox-img-wrapper {
    background: transparent !important;
    height: 95vh !important; 
    width: 95vw !important;
    max-height: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0;
}

.lightbox.easter-egg-view img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important; 
    
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* --- FAVORITES / SEARCH MESSAGE CENTERING --- */
#favorites-msg { 
    text-align: center; 
    padding: 0 20px; 
    width: 100%;
    min-height: 50vh; 
    
    /* FLEXBOX CENTERING (Required for JS 'display: flex' to work) */
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    
    margin-top: 0 !important; 
    display: none; 
}

/* --- LIGHTBOX GALLERY ARROWS --- */
.lb-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    user-select: none;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.2s ease;
    z-index: 1002;
}

.lb-nav-btn:hover {
    background: #fff;
    color: #000;
    scale: 1.1;
}

.lb-nav-btn.prev { left: 20px; }
.lb-nav-btn.next { right: 20px; }

/* Hide buttons if there is only 1 image */
.lightbox[data-single="true"] .lb-nav-btn { display: none; }

/* Mobile adjustments */
@media (max-width: 768px) {
    .lb-nav-btn { width: 40px; height: 40px; font-size: 20px; }
    .lb-nav-btn.prev { left: 10px; }
    .lb-nav-btn.next { right: 10px; }
}

/* --- LIGHTBOX AUTHOR UPDATES --- */

/* 1. Reset Details Box to allow stacking */
.lightbox-details {
    padding: 30px !important; /* Reset the old 60px top padding */
    display: flex;
    flex-direction: column;
}

/* 2. Make Title Relative (So Author sits below it) */
.lb-title {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    
    margin-bottom: 4px !important;
    
    /* Add padding to the right so it doesn't hit the buttons */
    padding-right: 140px; 
    
    /* Keep existing animation */
    opacity: 0; 
    animation: slideUpText 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
    animation-delay: 0.2s;
}

/* 3. New Author Text Style */
.lb-author {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted); /* Uses your grey variable */
    margin-bottom: 0px;
    
    /* Animation to match the title */
    opacity: 0;
    animation: slideUpText 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
    animation-delay: 0.25s; /* Slight delay so it flows after title */
}

/* --- LIGHTBOX AUTHOR LINK --- */
.lb-author a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3); /* Subtle underline */
    transition: all 0.2s ease;
    pointer-events: auto; /* Ensure it's clickable */
}

.lb-author a:hover {
    color: #fff;
    border-bottom: 1px solid #fff; /* Bright white underline on hover */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* --- GALLERY SLIDE ANIMATIONS --- */

/* 1. Slide Out States (Exit) */
.slide-out-left { 
    transform: translateX(-50px) !important; 
    opacity: 0 !important; 
}
.slide-out-right { 
    transform: translateX(50px) !important; 
    opacity: 0 !important; 
}

/* 2. Slide In Prep States (Instant Jump) */
/* We use 'transition: none' to instantly teleport the image to the starting side */
.slide-in-prep-left { 
    transform: translateX(-50px) !important; 
    opacity: 0 !important; 
    transition: none !important; 
}
.slide-in-prep-right { 
    transform: translateX(50px) !important; 
    opacity: 0 !important; 
    transition: none !important; 
}

/* --- PHOTOGRAPHY CREDIT --- */
/* Reuse the author style, but delay the animation slightly */
#lb-photo {
    animation-delay: 0.3s !important; 
}

/* --- LIGHTBOX CLOSING ANIMATION --- */
@keyframes fadeClose { 
    from { opacity: 1; } 
    to { opacity: 0; } 
}

@keyframes zoomClose { 
    from { transform: scale(1); opacity: 1; } 
    to { transform: scale(0.9); opacity: 0; } 
}

/* This class is added by JS when closing */
.lightbox.closing {
    animation: fadeClose 0.3s cubic-bezier(0.33, 1, 0.68, 1) forwards !important;
    pointer-events: none; /* Prevents clicking while fading out */
}

.lightbox.closing .lightbox-content {
    animation: zoomClose 0.3s cubic-bezier(0.33, 1, 0.68, 1) forwards !important;
}

/* --- FIX SUGGESTION BOX MARGIN ON MOBILE --- */

/* Tablet/Standard Mobile: Match the 24px grid gap */
@media (max-width: 768px) {
    #suggestionBox {
        /* !important is needed to override the inline style in index.html */
        margin-top: 24px !important; 
    }
}

/* Small Mobile: Match the 12px grid gap */
@media (max-width: 550px) {
    #suggestionBox {
        margin-top: 12px !important; 
    }
}

/* --- COLORS PAGE GRID FIX --- */
.content-width.wide-layout {
    max-width: 100% !important; /* Allows full width */
    padding: 0 10px; /* Small padding so it doesn't touch the exact edge */
}

.colors-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 20px;
    align-items: start;
    margin-top: 20px;
}

.colors-grid .card {
    width: 100%;
    margin-bottom: 0; 
    height: 100%;
}

/* Stack on mobile */
@media (max-width: 900px) {
    .colors-grid {
        grid-template-columns: 1fr;
    }
}

/* --- TOP CONTROLS (INFO + SORT) --- */
.top-controls-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px; /* Adjust this to push the cards down */
}

.top-controls-wrapper #infoSection {
    width: 100%;
    max-width: 800px;
    margin: 0 !important; 
    padding-bottom: 15px;
}

.top-controls-wrapper .sort-wrapper {
    position: absolute;
    right: 0;
    bottom: 0; /* Pins it to the bottom of the info box */
    width: auto;
    margin: 0 !important;
}

/* On screens smaller than 1300px, stack them so they don't overlap */
@media (max-width: 1300px) {
    .top-controls-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .top-controls-wrapper #infoSection {
        margin-bottom: 15px !important;
    }
    
    .top-controls-wrapper .sort-wrapper {
        position: relative;
        right: auto;
        bottom: auto;
        width: 100%;
        justify-content: center;
        margin-bottom: 0px !important; /* This fixes the mobile overlap */
    }
}

/* --- FAVORITES PAGE CONTROLS --- */
.favorites-controls {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 45px; 
    margin-top: 25px;    /* Space below the title */
    margin-bottom: 35px; /* Space above the map cards */
}

.favorites-controls #unfavorite-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 16px;
    margin: 0 !important; /* Stops other margins from interfering */
    z-index: 10;
}

.favorites-controls .sort-wrapper {
    position: absolute;
    right: 0;
    margin: 0 !important;
    width: auto;
    z-index: 20;
}

/* Mobile: Stack them neatly so they never overlap */
@media (max-width: 900px) {
    .favorites-controls {
        flex-direction: column;
        gap: 20px;
        margin-top: 10px;
    }
    .favorites-controls .sort-wrapper {
        position: relative;
        right: auto;
        width: 100%;
        justify-content: center;
    }
}

/* --- ENABLE TEXT HIGHLIGHTING IN GUIDE TAB --- */
.split-layout-wrapper,
.split-layout-wrapper *,
.guide-sidebar,
.guide-sidebar * {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* --- GUIDE TAB IMAGE HOVER ANIMATION --- */
.split-layout-wrapper img {
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease, border-color 0.3s ease !important;
    cursor: pointer !important; 
}

.split-layout-wrapper img:hover {
    transform: translateY(-5px) scale(1.02) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* --- PREVENT PURPLE VISITED LINKS --- */
a:visited {
    color: #fff !important;
}

/* --- SIDEBAR ACTIVE LINK STATE --- */
.guide-sidebar a {
    color: var(--text-muted) !important; 
}
.guide-sidebar a.active, .guide-sidebar a:hover {
    color: #fff !important;
    transform: translateX(5px);
    font-weight: 600; 
}

.card p a, 
.card p a:visited {
    color: #fff !important;
}

.lightbox-img-wrapper {
    position: relative;
}