/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg:        #07070f;
    --surface:   #0e0e1c;
    --surface-2: #15152a;
    --surface-3: #1c1c36;
    --border:    rgba(255, 255, 255, 0.06);
    --border-md: rgba(255, 255, 255, 0.10);
    --text:      #eeeeff;
    --text-dim:  rgba(238, 238, 255, 0.50);
    --text-mute: rgba(238, 238, 255, 0.28);
    --panel-w:   400px;
    --ease:      cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   MAP
   ============================================================ */
#map {
    width: 100vw;
    height: calc(100vh - 70px); /* 70px = portfolio nav height */
    margin-top: 70px;
    background: var(--bg);
    cursor: crosshair;
}

.leaflet-container {
    background: var(--bg) !important;
    font-family: inherit;
}

/* Zoom control */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 80px !important;
}

.leaflet-control-zoom a {
    background: var(--surface-2) !important;
    color: var(--text-dim) !important;
    border: 1px solid var(--border) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 32px !important;
    font-size: 18px !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.leaflet-control-zoom a:hover {
    background: var(--surface-3) !important;
    color: var(--text) !important;
    border-color: var(--border-md) !important;
}

.leaflet-control-zoom-in  { border-radius: 8px 8px 0 0 !important; }
.leaflet-control-zoom-out { border-radius: 0 0 8px 8px !important; border-top: none !important; }

/* Attribution */
.leaflet-control-attribution {
    background: rgba(7, 7, 15, 0.75) !important;
    color: var(--text-mute) !important;
    font-size: 10px !important;
    border-radius: 6px 0 0 0 !important;
    backdrop-filter: blur(8px);
}

.leaflet-control-attribution a { color: var(--text-dim) !important; }

/* Kill default popups — using side panel instead */
.leaflet-popup { display: none !important; }

/* ============================================================
   STATS BAR
   ============================================================ */
#stats-bar {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    background: rgba(14, 14, 28, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 10px 24px;
    z-index: 800;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    animation: slideUpFade 0.7s var(--ease-out) 1s both;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 18px;
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-mute);
}

.stat-sep {
    width: 1px;
    height: 26px;
    background: var(--border);
    flex-shrink: 0;
}

/* ============================================================
   SIDE PANEL
   ============================================================ */
#side-panel {
    position: fixed;
    top: 70px; /* sits below the 70px portfolio nav */
    right: 0;
    width: var(--panel-w);
    height: calc(100vh - 70px);
    background: rgba(7, 7, 15, 0.97);
    backdrop-filter: blur(40px) saturate(160%);
    border-left: 1px solid var(--border);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 1px));
    transition: transform 0.45s var(--ease-out);
    overflow: hidden;
}

#side-panel.open {
    transform: translateX(0);
}

#panel-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 890;
    pointer-events: none;
    transition: background 0.45s ease;
}

#panel-backdrop.active {
    background: rgba(0, 0, 0, 0.35);
    pointer-events: all;
    cursor: pointer;
}

#panel-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 10;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

#panel-close:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border-md);
}

#panel-inner {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}

#panel-inner::-webkit-scrollbar { width: 3px; }
#panel-inner::-webkit-scrollbar-track { background: transparent; }
#panel-inner::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

/* --- Panel Header --- */
.panel-header {
    position: relative;
    padding: 52px 28px 28px;
    overflow: hidden;
}

.panel-header-glow {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    opacity: 0.12;
    filter: blur(60px);
    pointer-events: none;
}

.panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 14px;
    border: 1px solid;
}

.panel-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 12px;
}

.panel-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.panel-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
}

.panel-meta-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* --- Divider --- */
.panel-divider {
    height: 1px;
    background: var(--border);
    margin: 0 28px;
}

/* --- Panel Section --- */
.panel-section {
    padding: 24px 28px;
}

.panel-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-mute);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* --- Photo Grid --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}

.photo-grid .thumb:first-child {
    grid-column: span 3;
    aspect-ratio: 16 / 9;
}

.thumb {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--surface-2);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--ease);
}

.thumb:hover img {
    transform: scale(1.08);
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb:hover .thumb-overlay {
    background: rgba(0, 0, 0, 0.2);
}

.thumb-more {
    position: absolute;
    bottom: 7px;
    right: 7px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
}

/* Empty state */
.no-photos {
    padding: 36px 16px;
    text-align: center;
    color: var(--text-mute);
    font-size: 13px;
    line-height: 1.6;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.no-photos-icon {
    font-size: 28px;
    margin-bottom: 10px;
    opacity: 0.45;
}

/* --- Visit Cards --- */
.visit-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    transition: border-color 0.15s ease;
}

.visit-card:hover { border-color: var(--border-md); }
.visit-card:last-child { margin-bottom: 0; }

.visit-year {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.visit-comment {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.55;
}

/* ============================================================
   MARKERS
   ============================================================ */
.custom-marker {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}

.marker-wrap {
    position: relative;
    width: 12px;
    height: 12px;
}

.marker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    position: absolute;
    top: 2px;
    left: 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.marker-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid;
    animation: markerPulse 2.5s ease-out infinite;
    transform-origin: center;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#lightbox.open {
    opacity: 1;
    pointer-events: all;
}

#lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

#lb-img-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 86vh;
}

#lb-img {
    max-width: 90vw;
    max-height: 86vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
    transition: opacity 0.18s ease;
    display: block;
}

#lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

#lb-close:hover {
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

#lb-prev, #lb-next {
    position: absolute;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.75);
    width: 46px;
    height: 46px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

#lb-prev { left: 20px; }
#lb-next { right: 20px; }

#lb-prev:hover, #lb-next:hover {
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

#lb-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

#lb-counter {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 14px;
    border-radius: 100px;
    white-space: nowrap;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateX(-50%) translateY(14px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

@keyframes markerPulse {
    0%   { transform: scale(0.9); opacity: 0.7; }
    60%  { transform: scale(2.6); opacity: 0;   }
    100% { transform: scale(2.6); opacity: 0;   }
}

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

.panel-animate {
    animation: fadeSlideIn 0.32s var(--ease-out) both;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    :root { --panel-w: 100vw; }

    #side-panel {
        top: auto;
        bottom: 0;
        height: 82vh;
        width: 100vw;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 20px 20px 0 0;
        transform: translateY(calc(100% + 1px));
    }

    #side-panel.open { transform: translateY(0); }

    #stats-bar {
        bottom: 16px;
        padding: 8px 18px;
    }

    .stat-number { font-size: 17px; }
    .stat-item   { padding: 0 12px; }

    #lb-prev { left: 10px; }
    #lb-next { right: 10px; }
}
