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

body {
    font-family: 'Georgia', serif;
    background-color: #f5f5f0;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Title overlay on map - floating, minimal */
#map-title {
    position: absolute;
    top: 28px;
    left: 32px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

#map-title .title-line-1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 400;
    color: #2a2a2a;
    letter-spacing: 0.08em;
    line-height: 1.2;
}

#map-title .title-line-2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 400;
    font-style: italic;
    color: #555;
    letter-spacing: 0.06em;
    line-height: 1.2;
}

/* Language selector */
#lang-selector {
    position: absolute;
    top: 28px;
    right: 32px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lang-btn {
    background: none;
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #888;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    transition: color 0.2s ease;
}

.lang-btn:hover {
    color: #333;
}

.lang-btn.active {
    color: #1a1a1a;
    font-weight: 600;
}

.lang-divider {
    color: #ccc;
    font-size: 0.75rem;
}

/* Map */
main {
    flex: 1;
    display: flex;
}

#map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#map {
    flex: 1;
    min-height: 500px;
    position: relative;
    background-color: #f5f2eb;
}

/* Warm, muted map tiles */
.leaflet-tile-pane {
    filter: sepia(15%) saturate(0.9) contrast(0.85) brightness(1.02);
    transition: filter 0.3s ease;
}

/* Warm paper overlay */
#map::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(245, 240, 230, 0.3) 0%,
        rgba(240, 235, 220, 0.2) 100%
    );
    z-index: 400;
}

/* Vignette overlay */
#map::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 35%,
        rgba(30, 25, 20, 0.04) 65%,
        rgba(30, 25, 20, 0.1) 100%
    );
    z-index: 500;
}

/* Custom map markers - museum label style */
.custom-marker {
    background-color: transparent;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.08),
        0 0 12px 4px rgba(0, 0, 0, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.4s ease, opacity 0.3s ease, box-shadow 0.4s ease, border-color 0.3s ease;
    opacity: 0.85;
}

.custom-marker:hover,
.custom-marker.active {
    transform: scale(1.25);
    opacity: 1;
    border-color: #000;
    box-shadow:
        0 0 0 4px rgba(0, 0, 0, 0.1),
        0 0 16px 4px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000 !important;
}

/* Size variations for visual hierarchy */
.custom-marker.size-small {
    width: 14px !important;
    height: 14px !important;
    margin-left: -7px !important;
    margin-top: -7px !important;
}

.custom-marker.size-medium {
    width: 18px !important;
    height: 18px !important;
    margin-left: -9px !important;
    margin-top: -9px !important;
}

.custom-marker.size-large {
    width: 22px !important;
    height: 22px !important;
    margin-left: -11px !important;
    margin-top: -11px !important;
}

/* Popup panel - museum catalogue style */
#popup {
    position: absolute;
    background: #fffefa;
    display: flex;
    flex-direction: column;
    width: 280px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96) translateY(8px);
}

#popup-image-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0ebe0;
}

#popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.25s ease;
}

#popup-content {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.5rem 1.75rem;
}

#popup h2 {
    font-size: 1.35rem;
    font-weight: 400;
    margin-bottom: 0.9rem;
    font-family: 'Playfair Display', Georgia, serif;
    color: #1a1a1a;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

#popup-excerpt {
    color: #666;
    line-height: 1.6;
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-style: italic;
}

#popup-link {
    display: inline-block;
    padding: 0;
    background: none;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.7rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
    transition: border-color 0.2s ease, color 0.2s ease;
    align-self: flex-start;
}

#popup-link:hover {
    color: #000;
    border-color: #1a1a1a;
}

/* Footer */
footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background-color: #F4F1EA;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.75rem;
    color: #888;
}

footer p {
    margin: 0;
}

footer a {
    color: #777;
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #333;
}

footer .footer-divider {
    color: #ccc;
}

/* Hide default Leaflet attribution */
.leaflet-control-attribution {
    display: none !important;
}

/* ===================== */
/* Reading page styles   */
/* ===================== */

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #1a1a1a, #333);
    z-index: 2000;
    transition: width 0.1s ease-out;
}

/* Sticky navigation bar */
.sticky-nav {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1500;
    transition: top 0.3s ease;
}

.sticky-nav.visible {
    top: 0;
}

.sticky-nav a {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1a1a1a;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.sticky-nav a:hover {
    border-color: #1a1a1a;
    background-color: rgba(0, 0, 0, 0.03);
}

.sticky-nav .nav-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: #333;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reading page body */
.reading-body {
    background-color: #f8f8f6;
    overflow-x: hidden;
}

.reading-page {
    max-width: 65ch;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    background-color: #f8f8f6;
}

.reading-page .back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: #000;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reading-page .back-link:hover {
    text-decoration: underline;
}

