/* Layout for the full-page results maps (maps/*.html).
   Loaded after ../styles.css, which provides the tokens, the site nav,
   and the shared map pieces (colour ramp, tooltip, swatches, loading overlay). */

html, body { height: 100%; }

body {
    display: flex;
    flex-direction: column;
    line-height: 1.55;
    overflow: hidden;
}

/* The site nav is fixed on the homepage; here it sits in the flow above the map */
nav {
    position: relative;
    flex-shrink: 0;
}

main {
    flex: 1;
    display: flex;
    min-height: 0;
}

.panel {
    width: 360px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.map-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

#map { position: absolute; inset: 0; }

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.back-link:hover { color: var(--accent-hover); }

.eyebrow {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 400;
    margin-top: 14px;
}

.panel h1 {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.1;
    margin: 6px 0 10px;
}

.lede {
    color: var(--text-secondary);
    font-size: 14px;
}

.section-label {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 10px;
}

/* ===== Layer toggle ===== */
.segmented {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.segmented button {
    flex: 1;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 9px 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.segmented button + button { border-left: 1px solid var(--border-color); }

.segmented button:hover { color: var(--text-primary); }

/* Place buttons: up to five short names in one row */
.segmented.places button { padding: 9px 4px; font-size: 12px; }

.segmented button[aria-pressed="true"] {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 400;
}

/* ===== Legend ===== */
.legend { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.legend li {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend .range {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.legend-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Ranked list ===== */
.rank-list { list-style: none; counter-reset: rank; }

.rank-list li { counter-increment: rank; }

.rank-list button {
    width: 100%;
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 8px;
    align-items: center;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    padding: 7px 2px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.rank-list button::before {
    content: counter(rank);
    color: var(--text-muted);
    font-size: 12px;
}

.rank-list button:hover,
.rank-list button:focus-visible {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    outline: none;
}

.rank-list .val {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Method ===== */
details {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

summary {
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 400;
}

details p { margin-top: 10px; }

details a { color: var(--accent); }

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.stat {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 10px 12px;
}

.stat b {
    display: block;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat span { font-size: 12px; color: var(--text-muted); }

/* ===== Other maps ===== */
.other-maps { list-style: none; display: flex; flex-direction: column; gap: 4px; }

.other-maps a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
}

.other-maps a::after { content: ' →'; color: var(--accent); }

.other-maps a:hover { color: var(--text-primary); }

/* ===== Data offer (maps of products we sell) ===== */
.data-offer {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.data-offer .section-label { margin-bottom: 6px; }
.data-offer p { margin-bottom: 10px; }
.data-offer-link { color: var(--text-primary); font-weight: 400; }

.credits { font-size: 11px; color: var(--text-muted); margin-top: auto; }

.credits a { color: var(--text-secondary); }

.disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    border-left: 2px solid var(--border-color);
    padding-left: 10px;
}

[hidden] { display: none !important; }

/* ===== Mobile: map on top, panel scrolls below ===== */
@media (max-width: 820px) {
    body { overflow: auto; height: auto; }
    main { flex-direction: column; }
    .map-wrap { flex: none; height: 62vh; order: -1; }
    .panel { width: 100%; border-right: none; border-top: 1px solid var(--border-color); padding: 20px 16px; overflow: visible; }
    .panel h1 { font-size: 28px; }
}
