html,
body {
    height: 100%;
    margin: 0;
    background-color: #ede8e0;
    font-family: Inter, sans-serif;
    text-rendering: optimizeLegibility;
    text-align: center;
    overflow-x: hidden;
    max-width: 100%;
}


/* ---- Popup overlay backdrop ---- */
/* Hidden by default; becomes a full-screen dark overlay whenever a
   .popup-content.visible lives inside it (CSS :has() selector).        */
.popup-info {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.50);
    align-items: center;
    justify-content: center;
}

.popup-info:has(.popup-content.visible) {
    display: flex;
}


/* ---- Modal box ---- */
.popup-content {
    width: 75vw;
    max-width: 1100px;
    height: 82vh;
    display: none;
    flex-direction: column;
    position: relative;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0px 20px 60px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.popup-content.visible {
    display: flex;
}


/* ---- Title / header bar ---- */
.popup-content .popup-title {
    background-color: #1e0e1a;
    color: #ffffff;
    text-align: left;
    padding: 16px 52px 16px 24px;
    font-weight: 600;
    font-size: 20px;
    line-height: 1.3;
    flex-shrink: 0;
    /* remove old fixed height */
    height: auto;
}


/* ---- Close (×) button — sits in the top-right corner of the title bar ---- */
/* close.svg already has fill="#e3e3e3" (light grey) — no invert needed.   */
.popup-content .exit-button {
    width: 28px;
    height: 28px;
    top: 13px;
    right: 16px;
    z-index: 100000 !important;
    background-color: transparent;
    position: absolute;
    background-image: url('../icons/close.svg');
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-size: 80%;
    cursor: pointer;
    opacity: 0.80;
    transition: opacity 0.15s;
}

.popup-content .exit-button:hover {
    opacity: 1;
}


/* ---- Scrollable body ---- */
.popup-content .popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 30px 30px 30px;
    font-size: 14px;
    text-align: left;
    line-height: 1.65;
    color: #222222;
    background-color: #ede8e0;  /* matches main page background */
    white-space: normal;        /* was pre-wrap */
    height: auto;               /* remove old fixed height */
}


/* ---- Section headings inside the help body (## in markdown → <h2>) ---- */
.popup-content .popup-body h2 {
    font-size: 15px;
    font-weight: 700;
    color: #1e0e1a;
    margin: 1.4em 0 0.45em 0;
    padding-bottom: 6px;
    border-bottom: 1.5px solid #cfc8bf;
}

.popup-content .popup-body h2:first-child {
    margin-top: 0;
}

.popup-content .popup-body p {
    margin: 0.5em 0;
}

.popup-content .popup-body strong {
    color: #111111;
}

.popup-content .popup-body a {
    color: #1e0e1a;
    text-decoration: underline;
}

.popup-content .popup-body a:hover {
    opacity: 0.75;
}


/* ---- Citation popup (narrow variant) ---- */
#citation-content {
    width: 500px;
    height: auto;
    min-height: 80px;
}


/* ---- Main layout ---- */
.grid-container {
    display: flex;
    flex-direction: row;
    height: 100%;
}

.grid-container.blurred {
    filter: blur(2px);
}

.left-panel {
    width: 15%;
    padding: 10px;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    min-width: 250px;
    max-width: 800px;
    height: 100%;
}

.right-panel {
    flex-grow: 1;
    flex-direction: column;
    padding: 10px;
    height: 84%;
    padding-bottom: 20px;
}

.top-icon-row {
    display: flex;
    width: 100%;
    height: 72px;
    padding: 10px;
    flex-direction: row;
    align-items: center;
}

/* Restore original icon spacing */
.top-icon-row-icon {
    margin-right: 20px;
}

/* Push the icon buttons to the far right */
#helpbox-button {
    margin-left: auto;
}

.leaflet-map {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    min-width: 400px;
    min-height: 400px;
}


/* ---- Mobile ---- */
@media (max-width: 800px) {
    .grid-container {
        flex-direction: column;
        display: grid
    }

    .left-panel {
        width: 100%;
        display: grid;
        height: 800px;
        min-width: 200px;
        overflow: visible;
        padding: 10px 0;
        margin: 0 0px;
    }

    .right-panel {
        flex-direction: column;
        padding: 10px;
    }

    .popup-content {
        width: 95vw;
        height: 90vh;
    }
}