/* Full-bleed hero image container */
.hero-container {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    margin-bottom: 2.5rem;
}

.reading-page .hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Gradient overlay for text contrast */
.hero-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

.reading-page h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: #000;
    letter-spacing: -0.01em;
}

.reading-page .location {
    font-family: 'Montserrat', sans-serif;
    color: #666;
    font-style: italic;
    margin-bottom: 2.5rem;
    font-size: 0.9rem;
}

.reading-page .story {
    font-family: 'Georgia', serif;
    font-size: 1.15rem;
    line-height: 1.75;
    color: #1a1a1a;
    font-weight: 400;
}

.reading-page .story p {
    margin-bottom: 1.75rem;
    text-align: left;
}

/* Drop cap - large first letter */
.reading-page .story p:first-of-type::first-letter {
    float: left;
    font-size: 4.5rem;
    line-height: 0.85;
    padding-right: 0.6rem;
    padding-top: 0.15rem;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    color: #000;
}

/* Pull quote styling */
.reading-page .pullquote {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3rem;
    font-style: italic;
    background-color: #000;
    color: #fff;
    padding: 0.4rem 0.6rem;
    margin: 2.5rem 0;
    display: inline-block;
    line-height: 1.5;
}

/* Highlighted name styling */
.reading-page .story .name-highlight {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    background-color: #000;
    color: #fff;
    padding: 0.15rem 0.4rem;
    letter-spacing: 0.05em;
}

/* ===================== */
/* End of article        */
/* ===================== */
.article-end {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid #ddd;
}

.article-end .end-divider {
    text-align: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: #999;
    margin-bottom: 2.5rem;
}

.return-cta {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.return-cta a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background-color: #1a1a1a;
    color: #fff;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.return-cta a:hover {
    background-color: #000;
    transform: translateY(-2px);
}

/* Stories nearby section */
.stories-nearby {
    background-color: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stories-nearby h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
}

.nearby-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nearby-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background-color: #f8f8f6;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.nearby-item:hover {
    background-color: #f0efe8;
    transform: translateX(4px);
}

.nearby-dot {
    width: 12px;
    height: 12px;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.nearby-info {
    flex: 1;
}

.nearby-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    color: #1a1a1a;
    margin-bottom: 0.2rem;
}

.nearby-location {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nearby-arrow {
    font-size: 1rem;
    color: #999;
    transition: transform 0.2s ease;
}

.nearby-item:hover .nearby-arrow {
    transform: translateX(4px);
}

/* Responsive */
@media (max-width: 600px) {
    #map-title {
        top: 16px;
        left: 16px;
    }

    #map-title .title-line-1 {
        font-size: 1rem;
        letter-spacing: 0.05em;
    }

    #map-title .title-line-2 {
        font-size: 0.85rem;
        letter-spacing: 0.04em;
    }

    #lang-selector {
        top: 16px;
        right: 16px;
        padding: 0.3rem 0.5rem;
    }

    #popup {
        width: 240px;
        border-radius: 16px;
    }

    #popup-image-wrapper {
        height: 140px;
    }

    #popup-content {
        padding: 1.1rem 1.1rem 1.3rem;
    }

    #popup h2 {
        font-size: 1.15rem;
        margin-bottom: 0.7rem;
    }

    #popup-excerpt {
        font-size: 0.75rem;
        margin-bottom: 1rem;
        line-height: 1.55;
    }

    #popup-link {
        font-size: 0.65rem;
    }

    /* Reading page mobile */
    .sticky-nav {
        padding: 0 1rem;
    }

    .sticky-nav .nav-title {
        display: none;
    }

    .reading-page {
        padding: 1.5rem 1rem 3rem;
    }

    .hero-container {
        /* Ensure full-bleed works on mobile without overflow */
        width: 100vw;
        margin-left: calc(-50vw + 50%);
    }

    .reading-page h1 {
        font-size: 2rem;
    }

    .reading-page .story {
        font-size: 1.05rem;
        line-height: 1.7;
    }

    .reading-page .story p:first-of-type::first-letter {
        font-size: 3.5rem;
    }

    .reading-page .pullquote {
        font-size: 1.1rem;
    }

    .stories-nearby {
        padding: 1.5rem;
    }

    .return-cta a {
        width: 100%;
        justify-content: center;
    }
}
