.ap-map-credit{position:absolute;right:14px;bottom:10px;z-index:520;color:#d7b46a;font-size:.72rem;text-shadow:0 1px 4px #000;pointer-events:none}.ap-map-credit span{color:#8f9b93}.leaflet-control-attribution{display:none!important}.ap-academic-badge{position:absolute;left:14px;top:14px;z-index:520;max-width:310px;border:1px solid rgba(215,180,106,.28);background:rgba(7,10,9,.74);backdrop-filter:blur(14px);color:#b9c4bb;padding:.55rem .65rem;font:600 .7rem/1.35 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;box-shadow:0 16px 45px rgba(0,0,0,.32);pointer-events:none}.ap-academic-badge strong{display:block;color:#d7b46a;font-size:.62rem;text-transform:uppercase;letter-spacing:.12em;margin-bottom:.18rem}.ap-academic-badge span{color:#f6f0e6}.ap-source-note{border:1px solid rgba(215,180,106,.22);background:rgba(215,180,106,.07);color:#b9c4bb;padding:.62rem .7rem;margin:.65rem 0;font-size:.82rem;line-height:1.45}.ap-source-note strong{display:block;color:#d7b46a;font-size:.64rem;text-transform:uppercase;letter-spacing:.11em;margin-bottom:.25rem}@media(max-width:760px){.ap-academic-badge{display:none}.ap-map-credit{right:10px;bottom:8px;font-size:.65rem}}

/* Map control collision guard: when a scene/status card occupies the upper-left corner, move Leaflet zoom below it. */
.ap-map-has-top-left-overlay .leaflet-top.leaflet-left{top:132px!important}
.ap-map-has-top-left-overlay .leaflet-top.leaflet-left .leaflet-control{margin-top:12px!important}
.leaflet-control-zoom a{font-weight:900!important;color:#050505!important}
@media(max-width:900px){.ap-map-has-top-left-overlay .leaflet-top.leaflet-left{top:92px!important}}

/* Academic map-room scroll standard: side panels must never hide lower controls. */
.shell>.side,.shell>aside,.ww1-side,.ww1-right,.dashboard-side,.genocide-side,.conflict-side,.right,.side{
  max-height:100vh;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-width:thin;
  scrollbar-color:rgba(215,180,106,.58) rgba(255,255,255,.07);
}
.shell>.side::-webkit-scrollbar,.shell>aside::-webkit-scrollbar,.ww1-side::-webkit-scrollbar,.ww1-right::-webkit-scrollbar,.dashboard-side::-webkit-scrollbar,.genocide-side::-webkit-scrollbar,.conflict-side::-webkit-scrollbar,.right::-webkit-scrollbar,.side::-webkit-scrollbar{width:10px}
.shell>.side::-webkit-scrollbar-track,.shell>aside::-webkit-scrollbar-track,.ww1-side::-webkit-scrollbar-track,.ww1-right::-webkit-scrollbar-track,.dashboard-side::-webkit-scrollbar-track,.genocide-side::-webkit-scrollbar-track,.conflict-side::-webkit-scrollbar-track,.right::-webkit-scrollbar-track,.side::-webkit-scrollbar-track{background:rgba(255,255,255,.055)}
.shell>.side::-webkit-scrollbar-thumb,.shell>aside::-webkit-scrollbar-thumb,.ww1-side::-webkit-scrollbar-thumb,.ww1-right::-webkit-scrollbar-thumb,.dashboard-side::-webkit-scrollbar-thumb,.genocide-side::-webkit-scrollbar-thumb,.conflict-side::-webkit-scrollbar-thumb,.right::-webkit-scrollbar-thumb,.side::-webkit-scrollbar-thumb{background:rgba(215,180,106,.48);border-radius:999px;border:2px solid rgba(0,0,0,.28)}
.records,.ledger,.country-table-wrap,.dashboard-table,.results-panel{min-height:0;overflow-y:auto;overflow-x:hidden}
@media(max-width:900px){.shell>.side,.shell>aside,.ww1-side,.ww1-right,.dashboard-side,.genocide-side,.conflict-side,.right,.side{max-height:none;overflow-y:visible}.records,.ledger,.country-table-wrap,.dashboard-table,.results-panel{max-height:340px;overflow-y:auto}}

/* Academic citation cards must not become accidental extra grid columns/rows in map shells. */
.shell{position:relative}
.shell>.source-reconstruction.academic-citation-section,
.shell>.academic-citation-section{
  position:fixed;
  left:400px;
  bottom:16px;
  z-index:535;
  width:min(460px,calc(100vw - 430px));
  display:grid;
  grid-template-columns:1fr;
  gap:.45rem;
  pointer-events:none;
  margin:0!important;
  padding:0!important;
}
.shell>.source-reconstruction.academic-citation-section .source-card,
.shell>.academic-citation-section .source-card{
  pointer-events:auto;
  border:1px solid rgba(215,180,106,.32)!important;
  background:rgba(7,10,14,.78)!important;
  backdrop-filter:blur(14px);
  color:#b9c4bb;
  padding:.58rem .68rem!important;
  box-shadow:0 16px 46px rgba(0,0,0,.34);
  max-width:100%;
}
.shell>.source-reconstruction.academic-citation-section .source-card strong,
.shell>.academic-citation-section .source-card strong{
  color:#d7b46a!important;
  font-size:.62rem!important;
  line-height:1.2!important;
  letter-spacing:.1em!important;
  text-transform:uppercase!important;
  margin:0 0 .18rem!important;
}
.shell>.source-reconstruction.academic-citation-section .source-card span,
.shell>.academic-citation-section .source-card span{
  display:block;
  color:#d8ddd8!important;
  font-size:.74rem!important;
  line-height:1.38!important;
  overflow-wrap:break-word!important;
}
@media(max-width:900px){
  .shell>.source-reconstruction.academic-citation-section,
  .shell>.academic-citation-section{
    position:static;
    width:auto;
    padding:12px!important;
    grid-column:1/-1;
    pointer-events:auto;
  }
}


/* Zero-loss interaction standard: points, popups, and labels stay above context polygons. */
.leaflet-overlay-pane{z-index:350!important}.leaflet-marker-pane{z-index:650!important}.leaflet-tooltip-pane{z-index:690!important}.leaflet-popup-pane{z-index:720!important}
.leaflet-apboundary-pane,.leaflet-apcontext-pane{z-index:360!important}
.leaflet-apzone-pane{z-index:390!important}
.leaflet-aproute-pane,.leaflet-apflow-pane,.leaflet-apline-pane{z-index:430!important}
.leaflet-appoint-pane{z-index:650!important}
.leaflet-aplabel-pane{z-index:690!important;pointer-events:none!important}
.leaflet-overlay-pane path{vector-effect:non-scaling-stroke}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-interactive{touch-action:manipulation}
.leaflet-popup-content-wrapper{background:rgba(8,13,11,.96)!important;border:1px solid rgba(215,180,106,.28)!important;border-radius:12px!important;color:#e8efe8!important;box-shadow:0 18px 55px rgba(0,0,0,.42)!important}.leaflet-popup-tip{background:rgba(8,13,11,.96)!important;border:1px solid rgba(215,180,106,.2)!important}.leaflet-popup-content{font-size:.86rem;line-height:1.45;color:#e8efe8;min-width:240px;max-width:min(420px,calc(100vw - 72px));white-space:normal!important;overflow-wrap:break-word!important;word-break:normal!important}.leaflet-popup-content *{max-width:100%;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important}.leaflet-popup-content strong,.leaflet-popup-content b{color:#fff8e8}.leaflet-popup-content a{color:#d7b46a;text-decoration:none;border-bottom:1px solid rgba(215,180,106,.35)}
.ap-reading-panel span{display:block;color:#dfe7df!important;line-height:1.45}.ap-manifest-link:hover{background:rgba(215,180,106,.16)!important;color:#fff2c4!important}.ap-map-data-coverage,.data-coverage,.coverage-card{border:1px solid rgba(215,180,106,.25)!important;background:rgba(215,180,106,.07)!important;color:#dfe7df!important}
/* Public language standard: compact source cards should wrap instead of breaking layout. */
.source-card,.academic-citation-card,.academic-version-card,.ap-source-note{overflow-wrap:anywhere;word-break:normal}
/* Dense polygon maps: keep context softer than event/point layers. */
.ap-context-geometry{filter:saturate(.82) brightness(.94)}


/* Side-panel title resilience: long atlas names must not disappear under scrollbars or neighboring panels. */
.dashboard-side h1,.side h1,.ww1-side h1,.genocide-side h1,.conflict-side h1,aside h1{
  overflow-wrap:anywhere;
  word-break:normal;
  hyphens:auto;
  max-width:100%;
}
.dashboard-side.left h1,.route-side.left h1{
  font-size:clamp(2.25rem,3.2vw,4.25rem);
  line-height:.98;
  letter-spacing:-.045em;
}
.dashboard-topbar .dashboard-brand,.route-topbar .dashboard-brand,.site-header .brand{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
@media(max-width:1180px){.dashboard-side.left h1,.route-side.left h1{font-size:clamp(2rem,4vw,3.25rem)}}
@media(max-width:900px){.dashboard-topbar .dashboard-brand,.route-topbar .dashboard-brand{max-width:62vw}.dashboard-side.left h1,.route-side.left h1{font-size:2.55rem}}


/* Narrow side-panel scrollbar safe area. Prevent large map titles from being clipped by the panel edge. */
.dashboard-side,.side,.ww1-side,.genocide-side,.conflict-side,aside{
  box-sizing:border-box;
  scrollbar-gutter:stable;
}
.dashboard-side.left,.side.left,aside.left{
  padding-right:max(18px,1rem)!important;
}
.dashboard-side h1,.side h1,.ww1-side h1,.genocide-side h1,.conflict-side h1,aside h1{
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  overflow-wrap:break-word!important;
  word-break:normal!important;
}
.dashboard-side.left h1:not(.no-auto-fit),.side.left h1:not(.no-auto-fit),aside.left h1:not(.no-auto-fit){
  font-size:clamp(2.15rem,2.85vw,3.85rem)!important;
  line-height:1!important;
  max-width:calc(100% - 8px);
}
@media(max-width:1320px){.dashboard-side.left h1:not(.no-auto-fit),.side.left h1:not(.no-auto-fit),aside.left h1:not(.no-auto-fit){font-size:clamp(2rem,2.55vw,3.25rem)!important}}


/* Unified AP rich popup standard, modeled after the Genocide Atlas. */
.atlas-rich-popup .leaflet-popup-content-wrapper{background:rgba(8,13,11,.96)!important;border:1px solid rgba(215,180,106,.34)!important;border-radius:14px!important;box-shadow:0 22px 70px rgba(0,0,0,.46)!important;color:#e8efe8!important;backdrop-filter:blur(14px)}
.atlas-rich-popup .leaflet-popup-tip{background:rgba(8,13,11,.96)!important;border:1px solid rgba(215,180,106,.25)!important}.atlas-rich-popup .leaflet-popup-content{margin:0!important;min-width:320px;max-width:min(420px,calc(100vw - 72px));width:auto!important}.atlas-rich-popup__card{padding:1rem;display:grid;gap:.65rem}.atlas-rich-popup__card h3{margin:0;color:#fff8e8;font-family:Georgia,serif;font-size:1.28rem;line-height:1.05}.atlas-popup__eyebrow{margin:0!important;color:#ffd66f!important;text-transform:uppercase;letter-spacing:.11em;font-size:.64rem!important;font-weight:800}.atlas-popup__summary{margin:0!important;color:#dce8df!important;line-height:1.45!important}.atlas-popup__chips{display:flex;flex-wrap:wrap;gap:.35rem}.atlas-popup__chips span{border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);color:#fff8e8;padding:.24rem .42rem;font-size:.68rem}.atlas-popup__metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem}.atlas-popup__metrics div{border:1px solid rgba(255,255,255,.13);background:rgba(255,255,255,.045);padding:.45rem}.atlas-popup__metrics span{display:block;color:#8ed0c2;text-transform:uppercase;letter-spacing:.09em;font-size:.58rem}.atlas-popup__metrics strong{display:block;color:#fff8e8;font-size:.82rem;line-height:1.15}.atlas-popup__provenance{display:grid;gap:.35rem;margin:0}.atlas-popup__provenance div{display:grid;grid-template-columns:92px 1fr;gap:.45rem}.atlas-popup__provenance dt{color:#8ed0c2;font-size:.62rem;text-transform:uppercase;letter-spacing:.08em}.atlas-popup__provenance dd{margin:0;color:#e8efe8;font-size:.72rem}.atlas-popup__actions{display:flex;gap:.45rem;flex-wrap:wrap}.atlas-popup__actions a{display:inline-flex!important;align-items:center;border:1px solid rgba(215,180,106,.35)!important;background:rgba(215,180,106,.1)!important;color:#ffd66f!important;padding:.42rem .58rem;text-decoration:none!important;font-weight:800;font-size:.72rem}.heritage-popup-image{width:100%;max-height:150px;object-fit:cover;border:1px solid rgba(255,255,255,.14)}
@media(max-width:760px){.atlas-popup__metrics{grid-template-columns:1fr}.atlas-rich-popup .leaflet-popup-content{min-width:240px}}

/* AP layer contract: keep rich map popups readable across atlas rooms. */
.leaflet-popup.ap-popup-contract .leaflet-popup-content,
.leaflet-popup.atlas-rich-popup .leaflet-popup-content{
  min-width:280px;
  max-width:min(430px, calc(100vw - 44px));
  margin:0!important;
  padding:0!important;
  white-space:normal;
  word-break:normal;
  overflow-wrap:break-word;
}
.leaflet-pane.apBoundaryFillPane,
.leaflet-pane.apContextPolygonPane{
  mix-blend-mode:normal;
}
.leaflet-pane.apPointPane,
.leaflet-pane.apPopupAnchorPane{
  pointer-events:auto;
}

/* AP popup standardizer for legacy atlas rooms. */
.ap-standard-popup,
.atlas-popup{
  color:#fff8e8;
  font-family:Arial, sans-serif;
  line-height:1.45;
}
.leaflet-popup .ap-standard-popup,
.leaflet-popup .atlas-popup{
  display:block;
  padding:14px 15px 13px;
}
.leaflet-popup .atlas-popup .popup,
.leaflet-popup .ap-standard-popup .popup{
  display:block;
  min-width:0;
}
.leaflet-popup .atlas-popup header,
.leaflet-popup .ap-standard-popup header{
  margin-top:0;
}
.leaflet-popup .atlas-popup>*:first-child,
.leaflet-popup .ap-standard-popup>*:first-child{
  margin-top:0!important;
}
.leaflet-popup .atlas-popup>*:last-child,
.leaflet-popup .ap-standard-popup>*:last-child{
  margin-bottom:0!important;
}
.leaflet-popup .atlas-popup .facts,
.leaflet-popup .atlas-popup__facts{
  margin:.7rem 0;
}
.leaflet-popup .atlas-popup__facts{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:.45rem;
}
.leaflet-popup .atlas-popup__facts div{
  border:1px solid rgba(255,255,255,.13);
  background:rgba(255,255,255,.045);
  padding:.48rem .52rem;
}
.leaflet-popup .atlas-popup__facts span{
  display:block;
  color:#8ed0c2;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:.58rem;
}
.leaflet-popup .atlas-popup__facts strong{
  display:block;
  margin-top:.12rem;
  line-height:1.15;
}
.ap-standard-popup strong,
.atlas-popup h3,
.atlas-popup strong{
  color:#fff8e8;
  font-weight:900;
}
.ap-standard-popup span,
.ap-standard-popup small,
.atlas-popup small,
.atlas-popup__meta,
.atlas-popup__eyebrow{
  color:#b9c9bf;
}
.ap-standard-popup p,
.atlas-popup p{
  margin:.45rem 0;
}
.ap-standard-popup a,
.atlas-popup a{
  color:#f2ca67;
  font-weight:800;
  text-decoration:none;
  border-bottom:1px solid rgba(242,202,103,.35);
}
.ap-standard-popup a:hover,
.atlas-popup a:hover{
  border-bottom-color:#f2ca67;
}
.leaflet-popup.ap-popup-contract .leaflet-popup-content-wrapper,
.leaflet-popup.atlas-rich-popup .leaflet-popup-content-wrapper{
  background:rgba(7,14,11,.96);
  color:#fff8e8;
  border:1px solid rgba(242,202,103,.28);
  border-radius:14px;
  box-shadow:0 18px 45px rgba(0,0,0,.42);
}
.leaflet-popup.ap-popup-contract .leaflet-popup-tip,
.leaflet-popup.atlas-rich-popup .leaflet-popup-tip{
  background:rgba(7,14,11,.96);
  border:1px solid rgba(242,202,103,.18);
}
.leaflet-popup.ap-popup-contract .leaflet-popup-close-button{
  color:#f2ca67 !important;
  font-size:20px;
  padding:8px 10px 0 0;
}

.ap-popup-record-action{
  display:flex;
  gap:8px;
  margin-top:.7rem;
  padding-top:.65rem;
  border-top:1px solid rgba(242,202,103,.22);
}
.ap-popup-record-action a{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:0 10px;
  border:1px solid rgba(242,202,103,.55) !important;
  border-radius:4px;
  background:rgba(242,202,103,.12);
  color:#f2ca67 !important;
  font:900 12px/1 Arial,sans-serif;
  text-transform:uppercase;
  letter-spacing:.04em;
}
