/* ═══════════════════════════════════════════════════════════════════
   PFAS Italy Map — two-panel full-height layout
   ═══════════════════════════════════════════════════════════════════ */

/* ── Page chrome overrides ───────────────────────────────────────── */

body {
    overflow: hidden;
}

.page-footer {
    display: none;
}

/* Remove horizontal padding so the panels reach the edges */
.page-shell {
    width: 100%;
    max-width: 100%;
    height: calc(100svh - 5.7rem);   /* below the nav */
    min-height: 0;
    padding: clamp(0.7rem, 1.4vh, 1rem) clamp(0.75rem, 2vw, 1.5rem);
    display: flex;
    box-sizing: border-box;
}

/* ── Two-panel grid ──────────────────────────────────────────────── */

.pfas-screen {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(300px, 348px) minmax(0, 1fr);
    gap: clamp(0.85rem, 1.6vw, 1.25rem);
    align-items: stretch;
}

/* ════════════════════════════════════════════════════════════════════
   LEFT PANEL
   ════════════════════════════════════════════════════════════════════ */

.pfas-side {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: clamp(0.8rem, 1.4vw, 1.1rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(154, 251, 245, 0.18) transparent;
    border-radius: 1.4rem;
}

/* glass-panel mixin already applied via class in HTML; these are overrides */
.pfas-side.glass-panel {
    background: linear-gradient(
        170deg,
        rgba(6, 25, 40, 0.86),
        rgba(4, 18, 30, 0.78)
    );
    border: 1px solid rgba(230, 254, 255, 0.13);
}

/* ── Header ──────────────────────────────────────────────────────── */

.pfas-side-header {
    flex-shrink: 0;
}

.pfas-side-header .eyebrow {
    margin: 0 0 0.3rem;
}

.pfas-side-title {
    margin: 0;
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
}

/* ── Search block ────────────────────────────────────────────────── */

.pfas-search-block {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pfas-search-input {
    width: 100%;
    box-sizing: border-box;
    border-radius: 0.75rem;
    border: 1px solid rgba(230, 254, 255, 0.18);
    background: rgba(5, 27, 42, 0.64);
    color: var(--foam);
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-size: 0.88rem;
    transition: border-color 0.18s;
}

.pfas-search-input::placeholder {
    color: rgba(188, 239, 246, 0.42);
}

.pfas-search-input:focus {
    outline: none;
    border-color: rgba(154, 251, 245, 0.48);
}

.pfas-search-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pfas-btn {
    flex: 1 1 auto;
    border: 1px solid rgba(230, 254, 255, 0.24);
    border-radius: 999px;
    background: rgba(8, 30, 45, 0.68);
    color: var(--foam);
    font: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.52rem 0.88rem;
    cursor: pointer;
    transition: border-color 0.18s, transform 0.14s, background 0.18s;
    white-space: nowrap;
}

.pfas-btn:hover {
    border-color: rgba(154, 251, 245, 0.55);
    transform: translateY(-1px);
}

.pfas-btn--primary {
    background: rgba(47, 216, 208, 0.14);
    border-color: rgba(154, 251, 245, 0.44);
}

.pfas-btn--primary:hover {
    background: rgba(47, 216, 208, 0.22);
    border-color: rgba(154, 251, 245, 0.72);
}

.pfas-status-line {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.45;
    color: rgba(188, 239, 246, 0.72);
    min-height: 1.1em;
}

/* ── Unified info box (readout + legend + sources) ───────────────── */

.pfas-infobox {
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 0.9rem;
    border: 1px solid rgba(230, 254, 255, 0.12);
    background: rgba(4, 20, 33, 0.44);
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(154, 251, 245, 0.14) transparent;
    transition: border-color 0.3s;
}

/* Risk tint on the box border */
.pfas-infobox.risk-baseline { border-color: rgba(242, 201, 76,  0.32); }
.pfas-infobox.risk-elevated { border-color: rgba(243, 155, 45,  0.38); }
.pfas-infobox.risk-high     { border-color: rgba(212, 82,  42,  0.42); }
.pfas-infobox.risk-severe   { border-color: rgba(143, 29,  36,  0.48); }

.pfas-infobox-divider {
    border: none;
    border-top: 1px solid rgba(230, 254, 255, 0.09);
    margin: 0.1rem 0;
}

.pfas-readout-badge-row {
    display: flex;
    align-items: center;
}

.pfas-readout-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(230, 254, 255, 0.20);
    background: rgba(47, 216, 208, 0.08);
    color: var(--aqua);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.28rem 0.72rem;
    min-height: 1.6rem;
    min-width: 5ch;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.pfas-readout-rows {
    display: flex;
    flex-direction: column;
    gap: 0.36rem;
}

.pfas-readout-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
    font-size: 0.8rem;
}

.pfas-readout-row span {
    color: rgba(188, 239, 246, 0.72);
    white-space: nowrap;
}

.pfas-readout-row strong {
    color: var(--foam);
    text-align: right;
    font-size: 0.82rem;
}

.pfas-readout-explanation {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.48;
    color: rgba(223, 250, 252, 0.82);
}

/* ── Risk legend ─────────────────────────────────────────────────── */

.pfas-legend {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.pfas-legend-title {
    margin: 0;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(188, 239, 246, 0.55);
}

.pfas-legend-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.pfas-legend-dot {
    flex-shrink: 0;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    margin-top: 0.25rem;
    display: block;
}

.pfas-legend-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.75rem;
    line-height: 1.38;
}

.pfas-legend-text strong {
    color: var(--foam);
    font-size: 0.77rem;
}

.pfas-legend-text span {
    color: rgba(188, 239, 246, 0.65);
}

/* ── Data sources ────────────────────────────────────────────────── */

.pfas-sources-block {
    flex-shrink: 0;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.pfas-sources-title {
    margin: 0;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(188, 239, 246, 0.55);
}

.pfas-sources-links {
    margin: 0;
    font-size: 0.73rem;
    line-height: 1.6;
    color: rgba(188, 239, 246, 0.65);
}

.pfas-sources-links a {
    color: var(--aqua);
    text-decoration: none;
    opacity: 0.82;
    transition: opacity 0.15s;
}

.pfas-sources-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.pfas-sources-note {
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.45;
    color: rgba(188, 239, 246, 0.48);
}

.pfas-sources-note small {
    font-size: inherit;
}

/* ════════════════════════════════════════════════════════════════════
   RIGHT PANEL — full-height map
   ════════════════════════════════════════════════════════════════════ */

.pfas-map-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: stretch;
}

.pfas-map-shell {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 !important;
    border-radius: 1.4rem;
    border: 1px solid rgba(230, 254, 255, 0.14);
    background:
        radial-gradient(circle at 18% 10%, rgba(154, 251, 245, 0.14), transparent 34%),
        radial-gradient(circle at 86% 88%, rgba(255, 186, 125, 0.15), transparent 38%),
        linear-gradient(170deg, rgba(5, 25, 36, 0.84), rgba(7, 38, 56, 0.56));
    overflow: hidden;
    box-shadow: 0 28px 72px rgba(1, 12, 19, 0.48);
    /* NO aspect-ratio — fills full available height */
}

.pfas-map-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* ── Map badge overlay ───────────────────────────────────────────── */

.pfas-map-badge {
    position: absolute;
    bottom: 1.1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    pointer-events: none;
    white-space: nowrap;
}

.pfas-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.32rem 0.78rem;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 700;
    background: rgba(4, 23, 34, 0.76);
    border: 1px solid rgba(230, 254, 255, 0.22);
    color: rgba(230, 254, 255, 0.92);
}

