.map-shell{
  background:#050608;
  color:#f6f7fb;
  min-height:100vh;
  padding-bottom: 136px;
}

.map-hero{
  padding: 80px 8vw 36px;
  background:
    linear-gradient(rgba(5,6,8,0.84), rgba(5,6,8,0.84)),
    radial-gradient(120% 120% at 12% 10%, rgba(244,180,26,0.18), transparent 48%),
    radial-gradient(120% 120% at 80% -10%, rgba(255,255,255,0.06), transparent 45%),
    url('../images/web/ai-search.jpg');
  background-size: cover;
  background-position:center;
}

.map-hero h1{
  font-family:'Playfair Display', serif;
  font-size: clamp(2.1rem, 3vw, 3.1rem);
  margin:0 0 10px;
}

.map-hero .muted{
  color: rgba(246,247,251,0.92);
}

.map-search{
  margin-top:14px;
  display:flex;
  gap:10px;
  align-items:center;
  max-width: 720px;
}

.map-search-input{
  flex:1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 12px 14px;
  color: #f6f7fb;
}

.map-search-input:focus{
  outline: none;
  border-color: rgba(126,231,195,0.7);
  box-shadow: 0 0 0 3px rgba(126,231,195,0.16);
}

.map-search-btn{
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.04);
  color: #f6f7fb;
  font-weight: 600;
}

.map-search-btn:hover{
  border-color:#7ee7c3;
  color:#7ee7c3;
}

.map-selected{
  margin-top: 12px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-body{
  display:grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  padding: 18px 8vw 64px;
}

.map-facets{
  position: sticky;
  top: 18px;
  align-self: start;
  display:flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 28px);
  overflow:auto;
}

.facet-panel{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  overflow:hidden;
}

.facet-toggle{
  width:100%;
  text-align:left;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  color: #f6f7fb;
  font-weight: 700;
  display:flex;
  align-items:center;
  justify-content: space-between;
}

.facet-toggle::after{
  content: "▾";
  opacity: 0.8;
}

.facet-toggle[aria-expanded="false"]::after{
  content: "▸";
}

.facet-content{
  padding: 10px 14px 14px;
}

