/* Apple HIG-inspired web foundations. Keep browser text scaling and pinch zoom available. */
:root {
  --font-interface:-apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --text-body:1.0625rem;
  --text-secondary:.9375rem;
  --text-caption:.8125rem;
  --text-small:.75rem;
  --text-secondary-color:var(--muted);
  --touch-target:44px;
}
body { font-family:var(--font-interface); font-size:var(--text-body); line-height:1.5; }
button, input, select { font-family:inherit; }
button { touch-action:manipulation; }
.primary-button:hover, .filters-toggle[data-active="true"]:hover { background:var(--accent-hover); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.masthead { min-height:82px; height:auto; padding-block:12px; padding-top:max(12px,env(safe-area-inset-top)); }
.masthead nav button, .export-button, .reset-button,
.status-chip, .view-switch button, .map-note, .dialog-close,
.primary-button, .secondary-button, .card-read-more, .directory-footer button,
.gallery-controls button, .image-viewer-bar button, .image-viewer-footer button,
.upload-managed button, .nearby-list button, .source-link, td button {
  min-width:var(--touch-target); min-height:var(--touch-target);
}
.masthead nav button, .export-button, .reset-button, .status-chip,
.view-switch button, .primary-button, .secondary-button { font-size:var(--text-secondary); }
.status-chip { flex-shrink:0; border-radius:9px; padding:9px 12px; }
.status-chip b { font-size:var(--text-small); }
.filter-bar { gap:12px; }
.status-filters { min-width:0; padding:3px; margin:-3px; }
.reset-button { flex-shrink:0; }
.eyebrow, .filter-label { font-size:.6875rem; }
.search-box { min-height:48px; border-radius:10px; }
.search-toolbar { display:flex; align-items:stretch; gap:10px; }
.search-toolbar .search-box { flex:1; min-width:0; }
.filters-toggle { position:relative; display:grid; place-items:center; flex:0 0 48px; min-height:48px; padding:10px; border:1px solid var(--border); border-radius:10px; background:var(--paper); color:var(--accent); }
.filters-toggle .icon { width:22px; height:22px; }
.filters-toggle:hover, .filters-toggle[aria-expanded="true"] { background:var(--surface); border-color:var(--accent-border); }
.filters-toggle[data-active="true"] { background:var(--accent); border-color:var(--accent); color:#fff; }
.filter-count { position:absolute; top:-6px; right:-5px; display:grid; place-items:center; min-width:20px; height:20px; padding:0 4px; border:2px solid #fff; border-radius:12px; background:var(--accent); color:#fff; font-size:.6875rem; line-height:1; font-weight:700; }
.filter-count[hidden], .filter-panel[hidden] { display:none; }
.filter-panel { margin-top:12px; padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--paper); }
.filter-panel .select-row:first-child { margin-top:0; }
.filter-panel .year-help:last-child { margin-bottom:0; }
.cost-filter { position:relative; min-width:0; margin:0 0 14px; padding:0 0 12px; border:0; border-bottom:1px solid var(--border); }
.cost-filter legend { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; min-height:32px; padding:0; font-size:var(--text-secondary); font-weight:600; color:var(--ink); }
.cost-clear { min-height:32px; padding:0 2px; font-size:var(--text-small); color:var(--accent); text-decoration:underline; text-underline-offset:3px; }
.cost-clear[hidden] { display:none; }
.cost-values { display:flex; justify-content:space-between; gap:12px; margin-top:4px; }
.cost-values label { min-width:0; font-size:var(--text-small); color:var(--muted); cursor:pointer; }
.cost-values label:last-child { text-align:right; }
.cost-values strong { display:block; margin-top:3px; font-size:var(--text-secondary); color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums; }
.cost-range { --cost-start:0%; --cost-end:100%; position:relative; height:44px; margin:0 2px; }
.cost-range-track { position:absolute; left:12px; right:12px; height:5px; top:20px; border-radius:4px; background:linear-gradient(to right,var(--border-strong) 0 var(--cost-start),var(--accent) var(--cost-start) var(--cost-end),var(--border-strong) var(--cost-end) 100%); }
.cost-range input { position:absolute; inset:0; width:100%; height:44px; margin:0; padding:0; background:transparent; appearance:none; -webkit-appearance:none; pointer-events:none; border:0; outline:none; }
.cost-range input:last-child { z-index:2; }
.cost-range input::-webkit-slider-runnable-track { height:5px; background:transparent; }
.cost-range input::-moz-range-track { height:5px; background:transparent; }
.cost-range input::-webkit-slider-thumb { appearance:none; -webkit-appearance:none; pointer-events:auto; width:24px; height:24px; margin-top:-9.5px; border:3px solid var(--accent); border-radius:50%; background:var(--paper); cursor:ew-resize; box-shadow:0 1px 4px #0003; }
.cost-range input::-moz-range-thumb { pointer-events:auto; width:18px; height:18px; border:3px solid var(--accent); border-radius:50%; background:var(--paper); cursor:ew-resize; box-shadow:0 1px 4px #0003; }
.cost-range input:focus-visible::-webkit-slider-thumb { outline:3px solid var(--accent); outline-offset:4px; }
.cost-range input:focus-visible::-moz-range-thumb { outline:3px solid var(--accent); outline-offset:4px; }
.cost-help { margin:0; font-size:var(--text-small); color:var(--muted); line-height:1.5; }
.search-box input, .select-row select, .results-row select { font-size:1rem; }
.select-row select, .results-row select { min-height:var(--touch-target); border-radius:8px; color:var(--text-secondary-color); }
.search-box input::placeholder { color:var(--muted); opacity:1; }
.results-row { flex-wrap:wrap; font-size:var(--text-caption); color:var(--text-secondary-color); gap:8px; }
.results-row select { max-width:100%; font-size:var(--text-caption); }
.minor-toggle { min-height:var(--touch-target); font-size:var(--text-secondary); }
.minor-toggle input, .area-filter input { width:18px; height:18px; flex-shrink:0; }
.year-help { font-size:var(--text-small); color:var(--text-secondary-color); }
.project-list { scroll-margin-top:16px; }
.project-card h3 { font-size:var(--text-body); line-height:1.35; min-height:0; }
.card-description { font-size:var(--text-secondary); color:var(--text-secondary-color); line-height:1.5; min-height:0; }
.card-place, .card-bottom, .card-read-more, .category { font-size:var(--text-caption); color:var(--text-secondary-color); }
.card-read-more { color:var(--accent); margin-top:8px; flex-wrap:wrap; }
.card-bottom { flex-wrap:wrap; gap:8px; }
.card-cost { font-size:1.25rem; }
.badge, .popup .badge { font-size:var(--text-small); color:color-mix(in srgb,var(--status-color) 70%,var(--ink)); }
.category { text-align:right; }
.directory-footer { flex-wrap:wrap; white-space:normal; font-size:var(--text-small); color:var(--text-secondary-color); padding-block:8px; }
.directory-footer button { font-size:var(--text-small); }
.page-summary { flex-wrap:wrap; font-size:var(--text-caption); color:var(--text-secondary-color); }
.page-buttons, .table-view .page-buttons { justify-content:center; gap:8px; }
.page-buttons button, .table-view .page-buttons button { min-width:var(--touch-target); height:auto; min-height:var(--touch-target); padding:8px; font-size:1rem; border-radius:10px; }
.pagination { padding-bottom:max(12px,env(safe-area-inset-bottom)); }
.map-controls button { width:var(--touch-target); height:var(--touch-target); }
.map-controls { top:92px; border-radius:12px; }
.map-top { gap:8px; }
.area-filter { min-height:var(--touch-target); font-size:var(--text-small); border-radius:9px; }
.view-switch { border-radius:12px; }
.view-switch button { border-radius:8px; padding:8px 12px; }
.map-note { font-size:var(--text-small); }
.table-heading p, table, td small { font-size:var(--text-caption); color:var(--text-secondary-color); }
td button { font-size:var(--text-secondary); }
.table-view { padding-top:100px; }
.leaflet-container a.leaflet-popup-close-button { width:44px; height:44px; line-height:42px; top:8px; right:8px; border:1px solid var(--border); border-radius:50%; color:var(--accent); background:var(--paper); font-size:26px; box-shadow:0 2px 8px #242a3414; }
.leaflet-popup-content { margin-top:22px; }
.leaflet-popup-content > .nearby-projects:first-child { margin-right:44px; }
.leaflet-popup-content > .popup:first-child > .badge { margin-right:44px; }
.popup h2 { padding-right:12px; font-size:1.2rem; }
.popup .address, .popup .status-date, .popup-facts small, .source-label { font-size:var(--text-small); color:var(--text-secondary-color); }
.popup .description, .popup .popup-summary, .popup-facts strong, .popup .detail-button { font-size:.8rem; }
.popup .detail-button { min-height:44px; border-radius:9px; }
.nearby-list small, .nearby-projects summary { font-size:var(--text-small); }
dialog { max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius:20px; }
dialog p, .detail-facts strong, .full-description, .project-timeline p, .tenant-group p { font-size:var(--text-body); line-height:1.55; color:var(--text-secondary-color); }
dialog h3, .project-timeline h3, .profile-section > summary { font-size:var(--text-body); }
.detail-location, .detail-facts p, .detail-status p, .detail-sources .source-link,
.source-link, .related-projects strong { font-size:var(--text-secondary); }
.detail-facts small, .detail-status small, .detail-footer small, .source-link small,
.profile-section > summary small, .project-timeline time, .reading-sources a,
.related-projects span, .tenant-status, .tenant-names li, .year-label,
.inventory-notice, .inventory-notice strong, .popup .inventory-notice,
.project-dialog-bar > span, .status-definition, .about-callout { font-size:var(--text-caption); color:var(--text-secondary-color); }
.location-note { font-size:var(--text-caption)!important; }
.reading-sources a { display:inline-flex; align-items:center; min-height:44px; }
.project-dialog-bar { align-items:center; }
.detail-facts > div { min-width:0; overflow-wrap:anywhere; }
.gallery-heading, .gallery-compact .gallery-heading, .image-meta, .gallery-compact .image-meta,
.gallery-heading b { font-size:var(--text-small); }
.gallery-heading { flex-wrap:wrap; }
.image-caption, .gallery-compact .image-caption, .image-viewer figcaption p { font-size:var(--text-secondary); line-height:1.5; }
.gallery-photo figcaption a, .gallery-compact .gallery-photo figcaption a,
.image-credit, .image-uploaded, .image-license, .image-viewer figcaption a,
.image-viewer .image-meta, .image-viewer-footer, .image-viewer-bar,
.gallery-unavailable, .image-failure { font-size:var(--text-caption); color:var(--text-secondary-color); }
.gallery-controls button, .gallery-compact .gallery-controls button { width:44px; height:44px; border-radius:9px; }
.image-viewer-footer button { font-size:var(--text-secondary); }
.image-viewer-bar button { flex-shrink:0; }
.upload-section>summary, .upload-picker { font-size:var(--text-secondary); }
.upload-section>summary span, .upload-body p, .upload-form>small,
.upload-fields label, .upload-preview label, .upload-managed, .upload-managed small,
.upload-managed button { font-size:var(--text-caption); color:var(--text-secondary-color); }
.upload-fields input, .upload-preview input, .upload-preview select, .upload-picker input { font-size:1rem; min-height:44px; }
@media(min-width:901px) {
  body { display:flex; flex-direction:column; height:100dvh; min-height:600px; }
  main { display:flex; flex:1; flex-direction:column; min-height:0; }
  .masthead, .filter-bar { flex-shrink:0; }
  .workspace { grid-template-columns:minmax(340px,28%) 1fr; flex:1; height:auto; min-height:0; }
  .select-row select { font-size:.875rem; }
}
@media(min-width:621px) and (max-width:900px) {
  .workspace { display:flex; flex-direction:column; height:auto; min-height:0; }
  .map-wrap { order:1; }
  .directory { order:2; border-right:0; }
  .project-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); overflow:visible; }
}
@media(max-width:900px) {
  /* Give the mobile map 30% more height; svh keeps browser-bar changes stable. */
  .map-wrap { height:clamp(364px,65svh,650px); min-height:0; }
}
@media(max-width:800px) {
  .masthead { gap:12px; }
  .masthead nav { gap:12px; }
  .map-controls { top:80px; }
}
@media(max-width:620px) {
  .masthead, .filter-bar, .directory-tools { padding-left:max(16px,env(safe-area-inset-left)); padding-right:max(16px,env(safe-area-inset-right)); }
  .masthead { min-height:72px; }
  .masthead nav button { font-size:var(--text-caption); }
  .map-top { flex-wrap:wrap; }
  .map-top .view-switch button { font-size:var(--text-secondary); padding:8px 10px; }
  .popup h2 { font-size:1.15rem; }
  .area-filter { font-size:var(--text-small); padding:8px; }
  .project-list { gap:0 16px; padding:0 max(16px,env(safe-area-inset-left)) 0 max(16px,env(safe-area-inset-right)); }
  .project-card { padding:20px 0; min-width:0; }
  .card-top { gap:8px; }
  .card-bottom { align-items:center; }
  .project-card .card-bottom > span:last-child { text-align:left; }
  .pagination { padding:16px max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
  .page-buttons { margin-top:12px; }
  .table-view .pagination { padding-block:16px; }
  .image-viewer-footer { flex-wrap:wrap; padding-bottom:max(16px,env(safe-area-inset-bottom)); }
  .status-definition { grid-template-columns:1fr; gap:6px; }
}
@media(max-width:480px) {
  .project-list { grid-template-columns:1fr; }
  .detail-facts { grid-template-columns:1fr; }
}
@media(max-width:360px) {
  .select-row { flex-wrap:wrap; margin-top:8px; }
  .select-row select, .minor-toggle { width:100%; }
  .masthead { flex-wrap:wrap; }
  .masthead .brand { flex-basis:100%; }
  .masthead nav { margin-left:0; }
  .export-button { margin-left:auto; }
  .area-filter { position:absolute; top:66px; left:0; }
}

/* A compact visual directory leaves the map and project records room to breathe. */
.directory-tools { padding:16px 16px 0; border-bottom:1px solid var(--border); }
.directory-tools .search-box { background:var(--surface); border-color:transparent; }
.directory-tools .search-box:focus-within { border-color:var(--accent-border); }
.directory-tools .filters-toggle { border-color:transparent; background:var(--surface); }
.directory-tools .filters-toggle[data-active="true"] { background:var(--accent); }
.directory-tools .results-row { padding:6px 0; gap:4px; }
.directory-tools .results-row select { max-width:144px; }
.directory .project-list { flex:1; padding:0 8px; }
.project-card { padding:0; border-top:0; border-bottom:1px solid var(--border); border-radius:0; }
.project-card:hover { background:var(--card-hover); border-radius:0; }
.project-card.is-selected { background:var(--accent-soft); border-radius:0; box-shadow:inset 3px 0 var(--accent); }
.project-card .card-main { display:grid; align-items:center; gap:12px; padding:12px; min-height:44px; border-radius:6px; }
.project-card .card-main:focus-visible { outline-offset:-3px; }
.project-card .card-main.has-thumbnail { grid-template-columns:minmax(0,1fr) 112px; }
.card-copy { min-width:0; }
.project-card .card-top { justify-content:flex-start; flex-wrap:wrap; gap:4px 8px; margin:0 0 4px; }
.project-card .badge { padding:2px 0; background:none; font-size:var(--text-small); }
.card-scope { color:var(--muted); font-size:var(--text-small); }
.card-heading { display:flex; align-items:flex-start; gap:4px; margin-bottom:4px; }
.project-card .card-title { min-width:0; font-size:1rem; font-weight:600; line-height:1.35; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.card-heading .icon { flex-shrink:0; width:12px; height:16px; margin-top:3px; color:var(--muted); }
.project-card .card-place { display:block; font-size:var(--text-caption); line-height:1.4; }
.card-thumbnail { position:relative; display:block; width:112px; height:112px; overflow:hidden; border-radius:9px; background:var(--surface); }
/* Fixed photo frames fill edge to edge for every image kind, including renderings. */
.card-thumbnail img { display:block; width:100%; height:100%; object-fit:cover; }
.card-image-label { position:absolute; bottom:4px; left:4px; padding:1px 5px; border-radius:4px; color:var(--ink); background:var(--overlay); font-size:.6875rem; line-height:1.5; }
.card-budget { display:block; margin-top:8px; color:var(--muted); font-size:var(--text-small); }
.project-card .card-cost { color:var(--ink); font-size:var(--text-secondary); font-weight:600; letter-spacing:0; }
.directory .pagination, .table-view .pagination { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; padding:8px 16px max(8px,env(safe-area-inset-bottom)); }
.directory .pagination[hidden], .table-view .pagination[hidden] { display:none; }
.pagination .page-summary { font-size:var(--text-small); }
.pagination .page-buttons { margin:0; gap:2px; }
.pagination .page-buttons button { padding:8px; border-color:transparent; background:transparent; font-size:.875rem; border-radius:8px; }
.pagination .page-buttons button[aria-current="page"] { color:var(--accent); background:var(--accent-soft); border-color:transparent; }
@media(min-width:901px) {
  .workspace { grid-template-columns:clamp(360px,29vw,420px) minmax(0,1fr); }
  .directory-tools { flex:0 0 auto; max-height:none; overflow:visible; }
  .filter-panel { max-height:max(180px,calc(55dvh - 180px)); overflow-y:auto; overscroll-behavior:contain; }
}
@media(min-width:621px) and (max-width:900px) {
  .directory .project-list { gap:0 12px; }
}
@media(max-width:620px) {
  .directory-tools { padding-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right)); }
  .directory .project-list { padding-inline:max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right)); grid-template-columns:1fr; }
  .directory .pagination { padding-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right)); }
}
@media(max-width:380px) {
  .project-card .card-main.has-thumbnail { grid-template-columns:minmax(0,1fr) 104px; }
  .card-thumbnail { width:104px; height:104px; }
  .directory .pagination { gap:4px; padding-inline:8px; }
}