.pfas-hint {
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: rgba(188, 239, 246, 0.5);
}

/* ── Leaflet overrides ───────────────────────────────────────────── */

.pfas-map-stage .leaflet-control-zoom a {
    background: rgba(6, 26, 39, 0.84);
    color: var(--foam);
    border-color: rgba(230, 254, 255, 0.22);
}

.pfas-map-stage .leaflet-control-zoom a:hover {
    background: rgba(6, 26, 39, 0.96);
    border-color: rgba(154, 251, 245, 0.45);
}

.pfas-map-stage .leaflet-control-attribution {
    background: rgba(6, 26, 39, 0.62);
    color: rgba(230, 254, 255, 0.76);
    font-size: 0.6rem;
}

.pfas-map-stage .leaflet-control-attribution a {
    color: rgba(154, 251, 245, 0.8);
}

.pfas-map-stage .leaflet-tile-pane {
    filter: saturate(0.66) hue-rotate(160deg) brightness(0.58) contrast(1.16);
}

.pfas-map-stage.is-detailed-basemap .leaflet-tile-pane {
    filter: saturate(0.82) hue-rotate(150deg) brightness(0.66) contrast(1.14);
}

.pfas-map-stage .leaflet-heatmap-layer {
    filter: saturate(1.42) contrast(1.32) brightness(0.86);
    opacity: 0.78 !important;
    mix-blend-mode: normal;
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    /* Unlock page scroll, show footer */
    body {
        overflow: auto;
    }

    .page-footer {
        display: revert;
    }

    .page-shell {
        height: auto;
        min-height: 0;
    }

    /* Stack panels vertically */
    .pfas-screen {
        grid-template-columns: 1fr;
        height: auto;
    }

    /* Left panel: auto height, no scroll needed */
    .pfas-side {
        overflow-y: visible;
        max-height: none;
    }

    /* Right panel: fixed proportion map */
    .pfas-map-panel {
        height: min(72svh, 600px);
    }

    .pfas-map-shell {
        border-radius: 1.2rem;
    }
}

@media (max-width: 600px) {
    .pfas-screen {
        gap: 0.75rem;
    }

    .pfas-side-title {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    .pfas-map-panel {
        height: min(80svh, 480px);
    }

    .pfas-map-badge {
        bottom: 0.7rem;
    }

    .pfas-hint {
        display: none;
    }
}
