/* ==========================================================
   MAPAS E TERRITÓRIOS — EXPERIÊNCIA CARTOGRÁFICA V2
   ========================================================== */

.territory-portal{
  position:relative;min-height:500px;overflow:hidden;color:#fff;
  background:var(--territory-hero-image) center 46%/cover no-repeat;isolation:isolate
}
.territory-portal-shade{
  position:absolute;inset:0;z-index:-1;
  background:
    radial-gradient(circle at 78% 47%,rgba(197,158,84,.17),transparent 29%),
    linear-gradient(90deg,rgba(5,38,63,.98) 0%,rgba(5,38,63,.90) 46%,rgba(5,38,63,.42) 76%,rgba(5,38,63,.68) 100%)
}
.territory-portal-inner{padding-top:28px;padding-bottom:48px}
.territory-breadcrumb{display:flex;align-items:center;gap:8px;color:rgba(255,255,255,.64);font-size:.7rem}
.territory-breadcrumb a{color:rgba(255,255,255,.76);text-decoration:none}
.territory-hero-copy{max-width:760px;padding:92px 0 62px}
.territory-eyebrow{
  display:block;color:#a9761c;font-size:.64rem;font-weight:900;letter-spacing:.14em;text-transform:uppercase
}
.territory-hero-copy .territory-eyebrow{color:#d7b36a}
.territory-hero-copy h1{
  margin:8px 0 16px;color:#fff;font-family:"Cormorant Garamond",Georgia,serif;
  font-size:clamp(3.7rem,7vw,6.4rem);line-height:.92;font-weight:600;letter-spacing:-.04em
}
.territory-hero-copy p{
  max-width:680px;margin:0;color:rgba(255,255,255,.83);
  font-family:Georgia,"Times New Roman",serif;font-size:1.08rem;line-height:1.72
}
.territory-hero-action{
  display:inline-flex;align-items:center;gap:9px;margin-top:28px;padding:12px 15px;
  border:1px solid rgba(255,255,255,.28);border-radius:9px;color:#fff;text-decoration:none;
  font-size:.72rem;font-weight:800
}
.territory-hero-action:hover{color:#fff;background:rgba(255,255,255,.08)}

.territory-experience{padding:72px 0 86px;background:linear-gradient(180deg,#f5f1e9 0,#fff 390px)}
.territory-intro{
  display:grid;grid-template-columns:.9fr 1.1fr;gap:52px;max-width:1120px;
  margin:0 auto 48px;padding-bottom:38px;border-bottom:1px solid #e3e6e7
}
.territory-intro h2,.territory-section-head h2,.territory-next-paths h2,.territory-empty-state h2{
  margin:5px 0 8px;color:#0a3556;font-family:"Cormorant Garamond",Georgia,serif;font-weight:600
}
.territory-intro h2{font-size:2.7rem;line-height:1.06}
.territory-intro>p{margin:0;color:#667886;font-family:Georgia,serif;font-size:.98rem;line-height:1.8}

.territory-map-stage{
  display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:24px;align-items:start;max-width:1200px;margin:0 auto
}
.territory-filter-panel{
  display:grid;grid-template-columns:1.35fr .65fr;gap:12px;margin-bottom:14px
}
.territory-filter-section{
  padding:17px 18px;border:1px solid #e1e5e7;border-radius:12px;background:#fff;
  box-shadow:0 6px 18px rgba(13,47,70,.035)
}
.territory-filter-heading{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:10px}
.territory-filter-heading h3{margin:4px 0 0;color:#21435c;font-size:.86rem;font-weight:800}
.timeline-range-label{
  padding:6px 9px;border-radius:7px;background:#f5efe4;color:#8c651d;
  font-size:.69rem;font-weight:800;white-space:nowrap
}
.timeline-controls{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.timeline-controls label span{display:block;margin-bottom:4px;color:#7b8891;font-size:.58rem;font-weight:800;text-transform:uppercase}
.timeline-controls input[type=range]{width:100%;accent-color:#b8871d}
.timeline-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
.timeline-chip,.map-filter{
  border:1px solid #d9dfe2;background:#fff;color:#536a7a;border-radius:999px;
  padding:7px 10px;font-size:.64rem;font-weight:800;cursor:pointer
}
.timeline-chip:hover,.map-filter:hover{border-color:#b68a3a;color:#8e651e}
.map-toolbar{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.map-filter.active{background:#0b3a5c;color:#fff;border-color:#0b3a5c}
.map-count{display:none!important}

.map-shell{
  position:relative;min-height:610px;overflow:hidden;border:1px solid #d8dfdf;border-radius:16px;
  background:#e8eee9;box-shadow:0 14px 34px rgba(13,47,70,.09)
}
#territoryMap{height:610px;width:100%;z-index:1}
.map-empty{
  position:absolute;inset:0;z-index:3;display:grid;place-items:center;padding:30px;
  background:#e8eee9;color:#53616b;text-align:center
}
.map-empty>div{display:flex;flex-direction:column;align-items:center;gap:8px}
.map-empty i{font-size:2rem;color:#a87823}
.map-empty strong{color:#21445c}
.map-empty small{max-width:360px}
.map-legend{
  position:absolute;left:14px;bottom:14px;z-index:500;max-width:430px;
  padding:10px 12px;border:1px solid #e1ddd3;border-radius:10px;
  background:rgba(255,255,255,.95);box-shadow:0 5px 18px rgba(0,0,0,.10)
}
.map-legend-title{display:block;margin-bottom:6px;color:#526676;font-size:.59rem;font-weight:900;text-transform:uppercase}
.map-key{display:flex;gap:10px;flex-wrap:wrap;color:#59656d;font-size:.62rem}
.map-key span{display:inline-flex;align-items:center;gap:4px}
.map-key i{width:8px;height:8px;border-radius:50%;display:inline-block}
.map-key .k-city{background:#0b6fa4}.map-key .k-island{background:#2f8f5b}.map-key .k-region{background:#8b6b1e}
.map-key .k-historic{background:#7a4e8e;border-radius:2px}.map-key .k-river{background:#2a86b7}
.map-note{display:flex;gap:7px;margin:10px 2px 0;color:#76838b;font-size:.65rem;line-height:1.5}

.territory-context-panel{position:sticky;top:120px}
.territory-info{
  padding:25px;border:1px solid #e1e4e4;border-radius:14px;background:#fff;
  box-shadow:0 10px 28px rgba(13,47,70,.055)
}
.territory-info h2{
  margin:6px 0 7px;color:#153d5a;font-family:"Cormorant Garamond",Georgia,serif;
  font-size:2rem;line-height:1.05
}
.territory-historic-name{margin:0 0 12px;color:#98835e;font-family:Georgia,serif;font-style:italic;font-size:.78rem}
.territory-period{
  display:inline-flex;align-items:center;gap:7px;margin:3px 0 15px;padding:7px 9px;
  border-radius:7px;background:#f6f0e5;color:#81601f;font-size:.66rem;font-weight:800
}
.territory-description{margin:0;color:#657684;font-size:.76rem;line-height:1.7;white-space:normal}
.territory-context-jump{
  display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:20px;padding-top:15px;
  border-top:1px solid #e5e8e9;color:#8d651e;text-decoration:none;font-size:.69rem;font-weight:800
}

.territory-marker{background:transparent;border:0}
.territory-marker .pin{
  width:30px;height:30px;border-radius:50% 50% 50% 0;background:#b8871d;border:3px solid #fff;
  box-shadow:0 3px 12px rgba(0,0,0,.32);transform:rotate(-45deg);position:relative
}
.territory-marker .pin:after{
  content:"";width:8px;height:8px;border-radius:50%;background:#fff;position:absolute;left:8px;top:8px
}
.territory-marker.active .pin{background:#0b365d;width:36px;height:36px}
.territory-marker.city .pin{background:#0b6fa4}.territory-marker.island .pin{background:#2f8f5b}
.territory-marker.region .pin{background:#8b6b1e}.territory-marker.historic .pin{background:#7a4e8e;border-radius:7px 7px 7px 0}
.territory-marker.river .pin{background:#2a86b7}.territory-marker.other .pin{background:#5d6870}
.territory-marker.active .pin{
  box-shadow:0 0 0 4px rgba(255,255,255,.8),0 4px 14px rgba(0,0,0,.34)
}
.active-marker-wrap{position:relative;width:190px;height:42px}
.active-marker-wrap>.pin{position:absolute;left:0;top:0}
.territory-active-label{
  position:absolute;left:28px;top:0;min-height:36px;display:flex;align-items:center;gap:7px;
  padding:7px 11px;border:2px solid #b8871d;border-radius:999px;background:#fff;color:#0b365d;
  font-size:.68rem;font-weight:800;box-shadow:0 4px 15px rgba(0,0,0,.18);white-space:nowrap
}
.territory-active-label .dot{width:8px;height:8px;border-radius:50%;background:#b8871d}
.active-count{display:none!important}
.territory-marker.active .pin:after{left:11px;top:11px}

.leaflet-popup-content-wrapper{border-radius:13px}
.leaflet-popup-content{min-width:190px}
.popup-title{margin-bottom:4px;color:#0b365d;font-size:.88rem;font-weight:800}
.popup-meta{margin-bottom:8px;color:#66727b;font-size:.65rem;line-height:1.45}
.popup-link{
  display:inline-block;padding:7px 10px;border-radius:7px;background:#0b365d;
  color:#fff!important;text-decoration:none;font-size:.63rem;font-weight:800
}
.leaflet-container img.leaflet-tile{max-width:none!important;max-height:none!important;width:256px!important;height:256px!important;padding:0!important;margin:0!important;border:0!important}
.leaflet-tile-pane{will-change:transform}
.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas{position:absolute;left:0;top:0}
.leaflet-map-pane,.leaflet-tile-pane,.leaflet-overlay-pane,.leaflet-shadow-pane,.leaflet-marker-pane,.leaflet-tooltip-pane,.leaflet-popup-pane{position:absolute;left:0;top:0}
.leaflet-control{position:relative;z-index:800;pointer-events:auto}
.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}
.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}
.leaflet-control-zoom a{display:block;width:30px;height:30px;line-height:30px;text-align:center;background:#fff;color:#333;text-decoration:none;border-bottom:1px solid #ccc}
.leaflet-control-zoom{margin:10px;border:1px solid #bbb;border-radius:5px;overflow:hidden;box-shadow:0 1px 5px rgba(0,0,0,.25)}

.territory-directory,.territory-documents{max-width:1120px;margin:64px auto 0}
.territory-section-head{margin-bottom:24px}
.territory-section-head h2{font-size:2.45rem}
.territory-section-head p{max-width:720px;margin:0;color:#74818a;font-size:.76rem;line-height:1.6}
.territory-card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.territory-card{
  display:grid;grid-template-columns:42px 1fr auto;gap:12px;align-items:center;padding:14px;
  border:1px solid #e0e5e7;border-radius:10px;background:#fff;color:inherit;text-decoration:none;
  transition:.18s ease
}
.territory-card:hover,.territory-card.is-active{
  transform:translateY(-2px);border-color:#cdb06f;box-shadow:0 8px 22px rgba(13,47,70,.07)
}
.territory-card.is-active{background:#fffaf1}
.territory-card-icon{
  width:42px;height:42px;display:grid;place-items:center;border-radius:8px;background:#f4eee2;color:#a67620
}
.territory-card-copy small{
  display:block;color:#a0711e;font-size:.54rem;font-weight:900;letter-spacing:.08em
}
.territory-card-copy strong{display:block;margin-top:2px;color:#24455d;font-size:.76rem}
.territory-card-copy span{display:block;margin-top:2px;color:#849099;font-size:.61rem}
.territory-card>i{color:#a77720}

.territory-doc-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.territory-doc{
  display:flex;flex-direction:column;min-height:190px;padding:18px;border:1px solid #e0e5e7;
  border-radius:11px;background:#fff;color:inherit;text-decoration:none;
  box-shadow:0 6px 20px rgba(13,47,70,.035);transition:.18s ease
}
.territory-doc:hover{transform:translateY(-3px);border-color:#cfaf6c;box-shadow:0 12px 26px rgba(13,47,70,.08)}
.territory-doc-kind{
  color:#a3711a;font-size:.56rem;font-weight:900;letter-spacing:.08em;text-transform:uppercase
}
.territory-doc h3{
  margin:7px 0;color:#1e435e;font-family:"Cormorant Garamond",Georgia,serif;
  font-size:1.34rem;line-height:1.13
}
.territory-doc p{margin:0;color:#6c7c88;font-size:.7rem;line-height:1.5}
.territory-doc small{display:block;margin-top:5px;color:#9b8153;font-size:.62rem}
.territory-doc-note{margin-top:8px!important;color:#89949b!important;font-size:.65rem!important}
.territory-doc-open{
  display:inline-flex;align-items:center;gap:7px;margin-top:auto;padding-top:15px;color:#8c6319;font-size:.65rem;font-weight:800
}
.territory-doc-empty{
  grid-column:1/-1;padding:28px;border:1px dashed #d9dee0;border-radius:10px;color:#77858e;text-align:center;font-size:.76rem
}

.territory-next-paths{
  display:grid;grid-template-columns:.75fr 1.25fr;gap:34px;max-width:1050px;
  margin:68px auto 0;padding-top:40px;border-top:1px solid #e2e5e6
}
.territory-next-paths h2{font-size:2.05rem}
.territory-next-links{display:grid;gap:10px}
.territory-next-links a{
  display:grid;grid-template-columns:42px 1fr;gap:12px;align-items:center;padding:13px;
  border:1px solid #e0e5e7;border-radius:9px;background:#fff;color:inherit;text-decoration:none
}
.territory-next-links>a>i{
  width:42px;height:42px;display:grid;place-items:center;border-radius:8px;background:#f5efe4;color:#a6751e
}
.territory-next-links strong{display:block;color:#24455d;font-size:.76rem}
.territory-next-links small{display:block;margin-top:2px;color:#85919a;font-size:.64rem;line-height:1.35}
.territory-empty-state{
  max-width:720px;margin:30px auto;padding:55px 32px;text-align:center;border:1px solid #e0ddd5;border-radius:15px;background:#fff
}
.territory-empty-state>i{color:#a87823;font-size:2.3rem}
.visually-hidden{
  position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;
  overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important
}

@media(max-width:1050px){
  .territory-map-stage{grid-template-columns:1fr}
  .territory-context-panel{position:static}
  .territory-filter-panel{grid-template-columns:1fr}
}
@media(max-width:850px){
  .territory-intro{grid-template-columns:1fr;gap:18px}
  .territory-card-grid,.territory-doc-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .territory-next-paths{grid-template-columns:1fr}
}
@media(max-width:650px){
  .territory-portal{min-height:450px}
  .territory-hero-copy{padding:64px 0 45px}
  .territory-hero-copy h1{font-size:3.5rem}
  .territory-experience{padding-top:52px}
  .timeline-controls{grid-template-columns:1fr}
  #territoryMap,.map-shell{height:500px;min-height:500px}
  .map-legend{right:14px;max-width:none}
  .territory-card-grid,.territory-doc-grid{grid-template-columns:1fr}
}
@media(max-width:480px){
  #territoryMap,.map-shell{height:440px;min-height:440px}
  .territory-hero-copy h1{font-size:3rem}
}