/* Desktop photos advance deliberately; wheel gestures keep reading vertically. */
.gallery-count { display:none; }
.project-gallery[data-gallery-mode="buttons"] { display:flex; flex-direction:column; }
.project-gallery[data-gallery-mode="buttons"] .gallery-heading { order:0; margin-bottom:0; }
.project-gallery[data-gallery-mode="buttons"] .gallery-bottom { order:1; margin:4px 0 12px; justify-content:space-between; }
.project-gallery[data-gallery-mode="buttons"] .gallery-position { display:none; }
.project-gallery[data-gallery-mode="buttons"] .gallery-count { display:block; color:var(--muted); font-size:var(--text-caption); font-variant-numeric:tabular-nums; }
.project-gallery[data-gallery-mode="buttons"] .gallery-stage { order:2; }
.project-gallery[data-gallery-mode="buttons"] .photo-strip { display:block; overflow:visible; cursor:default; user-select:auto; }
.project-gallery[data-gallery-mode="buttons"] .gallery-photo { width:100%; }
.project-gallery[data-gallery-mode="buttons"] .gallery-photo[hidden] { display:none; }
.project-gallery[data-gallery-mode="buttons"] .image-caption { display:block; -webkit-line-clamp:unset; }
@media(hover:hover) and (pointer:fine) and (min-width:621px) {
  .leaflet-popup-content { padding-right:32px; }
  .popup h2 { font-size:1.4rem; line-height:1.2; }
  .project-dialog { max-width:900px; }
}
@media(hover:hover) and (pointer:fine) and (min-width:621px) and (max-width:900px) {
  /* Narrow desktop windows still need room for the reading popup. */
  .map-wrap { height:clamp(440px,72svh,720px); }
}