.map-main{
  display:flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.map-status{
  color:#c6c9d4;
  font-size: 0.95rem;
}

.section-header{
  display:flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.section-title{
  margin: 0;
  font-size: 1.2rem;
}

.section-subtitle{
  margin: 0;
  color:#c6c9d4;
  font-size: 0.95rem;
}

.panel-surface{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 14px;
  min-height: 320px;
}

.placeholder{
  color:#c6c9d4;
  border: 1px dashed rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

/* Tree styles (mirrors Search Explorer tree, compact). */
.tree-help{ margin-bottom: 8px; }

.tree-filter{
  display:flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}

.tree-filter-input{
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 9px 10px;
  color: #f6f7fb;
  font-size: 0.92rem;
}

.tree-filter-input:focus{
  outline: none;
  border-color: rgba(126,231,195,0.7);
  box-shadow: 0 0 0 3px rgba(126,231,195,0.14);
}

.tree-filter-clear{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  color:#c6c9d4;
  font-weight: 800;
  line-height: 1;
}

.tree-filter-clear:hover{
  border-color:#7ee7c3;
  color:#7ee7c3;
}

.tree-mark{
  background: rgba(126,231,195,0.18);
  color: #f6f7fb;
  padding: 0 2px;
  border-radius: 4px;
}
.tree{
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
}
.tree-node{
  border-radius: 12px;
  background: rgba(0,0,0,0.10);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px 8px 5px;
}
.tree-row{
  display: grid;
  align-items: center;
  gap: 6px;
}

.tree-row--parent{
  grid-template-columns: 22px 1fr auto auto;
}

.tree-row--leaf{
  grid-template-columns: 1fr auto;
}
.tree-twist{
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tree-twist:hover{ border-color:#7ee7c3; }
.tree-twist-icon{
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid rgba(246,247,251,0.85);
  transform: translateX(1px);
}
.tree-twist[aria-expanded="true"] .tree-twist-icon{ transform: rotate(90deg) translateX(0); }
.tree-check{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tree-check input[type="checkbox"]{ width: 16px; height: 16px; }
.tree-label{
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-weight: 400;
  line-height: 1.15;
}
.tree-count{
  color: #c6c9d4;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.tree-children{
  list-style: none;
  padding-left: 28px;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tree-more-btn{
  width: 100%;
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.03);
  color: #f6f7fb;
  font-weight: 700;
}
.tree-more-btn:hover{ border-color:#7ee7c3; color:#7ee7c3; }

.tree-inline-btn{
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.03);
  color: #c6c9d4;
  font-weight: 700;
  font-size: 0.82rem;
  justify-self: end;
}

.tree-inline-btn:hover{
  border-color:#7ee7c3;
  color:#7ee7c3;
}

.tree-controls{
  margin: 8px 0 10px;
}

.map-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.map-region{
  border-radius: 14px;
  padding: 14px 12px;
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.04);
  color: #f6f7fb;
  font-weight: 800;
  text-align: center;
}

.map-region:hover{
  border-color:#7ee7c3;
  color:#7ee7c3;
}

.map-region.is-selected{
  border-color:#7ee7c3;
  box-shadow: 0 0 0 3px rgba(126,231,195,0.14);
}

.treemap-toolbar{
  display:flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.treemap-breadcrumb{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.treemap-crumb{
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
  color: #f6f7fb;
  font-weight: 700;
  font-size: 0.86rem;
}

.treemap-crumb:hover{ border-color:#7ee7c3; color:#7ee7c3; }

.treemap-crumb[aria-current="page"]{
  border-color: rgba(255,255,255,0.30);
  color: #c6c9d4;
}

.treemap-controls{
  display:flex;
  align-items: center;
  gap: 8px;
}

.treemap-controls label{
  color: #c6c9d4;
  font-weight: 700;
  font-size: 0.86rem;
}

.treemap-select{
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  color: #f6f7fb;
  font-weight: 800;
}

.treemap-canvas{
  position: relative;
  width: 100%;
  height: clamp(460px, 62vh, 760px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
}

.treemap-tile{
  position:absolute;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: #f6f7fb;
  padding: 10px 10px;
  text-align: left;
  display:flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  overflow: hidden;
}

.treemap-tile:hover{
  border-color:#7ee7c3;
  color:#7ee7c3;
}

.treemap-tile.is-selected{
  border-color:#7ee7c3;
  box-shadow: 0 0 0 3px rgba(126,231,195,0.14);
}

.treemap-title{
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.treemap-stats{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin-top: 2px;
  color: #c6c9d4;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.treemap-stat{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.treemap-stat span:first-child{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.treemap-stat span:last-child{
  font-weight: 800;
  color: #f6f7fb;
}

.treemap-meta{
  color: #c6c9d4;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.treemap-help{
  margin-top: 10px;
  color: #c6c9d4;
  font-size: 0.88rem;
}

/* ------------------------------------------------------------------
   Actual map (SVG + centroid markers)
-------------------------------------------------------------------*/
.geo-toolbar{
  display:flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.geo-breadcrumb{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.geo-crumb{
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
  color: #f6f7fb;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1;
}

.geo-crumb:hover{ border-color:#7ee7c3; color:#7ee7c3; }

.geo-crumb[aria-current="page"]{
  border-color: rgba(255,255,255,0.30);
  color: #c6c9d4;
}

.geo-legend{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #c6c9d4;
  font-size: 0.85rem;
  font-weight: 700;
}

.geo-legend-item{
  display:inline-flex;
  align-items: center;
  gap: 6px;
}

.geo-swatch{
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display:inline-block;
  border: 1px solid rgba(255,255,255,0.18);
}
.geo-swatch--figure{ background: rgba(244,180,26,0.85); }
.geo-swatch--event{ background: rgba(123,181,255,0.85); }
.geo-swatch--book{ background: rgba(126,231,195,0.85); }
.geo-swatch--author{ background: rgba(255,107,107,0.85); }
.geo-swatch--series{ background: rgba(157,126,247,0.85); }

.geo-map-canvas{
  position: relative;
  width: 100%;
  height: clamp(520px, 68vh, 880px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
}

.geo-map-svg{
  width: 100%;
  height: 100%;
  display:block;
  touch-action: none;
  user-select: none;
}

.geo-country{
  fill: none;
  stroke: rgba(255,255,255,0.12);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.geo-spider-leg{
  stroke: rgba(255,255,255,0.22);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.geo-marker{ cursor: pointer; }
.geo-marker-box{
  fill: rgba(255,255,255,0.06);
  stroke: rgba(255,255,255,0.22);
  stroke-width: 1;
}

.geo-marker.has-children .geo-marker-box{
  stroke-dasharray: 3 3;
}

.geo-marker:hover .geo-marker-box{
  stroke: rgba(126,231,195,0.95);
}

.geo-marker.is-selected .geo-marker-box{
  stroke: rgba(126,231,195,0.95);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
}

.geo-bar--bg{ fill: rgba(255,255,255,0.10); }
.geo-bar--figure{ fill: rgba(244,180,26,0.90); }
.geo-bar--event{ fill: rgba(123,181,255,0.90); }
.geo-bar--book{ fill: rgba(126,231,195,0.92); }
.geo-bar--author{ fill: rgba(255,107,107,0.90); }
.geo-bar--series{ fill: rgba(157,126,247,0.90); }

.geo-marker-name{
  fill: #f6f7fb;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2px;
  pointer-events: none;
}

.geo-marker-eps{
  fill: rgba(246,247,251,0.92);
  font-size: 9px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.geo-tooltip{
  position: absolute;
  z-index: 5;
  min-width: 220px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(12,14,22,0.92);
  box-shadow: 0 18px 46px rgba(0,0,0,0.50);
  color: #f6f7fb;
  pointer-events: none;
}

.geo-tooltip-title{
  font-weight: 900;
  margin-bottom: 6px;
}

.geo-tooltip-row{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(198,201,212,0.95);
  font-weight: 800;
  font-size: 0.88rem;
  line-height: 1.15;
}

.geo-tooltip-divider{
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 8px 0 6px;
}

.geo-tooltip-subtitle{
  font-weight: 900;
  color: rgba(198,201,212,0.92);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.geo-tooltip-bars{
  display:flex;
  flex-direction: column;
  gap: 6px;
}

.geo-tooltip-bar-row{
  display:grid;
  grid-template-columns: 70px 1fr 34px;
  gap: 8px;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 800;
  color: rgba(198,201,212,0.95);
}

.geo-tooltip-bar-label{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.geo-tooltip-bar-track{
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
}

.geo-tooltip-bar-fill{
  height: 100%;
  border-radius: 999px;
}

.geo-tooltip-fill--figure{ background: rgba(244,180,26,0.92); }
.geo-tooltip-fill--event{ background: rgba(123,181,255,0.92); }
.geo-tooltip-fill--book{ background: rgba(126,231,195,0.92); }
.geo-tooltip-fill--author{ background: rgba(255,107,107,0.92); }
.geo-tooltip-fill--series{ background: rgba(157,126,247,0.92); }

.geo-tooltip-bar-value{
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.geo-help{
  margin-top: 10px;
  color: #c6c9d4;
  font-size: 0.88rem;
}

.map-shell .tab-row,
.map-dock .tab-row{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.map-shell .tab-btn,
.map-dock .tab-btn{
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
  color: #f6f7fb;
  font-weight: 800;
  line-height: 1;
}

.map-shell .tab-btn:hover,
.map-dock .tab-btn:hover{ border-color:#7ee7c3; color:#7ee7c3; }

.map-shell .tab-btn[aria-selected="true"],
.map-dock .tab-btn[aria-selected="true"]{
  border-color:#7ee7c3;
  box-shadow: 0 0 0 3px rgba(126,231,195,0.14);
}

.map-shell .tab-count,
.map-dock .tab-count{
  color: #c6c9d4;
  font-weight: 800;
}

.map-shell .results-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.map-shell .results-grid .timeline-card{
  border-radius: 18px;
  padding: 18px 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: #f6f7fb;
  text-decoration: none;
  display:block;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.map-shell .results-grid .timeline-card:hover{
  transform: translateY(-2px);
  border-color:#7ee7c3;
}

.map-shell .results-grid h3{
  font-size: 1.05rem;
  margin: 0 0 10px;
  line-height: 1.2;
}

.map-shell .results-grid h3.entity-result-title{
  display:flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.entity-author-pill{
  padding: 3px 8px;
  font-size: 0.78rem;
  opacity: 0.95;
}

.map-shell .results-footer{
  margin-top: 14px;
  display:flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.map-shell .pager-btn{
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
  color: #f6f7fb;
  font-weight: 800;
}

.map-shell .pager-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}

.map-shell .pager-label{
  color: #c6c9d4;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.entity-popover{
  position: fixed;
  z-index: 50;
  width: min(360px, calc(100vw - 20px));
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(10,12,18,0.96);
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  padding: 12px 12px;
  color: #f6f7fb;
}

.entity-popover-title{
  font-weight: 900;
  margin-bottom: 2px;
}

.entity-popover-subtitle{
  color: #c6c9d4;
  font-size: 0.86rem;
  margin-bottom: 10px;
}

.entity-popover-list{
  display:flex;
  flex-direction: column;
  gap: 6px;
}

.entity-popover-ep{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  color: #f6f7fb;
  text-decoration: none;
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}

.entity-popover-ep:hover{ border-color:#7ee7c3; color:#7ee7c3; }

.entity-popover-date{
  color: #c6c9d4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entity-popover-more{
  margin-top: 10px;
  color: #c6c9d4;
  font-size: 0.86rem;
}

.entity-popover-loading{
  color: #c6c9d4;
  font-weight: 800;
}

.map-dock{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, rgba(12,14,22,0.12), rgba(12,14,22,0.92) 40%, rgba(12,14,22,0.96));
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.12);
}

.map-dock-inner{
  max-width: 1200px;
  margin: 0 auto;
  display:flex;
  align-items: center;
  gap: 10px;
}

.map-dock-tabs{ flex: 0 0 auto; }
.map-dock .tab-row{ margin-bottom: 0; }

.map-shell .map-clear-btn{
  flex: 0 0 auto;
  border-color: rgba(255,255,255,0.22);
}

.map-dock-selected-wrap{
  flex: 1 1 auto;
  min-width: 0;
}

.map-dock-selected{
  display:flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}

.map-dock-selected::-webkit-scrollbar{ height: 8px; }
.map-dock-selected::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
}

.map-dock .tree-more-btn{
  width: auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.88rem;
  white-space: nowrap;
}

.graph-wrap{
  display:grid;
  grid-template-columns: minmax(320px, 1fr) minmax(220px, 320px);
  gap: 14px;
  align-items: start;
}

.graph-svg{
  width:100%;
  height: 360px;
  display:block;
}

@media(max-width: 980px){
  .map-body{ grid-template-columns: 1fr; }
  .map-facets{ position: static; max-height: none; }
  .graph-wrap{ grid-template-columns: 1fr; }
  .map-shell{ padding-bottom: 168px; }
  .map-dock-inner{ flex-wrap: wrap; justify-content: center; }
  .map-dock-selected{ justify-content: center; }
}

@media(max-width:720px){
  .map-hero{ padding:72px 6vw 28px; }

  /* Facets: reduce decoration, keep readable. */
  .facet-panel{ border-radius: 12px; }
  .facet-toggle{
    padding: 10px 12px;
    font-weight: 600;
    font-size: 1rem;
  }
  .facet-toggle::after{
    font-size: 0.95rem;
    opacity: 0.65;
  }
  .facet-content{ padding: 8px 12px 12px; }
  .tree-filter{ margin-bottom: 8px; gap: 6px; }
  .tree-filter-input{ padding: 8px 9px; font-size: 0.9rem; border-radius: 12px; }
  .tree-filter-clear{ width: 30px; height: 30px; border-radius: 10px; }

  .tree{ gap: 5px; padding-bottom: 8px; }
  .tree-node{
    border-radius: 12px;
    padding: 5px 7px 4px;
    background: transparent;
    border-color: rgba(255,255,255,0.06);
  }
  .tree-row{ gap: 5px; }
  .tree-row--parent{ grid-template-columns: 18px 1fr auto auto; }
  .tree-twist{
    width: 18px;
    height: 18px;
    border-radius: 7px;
    background: transparent;
    border-color: rgba(255,255,255,0.18);
  }
  .tree-twist-icon{
    border-top-width: 5px;
    border-bottom-width: 5px;
    border-left-width: 6px;
  }
  .tree-check{ gap: 6px; }
  .tree-check input[type="checkbox"]{ width: 14px; height: 14px; }
  .tree-count{ font-size: 0.78rem; }
  .tree-children{ padding-left: 20px; gap: 3px; }
  .tree-controls{ margin: 6px 0 8px; }
  .tree-more-btn{
    padding: 7px 9px;
    border-radius: 10px;
    font-weight: 600;
  }
  .tree-inline-btn{
    padding: 5px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
  }
}

/* ------------------------------------------------------------------
   Parchment / paper theme overrides (scoped to Map Explorer)
-------------------------------------------------------------------*/
html[data-site-theme='parchment'] .map-shell{
  --paper-bg: #FDF6E3;
  --paper-surface: #EFEADD;
  --paper-border: #D7CFB8;
  --ink: #2D2D2D;
  --ink-muted: #544840;
  --accent-red: #C0392B;
  --accent-gold: #B7950B;

  --bg: var(--paper-bg);
  --surface: var(--paper-surface);
  --text: var(--ink);
  --muted: var(--ink-muted);
  --border: var(--paper-border);
  --accent: var(--accent-gold);
  --accent-ink: var(--ink);

  background: var(--bg);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-dock{
  --text: #2D2D2D;
  --muted: #544840;
  --border: #D7CFB8;
}

html[data-site-theme='parchment'] .map-shell .muted{ color: var(--muted); }
html[data-site-theme='parchment'] .map-shell .text-muted{ color: var(--muted) !important; }
html[data-site-theme='parchment'] .map-shell .section-subtitle{
  color: var(--text);
  opacity: 0.94;
}
html[data-site-theme='parchment'] .map-shell .map-status{
  color: var(--muted);
  font-weight: 600;
}

html[data-site-theme='parchment'] .map-shell .map-hero{
  background:
    linear-gradient(rgba(253,246,227,0.56), rgba(253,246,227,0.72)),
    radial-gradient(120% 120% at 12% 10%, rgba(183,149,11,0.14), transparent 48%),
    radial-gradient(120% 120% at 80% -10%, rgba(192,57,43,0.10), transparent 45%),
    url('../images/web/ai-search.jpg');
  background-size: cover;
  background-position:center;
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .map-hero .eyebrow{
  color: var(--text);
  opacity: 0.82;
}
html[data-site-theme='parchment'] .map-shell .map-hero .muted{
  color: var(--text);
  opacity: 0.90;
}

html[data-site-theme='parchment'] .map-shell .map-search-input{
  background: rgba(239,234,221,0.85);
  border-color: var(--border);
  color: var(--text);
}
html[data-site-theme='parchment'] .map-shell .map-search-input::placeholder{ color: rgba(107,94,85,0.85); }
html[data-site-theme='parchment'] .map-shell .map-search-input:focus{
  border-color: rgba(183,149,11,0.95);
  box-shadow: 0 0 0 3px rgba(183,149,11,0.22);
}
html[data-site-theme='parchment'] .map-shell .map-search-btn{
  background: rgba(192,57,43,0.12);
  border-color: rgba(192,57,43,0.42);
  color: var(--text);
}
html[data-site-theme='parchment'] .map-shell .map-search-btn:hover{ border-color: var(--accent-red); color: var(--accent-red); }

html[data-site-theme='parchment'] .map-shell .facet-panel{
  background: rgba(239,234,221,0.92);
  border-color: var(--border);
}
html[data-site-theme='parchment'] .map-shell .facet-toggle{ color: var(--text); }

html[data-site-theme='parchment'] .map-shell .tree-filter-input{
  background: rgba(253,246,227,0.86);
  border-color: var(--border);
  color: var(--text);
}
html[data-site-theme='parchment'] .map-shell .tree-filter-input:focus{
  border-color: rgba(183,149,11,0.95);
  box-shadow: 0 0 0 3px rgba(183,149,11,0.18);
}
html[data-site-theme='parchment'] .map-shell .tree-filter-clear{
  background: rgba(253,246,227,0.70);
  border-color: var(--border);
  color: var(--muted);
}
html[data-site-theme='parchment'] .map-shell .tree-filter-clear:hover{ border-color: var(--accent); color: var(--accent); }
html[data-site-theme='parchment'] .map-shell .tree-mark{ background: rgba(183,149,11,0.22); color: var(--text); }

html[data-site-theme='parchment'] .map-shell .tree-node{
  background: rgba(253,246,227,0.70);
  border-color: rgba(215,207,184,0.85);
}
html[data-site-theme='parchment'] .map-shell .tree-twist{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.70);
}
html[data-site-theme='parchment'] .map-shell .tree-twist-icon{ border-left-color: rgba(45,45,45,0.72); }
html[data-site-theme='parchment'] .map-shell .tree-count{ color: var(--muted); }
html[data-site-theme='parchment'] .map-shell .tree-more-btn,
html[data-site-theme='parchment'] .map-shell .tree-inline-btn{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.65);
  color: var(--text);
}
html[data-site-theme='parchment'] .map-shell .tree-more-btn:hover,
html[data-site-theme='parchment'] .map-shell .tree-inline-btn:hover{
  border-color: var(--accent);
  color: var(--accent);
}

html[data-site-theme='parchment'] .map-shell .panel-surface{
  background: rgba(239,234,221,0.92);
  border-color: var(--border);
}

html[data-site-theme='parchment'] .map-shell .map-region{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.76);
  color: var(--text);
  font-weight: 800;
}
html[data-site-theme='parchment'] .map-shell .map-region:hover{ border-color: rgba(183,149,11,0.95); color: rgba(183,149,11,1); }
html[data-site-theme='parchment'] .map-shell .map-region.is-selected{
  border-color: rgba(183,149,11,0.95);
  box-shadow: 0 0 0 3px rgba(183,149,11,0.18);
}

html[data-site-theme='parchment'] .map-shell .treemap-controls label{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .treemap-select{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.72);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .treemap-crumb{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.72);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .treemap-crumb[aria-current="page"]{
  border-color: rgba(183,149,11,0.75);
  color: rgba(183,149,11,1);
}

html[data-site-theme='parchment'] .map-shell .treemap-canvas{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.66);
}

html[data-site-theme='parchment'] .map-shell .treemap-tile{
  border-color: rgba(215,207,184,0.95);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .treemap-tile:hover{
  border-color: rgba(183,149,11,0.95);
  color: rgba(183,149,11,1);
}

html[data-site-theme='parchment'] .map-shell .treemap-tile.is-selected{
  border-color: rgba(183,149,11,0.95);
  box-shadow: 0 0 0 3px rgba(183,149,11,0.18);
}

html[data-site-theme='parchment'] .map-shell .geo-crumb{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.72);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .geo-crumb:hover{
  border-color: rgba(183,149,11,0.95);
  color: rgba(183,149,11,1);
}

html[data-site-theme='parchment'] .map-shell .geo-crumb[aria-current="page"]{
  border-color: rgba(183,149,11,0.75);
  color: rgba(183,149,11,1);
}

html[data-site-theme='parchment'] .map-shell .geo-legend{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .geo-swatch{
  border-color: rgba(215,207,184,0.95);
}

html[data-site-theme='parchment'] .map-shell .geo-map-canvas{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.66);
}

html[data-site-theme='parchment'] .map-shell .geo-country{
  stroke: rgba(45,45,45,0.16);
}

html[data-site-theme='parchment'] .map-shell .geo-spider-leg{
  stroke: rgba(45,45,45,0.22);
}

html[data-site-theme='parchment'] .map-shell .geo-marker-box{
  fill: rgba(239,234,221,0.95);
  stroke: rgba(215,207,184,0.95);
}

html[data-site-theme='parchment'] .map-shell .geo-marker:hover .geo-marker-box{
  stroke: rgba(183,149,11,0.95);
}

html[data-site-theme='parchment'] .map-shell .geo-marker.is-selected .geo-marker-box{
  stroke: rgba(183,149,11,0.95);
}

html[data-site-theme='parchment'] .map-shell .geo-bar--bg{ fill: rgba(45,45,45,0.10); }
html[data-site-theme='parchment'] .map-shell .geo-bar--figure{ fill: rgba(183,149,11,0.92); }
html[data-site-theme='parchment'] .map-shell .geo-bar--event{ fill: rgba(52,124,194,0.85); }
html[data-site-theme='parchment'] .map-shell .geo-bar--book{ fill: rgba(22,160,133,0.80); }
html[data-site-theme='parchment'] .map-shell .geo-bar--author{ fill: rgba(192,57,43,0.82); }
html[data-site-theme='parchment'] .map-shell .geo-bar--series{ fill: rgba(125,90,195,0.82); }

html[data-site-theme='parchment'] .map-shell .geo-marker-name{
  fill: var(--text);
}

html[data-site-theme='parchment'] .map-shell .geo-marker-eps{
  fill: rgba(45,45,45,0.92);
}

html[data-site-theme='parchment'] .map-shell .geo-tooltip{
  background: rgba(239,234,221,0.98);
  border-color: rgba(215,207,184,0.95);
  color: var(--text);
  box-shadow: 0 18px 46px rgba(67,50,31,0.24);
}

html[data-site-theme='parchment'] .map-shell .geo-tooltip-row{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .geo-tooltip-divider{
  background: rgba(45,45,45,0.12);
}

html[data-site-theme='parchment'] .map-shell .geo-tooltip-subtitle{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .geo-tooltip-bar-track{
  background: rgba(45,45,45,0.06);
  border-color: rgba(45,45,45,0.10);
}

html[data-site-theme='parchment'] .map-shell .geo-tooltip-fill--figure{ background: rgba(183,149,11,0.92); }
html[data-site-theme='parchment'] .map-shell .geo-tooltip-fill--event{ background: rgba(52,124,194,0.85); }
html[data-site-theme='parchment'] .map-shell .geo-tooltip-fill--book{ background: rgba(22,160,133,0.80); }
html[data-site-theme='parchment'] .map-shell .geo-tooltip-fill--author{ background: rgba(192,57,43,0.82); }
html[data-site-theme='parchment'] .map-shell .geo-tooltip-fill--series{ background: rgba(125,90,195,0.82); }

html[data-site-theme='parchment'] .map-shell .geo-help{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .treemap-stats{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .treemap-stat span:last-child{
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .treemap-meta{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .results-grid .timeline-card{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.78);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .results-grid .timeline-card:hover{
  border-color: rgba(183,149,11,0.95);
  box-shadow: 0 16px 34px rgba(67,50,31,0.14);
}

html[data-site-theme='parchment'] .map-shell .tab-btn,
html[data-site-theme='parchment'] .map-dock .tab-btn{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.72);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .tab-btn[aria-selected="true"],
html[data-site-theme='parchment'] .map-dock .tab-btn[aria-selected="true"]{
  border-color: rgba(183,149,11,0.95);
  color: rgba(183,149,11,1);
  box-shadow: none;
}

html[data-site-theme='parchment'] .map-shell .tab-count,
html[data-site-theme='parchment'] .map-dock .tab-count{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .pager-btn{
  border-color: rgba(215,207,184,0.95);
  background: rgba(253,246,227,0.72);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .pager-label{
  color: var(--muted);
}

html[data-site-theme='parchment'] .map-shell .placeholder{
  color: var(--muted);
  border-color: rgba(215,207,184,0.95);
}

html[data-site-theme='parchment'] .map-shell .entity-popover{
  background: rgba(239,234,221,0.98);
  border-color: rgba(215,207,184,0.95);
  color: var(--text);
  box-shadow: 0 18px 46px rgba(67,50,31,0.24);
}

html[data-site-theme='parchment'] .map-shell .entity-popover-ep{
  border-color: rgba(215,207,184,0.85);
  background: rgba(253,246,227,0.78);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-shell .entity-popover-ep:hover{
  border-color: rgba(183,149,11,0.85);
  color: rgba(183,149,11,1);
}

html[data-site-theme='parchment'] .map-dock{
  background: rgba(239,234,221,0.98);
  border-top-color: rgba(215,207,184,0.95);
  box-shadow: 0 -14px 34px rgba(67,50,31,0.10);
}

html[data-site-theme='parchment'] .map-dock .tree-more-btn{
  border-color: rgba(183,149,11,0.55);
  background: rgba(183,149,11,0.12);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-dock .map-clear-btn{
  border-color: rgba(192,57,43,0.50);
  background: rgba(192,57,43,0.10);
  color: var(--text);
}

html[data-site-theme='parchment'] .map-dock .map-clear-btn:hover{
  border-color: rgba(192,57,43,0.95);
  color: rgba(192,57,43,0.95);
}
