/**
 * skydb-pages.css — site-wide page styles (non-modal).
 *
 * Anything specific to building/city/country/file detail pages, gallery
 * templates, etc. goes here. Modal styles live in skydb-modal.css. Keep
 * each rule as close as possible to Bootstrap 5.3 utility behaviour; only
 * write custom CSS when Bootstrap doesn't provide a utility.
 */

/* bootstrap-fileinput visual fix on /upload/. The plugin renders an
 * outer `.input-group.file-caption-main` containing a `.file-caption`
 * input + a button group with `.btn-file`. Bootstrap 5.3 doesn't auto-
 * strip the radii here because the button is wrapped inside an extra
 * `.input-group-btn` div. Force the inner caption input flush-right and
 * the button flush-left so they bond into one rounded input-group. */
.file-input .input-group.file-caption-main { flex-wrap: nowrap; }
.file-input .file-caption,
.file-input .file-caption .form-control,
.file-input .file-caption .file-caption-name {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.file-input .input-group-btn .btn-file,
.file-input .btn-file {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    margin-left: -1px !important;
}
.file-input .input-group-btn { display: flex; }

/* ============================================================
 * Building detail page — Atlas redesign.
 * Layered on top of the legacy `.skydb-object-data` table
 * styling (kept for the Object data rows). Mirrors the
 * homepage rhythm: hero band → stats band → numbered
 * sections with per-section edit buttons.
 * ============================================================ */
.skydb-bldg__hero {
    position: relative;
    min-height: clamp(280px, 38vw, 460px);
    overflow: hidden;
    color: #fff;
    background: var(--skydb-navy-deep, #141E5C);
    margin-top: 0;
}
.skydb-bldg__hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    z-index: 0;
}
.skydb-bldg__hero-veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 18, 48, 0.20) 0%, rgba(10, 18, 48, 0.65) 60%, rgba(10, 18, 48, 0.95) 100%);
    z-index: 1;
}
.skydb-bldg__hero-meta {
    position: relative;
    z-index: 2;
    padding-top: clamp(2rem, 6vw, 5rem);
    padding-bottom: clamp(1.5rem, 4vw, 3rem);
    padding-left: clamp(1rem, 4vw, 3rem);
    padding-right: clamp(1rem, 4vw, 3rem);
}
.skydb-bldg__hero-meta .eyebrow { color: rgba(255,255,255,0.85); }
.skydb-bldg__hero-title {
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-weight: 800;
    font-size: clamp(2rem, 6vw, 5rem);
    line-height: 0.95;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    margin: 0.5rem 0 0.85rem;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
    color: #fff;
}
.skydb-bldg__hero-where {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.92);
}
.skydb-bldg__hero-city {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.skydb-bldg__hero-city:hover { color: var(--skydb-cyan, #38BDF8); }
.skydb-bldg__hero-id {
    font-family: var(--skydb-font-mono, ui-monospace, "SF Mono", monospace);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.skydb-bldg__hero-src {
    font-family: var(--skydb-font-mono, ui-monospace, monospace);
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
}
.skydb-bldg__hero--blank {
    background: linear-gradient(135deg, var(--skydb-navy-deep, #141E5C) 0%, var(--skydb-navy, #1F2D7A) 100%);
}

/* Stats band — mirror homepage `.skydb-stats__inner` so the
 * building page picks up the same numeric rhythm. */
.skydb-bldg__stats {
    background: var(--skydb-paper-2, #F2F5FA);
    border-bottom: 1px solid var(--skydb-rule, #DCE3EF);
    padding: 1.25rem 0 1.1rem;
}
.skydb-bldg__stats-inner {
    padding-left: clamp(1rem, 4vw, 3rem);
    padding-right: clamp(1rem, 4vw, 3rem);
}
.skydb-bldg__stats .skydb-stats__item {
    border-left: 1px solid var(--skydb-rule, #DCE3EF);
    padding: 0.25rem 1rem 0.25rem 1.25rem;
}
.skydb-bldg__stats .col-6:first-child .skydb-stats__item,
.skydb-bldg__stats .col-lg-3:first-child .skydb-stats__item { border-left: 0; padding-left: 0; }
.skydb-bldg__stats-unit { font-size: 0.55em; color: var(--skydb-fg-muted, #5A6489); margin-left: 4px; }
.skydb-bldg__stats-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: clamp(1rem, 1.4vw, 1.4rem);
    text-transform: capitalize;
}

/* Body block (sections under the stats band). Top/bottom padding adds
 * vertical breathing room; horizontal padding is set in the stats
 * block above so all three (hero meta / stats / body) share the
 * same inset value. */
.skydb-bldg__body { padding-top: 2.25rem; padding-bottom: 3rem; }
/* External-link arrow next to anchors that open in a new tab. Sits
 * inline at a slightly smaller size, muted by default, picks up the
 * link colour on hover. Used after Google Maps / Bing Maps / weblinks. */
.skydb-bldg__ext {
    font-size: 0.78em;
    margin-left: 0.2em;
    color: var(--skydb-fg-muted, #5A6489);
    vertical-align: 1px;
}
a:hover .skydb-bldg__ext { color: inherit; }

/* Section header. Heading text + inline edit button — no separate
 * right-aligned action column. Buttons sit `align-baseline` directly
 * after the heading text per user direction. */
/* Spacing above each section comes from explicit `<div class="spacer-N">`
 * elements in the template (matches the rest of the theme's vertical
 * rhythm). Section itself carries no margin. */
.skydb-bldg__section { margin-top: 0; }
.skydb-bldg__h {
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-weight: 800;
    font-size: clamp(1.6rem, 2.8vw, 2.6rem);
    text-transform: uppercase;
    letter-spacing: 0.01em;
    line-height: 1;
    margin: 0 0 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;          /* button vertically centred with the heading text */
    gap: 0.75rem;
}
.skydb-bldg__h .btn {
    font-family: var(--skydb-font-body, inherit);
    font-weight: 600;
    font-size: 1rem;              /* readable; was 0.85rem and too small per user */
    padding: 0.4rem 1rem;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.2;
}
.skydb-bldg__h-sub {
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--skydb-fg-muted, #5A6489);
    margin: 0 0 0.5rem;
}

/* Object data table — info-icon next to each label. Pre-existing
 * `.skydb-object-data` rules cover the table layout itself. */
.skydb-bldg__data td { vertical-align: top; }
.skydb-bldg__data-label { font-weight: 500; }
/* City/country links in the value cells render at body weight (no
 * bold). `!important` because the screenshot showed a heavier weight
 * being applied somewhere we couldn't pin down via cascade order;
 * forcing it here is the simplest way to keep the row uniform. */
.skydb-bldg__data td a,
.skydb-bldg__data td a:link,
.skydb-bldg__data td a:visited,
.skydb-bldg__data td a:hover { font-weight: 400 !important; }
.skydb-bldg__info {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--skydb-fg-muted, #5A6489);
    line-height: 1;
    cursor: help;
    font-size: 0.95em;
    vertical-align: baseline;
}
.skydb-bldg__info:hover,
.skydb-bldg__info:focus-visible { color: var(--skydb-cyan-deep, #0EA5E9); outline: none; }

/* Map panel inside the Object data section. */
.skydb-bldg__map-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--skydb-rule, #DCE3EF);
}
.skydb-bldg__map { width: 100%; height: clamp(260px, 32vw, 420px); }
.skydb-bldg__map-foot { font-size: 0.9rem; }

.skydb-bldg__rating {
    background: var(--skydb-paper-2, #F2F5FA);
    border: 1px solid var(--skydb-rule, #DCE3EF);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}
.skydb-bldg__rating .skydb-bldg__h-sub { margin-bottom: 0.3rem; }
.skydb-rating-stars { font-size: 1.15rem; line-height: 1; display: flex; align-items: center; }
.skydb-rating-stars .skydb-rating-star { color: var(--bs-primary, #214196); margin-right: 1px; }
.skydb-rating-summary { font-family: var(--skydb-font-mono, ui-monospace, monospace); font-size: 0.95rem; }
.skydb-rating-vote { display: flex; flex-wrap: wrap; align-items: center; }
.skydb-rating-star--input {
    background: transparent;
    border: 0;
    padding: 0 2px;
    line-height: 1;
    cursor: pointer;
    color: var(--skydb-fg-muted, #5A6489);
    font-size: 1.15rem;
    transition: color 0.12s ease;
}
.skydb-rating-star--input.is-on,
.skydb-rating-star--input:hover,
.skydb-rating-star--input:focus-visible { color: var(--bs-primary, #214196); outline: none; }
.skydb-rating-feedback { font-size: 0.8rem; }

/* Weblinks list — show the actual URL after the source name so users
 * (and crawlers) see where the link goes before clicking. Source label
 * is mono-caps muted; URL truncates with an ellipsis on long paths so
 * each row stays a single line. Hover/click still resolve to the full
 * URL via the anchor's href. */
.skydb-weblink-list li {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    min-width: 0;
}
.skydb-weblink-list .skydb-weblink__source {
    flex: 0 0 auto;
    min-width: 6.5rem;
    font-family: var(--skydb-font-mono, ui-monospace, "SF Mono", monospace);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--skydb-fg-muted, #5A6489);
}
/* The link wraps both the URL text + the external-link icon so the
 * arrow sits flush against the URL (not floated to the right). The
 * inner span carries the truncation; the icon stays at its natural
 * size with `flex-shrink: 0` so it never collapses. */
.skydb-weblink-list .skydb-weblink__url {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 0.92rem;
}
.skydb-weblink-list .skydb-weblink__url-text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.skydb-weblink-list .skydb-weblink__url .skydb-bldg__ext {
    flex: 0 0 auto;
    margin-left: 0;
}

/* Admin block — Delete-this-building isolated from editorial actions. */
.skydb-bldg__admin-actions {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--skydb-rule, #DCE3EF);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Mobile tightening for the section-head row. */
@media (max-width: 575.98px) {
    .skydb-bldg__section-head { align-items: flex-start; }
    .skydb-bldg__hero-title  { font-size: clamp(1.6rem, 9vw, 2.4rem); }
    .skydb-bldg__hero-meta   { padding-top: 1.5rem; }
    .skydb-bldg__stats .skydb-stats__item { padding: 0.5rem 0.75rem; }
    .skydb-bldg__stats .col-6:nth-child(odd) .skydb-stats__item { border-left: 0; padding-left: 0; }
}

/* Dark-mode surfaces — mirror `.skydb-list-cmp` dark overrides. */
[data-bs-theme="dark"] .skydb-bldg__stats {
    background: rgba(120, 170, 255, 0.05);
    border-bottom-color: rgba(120, 170, 255, 0.10);
}
[data-bs-theme="dark"] .skydb-bldg__stats .skydb-stats__item { border-left-color: rgba(120, 170, 255, 0.10); }
[data-bs-theme="dark"] .skydb-bldg__rating {
    background: rgba(120, 170, 255, 0.05);
    border-color: rgba(120, 170, 255, 0.10);
}
[data-bs-theme="dark"] .skydb-bldg__map-wrap { border-color: rgba(120, 170, 255, 0.10); }
[data-bs-theme="dark"] .skydb-bldg__admin-actions { border-top-color: rgba(120, 170, 255, 0.10); }


/* Admin-only environment indicator pinned bottom-right. WP / DB / ES
 * pills surface env mismatches at a glance — e.g. WP=live but DB=dev.
 * Rendered from footer.php only when the visitor is a SKYDB admin.
 * Green = live, red = anything else (dev / local / unset). */
.skydb-devlabels {
	position: fixed;
	right: 25px;
	top: 70px;            /* was 110 in legacy; -70 then +30 per user direction */
	z-index: 1080;
	pointer-events: none;
	line-height: normal;
}
.skydb-devlabels .labelbox {
	display: inline-block;
	color: #fff;
	padding: 2px 6px;
	margin-left: 4px;
	border-radius: 3px;
	font-size: 11px;
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	line-height: 1.4;
	letter-spacing: 0.02em;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.skydb-devlabels .labelbox:first-child { margin-left: 0; }
.skydb-devlabels .labelbox-green { background: #2ea043; }
.skydb-devlabels .labelbox-red   { background: #cf222e; }

/* Main page scrollbar — wide, SKYDB-primary-coloured.
 *
 * Single document scrollbar: applied to <html> only (the body scroll
 * caused a second narrow gutter to render alongside ours). `body`
 * defaults to `overflow: visible` and inherits the document scroll
 * from the html element, so styling html is sufficient.
 * `overflow-y: scroll` reserves the gutter so the bar is always
 * visible (macOS overlay default would hide it).
 *
 * The `::-webkit-scrollbar` pseudo-elements are scoped to `html` so
 * scrollable in-page panels (modals, .table-responsive, .scroll
 * blocks) keep the browser's native styling — only the document
 * scrollbar takes the SKYDB-primary palette. */
html {
    overflow-y: scroll;
    scrollbar-width: auto;
    scrollbar-color: var(--bs-primary, #214196) rgba(33, 65, 150, 0.08);
}
/* Prevent <body> from rendering its own scrollbar — Bootstrap /
 * the theme set body { overflow-y: scroll } which paints a second
 * narrow gutter inside the document area on macOS. Force visible so
 * the document scroll lives only on <html>. */
body {
    overflow-y: visible;
}
/* Unscoped + !important: Chromium on macOS occasionally falls back
 * to the native scrollbar width when the rule is scoped to a single
 * element (html/body) — the spec is fuzzy about which element owns
 * the document scrollbar. Unscoped + !important wins over the
 * native default in all paths we care about. The wp-block-gallery
 * figcaption rule (block-library/style.min.css) and the leaflet
 * rule are both heavily scoped, so they keep their styling on
 * those elements. */
::-webkit-scrollbar {
    width: 22px !important;
    height: 22px !important;
}
::-webkit-scrollbar-track {
    background: rgba(33, 65, 150, 0.08);
}
::-webkit-scrollbar-thumb {
    background: var(--bs-primary, #214196);
    border-radius: 11px;
    border: 4px solid rgba(33, 65, 150, 0.08);
}
::-webkit-scrollbar-thumb:hover {
    background: #1a3477;
}

/* Object-data table on the building page uses Bootstrap .table + .w-50 on
 * its <col> elements to force a 50/50 split. Bootstrap doesn't ship a
 * table-layout: fixed utility, so the one rule below enables the colgroup
 * widths to actually bind (browsers ignore col widths under the default
 * auto layout). */
.skydb-object-data {
    table-layout: fixed;
}

/* Bootstrap 5.3 + WordPress' wp-block-table both ship cells with
 * `padding: .5rem .5rem` (vertical + horizontal). On SKYDB pages the
 * horizontal inset compounds with the .container gutter and pushes the
 * first column off its alignment with the headings above. Drop the
 * horizontal padding to 0 so cells line up flush with the column edge.
 * Same selector + load order as Bootstrap so source-order overrides win. */
.table>:not(caption)>*>*,
.wp-block-table table>:not(caption)>*>* {
    padding: .5rem 0;
}

/* Leaflet map on the building detail page. Fixed height because Bootstrap
 * doesn't offer a pixel-height utility; width follows the parent column. */
.skydb-leaflet-map {
    height: 300px;
}
.skydb-leaflet-wrap { position: relative; }
/* The "Open full screen map" text link that used to live in the upper-
 * right of every embedded map was removed; the trigger is now the ⛶
 * Leaflet control button on the top-left rail. See .skydb-map-fullscreen
 * below and skydb-map.js → FullscreenControl. */

/* File detail page — match the live www.skydb.net layout. The headline
 * sits between two solid SKYDB-blue rules; styled via the page's
 * wrapper class so the H1/H2 themselves stay bare. */
.skydb-file-rule {
    border: 0;
    border-top: 3px solid var(--bs-primary, #214196);
    opacity: 1;
}

/* Fullscreen-toggle button — sits on the top-left rail under the zoom
 * +/- buttons. Same look as Leaflet's default control buttons; uses the
 * shared hover-label CSS (`.leaflet-bar a[data-skydb-tip]`) for the
 * "Open full screen" tooltip on hover. */
.skydb-map-fullscreen a {
    background: #fff;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    display: block;
    font-size: 18px; /* ⛶ glyph reads better slightly larger */
    color: #214196;
}
.skydb-map-fullscreen a:hover { background: #f4f4f4; }

/* Fullscreen map overlay — fixed-position, covers the viewport. Lives on
 * top of the WP header, footer, and any other page content. The page
 * scroll is locked while it's open (see body.skydb-fullscreen-map-open). */
body.skydb-fullscreen-map-open { overflow: hidden; }
/* z-index 1040 sits between the WP header (~1030) and Bootstrap modal
 * backdrops (1050) — so any modal opened from INSIDE the overlay (e.g.
 * 'Add object' → manageobjectdata) renders ABOVE the map, not behind it. */
.skydb-fullscreen-map {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: #eee;
}
.skydb-fullscreen-map .skydb-fullscreen-map-canvas {
    position: absolute;
    inset: 0;
    background: #eee;
}
/* Close X — top-right, sits above the map */
.skydb-fullscreen-map-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.skydb-fullscreen-map-close:hover { background: #f8f9fa; color: #000; }
/* Search bar inside the overlay reuses .skydb-map-search positioning */
.skydb-fullscreen-map .skydb-map-search { z-index: 1000; }

/* Phorio-style building popup — SKYDB primary background, white text,
 * three-column body (facts | mini-map | photo) collapsing on narrow
 * viewports. Targets the .skydb-bldg-popup wrapper class on the L.popup
 * so we override Leaflet's default white frame. */
.leaflet-popup.skydb-bldg-popup .leaflet-popup-content-wrapper {
    background: var(--bs-primary, #214196);
    color: #fff;
    border-radius: 6px;
    padding: 0;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-popup.skydb-bldg-popup .leaflet-popup-content { margin: 0; width: auto !important; min-width: 420px; }
@media (max-width: 480px) {
    .leaflet-popup.skydb-bldg-popup .leaflet-popup-content { min-width: 0; }
}
.leaflet-popup.skydb-bldg-popup .leaflet-popup-tip { background: var(--bs-primary, #214196); }
.leaflet-popup.skydb-bldg-popup .leaflet-popup-close-button {
    color: #fff;
    font-size: 22px;
    padding: 6px 8px 0 0;
    cursor: pointer;
}
.leaflet-popup.skydb-bldg-popup .leaflet-popup-close-button:hover { color: #ddd; }

.skydb-bldg-popup-loading { padding: 16px; color: #fff; font-size: 13px; }

.skydb-bldg-popup-inner { font-size: 13px; line-height: 1.4; padding: 10px 12px; }
.skydb-bldg-popup-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-right: 24px; margin-bottom: 8px; }
.skydb-bldg-popup-icon { font-size: 16px; }
.skydb-bldg-popup .skydb-bldg-popup-name,
.skydb-bldg-popup a.skydb-bldg-popup-name { color: #fff !important; font-weight: 700; font-size: 16px; text-decoration: none; }
.skydb-bldg-popup a.skydb-bldg-popup-name:hover { color: #fff !important; text-decoration: underline; }
.skydb-bldg-popup-flag { font-size: 14px; }
.skydb-bldg-popup .skydb-bldg-popup-city,
.skydb-bldg-popup a.skydb-bldg-popup-city { color: rgba(255,255,255,0.85) !important; text-decoration: none; }
.skydb-bldg-popup a.skydb-bldg-popup-city:hover { color: #fff !important; text-decoration: underline; }
.skydb-bldg-popup .skydb-bldg-popup-facts a { color: rgba(255,255,255,0.92) !important; text-decoration: underline; }
.skydb-bldg-popup .skydb-bldg-popup-foot a { color: #fff !important; }

.skydb-bldg-popup-body { display: flex; gap: 8px; align-items: flex-start; }
.skydb-bldg-popup-facts { flex: 1 1 auto; min-width: 0; }
.skydb-bldg-popup-facts > div { margin-bottom: 3px; }
.skydb-bldg-popup-facts a { color: rgba(255,255,255,0.92); text-decoration: underline; }
.skydb-bldg-popup-status { display: flex; align-items: center; gap: 6px; }
.skydb-bldg-popup-status-pill {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #888;
}
.skydb-bldg-popup-status-pill[data-group="3"] { background: #f59f00; }
.skydb-bldg-popup-status-pill[data-group="4"] { background: #5cb85c; }
.skydb-bldg-popup-status-pill[data-group="5"] { background: #5a4632; }
.skydb-bldg-popup-architect { margin-top: 4px; }

.skydb-bldg-popup-mini,
.skydb-bldg-popup-photo {
    flex: 0 0 auto;
    display: block;
    border-radius: 3px;
    overflow: hidden;
    line-height: 0;
}
.skydb-bldg-popup-mini img { width: 100px; height: 90px; object-fit: cover; display: block; }
.skydb-bldg-popup-photo img { width: 110px; height: 90px; object-fit: cover; display: block; }

.skydb-bldg-popup-foot {
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-top: 10px;
    padding-top: 8px;
}
.skydb-bldg-popup-foot a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.skydb-bldg-popup-foot a:hover { text-decoration: underline; }

/* Responsive: stack body columns on narrow popups (mobile / small map) */
@media (max-width: 480px) {
    .leaflet-popup.skydb-bldg-popup .leaflet-popup-content-wrapper { max-width: 92vw; }
    .skydb-bldg-popup-body { flex-direction: column; }
    .skydb-bldg-popup-mini, .skydb-bldg-popup-photo { width: 100%; }
    .skydb-bldg-popup-mini img,
    .skydb-bldg-popup-photo img { width: 100%; height: 140px; }
}

/* Phorio-style floating building infobox — triggered by clicking any
 * .call_infobox element, fed by GET /wp-json/v1/building/<id>/infobox.
 * Reuses the .skydb-bldg-popup-* inner classes so the body looks like
 * the Leaflet map popup; this rule set just provides the standalone
 * frame (purple background, shadow, position, tip arrow, close button)
 * that Leaflet supplies for the map version. */
/* The host has fixed width, no min-height — content-fitting height so
 * there's no padding at the bottom. Positioning is anchored to the
 * host's BOTTOM (set in JS as `bottom: <docHeight - pageY + tipGap>`),
 * which keeps the cursor-tip position constant regardless of content
 * height. Loading state and real content therefore share the same
 * bottom edge — no jump between paints.
 *
 * body must be `position: relative` so the host's `bottom` is anchored
 * to the document (body content box) rather than the viewport's
 * initial containing block — without this, the box renders at the top
 * of the viewport instead of above the trigger. */
body { position: relative; }
#skydb-bldg-infobox-host {
    position: absolute;
    /* Below Bootstrap's .modal-backdrop (1050) and .modal (1055) so an
     * opening modal always sits on top of the infobox. Above ordinary
     * page content. */
    z-index: 1040;
    width: 460px;
    max-width: 92vw;
}
.skydb-bldg-infobox {
    width: 100%;
    background: var(--bs-primary, #214196);
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.skydb-bldg-infobox .skydb-bldg-popup-inner { padding: 12px 14px 10px; }
.skydb-bldg-infobox-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.85;
}
.skydb-bldg-infobox-close:hover { opacity: 1; }
/* Tip arrow: a 14px square rotated 45deg, half-tucked under the box.
 * Horizontal position is set by the JS positioner via inline `left`
 * so the tip points at the trigger element (Phorio behaviour). When
 * the box is clamped to the viewport edge the box can't centre on
 * the cursor anymore, but the arrow still aligns with where the
 * user clicked. */
.skydb-bldg-infobox-tip {
    position: absolute;
    bottom: -7px;
    transform: translateX(-50%) rotate(45deg);
    width: 14px;
    height: 14px;
    background: var(--bs-primary, #214196);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.15);
}
@media (max-width: 480px) {
    .skydb-bldg-infobox { width: 92vw; }
}


/* /cities/ page — top cities ranked by skyscraper presence.
 * Numbered card grid, Bootstrap-friendly columns, dark-mode-aware via
 * the existing Atlas tokens. The sort tabs use anchor links so the
 * URL carries the chosen ranking (?sort=…) for back-button + share. */
/* Full-width — the page wrapper above us already paints the page
 * background; this template owns the inner padding only, and lets
 * the card grid stretch edge-to-edge on wide viewports. */
.skydb-cities { padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; }
.skydb-cities__header { margin-bottom: 1.5rem; }
.skydb-cities__lede {
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 1.5rem;
}
.skydb-cities__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.skydb-cities__tab {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bs-body-color);
    background: transparent;
    border: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.125));
    text-decoration: none;
    transition: all 0.15s ease;
}
.skydb-cities__tab:hover {
    background: var(--bs-tertiary-bg, #f8f9fa);
    color: var(--bs-body-color);
    text-decoration: none;
}
.skydb-cities__tab.is-active {
    background: var(--bs-primary, #214196);
    color: #fff;
    border-color: var(--bs-primary, #214196);
}
.skydb-cities__tab.is-active:hover { background: var(--bs-primary, #214196); color: #fff; }
.skydb-cities__grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.skydb-cities__card {
    padding: 1rem;
    border: 1px solid rgba(33, 65, 150, 0.12);
    border-radius: 8px;
    /* Subtle SKYDB-blue tint so adjacent cards visually separate
     * without needing a heavier border. Tied to --bs-primary so a
     * theme rebrand carries through. Dark-mode override below. */
    background: rgba(33, 65, 150, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.skydb-cities__card:hover {
    background: rgba(33, 65, 150, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 65, 150, 0.12);
}
/* Rank lives in the header flexbox so a 3-digit number widens the
 * column instead of overflowing the absolute slot the previous
 * iteration used. flex-shrink:0 keeps the city name pushed safely
 * past the rank regardless of digit count. */
.skydb-cities__rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-secondary-color, #6c757d);
    line-height: 1;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.skydb-cities__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.skydb-cities__flag {
    width: 26px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}
.skydb-cities__name-block { display: flex; flex-direction: column; min-width: 0; }
.skydb-cities__name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--bs-body-color);
    text-decoration: none;
    line-height: 1.2;
}
.skydb-cities__name:hover { color: var(--bs-primary, #214196); text-decoration: none; }
.skydb-cities__country {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
    text-decoration: none;
}
a.skydb-cities__country:hover {
    color: var(--bs-primary, #214196);
    text-decoration: underline;
}
.skydb-cities__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 1rem;
    margin: 0;
}
.skydb-cities__stat { margin: 0; }
.skydb-cities__stat dt {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 600;
    margin: 0;
}
.skydb-cities__stat dd { margin: 0; font-size: 1rem; font-weight: 600; }
.skydb-cities__stat.is-primary dd {
    color: var(--skydb-cyan, #38BDF8);
    font-size: 1.25rem;
    font-weight: 700;
}
.skydb-cities__stat dd a { color: inherit; text-decoration: none; }
.skydb-cities__stat dd a:hover { text-decoration: underline; }
.skydb-cities__sub {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.skydb-cities__sub a { color: inherit; }
[data-bs-theme="dark"] .skydb-cities__card {
    background: rgba(120, 170, 255, 0.06);
    border-color: rgba(120, 170, 255, 0.15);
}
[data-bs-theme="dark"] .skydb-cities__card:hover {
    background: rgba(120, 170, 255, 0.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
[data-bs-theme="dark"] .skydb-cities__tab {
    border-color: rgba(255, 255, 255, 0.15);
}
[data-bs-theme="dark"] .skydb-cities__tab:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Search-form panel — wraps the two rows of filter inputs above the
 * results table. Subtle SKYDB-blue tint + matching border so the
 * panel reads as a discrete surface in both light + dark mode (matches
 * the visual treatment used by the cities-page cards). */
.skydb-search-panel {
    background: rgba(33, 65, 150, 0.05);
    border: 1px solid rgba(33, 65, 150, 0.15);
}
[data-bs-theme="dark"] .skydb-search-panel {
    background: rgba(120, 170, 255, 0.06);
    border-color: rgba(120, 170, 255, 0.15);
}

/* Search-result row thumbnail — left-aligned mini photo next to the
 * building name in the /search/ list. Square so 200×N or N×200 source
 * images crop the same way regardless of orientation. */
.search-result-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    display: block;
}

/* ------------------------------------------------------------------
 * ObjectList displaymodes — shared visual language across /search/
 * and any [snippet template="list/<entity>"] shortcode render.
 * Each block is scoped to one displaymode so adding a partial in
 * a future commit only touches its block.
 * --------------------------------------------------------------- */

/* Atlas's `.entry-content a` rule applies underlines + cyan colour
 * to every anchor inside the WP page body. Override across all the
 * list partials so cards/tiles/rows render without the underline,
 * matching the rest of the site (cities cards, infobox, etc.). */
.skydb-list-table a,
.skydb-list-tile__inner,
.skydb-list-detail-row__name a,
.skydb-list-detail-row__where a,
.skydb-list-compare__link,
.skydb-list-diagrams__bldg,
.skydb-list-map__list a {
    text-decoration: none !important;
}
.skydb-list-table a:hover,
.skydb-list-tile__inner:hover,
.skydb-list-detail-row__name a:hover,
.skydb-list-detail-row__where a:hover,
.skydb-list-compare__link:hover,
.skydb-list-diagrams__bldg:hover,
.skydb-list-map__list a:hover {
    text-decoration: none !important;
}

/* Country-flag images at the two sizes we ship from Phorio assets. */
.skydb-flag-18 { width: 18px; height: auto; vertical-align: -2px; border-radius: 1px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); margin-right: 0.25rem; }
.skydb-flag-26 { width: 26px; height: auto; vertical-align: -3px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); margin-right: 0.35rem; }

/* Unified rank chip — same look in every displaymode partial. The
 * background colour comes from the building's status group (matches
 * the pinpoint palette: green=completed / orange=under construction
 * / etc.), driven by --rank-color which the partial sets inline.
 * SKYDB-condensed font + "#" prefix + drop shadow. Position is set
 * by the outer wrapper (overlay over a tile image vs above a
 * silhouette vs inline in a table cell); the chip itself is
 * style-stable. */
.skydb-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.1rem 0.55rem;
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.2;
    color: #fff;
    background: var(--rank-color, var(--skydb-navy, #214196));
    border-radius: 4px;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.skydb-rank::before { content: '#'; opacity: 0.65; margin-right: 1px; }
/* Overlay variant — slightly stronger drop shadow for
 * legibility against full-bleed photos. */
.skydb-rank--overlay { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45); }
/* Tools::showStatusIcon — Phorio's small colour square in front of
 * a status label. Class-driven; the per-group background lives in
 * the .skydb-status-icon--gN selectors so the markup carries no
 * `style=` attribute. Phorio's exact palette. */
.skydb-status-icon { display: inline-block; width: 12px; height: 12px; vertical-align: middle; }
.skydb-status-icon--g0 { background-color: #888888; }
.skydb-status-icon--g1 { background-color: #BB9672; }
.skydb-status-icon--g2 { background-color: #2F99FF; }
.skydb-status-icon--g3 { background-color: #f98926; }
.skydb-status-icon--g4 { background-color: #7ed75c; }
.skydb-status-icon--g5 { background-color: #AFAFAF; }
.skydb-status-icon--g6 { background-color: #888888; }

/* Status-group palette — same colours as the pinpoint icon set.
 * Used as the rank-chip background AND as a tint on related
 * widgets that need the per-building status accent (compare card,
 * diagrams hatch lines, etc.). One class per group; no inline
 * `style="--rank-color: …"` on render. */
.skydb-rank--g0,
.skydb-rank--g1,
.skydb-rank--g2,
.skydb-rank--g6 { background: #888888; }
.skydb-rank--g3 { background: #f59f00; }
.skydb-rank--g4 { background: #5cb85c; }
.skydb-rank--g5 { background: #5a4632; }
/* Diagrams silhouette fill — uniform SKYDB navy regardless of
 * status. Status colour lives on the rank chip; the SVG body
 * stays a single calm tone so the skyline reads as one shape. */
.skydb-diagram-svg rect,
.skydb-diagram-svg line { fill: #214196; stroke: #214196; }
/* Hatch line override — neutral colour regardless of fill class. */
.skydb-diagram-svg .skydb-diagram-hatch { stroke: rgba(255,255,255,0.18); fill: none; }
/* Per-displaymode positioning shims (the chip itself stays uniform). */
.skydb-list-tile__rank-pos      { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2; }
.skydb-list-detail-row__rank-pos { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2; }
.skydb-list-cmp__rank-pos        { position: absolute; top: 0.75rem; left: 0.75rem; z-index: 2; }
.skydb-list-diagrams__rank-pos   { margin-bottom: 0.5rem; }
.skydb-list-map__rank-pos        { margin-right: 0.35rem; }

/* displaymode=list — flex-row card list (replaces the older
 * basic table). One row per building: rank chip + thumb + name/where
 * + stats + status. Hover lift, alternating tint, condensed font on
 * numbers. Reads denser than gallery but more visual than a table. */
.skydb-list-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.skydb-list-row { margin: 0; }
.skydb-list-row__link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: rgba(33, 65, 150, 0.04);
    border: 1px solid rgba(33, 65, 150, 0.10);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.skydb-list-row__link:hover {
    background: rgba(33, 65, 150, 0.09);
    transform: translateX(4px);
    box-shadow: 0 4px 14px rgba(33, 65, 150, 0.12);
    color: inherit;
    text-decoration: none;
}
.skydb-list-row__rank { flex: 0 0 auto; }
.skydb-list-row__thumb {
    flex: 0 0 72px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(33, 65, 150, 0.06);
    position: relative;
}
.skydb-list-row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.skydb-list-row__thumb-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 1.6rem; color: rgba(0,0,0,0.18); }
.skydb-list-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.skydb-list-row__name { font-size: 1rem; line-height: 1.2; font-weight: 700; color: var(--bs-body-color); display: block; min-width: 0; max-width: 100%; }
.skydb-list-row__where { font-size: 0.85rem; color: var(--bs-secondary-color, #6c757d); display: block; }
/* Three fixed-width stat slots — height / floors / year — so the
 * values line up as columns across all rows even when individual
 * cells are empty. No visible borders; just stable widths. */
.skydb-list-row__stats { flex: 0 0 auto; display: grid; grid-template-columns: 5.5rem 4rem 4rem; gap: 0; align-items: baseline; }
.skydb-list-row__stat { font-family: var(--skydb-font-condensed, "Archivo Narrow"); font-weight: 700; font-size: 1.6rem; color: var(--skydb-navy, #1F2D7A); line-height: 1; font-variant-numeric: tabular-nums; text-align: right; padding-right: 0.5rem; }
.skydb-list-row__stat em { font-style: normal; font-size: 0.62em; font-weight: 600; color: var(--bs-secondary-color, #6c757d); margin-left: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
/* Sort-driven column highlight — utility class added by
 * Tools::activeStatClasses to whichever cell matches the active
 * `sort` param. Same modifier across every displaymode so list /
 * gallery / details / compare / diagrams / map all light up the
 * column the user is ordering by. */
.skydb-list-row__stat.is-sort-active,
.skydb-list-tile__stat.is-sort-active,
.skydb-list-map__h.is-sort-active,
.skydb-list-diagrams__cap-h.is-sort-active,
.skydb-list-diagrams__cap-y.is-sort-active { color: var(--skydb-cyan-deep, #0EA5E9); font-weight: 600; }
/* Sort-driven cyan on details-mode value (color only, no layout). */
.skydb-list-detail-row__stat.is-sort-active dd { color: var(--skydb-cyan-deep, #0EA5E9); }
/* Status cell layout (list mode) — independent rule; was accidentally
 * merged with the rule above which corrupted detail-row sort highlight. */
.skydb-list-row__status { flex: 0 0 9.5rem; display: flex; align-items: center; gap: 0.45rem; font-size: 0.95rem; font-weight: 600; color: var(--bs-body-color); white-space: nowrap; text-transform: capitalize; }
@media (max-width: 767.98px) {
    /* Compact 2-column grid: rank+thumb on the left (one cell that
     * spans all rows), name/where/stats/status stacked on the right.
     * Keeps each row ≈ 80 px tall regardless of which fields are set. */
    .skydb-list-row__link {
        display: grid;
        grid-template-columns: auto 56px 1fr;
        grid-template-areas:
            "rank thumb main"
            "rank thumb stats"
            "rank thumb status";
        column-gap: 0.6rem;
        row-gap: 0.2rem;
        padding: 0.55rem 0.7rem;
        align-items: start;
    }
    .skydb-list-row__rank   { grid-area: rank;   align-self: center; }
    .skydb-list-row__thumb  { grid-area: thumb;  align-self: center; flex: 0 0 56px; width: 56px; height: 44px; }
    .skydb-list-row__main   { grid-area: main;   min-width: 0; flex: unset; }
    .skydb-list-row__stats  { grid-area: stats;  display: flex; gap: 1rem; grid-template-columns: none; flex: unset; align-items: baseline; }
    .skydb-list-row__status { grid-area: status; flex: unset; font-size: 0.85rem; }
    .skydb-list-row__name   { font-size: 1rem; }
    .skydb-list-row__stat   { font-size: 1rem; padding-right: 0; text-align: left; }
    .skydb-list-row__stat.is-sort-active { font-size: 1.1rem; }
}
[data-bs-theme="dark"] .skydb-list-row__link { background: rgba(120, 170, 255, 0.06); border-color: rgba(120, 170, 255, 0.12); }
[data-bs-theme="dark"] .skydb-list-row__link:hover { background: rgba(120, 170, 255, 0.12); }
[data-bs-theme="dark"] .skydb-list-row__stat { color: rgba(255,255,255,0.92); }
[data-bs-theme="dark"] .skydb-list-row__stat.is-sort-active,
[data-bs-theme="dark"] .skydb-list-tile__stat.is-sort-active,
[data-bs-theme="dark"] .skydb-list-map__h.is-sort-active,
[data-bs-theme="dark"] .skydb-list-diagrams__cap-h.is-sort-active,
[data-bs-theme="dark"] .skydb-list-diagrams__cap-y.is-sort-active,
[data-bs-theme="dark"] .skydb-list-detail-row__stat.is-sort-active dd,

/* displaymode=gallery — responsive card grid. */
.skydb-list-tiles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.skydb-list-tile { margin: 0; }
.skydb-list-tile__inner {
    display: flex;
    flex-direction: column;
    background: rgba(33, 65, 150, 0.04);
    border: 1px solid rgba(33, 65, 150, 0.12);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.skydb-list-tile__inner:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(33, 65, 150, 0.12);
    text-decoration: none;
    color: inherit;
}
.skydb-list-tile__image-wrap { position: relative; aspect-ratio: 4/3; background: rgba(0,0,0,0.04); overflow: hidden; }
.skydb-list-tile__image { width: 100%; height: 100%; object-fit: cover; display: block; }
.skydb-list-tile__image-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2rem; color: rgba(0,0,0,0.2); }
.skydb-list-tile__rank { position: absolute; top: 0.5rem; left: 0.5rem; background: rgba(0,0,0,0.55); color: #fff; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.skydb-list-tile__body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.skydb-list-tile__head { display: flex; align-items: center; gap: 0.4rem; }
.skydb-list-tile__name { font-size: 1rem; line-height: 1.2; display: block; min-width: 0; max-width: 100%; }
.skydb-list-tile__head { min-width: 0; }

/* Phorio's `shortentext` helper, ported verbatim. Used by every
 * displaymode partial wherever a single-line truncated label is
 * needed (building names in cards, city/country line, etc.). */
.shortentext { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ObjectList pagination control — appended once per render
 * (template-parts/list/_pagination.php). Reuses .skydb-cities__tab
 * pill colours indirectly via the same primary tokens, so the
 * page-number chips look consistent with the displaymode tab strip
 * elsewhere. */
.skydb-list-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0 0.5rem;
}
.skydb-list-pagination__count { font-size: 0.85rem; color: var(--bs-secondary-color, #6c757d); font-variant-numeric: tabular-nums; }
.skydb-list-pagination__count span { opacity: 0.75; }
.skydb-list-pagination__nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.skydb-list-pagination__nav li { margin: 0; }
.skydb-list-pagination__num,
.skydb-list-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(33, 65, 150, 0.15);
    background: transparent;
    color: var(--bs-body-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.skydb-list-pagination__num:hover,
.skydb-list-pagination__btn:hover {
    background: rgba(33, 65, 150, 0.08);
    color: var(--bs-body-color);
    text-decoration: none;
}
.skydb-list-pagination__num.is-active {
    background: var(--bs-primary, #214196);
    color: #fff;
    border-color: var(--bs-primary, #214196);
}
.skydb-list-pagination__btn.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.skydb-list-pagination__gap {
    color: var(--bs-secondary-color, #6c757d);
    padding: 0 0.25rem;
}
[data-bs-theme="dark"] .skydb-list-pagination { border-top-color: rgba(120, 170, 255, 0.15); }
[data-bs-theme="dark"] .skydb-list-pagination__num,
[data-bs-theme="dark"] .skydb-list-pagination__btn { border-color: rgba(120, 170, 255, 0.2); }
[data-bs-theme="dark"] .skydb-list-pagination__num:hover,
[data-bs-theme="dark"] .skydb-list-pagination__btn:hover { background: rgba(120, 170, 255, 0.1); }
.skydb-list-tile__meta { font-size: 0.85rem; color: var(--bs-secondary-color, #6c757d); }
.skydb-list-tile__stats { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; font-size: 0.85rem; color: var(--bs-body-color); }
[data-bs-theme="dark"] .skydb-list-tile__inner { background: rgba(120, 170, 255, 0.06); border-color: rgba(120, 170, 255, 0.15); }

/* displaymode=details — image + metadata two-column row. */
.skydb-list-details { display: flex; flex-direction: column; gap: 1rem; }
.skydb-list-detail-row { display: flex; gap: 1rem; padding: 1rem; background: rgba(33, 65, 150, 0.04); border: 1px solid rgba(33, 65, 150, 0.12); border-radius: 8px; }
.skydb-list-detail-row__image { position: relative; flex: 0 0 200px; aspect-ratio: 4/3; background: rgba(0,0,0,0.04); border-radius: 6px; overflow: hidden; }
.skydb-list-detail-row__image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.skydb-list-detail-row__placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2.5rem; color: rgba(0,0,0,0.2); }
.skydb-list-detail-row__rank { position: absolute; top: 0.5rem; left: 0.5rem; background: rgba(0,0,0,0.55); color: #fff; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.skydb-list-detail-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.skydb-list-detail-row__name { margin: 0; font-size: 1.5rem; }
.skydb-list-detail-row__name a { color: inherit; text-decoration: none; }
.skydb-list-detail-row__name a:hover { color: var(--skydb-cyan, #38BDF8); text-decoration: none; }
.skydb-list-detail-row__where { color: var(--bs-secondary-color, #6c757d); font-size: 0.95rem; }
.skydb-list-detail-row__where a { color: inherit; text-decoration: underline; }
.skydb-list-detail-row__stats { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0.25rem 0 0; }
.skydb-list-detail-row__stats > div { display: flex; flex-direction: column; }
.skydb-list-detail-row__stats dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bs-secondary-color, #6c757d); font-weight: 600; margin: 0; }
.skydb-list-detail-row__stats dd { margin: 0; font-weight: 600; }
.skydb-list-detail-row__architect { font-size: 0.9rem; color: var(--bs-secondary-color, #6c757d); }
@media (max-width: 767.98px) {
    .skydb-list-detail-row { flex-direction: column; }
    .skydb-list-detail-row__image { flex: 0 0 auto; aspect-ratio: 16/9; }
}
[data-bs-theme="dark"] .skydb-list-detail-row { background: rgba(120, 170, 255, 0.06); border-color: rgba(120, 170, 255, 0.15); }

/* displaymode=compare — film-poster cards in a horizontal strip,
 * each with a height-bar visualization + leader-highlighted stats.
 * Designed to look striking on first paint: deep navy background,
 * scroll-snap so a single building fills the viewport, name big in
 * the SKYDB display font on top of a gradient over the photo.
 *
 * Layout: 3 stacked sections per card —
 *   1. Poster (image + gradient + name overlay + status-tinted rank)
 *   2. Height bar (proportional fill against the result-set max)
 *   3. Stat row (Floors / Year / Status, leader cells in cyan)
 */
.skydb-list-compare-cards {
    display: flex;
    align-items: flex-start;     /* don't stretch cards to the tallest sibling */
    gap: 1rem;
    padding: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 1rem;
    /* Bright variant — sky-blue paper gradient. Cards keep the
     * navy poster + cyan accents so the design still reads as a
     * "skyline showcase". Dark-mode override below switches the
     * gradient to deep navy. */
    background: linear-gradient(135deg, var(--skydb-paper-2, #F2F5FA) 0%, var(--skydb-paper-3, #E6ECF5) 100%);
    border-radius: 8px;
    color: var(--bs-body-color);
}
.skydb-list-cmp {
    flex: 0 0 280px;
    align-self: flex-start;       /* card height = its own content, not the tallest sibling */
    scroll-snap-align: start;
    background: #fff;
    border: 1px solid rgba(33, 65, 150, 0.12);
    border-radius: 12px;
    overflow: hidden;
    display: block;               /* simple block flow: poster + stats stack naturally */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: var(--bs-body-color);
    text-decoration: none;
    height: auto;
    min-height: 0;
}
.skydb-list-cmp:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(33, 65, 150, 0.25);
    color: var(--bs-body-color);
    text-decoration: none;
}
.skydb-list-cmp__poster {
    position: relative;
    display: block;
    height: 360px;
    overflow: hidden;
    color: inherit;
    background-color: rgba(33, 65, 150, 0.06);
}
/* Building photo — fills the poster, cropped to cover. Uses native
 * `loading="lazy"` + `decoding="async"` on the <img> instead of a
 * CSS background, so off-screen cards don't fetch their image. */
.skydb-list-cmp__poster-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.skydb-list-cmp__poster--blank {
    background-image: linear-gradient(180deg, rgba(120, 170, 255, 0.18), rgba(120, 170, 255, 0.05));
}
.skydb-list-cmp__veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 18, 48, 0) 25%, rgba(10, 18, 48, 0.55) 60%, rgba(10, 18, 48, 0.95) 100%);
}
.skydb-list-cmp__rank {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    background: var(--rank-color, #888);
    color: #fff;
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-weight: 800;
    font-size: 1.4rem;
    padding: 0.05rem 0.6rem;
    border-radius: 4px;
    line-height: 1.2;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
.skydb-list-cmp__rank-num::before { content: '#'; opacity: 0.6; margin-right: 1px; }
.skydb-list-cmp__title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    z-index: 2;
}
.skydb-list-cmp__where {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    font-variant-numeric: tabular-nums;
}
.skydb-list-cmp__name {
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    line-height: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    margin: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
/* Vertical height bar overlaid on the right edge of the poster.
 * The fill grows from the bottom; `is-leader` (tallest in the result
 * set) gets a brighter cyan + glow. The dedicated bar-readout block
 * is gone — the height value now lives in the .__stats row at the
 * bottom alongside Floors / Year. */
.skydb-list-cmp__overlay-bar {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: 6px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    overflow: hidden;
    z-index: 2;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.skydb-list-cmp__overlay-bar-fill {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(180deg, rgba(120, 170, 255, 0.85), var(--skydb-cyan-deep, #0EA5E9));
    border-radius: 3px;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.skydb-list-cmp__overlay-bar-fill.is-leader {
    background: linear-gradient(180deg, var(--skydb-cyan, #38BDF8), var(--skydb-cyan-deep, #0EA5E9));
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.55);
}
.skydb-list-cmp__stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-auto-rows: min-content;        /* row = content height, never stretched */
    align-items: start;                  /* same: cells don't stretch vertically */
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(33, 65, 150, 0.08);
    background: #fff;
}
.skydb-list-cmp__stat {
    margin: 0;
    padding: 0.75rem 0.85rem 0.85rem;
    border-right: 1px solid rgba(33, 65, 150, 0.06);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.3rem;
    min-height: 0;
}
.skydb-list-cmp__stat:last-child { border-right: 0; }
.skydb-list-cmp__stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 600;
    line-height: 1.2;
}
/* All three stats render with the same condensed display font + size
 * so Height / Floors / Year read as one row. Bumped from 1.4 → 1.7 rem
 * for legibility in the card. */
.skydb-list-cmp__stat-value {
    font-family: var(--skydb-font-condensed, "Archivo Narrow");
    font-weight: 700;
    font-size: 1.7rem;
    color: var(--skydb-navy, #1F2D7A);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
/* Sort-driven cyan: the cell whose metric matches `?orderby=…` gets
 * the cyan accent on every card, so the user can scan one column
 * at a glance. The previous per-row `is-leader` highlight on the
 * stat cells (max value across the result set) was removed because
 * it conflicted with the sort highlight — `is-leader` is now kept
 * only on `.skydb-list-cmp__overlay-bar-fill` so the tallest
 * building's vertical bar still glows. */
.skydb-list-cmp__stat.is-sorted .skydb-list-cmp__stat-value {
    color: var(--skydb-cyan-deep, #0EA5E9);
}
@media (max-width: 767.98px) {
    .skydb-list-cmp { flex: 0 0 85vw; }
}

/* Compare — dark-mode override (same dramatic feel as the original
 * dark draft, but properly scoped to data-bs-theme=dark). */
[data-bs-theme="dark"] .skydb-list-compare-cards {
    background: linear-gradient(135deg, var(--skydb-navy-deep, #141E5C) 0%, var(--skydb-navy, #1F2D7A) 100%);
}
[data-bs-theme="dark"] .skydb-list-cmp { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); color: #fff; }
[data-bs-theme="dark"] .skydb-list-cmp:hover { box-shadow: 0 14px 30px rgba(0,0,0,0.45); }
[data-bs-theme="dark"] .skydb-list-cmp__stats { background: transparent; border-top-color: rgba(255,255,255,0.06); }
[data-bs-theme="dark"] .skydb-list-cmp__stat { border-right-color: rgba(255,255,255,0.04); }
[data-bs-theme="dark"] .skydb-list-cmp__stat-label { color: rgba(255,255,255,0.5); }
[data-bs-theme="dark"] .skydb-list-cmp__stat-value { color: rgba(255,255,255,0.95); }
[data-bs-theme="dark"] .skydb-list-cmp__stat.is-sorted .skydb-list-cmp__stat-value { color: var(--skydb-cyan, #38BDF8); }

/* displaymode=diagrams — proportional skyline silhouettes.
 * Status-tinted SVGs (green=completed / orange=construction / etc.)
 * sit on a horizon line with a subtle haze gradient behind them so
 * the strip reads as a real city skyline rather than a bar chart.
 * Wider columns + breathing-room gap.
 */
.skydb-list-diagrams {
    display: flex;
    align-items: flex-start;             /* ruler sticks to the top, doesn't stretch into the caption row */
    gap: 1rem;
    padding: 2.5rem 1.25rem 0.5rem;      /* top breathing room above the antennas */
    border: 1px solid rgba(33, 65, 150, 0.12);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(120, 170, 255, 0.06) 0%, rgba(33, 65, 150, 0.10) 100%);
}
.skydb-list-diagrams__ruler {
    flex: 0 0 56px;
    height: 540px;                       /* spans the plot area only — 0m tick aligns with SVG baselines */
    position: relative;
    border-right: 1px dashed rgba(33, 65, 150, 0.18);
}
.skydb-list-diagrams__tick { position: absolute; right: 0.5rem; transform: translateY(50%); font-size: 0.7rem; color: var(--bs-secondary-color, #6c757d); white-space: nowrap; font-variant-numeric: tabular-nums; }
.skydb-list-diagrams__tick::after { content: ''; position: absolute; right: -0.6rem; top: 50%; width: 4px; height: 1px; background: rgba(33, 65, 150, 0.4); }
.skydb-list-diagrams__scroll {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;        /* never spawn a vertical scrollbar inside */
    align-items: flex-end;     /* every bldg's bottom (caption baseline) sits on the strip's bottom */
    height: 595px;             /* 540 plot + ~30 caption row + scrollbar buffer */
    gap: 0.85rem;
}
.skydb-list-diagrams__bldg {
    flex: 0 0 auto;
    position: relative;        /* anchor for the absolute caption below */
    display: flex;
    flex-direction: column;    /* rank stacks above plot; both push to the bottom */
    align-items: center;
    justify-content: flex-end;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease;
}
.skydb-list-diagrams__bldg:hover { color: inherit; text-decoration: none; transform: translateY(-3px); }
.skydb-list-diagrams__bldg:hover .skydb-list-diagrams__svg rect,
.skydb-list-diagrams__bldg:hover .skydb-list-diagrams__svg line { fill: var(--skydb-cyan-deep, #0EA5E9); stroke: var(--skydb-cyan-deep, #0EA5E9); }
.skydb-list-diagrams__plot { position: relative; width: 110px; display: flex; align-items: flex-end; justify-content: center; flex-shrink: 0; }
.skydb-list-diagrams__svg { display: block; filter: drop-shadow(0 4px 6px rgba(33, 65, 150, 0.35)); }
.skydb-list-diagrams__svg rect, .skydb-list-diagrams__svg line { transition: fill 0.15s ease, stroke 0.15s ease; }
.skydb-list-diagrams__cap {
    flex-shrink: 0;            /* sits inside the bldg column, just below the plot */
    width: 110px;
    margin-top: 0.4rem;
    margin-bottom: 15px;       /* breathing room above the horizontal scrollbar */
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.2;
}
.skydb-list-diagrams__cap strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.skydb-list-diagrams__cap span { color: var(--bs-secondary-color, #6c757d); font-variant-numeric: tabular-nums; }
[data-bs-theme="dark"] .skydb-list-diagrams { border-color: rgba(120, 170, 255, 0.15); background: linear-gradient(180deg, rgba(10, 18, 48, 0.6), rgba(20, 30, 92, 0.9)); }
[data-bs-theme="dark"] .skydb-list-diagrams__rank { color: rgba(255,255,255,0.65); }
[data-bs-theme="dark"] .skydb-list-diagrams__svg { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45)); }

/* displaymode=map — Leaflet panel + scrolling sidebar list. */
.skydb-list-map { display: flex; height: 70vh; min-height: 480px; border: 1px solid rgba(33, 65, 150, 0.12); border-radius: 8px; overflow: hidden; background: var(--bs-body-bg); }
.skydb-list-map__sidebar { flex: 0 0 280px; overflow-y: auto; border-right: 1px solid rgba(33, 65, 150, 0.12); padding: 1rem; }
.skydb-list-map__sidebar-h { font-size: 1rem; margin: 0 0 0.75rem; }
.skydb-list-map__sidebar-h small { color: var(--bs-secondary-color, #6c757d); font-weight: 400; }
.skydb-list-map__list { list-style: none; margin: 0; padding: 0; }
.skydb-list-map__list li { margin: 0; }
.skydb-list-map__list a { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem; border-radius: 4px; color: var(--bs-body-color); text-decoration: none; font-size: 0.9rem; }
.skydb-list-map__list a:hover { background: rgba(33, 65, 150, 0.08); color: inherit; text-decoration: none; }
.skydb-list-map__list a small { margin-left: auto; color: var(--bs-secondary-color, #6c757d); font-variant-numeric: tabular-nums; }
.skydb-list-map__rank { display: inline-block; min-width: 1.6rem; font-family: var(--skydb-font-condensed, "Archivo Narrow"); font-weight: 700; color: var(--bs-secondary-color, #6c757d); font-variant-numeric: tabular-nums; }
.skydb-list-map__canvas { flex: 1; }
@media (max-width: 767.98px) {
    .skydb-list-map { flex-direction: column; height: auto; }
    .skydb-list-map__sidebar { flex: 0 0 auto; max-height: 200px; border-right: 0; border-bottom: 1px solid rgba(33, 65, 150, 0.12); }
    .skydb-list-map__canvas { height: 60vh; }
}
[data-bs-theme="dark"] .skydb-list-map { border-color: rgba(120, 170, 255, 0.15); }
[data-bs-theme="dark"] .skydb-list-map__sidebar { border-right-color: rgba(120, 170, 255, 0.15); }


/* Custom building pin icons — color-coded by status group. Strip
 * Leaflet's default white background that wraps every divIcon. */
.skydb-bldg-icon {
    background: none !important;
    border: 0 !important;
}
.skydb-bldg-icon svg { display: block; }

/* Locate-me Leaflet control — sits below the +/- zoom buttons.
 * Uses the same look as the default Leaflet bar so it looks native. */
.skydb-map-locate a {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
}
.skydb-map-locate a:hover { background: #f4f4f4; }

/* Drag-mode toggle (top-left, ✥). Active state highlights in SKYDB blue. */
.skydb-map-dragmode a {
    background: #fff;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    display: block;
    font-size: 18px;
    color: #214196;
}
.skydb-map-dragmode a:hover { background: #f4f4f4; }
.skydb-map-dragmode.is-active a { background: #214196; color: #fff; }

/* Region-name badge — shown in the lower-right of the map shell, just
 * above the Leaflet attribution strip ("© SKYDB | © OpenStreetMap"),
 * when ?region=NNN is loaded so the editor can see at a glance which
 * region they're editing. JS injects it after the boundary endpoint
 * resolves (skydb-map.js → installBoundaryEditor).
 *
 * Anchored bottom-right so it never overlaps the top-of-map controls
 * (search input, fullscreen link, draw toolbar). `bottom: 40px` keeps
 * a small gap above the attribution row; `right: 12px` matches the
 * rest of the rail inset. */
/* Container for the boundary-mode badges (region name + optional
 * "no boundary" warning). The bar is the only positioned element; the
 * two child badges flow inside it via flex so an ultra-long region
 * name truncates with ellipsis instead of overflowing the red badge.
 *
 * `max-width: calc(100% - 24px)` keeps the bar inside the rail inset.
 * `min-width: 0` on the region-name badge lets flex shrink it. */
.skydb-boundary-label-bar {
    position: absolute;
    bottom: 40px;
    right: 12px;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    gap: 6px;
    max-width: calc(100% - 24px);
    pointer-events: none;
}
.skydb-boundary-region-label,
.skydb-boundary-missing-label {
    color: #fff;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}
.skydb-boundary-region-label {
    background: rgba(33, 65, 150, 0.92);
    /* Allow flex shrink for long names; ellipsis the overflow. */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.skydb-boundary-missing-label {
    background: rgba(196, 33, 33, 0.92);
    /* Don't shrink — "no boundary" should stay legible at all viewport widths. */
    flex: 0 0 auto;
}

/* Permission banner shown when a non-admin lands on ?mode=boundary. */
.skydb-map-permission-banner {
    position: absolute;
    top: 62px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1010;
    background: rgba(220, 53, 69, 0.92);
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}
a.skydb-map-permission-banner {
    pointer-events: auto;
    cursor: pointer;
    text-decoration: none;
}
a.skydb-map-permission-banner:hover {
    background: rgba(220, 53, 69, 1);
    color: #fff;
}

/* Leaflet.draw vertex / midpoint handles — replace the default
 * 8×8 white squares (which were the white blobs the user spotted)
 * with SKYDB-blue circles, larger so they're easier to grab on
 * touch devices. Midpoint handles get a lighter fill so they look
 * insertable rather than draggable. */
.leaflet-editing-icon,
.leaflet-div-icon.leaflet-editing-icon {
    background: #214196;
    border: 2px solid #fff;
    border-radius: 50%;
    width:  12px !important;
    height: 12px !important;
    margin-left:  -6px !important;
    margin-top:   -6px !important;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
/* Midpoint (insertable) handle — Leaflet.draw doesn't class these
 * separately, so target by opacity-based selector that the lib sets. */
.leaflet-editing-icon[style*="opacity: 0.6"],
.leaflet-editing-icon[style*="opacity:0.6"] {
    background: rgba(33, 65, 150, 0.55);
    width:  10px !important;
    height: 10px !important;
    margin-left:  -5px !important;
    margin-top:   -5px !important;
}

/* Save-boundary control — sits in the top-left rail directly under the
 * Leaflet.draw toolbar so every boundary-edit control lives in one rail. */
.skydb-map-bsave a {
    background: #fff;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    display: block;
    font-size: 16px;
}
.skydb-map-bsave a:hover { background: #f4f4f4; }

/* Hover labels for every left-rail map icon (zoom +/-, locate, drag mode,
 * Leaflet.draw polygon/rectangle/edit/delete, save boundary). The native
 * `title` attribute is copied to `data-skydb-tip` by skydb-map.js so this
 * pseudo-element is the only tooltip shown — no duplicate native delay-tip.
 *
 * Position: directly to the right of the icon, vertically centred.
 * Z-index keeps it above neighbouring controls and the map tiles. */
.leaflet-bar a[data-skydb-tip] { position: relative; }
.leaflet-bar a[data-skydb-tip]::after {
    content: attr(data-skydb-tip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease-in 0.05s;
    z-index: 1000;
}
.leaflet-bar a[data-skydb-tip]:hover::after { opacity: 1; }

/* Equal inset on all four sides for the Leaflet control rails — by
 * default the left/right rails have no horizontal margin and the
 * controls sit flush against the map edge, which clashes with the
 * 12px top inset of the sidebar / 6px-8px logo inset at the bottom.
 * Pull both rails 12px inward so the +/-, locate, attribution etc.
 * line up visually with the sidebar gutter. */
.skydb-map-shell .leaflet-left,
.skydb-fullscreen-map .leaflet-left   { left:  12px; }
.skydb-map-shell .leaflet-right,
.skydb-fullscreen-map .leaflet-right  { right: 12px; }
.skydb-map-shell .leaflet-top,
.skydb-fullscreen-map .leaflet-top    { top:    12px; }
.skydb-map-shell .leaflet-bottom,
.skydb-fullscreen-map .leaflet-bottom { bottom: 12px; }
/* The logo control already has its own margin from the previous block;
 * zero out the extra padding now that the rail itself is inset. */
.skydb-map-logo { margin: 0; }

/* SKYDB logo (bottom-left, above the OSM attribution) — bare image,
 * no chrome, no halo. */
.skydb-map-logo {
    display: inline-block;
    margin: 0 0 6px 8px;
    background: transparent;
    border: 0;
    line-height: 0;
}
.skydb-map-logo img {
    height: 36px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 1px rgba(255,255,255,0.85));
}

/* Crosshair cursor on the map canvas — Phorio convention so users know
 * they can click anywhere on EMPTY map area to drop a pin. Building
 * pinpoints (.skydb-bldg-icon, .marker-cluster) and any other
 * leaflet-interactive layer keep their pointer cursor so it's clear
 * they're clickable. */
.skydb-map-crosshair.leaflet-container,
.skydb-map-crosshair .leaflet-grab,
.skydb-map-crosshair.leaflet-grab { cursor: crosshair !important; }
.skydb-map-crosshair.leaflet-dragging,
.skydb-map-crosshair.leaflet-dragging .leaflet-grab { cursor: grabbing !important; }
.skydb-map-crosshair .skydb-bldg-icon,
.skydb-map-crosshair .marker-cluster,
.skydb-map-crosshair .leaflet-marker-icon,
.skydb-map-crosshair .leaflet-popup-pane,
.skydb-map-crosshair .leaflet-popup-pane * { cursor: pointer !important; }

/* Coordinate-click popup (lat/lng + thumbnail + actions). Reuses the
 * .skydb-bldg-popup wrapper class so it picks up the SKYDB-blue
 * background, then layers its own minimal interior. */
.skydb-coord-popup { padding: 10px 12px; color: #fff; }
.skydb-coord-popup-coords {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.85);
}
.skydb-coord-popup-thumb { display: block; line-height: 0; }
.skydb-coord-popup-thumb img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 3px;
    background: rgba(0,0,0,0.2);
}
.skydb-coord-popup-note {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    margin: 8px 0 6px;
}
.skydb-coord-popup-actions { font-size: 13px; }
.skydb-coord-popup-actions a {
    color: #fff !important;
    text-decoration: underline;
    cursor: pointer;
}

/* Right-side sidebar — Phorio's "X objects in view" panel.
 * Collapsed = a small pill in the top-right showing the count.
 * Expanded = a 320px-wide column docked to the right edge with a
 * sort dropdown + scrollable list. Lives inside the map shell so it
 * positions absolute relative to the map area. */
.skydb-map-sidebar {
    position: absolute;
    top: 12px;
    right: 56px; /* leave room for the modal close X on the overlay */
    bottom: 12px;
    z-index: 1000;
    width: 320px;
    background: rgba(34, 34, 34, 0.94);
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    transition: width 160ms ease;
}
.skydb-map-shell--page .skydb-map-sidebar { right: 12px; }
.skydb-map-sidebar--collapsed {
    width: auto;
    bottom: auto; /* shrink-wrap height */
}
.skydb-map-sidebar-head { flex: 0 0 auto; }
.skydb-map-sidebar-toggle {
    width: 100%;
    background: transparent;
    border: 0;
    color: #fff;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
.skydb-map-sidebar-toggle:hover { background: rgba(255,255,255,0.06); }
.skydb-map-sidebar-toggle {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
}
.skydb-map-sidebar-loc {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.skydb-map-sidebar-loc:empty { display: none; }
.skydb-map-sidebar-counts {
    display: flex;
    align-items: center;
    gap: 6px;
}
.skydb-map-sidebar-num   { font-weight: 700; font-size: 16px; }
.skydb-map-sidebar-label { color: rgba(255,255,255,0.85); }
.skydb-map-sidebar-chev  { margin-left: auto; opacity: 0.7; font-size: 12px; }
.skydb-map-sidebar-body  { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
/* Filter tabs */
.skydb-map-sidebar-tabs {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.skydb-map-sidebar-tab {
    flex: 1 1 0;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.65);
    padding: 6px 4px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.skydb-map-sidebar-tab:hover    { color: #fff; }
.skydb-map-sidebar-tab.is-active{ color: #fff; border-bottom-color: #214196; }
.skydb-map-sidebar-tabpanels    { padding: 8px 10px 4px; }
.skydb-map-sidebar-tabpanel     { font-size: 12px; }
.skydb-map-sidebar-tabpanel input[type="text"],
.skydb-map-sidebar-tabpanel input[type="date"] {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.18);
    font-size: 12px;
}
.skydb-map-sidebar-tabpanel input[type="text"]::placeholder { color: rgba(255,255,255,0.45); }
.skydb-map-sidebar-tabpanel input[type="checkbox"] { accent-color: #214196; }
.skydb-map-sidebar-tabpanel label,
.skydb-map-sidebar-tabpanel small { color: rgba(255,255,255,0.85); }
.skydb-map-sidebar-hint {
    display: block;
    margin-top: 4px;
    color: rgba(255,255,255,0.55);
    font-size: 11px;
}
.skydb-map-sidebar-toolbar {
    padding: 6px 10px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.skydb-map-sidebar-sort.form-select-sm {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.18);
    font-size: 12px;
}
.skydb-map-sidebar-msg {
    padding: 4px 12px 8px;
    color: #ccc;
    font-size: 12px;
}
.skydb-map-sidebar-msg:empty { display: none; }
.skydb-map-sidebar-list {
    flex: 1 1 auto;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0 0 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.skydb-map-sidebar-item { margin: 0; }
.skydb-map-sidebar-link {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 12px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.skydb-map-sidebar-link:hover { background: rgba(33,65,150,0.5); color: #fff; }
.skydb-map-sidebar-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skydb-map-sidebar-meta { flex: 0 0 auto; color: rgba(255,255,255,0.7); font-size: 11px; white-space: nowrap; }

/* Mobile: collapse the sidebar to a thin overlay button so the map
 * stays usable. */
@media (max-width: 760px) {
    .skydb-map-sidebar { width: 260px; right: 8px; top: 8px; bottom: 8px; }
    .skydb-map-sidebar--collapsed { width: auto; bottom: auto; }
}

/* Full-screen-ish Leaflet shell for the .call_maplocation overlay and the
 * /map/ page. The shell stretches to fill its container; the canvas takes
 * all remaining vertical space below the search bar. */
.skydb-map-shell {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 480px;
}
.skydb-map-shell .skydb-map-canvas {
    position: absolute;
    inset: 0;
    background: #eee;
}
/* Inside a modal: a touch taller. */
.skydb-popup .skydb-map-shell { height: 78vh; }
/* On the standalone /map/ page: fill most of the viewport but leave a
 * sliver for the footer so the user can see / scroll to it. Edge-to-edge
 * horizontally. Strip the container padding/margin Elementor and the
 * theme inject so there are no white gaps around the map. */
.skydb-map-shell--page {
    /* Reserve ~280px above the map for WP header + admin bar + announce
     * strip, and another ~120px below for the footer peek. So the map
     * fits exactly within the visible viewport regardless of height,
     * with the start of the footer always visible. Clamped between
     * 320px (small viewports) and 70vh (very tall viewports). */
    height: clamp(320px, calc(100vh - 400px), 70vh);
    margin: 0;
    padding: 0;
}
/* Strip the .wrapper top/bottom padding (set in understrap.scss to
 * 1.5rem 0) on the /map/ page so the map sits flush against the
 * header and the footer. Targets only /map/ via :has() — won't
 * affect any other page. */
body:has(.skydb-map-shell--page) .wrapper {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
/* Strip the surrounding chrome: every wrapper that the WP page template +
 * Elementor + the theme add has padding/margin we don't want around a
 * full-screen map. Targets the page-id of the Map page; safe because no
 * other page should match. */
body.page .skydb-map-shell--page,
body.page .skydb-map-shell--page * {
    box-sizing: border-box;
}
/* Force the column/section ancestors to drop padding when the map shell
 * is inside them. :has() is supported in all modern browsers (April 2026). */
body.page :is(.col, [class*="col-"], .container, .container-fluid, .elementor-section, .elementor-column-wrap, .elementor-widget-container):has(> .skydb-map-shell--page),
body.page :is(.col, [class*="col-"], .container, .container-fluid, .elementor-section, .elementor-column-wrap, .elementor-widget-container):has(.skydb-map-shell--page) {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}
/* Bootstrap's .row sets negative left/right margins (-.5 * gutter) to
 * pull cols flush against the container's inner padding. When the row
 * wraps a full-width map shell (no other cols, no horizontal padding
 * in the parent), the negative margin pushes the row past the
 * container's right edge → horizontal scrollbar. Zero the gutter +
 * margins on the specific row that holds the map. */
body.page .row:has(.skydb-map-shell--page) {
    --bs-gutter-x: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
/* Search bar overlays the map, centered horizontally near the top.
 * Transparent background; only the input + button carry a visual. */
.skydb-map-search {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 6px;
    pointer-events: none; /* let map drag through the gap; children re-enable */
}
.skydb-map-search-input,
.skydb-map-search-go {
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
/* Atlas's global .btn rule sets border-radius: 50rem (pill shape).
 * The map search bar wants square corners — matches the legacy
 * theme's flat button style. */
.skydb-map-search-go.btn {
    border-radius: 0;
}
.skydb-map-search-input {
    flex: 0 0 320px;
    width: 320px;
    max-width: 70vw;
    background: #fff;
    border: 1px solid #dee2e6;
}

/* Smartphone viewport (<768px): the centred search bar and the
 * "Open full screen map" pill collide in the upper-right corner.
 * Shrink the input by 25% (320 → 240), anchor it to the top-right
 * rail, and stack the fullscreen link below it. */
@media (max-width: 767.98px) {
    .skydb-map-search {
        top: 12px;
        right: 12px;
        left: auto;
        transform: none;
    }
    .skydb-map-search-input {
        flex: 0 0 240px;
        width: 240px;
        max-width: calc(100vw - 90px); /* leave room for the Go button + inset */
    }
}

/* Object-fit utilities. Bootstrap 5.3 ships .object-fit-cover out of the
 * box, but the compiled child-theme.css in this theme is still Bootstrap
 * 5.1.1 (see css/child-theme.css header). Re-declare the one utility we
 * rely on so it works until the child theme's CSS is rebuilt against 5.3. */
.object-fit-cover { object-fit: cover; }

/* The child theme's compiled CSS declares `.wrapper { padding: 1.5rem 0; }`
 * which clobbers Bootstrap's `.container` horizontal padding. On desktop
 * the container's max-width hides the loss; on narrow viewports the content
 * ends up flush to the screen edge. Restore Bootstrap's .75rem gutter when
 * the page uses both classes together (our standard outer wrapper). */
.container.wrapper,
.container-fluid.wrapper {
    padding-left: var(--bs-gutter-x, 0.75rem);
    padding-right: var(--bs-gutter-x, 0.75rem);
}

/* Phorio-style auth pages: narrow centred form column.
 * Used by template-parts/signin.php and template-parts/join.php. */
.skydb-auth-page          { max-width: 420px; }
.skydb-auth-page--wide    { max-width: 480px; }

/* Multi-select for upload categories — fixed height so several rows
 * are visible at once. */
.skydb-cat-multi { height: 148px; }

/* bootstrap-fileinput drop zone on the upload page: signal click-to-pick
 * via a pointer cursor (browseOnZoneClick: true is enabled). The plugin's
 * default rules add a thicker dashed border on hover (.file-drop-zone.clickable:hover),
 * a teal focus ring (.file-drop-zone.clickable:focus), and a tinted-background
 * highlight on drag-over (.file-highlighted, set with !important) — all of
 * which read as an active drag state. The cursor change is enough feedback,
 * so suppress them. !important is needed because the plugin's stylesheet is
 * loaded inline by template-parts/upload.php AFTER skydb-pages.css, and the
 * .file-highlighted rule itself uses !important. Selectors / cursor target
 * .file-drop-zone-title too because the plugin sets cursor:default on it. */
.file-drop-zone,
.file-drop-zone-title,
.file-drop-zone.clickable,
.file-drop-zone.clickable .file-drop-zone-title { cursor: pointer !important; }
.file-drop-zone.clickable:hover,
.file-drop-zone.clickable:focus,
.file-highlighted {
    border: 1px dashed #aaa !important;
    background-color: transparent !important;
}