/* Map selections are compact name labels; the full profile opens on demand. */
.map-auto-label { position:absolute; left:30px; top:0; display:-webkit-box; width:max-content; max-width:min(176px,42vw); padding:2px 4px; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; white-space:normal; font-family:var(--font-display); font-size:1rem; font-weight:600; line-height:1.15; color:var(--ink); background:color-mix(in srgb,var(--paper) 88%,transparent); border-radius:4px; text-shadow:0 1px 2px var(--paper); pointer-events:none; user-select:none; opacity:0; transition:opacity .24s ease; }
/* Visible names share their parent marker's popup and drag-safe click handling. */
.map-auto-label[data-visible="true"] { opacity:var(--project-label-opacity,0); pointer-events:auto; cursor:pointer; }
@media(prefers-reduced-motion:reduce) { .map-auto-label { transition:none; } }
.project-name-popup .leaflet-popup-content-wrapper { padding:1px; border-radius:12px; }
.project-name-popup .leaflet-popup-content { margin:4px 8px; padding:0; line-height:1.35; }
.leaflet-container .project-name-popup a.leaflet-popup-close-button { top:4px; right:4px; border:0; border-radius:8px; box-shadow:none; background:transparent; }
.map-project-name { display:flex; flex-direction:column; align-items:stretch; gap:8px; width:100%; min-height:44px; padding:8px 4px; text-align:left; color:var(--ink); font-size:1.125rem; line-height:1.25; border-radius:6px; }
.map-project-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:28px; padding-right:40px; }
.map-project-heading > span { min-width:0; overflow-wrap:anywhere; }
.map-project-thumbnail { display:block; width:100%; height:88px; object-fit:cover; border-radius:6px; background:var(--surface); }
.map-project-name .icon { flex-shrink:0; width:14px; height:18px; color:var(--accent); }
.map-project-name:hover { color:var(--accent); }
.project-name-popup .nearby-projects { margin:0; padding:0; border:0; border-top:1px solid var(--border); background:transparent; }
.project-name-popup .nearby-projects summary { min-height:44px; padding:12px 4px; font-size:var(--text-small); color:var(--muted); }
.project-name-popup .nearby-list { max-height:144px; overflow-y:auto; overscroll-behavior:contain; }
.project-name-popup .nearby-list button { width:100%; padding:8px 4px; text-align:left; font-size:var(--text-caption); }

