:root {
    --ink: #152b2a;
    --muted: #5f7470;
    --paper: #f4f1e8;
    --panel: rgba(255, 253, 247, 0.96);
    --line: #d8ded5;
    --accent: #d65b3f;
    --accent-dark: #91402e;
    --teal: #1f6865;
    --shadow: 0 18px 45px rgba(21, 43, 42, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: radial-gradient(circle at 8% 5%, rgba(214, 91, 63, 0.13), transparent 28rem),
        linear-gradient(135deg, #f7f4ec 0%, #e7eee9 100%);
    color: var(--ink);
    font-family: Georgia, 'Times New Roman', serif;
}

.site-header {
    min-height: 76px;
    padding: 16px clamp(18px, 4vw, 64px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(21, 43, 42, 0.12);
    background: rgba(247, 244, 236, 0.86);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 12px 12px 12px 3px; background: var(--teal); color: #f8f4e8;
    font: 700 18px/1 Arial, sans-serif; transform: rotate(-4deg);
}
.brand-copy strong, .brand-copy span { display: block; }
.brand-copy strong { font-size: 21px; }
.brand-copy span { margin-top: 2px; color: var(--muted); font: 11px/1.2 Arial, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; }
.header-note { color: var(--muted); font: 12px/1.4 Arial, sans-serif; text-align: right; }

.page { width: min(1440px, 100%); margin: 0 auto; padding: clamp(20px, 4vw, 54px) clamp(18px, 4vw, 64px) 64px; }
.intro { max-width: 720px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 10px; color: var(--accent-dark); font: 700 11px/1.2 Arial, sans-serif; letter-spacing: 0.16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 12px; font-size: clamp(32px, 5vw, 66px); line-height: 0.98; }
.intro p { max-width: 610px; margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }

.atlas-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.map-card, .side-panel, .doc-section { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.map-card { overflow: hidden; border-radius: 8px; }

.analysis-popup-content {
    max-height: 50vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.5em;
}
.workspace-bar { min-height: 54px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: #fffdf7; }
.workspace-bar h2 { margin: 0; font-size: 18px; }
.status { color: var(--teal); font: 700 11px/1.2 Arial, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; }
#map { height: clamp(520px, 72vh, 860px); min-height: 520px; width: 100%; background: #dce7e1; }

.side-panel { padding: 20px; border-radius: 8px; }
.side-panel h2, .doc-section h2 { margin-bottom: 10px; font-size: 23px; }
.side-panel p, .doc-section p, .doc-section li { color: var(--muted); font-size: 14px; line-height: 1.55; }
.legend { display: grid; gap: 10px; margin: 18px 0 24px; }
.legend-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; font: 13px/1.3 Arial, sans-serif; }
.swatch { height: 14px; border-radius: 2px; border: 1px solid rgba(21, 43, 42, 0.2); }
.swatch-gradient { background: linear-gradient(90deg, #ffffcc, #ffeda0, #fed976, #feb24c, #fd8d3c, #fc4e2a, #e31a1c, #bd0026, #800026); }
.swatch-empty { background: repeating-linear-gradient(135deg, #fffdf7, #fffdf7 5px, #d8ded5 5px, #d8ded5 7px); }
.swatch-boundary { background: transparent; border: 2px dashed var(--accent); }
.panel-rule { height: 1px; margin: 20px 0; background: var(--line); }
.quick-facts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font: 12px/1.45 Arial, sans-serif; }
.quick-facts strong { display: block; }

.docs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.doc-section { padding: 22px; border-radius: 8px; }
.doc-section ul { margin: 0; padding-left: 18px; }
.ecos-logo { display: block; width: min(100%, 220px); height: auto; margin-top: 16px; }
.site-footer { padding: 24px 0 0; color: var(--muted); font: 11px/1.4 Arial, sans-serif; }
.leaflet-control select { max-width: 230px; }
.osfa-opacity-control {
    padding: 6px;
    border-radius: 4px;
    background: #fffdf7;
    color: var(--ink);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
    font: 12px/1.4 Arial, sans-serif;
}
.osfa-opacity-control label { display: grid; justify-items: center; gap: 4px; }
.osfa-opacity-value { text-align: right; }
.osfa-opacity-slider {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 120px;
    margin: 0;
    padding: 0;
    background: transparent;
    writing-mode: vertical-lr;
    direction: rtl;
}
.osfa-opacity-slider::-webkit-slider-runnable-track {
    width: 4px;
    border-radius: 2px;
    background: #c5ccc6;
}
.osfa-opacity-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-left: -5px;
    border: 1px solid #87958b;
    border-radius: 50%;
    background: #aab5ac;
    cursor: pointer;
}
.osfa-opacity-slider::-moz-range-track {
    width: 4px;
    border-radius: 2px;
    background: #c5ccc6;
}
.osfa-opacity-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 1px solid #87958b;
    border-radius: 50%;
    background: #aab5ac;
    cursor: pointer;
}
.osfa-opacity-slider:hover::-webkit-slider-thumb { background: #929f95; }
.osfa-opacity-slider:hover::-moz-range-thumb { background: #929f95; }
.osfa-opacity-slider:focus-visible { outline: 2px solid #87958b; outline-offset: 2px; }
.osfa-fullscreen-control button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: #fffdf7;
    color: var(--ink);
    font: 700 21px/1 Arial, sans-serif;
    cursor: pointer;
}
.osfa-fullscreen-control button:hover { background: #f1eee5; }
.map-card:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
    background: #dce7e1;
}
.map-card:fullscreen .workspace-bar { display: none; }
.map-card:fullscreen #map { width: 100%; height: 100%; min-height: 100vh; }

@media (max-width: 900px) {
    .atlas-grid { grid-template-columns: 1fr; }
    .side-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
    .side-panel > p, .panel-rule { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .site-header { align-items: flex-start; }
    .header-note { display: none; }
    h1 { font-size: 42px; }
    .workspace-bar { align-items: flex-start; flex-direction: column; }
    #map { min-height: 400px; height: 62vh; }
    .side-panel, .docs { display: block; }
    .quick-facts { margin-top: 20px; }
    .docs { margin-top: 18px; }
    .doc-section + .doc-section { margin-top: 18px; }
}

.cog-tile {
    image-rendering: pixelated;
}