/* ===========================
   Zoom In: the map format (Design: HubMap, round-four layout). Loaded after briefing-book.css,
   on map hubs only. inc/briefing-book-map.php prints the long article;
   assets/js/briefing-book-map.js draws the map and folds the list into rows.
   Legend: Renamed blue square, Rebuilt orange triangle, Remade maroon circle, Proposed outlined diamond.
   =========================== */

/* Title and intro on the left, lead image on the right, so the map starts on the first desktop screen.
   The lead image is never stretched past its file (1,179 pixels wide). */
.gb-bb-hero-map { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "t i"; grid-template-rows: auto; }
.gb-bb-hero-map:has(> .gb-bb-lead) { grid-template-areas: "t l" "i l"; grid-template-rows: auto 1fr; }
.gb-bb-hero-map .gb-bb-lead { max-width: 100%; }
.gb-bb-hero-map .gb-bb-lead img { max-width: min(100%, 1179px); }

/* The numbered shape */
.gb-bb-shape { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 14px; line-height: 1; color: #fff; }
.gb-bb-shape b { position: relative; font-weight: 800; }
.gb-bb-shape-renamed { background: #1e40af; }
.gb-bb-shape-rebuilt { background: #e0561f; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.gb-bb-shape-rebuilt b { padding-top: 35%; }
.gb-bb-shape-remade { background: #7f1d1d; border-radius: 50%; }
.gb-bb-shape-proposed { background: #16233f; color: #16233f; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.gb-bb-shape-proposed::before { content: ""; position: absolute; inset: 3px; background: #fff; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

/* Legend */
.gb-bb-legend { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.gb-bb-legend legend { padding: 0; margin-bottom: 8px; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: #4a5878; }
html.gb-bb-js .gb-bb-legend-key { display: none; }
.gb-bb-legend-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gb-bb-legend-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border: 2px solid #16233f; background: #fff; }
html.gb-bb-js .gb-bb-legend-item { cursor: pointer; }
.gb-bb-legend-item input { width: 18px; height: 18px; margin: 0; accent-color: #16233f; }
.gb-bb-legend-item .gb-bb-shape { width: 20px; height: 20px; }
.gb-bb-legend-item.is-off { border-color: #c3ccdb; background: #f4f6fa; }
.gb-bb-legend-item.is-off .gb-bb-shape, .gb-bb-legend-item.is-off .gb-bb-legend-label { opacity: .55; }
.gb-bb-legend-label { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; }
.gb-bb-legend-count { font-family: 'Barlow', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 0; color: #4a5878; }

/* Map and reveal */
.gb-bb-map-grid { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 16px; align-items: start; }
.gb-bb-map-col { min-width: 0; }
.gb-bb-map { position: relative; z-index: 0; isolation: isolate; height: 620px; background: #e9edf3; border: 1px solid #c3ccdb; }
html:not(.gb-bb-js) .gb-bb-map { height: auto; }
.gb-bb-map-still { display: block; width: 100%; height: auto; }
.gb-bb-map-still-detail { margin-top: 8px; border: 1px solid #c3ccdb; }
.gb-bb .gb-bb-map-still-note { margin-top: 8px; font-size: 14px; color: #4a5878; }
.gb-bb-map .leaflet-container { background: #e9edf3; font-family: 'Barlow', system-ui, sans-serif; }
/* At in-between zoom levels Leaflet scales the tiles. Its own fix for the hairline gap (plus-lighter blending) turns any
   sub-pixel overlap into a white line on this grey map, so blend normally and overlap each tile by one pixel instead. */
.gb-bb-map.leaflet-container img.leaflet-tile { mix-blend-mode: normal; width: 257px !important; height: 257px !important; }
.gb-bb-map .leaflet-control-attribution { font-size: 11px; background: rgba(255, 255, 255, .85); }
.gb-bb-map .leaflet-control-zoom a { color: #16233f; border-radius: 0 !important; }
.gb-bb-map .leaflet-bar { border-radius: 0; border: 2px solid #16233f; box-shadow: none; }
.gb-bb-map .gb-bb-pin, .gb-bb-map .gb-bb-cluster { background: none; border: 0; }
.gb-bb-map .gb-bb-pin:focus, .gb-bb-map .gb-bb-cluster:focus { outline: none; }
.gb-bb-map .gb-bb-pin:focus-visible .gb-bb-pin-ring, .gb-bb-map .gb-bb-cluster:focus-visible > div { outline: 3px solid #e0561f; outline-offset: 3px; }
.gb-bb-pin-ring { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.gb-bb-cluster-box { background: #16233f; color: #fff; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(10, 18, 36, .45); padding: 6px 10px; font-family: 'Barlow Condensed', sans-serif; line-height: 1.05; cursor: pointer; text-align: left; }
.gb-bb-cluster-box strong { display: block; font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: .03em; }
.gb-bb-cluster-box span { display: block; font-family: 'Barlow', sans-serif; font-weight: 600; font-size: 13px; line-height: 1.25; color: #f8c9b2; }
.gb-bb-map-reset { position: absolute; z-index: 500; left: 12px; bottom: 12px; background: #16233f; color: #fff; border: 0; padding: 0 14px; height: 40px; font: 700 15px 'Barlow Condensed', sans-serif; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }

.gb-bb-beyond { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.gb-bb-beyond-k { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: #4a5878; }
.gb-bb .gb-bb-beyond-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 10px 4px 6px; border: 1px solid #c3ccdb; background: #fff; color: #16233f; font-size: 14px; font-weight: 600; text-decoration: none; }
.gb-bb-beyond-chip .gb-bb-shape { width: 22px; height: 22px; font-size: 12px; }
.gb-bb .gb-bb-beyond-chip.is-current { border-color: #e0561f; background: #fde6da; }
.gb-bb .gb-bb-beyond-chip.is-filtered { opacity: .4; }

.gb-bb-map-reveal { border-top: 1px solid #d3dae6; margin-top: 18px; padding: 20px 0 0; min-width: 0; scroll-margin-top: 12px; }
.gb-bb-map-reveal:focus { outline: none; }
.gb-bb-map-reveal .gb-bb-reveal-none { display: grid; gap: 14px; align-content: start; }
.gb-bb-map-reveal .gb-bb-prompt { color: #2a3a5c; font-size: 18px; line-height: 1.4; text-wrap: pretty; }
.gb-bb-starters { display: grid; gap: 2px; }
.gb-bb .gb-bb-starters a { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; min-height: 44px; padding: 8px 10px; background: #fff; border: 1px solid #d3dae6; color: #16233f; font-weight: 600; font-size: 16px; text-decoration: none; }
.gb-bb .gb-bb-starters a:hover { background: #e3e8f1; color: #16233f; }
.gb-bb-starters-n { font-size: 13px; color: #4a5878; white-space: nowrap; }
.gb-bb-starters-note { font-size: 13px; color: #4a5878; }
.gb-bb-map-reveal .gb-bb-reveal-kicker { display: flex; align-items: center; gap: 8px; }
.gb-bb-map-reveal .gb-bb-reveal-kicker .gb-bb-shape { width: 16px; height: 16px; font-size: 0; }
.gb-bb-map-reveal .gb-bb-reveal-kicker .gb-bb-shape-proposed::before { inset: 2px; }
.gb-bb-map-reveal .gb-bb-reveal-slot .gb-bb-pbody { padding: 0; }
.gb-bb .gb-bb-map-reveal .gb-bb-place-h { font-size: 40px; line-height: 1; }
.gb-bb-map-reveal .gb-bb-place-h .gb-bb-shape, .gb-bb-map-reveal .gb-bb-place-cat { display: none; }

@media (min-width: 1000px) {
    html.gb-bb-js .gb-bb-map-grid { grid-template-columns: minmax(0, 1fr) 420px; }
    html.gb-bb-js .gb-bb-map-col { position: sticky; top: 12px; z-index: 1; }
    .gb-bb-map-reveal { background: #eef1f6; border-top: 0; margin-top: 0; padding: 20px 22px 24px; min-height: 620px; }
    .gb-bb-map-reveal .gb-bb-cards { grid-template-columns: minmax(0, 1fr); }
}

/* Loose stories under Latest: no place tag */
.gb-bb-loose { margin-top: 18px; padding-top: 16px; border-top: 2px solid #16233f; display: grid; gap: 12px; }
.gb-bb .gb-bb-loose-h { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 16px; letter-spacing: .06em; text-transform: uppercase; }
.gb-bb-loose .gb-bb-cards { grid-template-columns: minmax(0, 640px); }

/* Every place on the map */
.gb-bb .gb-bb-places { margin-top: 20px; border-top: 3px solid #16233f; }
.gb-bb-place { display: grid; border-bottom: 1px solid #d3dae6; scroll-margin-top: 12px; }
.gb-bb-place.is-filtered { display: none; }
.gb-bb-prow { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; text-align: left; background: transparent; color: #16233f; border: 0; padding: 10px; min-height: 52px; cursor: pointer; font-size: 16px; line-height: 1.3; }
.gb-bb-prow:hover { background: #e3e8f1; }
.gb-bb-prow-text { display: grid; gap: 1px; min-width: 0; }
.gb-bb-prow-name { font-weight: 600; font-size: 17px; }
.gb-bb-prow-cat { font-size: 13px; color: #4a5878; }
.gb-bb-place.is-current > .gb-bb-prow { background: #fde6da; }
.gb-bb-place.is-current > .gb-bb-prow .gb-bb-prow-name { font-weight: 700; }
.gb-bb-place.is-current > .gb-bb-prow .gb-bb-row-tail { color: #b23d12; }

.gb-bb-pbody { display: grid; gap: 12px; padding: 18px 0 24px; min-width: 0; }
html.gb-bb-js .gb-bb-place > .gb-bb-pbody { display: none; }
html.gb-bb-js .gb-bb-place.is-open > .gb-bb-pbody { display: grid; padding: 6px 10px 18px; background: #fde6da; }
html.gb-bb-js .gb-bb-place.is-open > .gb-bb-pbody .gb-bb-place-h, html.gb-bb-js .gb-bb-place.is-open > .gb-bb-pbody .gb-bb-place-cat { display: none; }
.gb-bb .gb-bb-place-h { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 28px; line-height: 1.05; display: flex; gap: 10px; align-items: center; text-wrap: balance; }
.gb-bb-place-cat { font-size: 14px; color: #4a5878; }
.gb-bb-place-note { font-size: 15px; color: #2a3a5c; }
.gb-bb-place-sum { max-width: 720px; color: #4a5878; font-style: italic; font-size: 16px; text-wrap: pretty; }
.gb-bb-place-wis { max-width: 720px; font-size: 15px; line-height: 1.4; padding: 10px 12px; background: #16233f; color: #fff; }
.gb-bb-place-wis strong { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #f08a5d; }
.gb-bb-place-asof { color: #c5cee0; }
.gb-bb-place-wis-text { display: block; margin-top: 2px; }
.gb-bb .gb-bb-place-fig figcaption a { color: #4a5878; }
html.gb-bb-js .gb-bb-pbody:not(.is-all) .gb-bb-card.is-extra { display: none; }
.gb-bb-pmore { min-height: 44px; }

@media (max-width: 999px) {
    .gb-bb-map { height: 520px; }
    .gb-bb .gb-bb-map-reveal .gb-bb-place-h { font-size: 34px; }
}
@media (max-width: 759px) {
    .gb-bb-hero-map, .gb-bb-hero-map:has(> .gb-bb-lead) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "t" "l" "i"; grid-template-rows: none; }
    .gb-bb-hero-map:not(:has(> .gb-bb-lead)) { grid-template-areas: "t" "i"; }
    .gb-bb-legend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gb-bb-legend-item { padding: 6px 8px; gap: 8px; }
    .gb-bb-map { height: 340px; }
    .gb-bb-map-reveal { display: none !important; }
    .gb-bb .gb-bb-place-h { font-size: 26px; }
}
@media print {
    .gb-bb-map-reveal, .gb-bb-prow, .gb-bb-pmore, .gb-bb-legend input, .gb-bb-map-reset { display: none !important; }
    html.gb-bb-js .gb-bb-place > .gb-bb-pbody { display: grid !important; }
    html.gb-bb-js .gb-bb-pbody .gb-bb-card.is-extra { display: grid !important; }
}