/* Leave a generous dismissal margin around the reading dialog. */
#project-dialog { --dialog-padding:clamp(18px,4vw,28px); width:calc(88vw - 28px); min-width:min(280px,calc(100vw - 40px)); max-width:800px; max-height:calc(84svh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding:var(--dialog-padding); }
#project-dialog .project-dialog-bar { top:calc(0px - var(--dialog-padding)); margin:calc(0px - var(--dialog-padding)) calc(0px - var(--dialog-padding)) 16px; padding:8px 12px; gap:10px; }
#project-dialog .dialog-close { border:0; border-radius:50%; background:transparent; }
#reading-title:focus { outline:none; }
#project-detail > .eyebrow { margin-top:0; }
#project-detail > h2 { margin:14px 0; }
#project-detail .project-gallery { margin:12px 0 16px; }
#project-detail .gallery-heading { margin-bottom:4px; }
#project-detail .gallery-photo figcaption { padding-top:6px; }
#project-detail .image-meta { margin-bottom:4px; }
#project-detail .image-caption { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
#project-detail .gallery-bottom { margin-top:6px; }
#project-detail .project-gallery[data-gallery-mode="buttons"] .gallery-bottom { margin:0 0 6px; }

/* A full, vertical photo archive complements the quick horizontal filmstrip. */
.gallery-open { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 16px; width:100%; min-height:44px; padding:8px 0; text-align:left; color:var(--accent); font-size:var(--text-secondary); font-weight:600; }
.gallery-open > span:last-child { font-size:var(--text-caption); font-weight:500; }
/* Compact bubble text without shrinking supporting labels or tap targets. */
.popup .gallery-open, .popup .image-caption { font-size:.8rem; }
.gallery-open:hover > span:last-child { text-decoration:underline; }
.gallery-archive { width:calc(100% - 32px); max-width:1100px; max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding:0; overscroll-behavior:contain; }
.archive-bar { position:sticky; top:0; z-index:2; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:20px 24px; background:var(--paper); border-bottom:1px solid var(--border); }
.archive-bar h2 { margin:4px 0 0; font-family:var(--font-interface); font-size:1.375rem; font-weight:650; letter-spacing:-.4px; line-height:1.3; }
.archive-eyebrow { display:block; font-size:var(--text-small); color:var(--text-secondary-color); letter-spacing:.3px; }
.archive-bar button { flex-shrink:0; min-width:44px; min-height:44px; border-radius:50%; font-size:28px; background:var(--surface); color:var(--accent); }
.archive-intro { padding:8px 24px 24px; }
.archive-intro p { margin-bottom:16px; }
.archive-jump { display:block; font-size:var(--text-caption); color:var(--text-secondary-color); max-width:480px; }
.archive-jump select { display:block; width:100%; min-height:44px; margin-top:6px; padding:10px; border:1px solid var(--border-strong); border-radius:10px; background:var(--paper); color:var(--ink); font-size:1rem; }
.archive-content { padding:0 24px max(24px,env(safe-area-inset-bottom)); }
.archive-chapter { padding:24px 0 32px; border-top:1px solid var(--border); scroll-margin-top:150px; }
.archive-chapter-heading { display:flex; align-items:flex-start; gap:14px; margin-bottom:20px; }
.archive-step { flex-shrink:0; display:grid; place-items:center; width:36px; height:36px; border-radius:50%; background:var(--accent-soft); font-size:var(--text-caption); color:var(--accent); font-weight:650; }
.archive-chapter h3 { font-size:1.25rem; line-height:1.3; margin:4px 0 8px; }
.archive-chapter-heading p { font-size:var(--text-secondary); line-height:1.5; max-width:720px; margin:0 0 8px; }
.archive-count { color:var(--text-secondary-color); font-size:var(--text-caption); }
.archive-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:28px 20px; }
.archive-grid .gallery-image { border-radius:10px; }
.archive-grid .gallery-photo:only-child { grid-column:1/-1; }
.archive-grid .gallery-photo figcaption { padding-top:12px; }
.archive-grid .image-kind { font-size:.6875rem; }
.archive-grid .image-caption { font-size:var(--text-caption); }
.archive-grid .image-meta { font-size:var(--text-small); }
.image-chapter-label { display:block; margin-bottom:8px; font-size:var(--text-secondary); color:var(--accent); }
@media(max-width:800px) { .archive-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:620px) {
  .gallery-archive { width:calc(100% - 16px); }
  .archive-bar { padding:14px 16px; gap:8px; }
  .archive-bar h2 { font-size:1.25rem; }
  .archive-intro, .archive-content { padding-left:16px; padding-right:16px; }
  .archive-grid { gap:24px 12px; }
  .archive-chapter-heading { gap:10px; }
  .archive-chapter h3 { font-size:1.0625rem; }
}
@media(max-width:360px) { .archive-grid { grid-template-columns:1fr; } }


/* Dense project profiles: selected from the five-size preview. */
#project-dialog {
  --text-body:.875rem;
  --text-secondary:.75rem;
  --text-caption:.75rem;
  --text-small:.75rem;
  --dialog-padding:.875rem;
  font-size:var(--text-body);
  line-height:1.4;
}
#project-dialog .project-dialog-bar {
  min-height:54px;
  margin-bottom:10px;
  padding:5px var(--dialog-padding);
  gap:8px;
}
#project-dialog .project-dialog-bar > span { font-size:var(--text-caption); line-height:1.4; }
#project-dialog .dialog-close { width:44px; min-height:44px; }
#project-dialog p, #project-dialog .detail-facts strong { line-height:1.4; }
#project-detail > .eyebrow { margin-bottom:8px; }
#project-detail .detail-kicker { margin-top:8px; gap:8px; }
#project-detail > h2 { font-size:1.5rem; line-height:1.2; margin:10px 0; }
#project-detail .detail-location { font-size:var(--text-secondary); line-height:1.4; align-items:flex-start; }
#project-detail .detail-location .icon { flex-shrink:0; margin-top:1px; }
#project-detail .detail-summary { font-size:var(--text-body); margin:10px 0; }
#project-detail .year-label { margin:8px 0; }
#project-detail .profile-section { margin:10px 0; }
#project-detail .profile-section > summary { min-height:44px; padding:12px; gap:10px; font-size:var(--text-body); line-height:1.4; }
#project-detail .profile-section > summary small { margin-top:4px; line-height:1.4; }
#project-detail .full-description { padding:0 12px 12px; margin:0; font-size:var(--text-body); }
#project-detail .project-timeline { margin:6px 0 12px; padding:0 12px 0 22px; }
#project-detail .project-timeline li { padding:0 0 14px 14px; }
#project-detail .project-timeline li:last-child { padding-bottom:0; }
#project-detail .project-timeline h3 { font-size:var(--text-body); line-height:1.4; margin:5px 0; }
#project-detail .project-timeline p { margin:5px 0 8px; }
#project-detail .reading-sources { gap:4px 10px; }
#project-detail .tenant-groups { padding:0 12px 4px; }
#project-detail .tenant-group { padding:10px 0; }
#project-detail .tenant-group p { margin:6px 0; }
#project-detail .tenant-names { gap:5px; margin:6px 0; }
#project-detail .related-projects { margin:10px 0; }
#project-detail .related-projects h3 { font-size:.9375rem; line-height:1.3; margin:0 0 7px; }
#project-detail .related-projects button { min-height:44px; padding:12px; }
#project-detail .related-projects button + button { margin-top:8px; }
#project-detail .related-projects strong { font-size:var(--text-body); line-height:1.4; }
#project-detail .related-projects span { font-size:var(--text-secondary); line-height:1.4; margin-top:6px; }
#project-detail .detail-facts { margin:12px 0; padding:12px 0; gap:10px 14px; }
#project-detail .detail-facts small { margin-bottom:5px; }
#project-detail .detail-facts .big-cost { font-size:1.25rem; line-height:1.25; letter-spacing:0; }
#project-detail .detail-facts p { font-size:var(--text-secondary); margin:8px 0 0; }
#project-detail .detail-status { padding:12px; }
#project-detail .detail-status p { font-size:var(--text-secondary); margin:6px 0 0; }
#project-detail .source-label { margin:12px 0 4px; }
#project-detail .source-link { padding-block:8px; line-height:1.4; }
#project-detail .additional-project-sources[hidden] { display:none; }
#project-detail .sources-toggle { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:44px; padding:10px 0; border-top:1px solid var(--border); color:var(--accent); font-size:var(--text-body); font-weight:600; text-align:left; }
#project-detail .sources-toggle:hover { color:var(--accent-hover); }
#project-detail .sources-toggle .icon { flex-shrink:0; transform:rotate(90deg); }
#project-detail .sources-toggle[aria-expanded="true"] .icon { transform:rotate(-90deg); }

#project-detail .location-note { margin:10px 0; line-height:1.4; }
#project-detail .detail-footer { gap:8px; flex-wrap:wrap; }
#project-detail .detail-footer button { font-size:var(--text-secondary); }
#project-detail .project-gallery { margin:10px 0; }
#project-detail .gallery-open { font-size:var(--text-body); padding:6px 0; gap:6px 10px; }
#project-detail .gallery-photo figcaption { padding-top:6px; line-height:1.4; }
#project-detail .image-caption { font-size:var(--text-secondary); line-height:1.4; }
#project-detail .image-meta { margin-bottom:4px; line-height:1.4; }
#project-detail .gallery-photo figcaption a { line-height:1.4; }
#project-detail .gallery-bottom { gap:10px; margin-top:6px; }
#project-detail .inventory-notice, #project-detail .scope-notice { padding:10px 12px; margin:10px 0; line-height:1.4; }
#project-detail .upload-section { margin:10px 0; }
#project-detail .upload-section > summary { min-height:44px; padding:12px; font-size:var(--text-body); }

/* Municipality selection is unavailable during the Buffalo-only browsing focus. */
#municipality[hidden] { display:none; }

.back-to-top { position:fixed; right:max(16px,env(safe-area-inset-right)); bottom:calc(80px + env(safe-area-inset-bottom)); z-index:1300; display:grid; place-items:center; width:48px; height:48px; padding:12px; border:1px solid var(--accent-border); border-radius:50%; background:var(--accent-solid); color:#fff; box-shadow:0 4px 18px #0005; touch-action:manipulation; }
.back-to-top[hidden] { display:none; }
.back-to-top:hover { background:var(--accent-solid-hover); }
.back-to-top:focus-visible { outline:3px solid var(--accent); outline-offset:4px; }
.back-to-top svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
