.territory{
  padding:clamp(120px,16vh,190px) 3vw 8vh;
  background:linear-gradient(180deg,#F8F5FA 0%,#EEE7F3 100%);
}

.territory-head{
  max-width:1250px;
  padding:0 3vw;
}

.territory-head h2{
  max-width:1100px;
}

.territory-head p{
  margin-top:28px;
  font-size:15px;
}

.map-experience{
  display:block;
  margin-top:clamp(70px,10vh,110px);
}

.map-stage{
  position:relative;
  min-height:850px!important;
  overflow:hidden;
  isolation:isolate;
  border:1px solid rgba(89,38,152,.12);
  border-radius:48px!important;
  background:#DDD2E7!important;
  box-shadow:0 45px 120px rgba(89,38,152,.16);
  cursor:default;
  width:100%;
  margin-left:0;
  transition:
    width .75s cubic-bezier(.2,.8,.2,1),
    margin-left .75s cubic-bezier(.2,.8,.2,1),
    min-height .75s cubic-bezier(.2,.8,.2,1),
    border-radius .6s ease,
    box-shadow .6s ease;
}

.map-stage:before{
  content:"";
  position:absolute;
  z-index:3;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(180deg,rgba(255,255,255,.52),transparent 22%,transparent 72%,rgba(50,19,78,.17)),
    linear-gradient(90deg,rgba(89,38,152,.12),transparent 34%,transparent 72%,rgba(89,38,152,.08));
}

.map-stage:after{
  content:"";
  position:absolute;
  z-index:3;
  inset:0;
  pointer-events:none;
  opacity:.16;
  background-image:radial-gradient(rgba(89,38,152,.34) .65px,transparent .65px);
  background-size:8px 8px;
  mix-blend-mode:multiply;
}

.map-world{
  position:absolute;
  z-index:1;
  inset:4% 2% -3%;
  transform:scale(1);
  transform-origin:center;
  transition:transform .7s cubic-bezier(.2,.75,.18,1),filter .8s ease;
  will-change:transform;
  perspective:1400px;
}

@media(hover:hover) and (min-width:901px){
  .map-stage:hover{
    box-shadow:0 50px 130px rgba(89,38,152,.2);
  }
}

.map-stage.focused .map-world{
  transform:translateX(-15%) scale(.78)!important;
  transform-origin:38% 52%;
}

.map-3d-object{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
  filter:drop-shadow(0 30px 40px rgba(64,29,96,.14));
}

.map-atmosphere{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 70% 44%,rgba(246,208,2,.24),transparent 17%),
    radial-gradient(circle at 45% 56%,rgba(89,38,152,.17),transparent 32%),
    linear-gradient(118deg,rgba(255,255,255,.38),transparent 42%);
  mix-blend-mode:screen;
  pointer-events:none;
}

.map-glow{
  position:absolute;
  z-index:4;
  width:300px;
  height:300px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(246,208,2,.28),rgba(255,255,255,.13) 38%,transparent 72%);
  transform:translate(-50%,-50%);
  opacity:0;
  transition:opacity .3s;
  pointer-events:none;
  mix-blend-mode:screen;
}

.map-stage:hover .map-glow{
  opacity:1;
}

.map-topbar{
  position:absolute;
  z-index:12;
  top:22px;
  left:22px;
  right:auto;
  height:62px;
  display:flex;
  align-items:center;
  gap:24px;
  padding:0 16px 0 20px;
  border:1px solid rgba(255,255,255,.76);
  border-radius:32px;
  background:rgba(255,255,255,.78);
  box-shadow:0 12px 38px rgba(89,38,152,.09);
  backdrop-filter:blur(20px);
}

.map-topbar .map-live{
  display:none;
}

.map-brand{
  width:118px;
  max-height:39px;
  object-fit:contain;
}

.map-live{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:auto;
  color:#5D5265;
  font-size:10px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.map-live i{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#F6D002;
  box-shadow:0 0 0 0 rgba(246,208,2,.4);
  animation:mapLive 2s ease-out infinite;
}

@keyframes mapLive{
  60%{box-shadow:0 0 0 10px rgba(246,208,2,0)}
}

.map-reset{
  border:0;
  border-radius:22px;
  padding:12px 17px;
  background:#592698;
  color:#fff;
  font:700 10px Montserrat,sans-serif;
  cursor:pointer;
}

.map-reset:hover,
.map-reset:focus-visible{
  background:#F6D002;
  color:#38204C;
  outline:3px solid rgba(255,255,255,.75);
}

.map-title{
  position:absolute;
  z-index:5;
  left:5.5%;
  bottom:19%;
  transition:opacity .45s,transform .6s;
  pointer-events:none;
}

.map-title span{
  display:block;
  color:rgba(89,38,152,.72);
  font-size:clamp(72px,11vw,170px);
  font-weight:900;
  line-height:.78;
  letter-spacing:-.085em;
}

.map-title small{
  display:block;
  margin-top:20px;
  color:#592698;
  font-size:10px;
  font-weight:800;
  letter-spacing:.24em;
}

.map-stage.focused .map-title{
  opacity:0;
  transform:translateY(30px);
}

.route{
  position:absolute;
  z-index:2;
  height:2px;
  overflow:visible;
  border-radius:3px;
  opacity:.66;
  transform-origin:left center;
  background:linear-gradient(90deg,transparent,rgba(89,38,152,.76),#F6D002);
  pointer-events:none;
}

.route:before{
  content:"";
  position:absolute;
  inset:-3px 0;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.9),transparent);
  transform:translateX(-100%);
  animation:routeTravel 3.6s ease-in-out infinite;
}

.route:after{
  right:-2px;
  top:-4px;
  width:10px;
  height:10px;
}

@keyframes routeTravel{
  55%,100%{transform:translateX(130%)}
}

.route-a{left:65%;top:43%;width:19%;transform:rotate(-9deg)}
.route-b{left:44%;top:54%;width:24%;transform:rotate(-5deg)}
.route-c{left:27%;top:70%;width:26%;transform:rotate(10deg)}


.map-point span{
  left:26px;
  top:-8px;
  padding:9px 12px;
  border:1px solid rgba(89,38,152,.1);
  border-radius:18px;
  box-shadow:0 10px 24px rgba(89,38,152,.12);
  font-size:10px;
}

.map-stage.focused .map-point:not(.active){
  opacity:.2;
}

.map-instruction{
  z-index:9;
  left:28px;
  bottom:86px;
  display:flex;
  align-items:center;
  gap:15px;
  padding:12px 17px 12px 12px;
  border:1px solid rgba(255,255,255,.75);
  background:rgba(255,255,255,.76);
  box-shadow:0 12px 34px rgba(89,38,152,.1);
  backdrop-filter:blur(18px);
  transition:opacity .35s,transform .45s;
}

.map-instruction>div{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.map-instruction b{
  font-size:11px;
}

.map-instruction span{
  font-size:9px;
}

.cursor-orbit{
  position:relative;
  width:34px;
  height:34px;
  border:1px solid rgba(89,38,152,.18);
  border-radius:50%;
}

.cursor-orbit:before,
.cursor-orbit:after{
  content:"";
  position:absolute;
  border-radius:50%;
}

.cursor-orbit:before{
  inset:8px;
  border:1px dashed #592698;
  animation:spin 5s linear infinite;
}

.cursor-orbit:after{
  width:6px;
  height:6px;
  left:14px;
  top:14px;
  background:#F6D002;
}

.map-stage.focused .map-instruction{
  opacity:0;
  transform:translateY(15px);
}

.city-panel{
  position:absolute;
  z-index:14;
  top:28px;
  right:24px;
  bottom:98px;
  width:370px;
  min-width:0;
  display:flex;
  padding:28px;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:rgba(89,38,152,.2) transparent;
  border:1px solid rgba(255,255,255,.9);
  border-radius:32px!important;
  background:rgba(255,255,255,.9)!important;
  box-shadow:0 35px 90px rgba(50,16,75,.2)!important;
  backdrop-filter:blur(28px);
  opacity:0;
  visibility:hidden;
  transform:translateX(calc(100% + 45px));
  transition:opacity .45s,visibility .45s,transform .7s cubic-bezier(.2,.75,.18,1)!important;
}

.city-panel::-webkit-scrollbar{
  width:5px;
}

.city-panel::-webkit-scrollbar-thumb{
  border-radius:8px;
  background:rgba(89,38,152,.2);
}

.map-stage.focused .city-panel{
  opacity:1;
  visibility:visible;
  transform:translateX(0);
}

.city-panel.changed{
  transform:translateX(0)!important;
}

.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.panel-head button{
  width:34px;
  height:34px;
  border:0;
  border-radius:50%;
  background:#F2ECF6;
  color:#592698;
  font-size:21px;
  cursor:pointer;
}

.panel-head button:hover,
.panel-head button:focus-visible{
  background:#F6D002;
  outline:2px solid #592698;
  outline-offset:2px;
}

.city-panel h3{
  margin:14px 0 18px;
  font-size:clamp(28px,2.35vw,40px);
  line-height:1;
  letter-spacing:-.05em;
}

.panel-main strong{
  font-size:clamp(48px,4vw,66px);
}

.panel-mini{
  margin:18px 0 14px;
}

.panel-mini div{
  padding:13px 14px;
}

.city-meta{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:14px;
}

.city-meta span{
  padding-top:12px;
  border-top:1px solid #E7DFEC;
}

.city-meta b,
.city-meta em{
  display:block;
  font-size:9px;
  line-height:1.5;
}

.city-meta b{
  color:#8C8194;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.city-meta em{
  margin-top:4px;
  color:#4E4356;
  font-style:normal;
  font-weight:700;
}

.city-panel>p{
  margin:0 0 13px;
  color:#706978;
  font-size:11px;
  line-height:1.6;
}

.activity-tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:13px;
}

.activity-tags span{
  padding:7px 9px;
  border-radius:14px;
  background:#F2ECF6;
  color:#592698;
  font-size:8px;
  font-weight:700;
}

.city-photo-carousel{
  position:relative;
  min-width:0;
  margin-top:0;
}

.photo-slots{
  display:flex;
  gap:12px;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  padding:2px;
  scroll-behavior:smooth;
  scroll-snap-type:x mandatory;
  overscroll-behavior-inline:contain;
  scrollbar-width:none;
}

.photo-slots::-webkit-scrollbar{
  display:none;
}

.photo-slots a{
  position:relative;
  display:block;
  flex:0 0 min(78%,240px);
  aspect-ratio:4/3;
  overflow:hidden;
  padding:0;
  border-radius:16px;
  background:#F2ECF6;
  text-decoration:none;
  scroll-snap-align:start;
  scroll-snap-stop:always;
}

.photo-slots a img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  transition:transform .45s cubic-bezier(.2,.8,.2,1),filter .35s ease;
}

.photo-slots a:hover img,
.photo-slots a:focus-visible img{
  transform:scale(1.07);
  filter:saturate(1.08);
}

.photo-slots a:focus-visible{
  outline:3px solid #F6D002;
  outline-offset:2px;
}

.photo-nav{
  position:absolute;
  top:50%;
  z-index:2;
  width:38px;
  height:38px;
  border:0;
  border-radius:50%;
  background:rgba(255,255,255,.94);
  color:#592698;
  box-shadow:0 8px 24px rgba(38,17,63,.18);
  font:700 19px/1 Montserrat,sans-serif;
  cursor:pointer;
  transform:translateY(-50%);
  transition:transform .25s ease,opacity .25s ease,box-shadow .25s ease;
}

.photo-nav:hover,
.photo-nav:focus-visible{
  transform:translateY(-50%) scale(1.06);
  box-shadow:0 10px 28px rgba(38,17,63,.25);
}

.photo-nav:focus-visible{
  outline:3px solid #F6D002;
  outline-offset:2px;
}

.photo-nav:disabled{
  opacity:0;
  pointer-events:none;
}

.photo-nav[hidden]{
  display:none;
}

.photo-prev{
  left:8px;
}

.photo-next{
  right:8px;
}

.photo-empty{
  display:grid;
  flex:1 0 100%;
  min-height:100px;
  place-items:center;
  border-radius:16px;
  background:#F6F2F8;
  color:#6F6179;
  font-size:10px;
  font-weight:700;
}

.city-rail{
  position:absolute;
  z-index:13;
  left:50%;
  bottom:22px;
  width:min(78%,1080px);
  height:56px;
  display:flex;
  align-items:center;
  gap:4px;
  overflow-x:auto;
  padding:5px;
  border:1px solid rgba(255,255,255,.75);
  border-radius:29px;
  background:rgba(255,255,255,.78);
  box-shadow:0 12px 34px rgba(50,16,75,.13);
  backdrop-filter:blur(20px);
  transform:translateX(-50%);
  transition:
    left .65s cubic-bezier(.2,.8,.2,1),
    right .65s cubic-bezier(.2,.8,.2,1),
    width .65s cubic-bezier(.2,.8,.2,1),
    transform .65s cubic-bezier(.2,.8,.2,1);
  scrollbar-width:none;
}

.map-stage.focused .city-rail{
  left:24px;
  right:418px;
  width:auto;
  transform:none;
}

.city-rail::-webkit-scrollbar{
  display:none;
}

.city-rail button{
  flex:0 0 auto;
  height:42px;
  padding:0 16px;
  border:0;
  border-radius:19px;
  background:transparent;
  color:#675B6F;
  font:700 11px Montserrat,sans-serif;
  cursor:pointer;
  white-space:nowrap;
}

body.map-active .nav{
  transform:translateY(calc(-100% - 28px));
  opacity:0;
  pointer-events:none;
}

.nav{
  transition:transform .45s cubic-bezier(.2,.8,.2,1),opacity .3s ease;
}

.city-rail button:hover,
.city-rail button:focus-visible,
.city-rail button.active{
  background:#592698;
  color:#fff;
  outline:none;
}

.map-progress{
  position:absolute;
  z-index:15;
  left:8%;
  right:8%;
  bottom:0;
  height:3px;
  overflow:hidden;
  border-radius:2px;
  background:rgba(255,255,255,.35);
}

.map-progress i{
  display:block;
  width:0;
  height:100%;
  background:#F6D002;
  transition:width .55s cubic-bezier(.2,.8,.2,1);
}

@media(max-width:900px){
  .territory{
    padding-left:18px;
    padding-right:18px;
  }

  .territory-head{
    padding:0 6px;
  }

  .map-stage{
    min-height:760px!important;
    border-radius:34px!important;
  }

  .map-topbar{
    top:14px;
    left:14px;
    right:14px;
  }

  .map-live{
    display:none;
  }

  .map-brand{
    width:102px;
  }

  .map-title{
    left:7%;
    bottom:26%;
  }

  .map-title span{
    font-size:17vw;
  }

  .map-instruction{
    left:18px;
    bottom:82px;
  }

  .city-panel{
    top:auto;
    left:12px;
    right:12px;
    bottom:72px;
    width:auto;
    min-width:0;
    max-height:64%;
    padding:25px;
    overflow-y:auto;
    border-radius:28px!important;
    transform:translateY(calc(100% + 90px));
  }

  .map-stage.focused .map-world{
    transform:translateY(-18%) scale(.72)!important;
    transform-origin:50% 28%;
  }

  .map-stage.focused .city-panel,
  .city-panel.changed{
    transform:translateY(0)!important;
  }

  .photo-slots{
    display:flex;
  }

  .photo-slots a{
    flex-basis:88%;
  }

  .photo-nav{
    width:34px;
    height:34px;
  }

  .city-rail{
    left:14px;
    right:14px;
    width:auto;
    transform:none;
  }

  .map-stage.focused .city-rail{
    left:14px;
    right:14px;
  }

  .city-rail button{
    font-size:10px;
    padding:0 14px;
  }

  .map-progress{
    left:12%;
    right:12%;
  }
}

@media(min-width:901px) and (max-width:1200px){
  .city-panel{
    width:330px;
    right:18px;
    padding:24px;
  }

  .map-stage.focused .city-rail{
    left:18px;
    right:366px;
  }

  .city-rail button{
    padding:0 13px;
    font-size:10px;
  }
}

@media(max-width:560px){
  .map-stage{
    min-height:700px!important;
  }

  .map-reset{
    padding:10px 12px;
  }

  .map-instruction{
    right:18px;
  }

  .cursor-orbit{
    display:none;
  }

  .city-panel{
    max-height:70%;
  }

  .panel-mini,
  .city-meta{
    grid-template-columns:1fr 1fr;
  }
}

@media(prefers-reduced-motion:reduce){
  .map-world,
  .city-panel,
  .map-point,
  .map-title,
  .map-instruction{
    transition:none!important;
  }
}

/* Leitura e navegação do painel municipal. */
[hidden]{display:none!important}

.city-panel{
  right:20px;
  bottom:auto;
  width:430px;
  max-height:calc(100% - 116px);
  padding:30px 32px 32px;
}

.panel-head{
  position:sticky;
  z-index:3;
  top:-30px;
  margin:-30px -32px 0;
  padding:24px 32px 12px;
  background:linear-gradient(180deg,rgba(255,255,255,.98) 72%,rgba(255,255,255,0));
}

.panel-head>div{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.panel-head small{
  color:#8C8194;
  font-size:10px;
  font-weight:600;
}

.city-panel h3{
  margin:10px 0 16px;
  font-size:clamp(30px,2.45vw,42px);
}

.panel-main{
  padding-bottom:18px;
  border-bottom:1px solid #E7DFEC;
}

.panel-main strong{
  color:#17131D;
  line-height:.94;
}

.panel-main span{
  margin-top:7px;
  font-size:12px;
  line-height:1.45;
}

.panel-mini[hidden]{display:none!important}

.city-meta{
  gap:16px;
  margin:16px 0 18px;
}

.city-meta span{
  min-width:0;
  padding:12px 0 0;
}

.city-meta b{font-size:10px}
.city-meta em{font-size:11px;line-height:1.45}

.city-panel>p{
  margin-bottom:18px;
  color:#5F5567;
  font-size:13px;
  line-height:1.68;
}

.city-school-list{
  margin-bottom:16px;
  padding:15px 17px;
  border:1px solid rgba(89,38,152,.08);
  background:#F7F3F9;
  font-size:11px;
  line-height:1.55;
}

.city-school-list li+li{margin-top:5px}

.activity-tags{margin:0 0 16px}
.activity-tags span{padding:8px 11px;font-size:9px}

.city-photo-carousel[hidden]{display:none!important}

.map-stage.focused .map-world{
  transform:translateX(-17%) scale(.76)!important;
  transform-origin:36% 52%;
}

.city-step{
  position:absolute;
  z-index:16;
  bottom:29px;
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border:1px solid rgba(89,38,152,.12);
  border-radius:50%;
  background:rgba(255,255,255,.96);
  color:#592698;
  box-shadow:0 8px 24px rgba(50,16,75,.14);
  font:800 17px/1 Montserrat,sans-serif;
  cursor:pointer;
  opacity:0;
  visibility:hidden;
  transition:opacity .25s,transform .25s,background .25s;
}

.city-step-prev{left:26px}
.city-step-next{right:464px}

.map-stage.focused .city-step{
  opacity:1;
  visibility:visible;
}

.city-step:hover,.city-step:focus-visible{
  background:#F6D002;
  outline:3px solid rgba(89,38,152,.16);
  transform:translateY(-2px);
}

.city-step:disabled{
  opacity:.35;
  cursor:not-allowed;
  transform:none;
}

.map-stage.focused .city-rail{
  left:76px;
  right:516px;
}

.city-rail:focus-visible{
  outline:3px solid #F6D002;
  outline-offset:3px;
}

.map-progress{
  left:76px;
  right:516px;
  bottom:17px;
}

@media(min-width:901px) and (max-width:1200px){
  .city-panel{width:380px}
  .city-step-next{right:408px}
  .map-stage.focused .city-rail,.map-progress{right:460px}
}

@media(max-width:900px){
  .city-panel{
    left:10px;
    right:10px;
    bottom:76px;
    width:auto;
    max-height:68%;
    padding:24px 22px 26px;
  }
  .panel-head{
    top:-24px;
    margin:-24px -22px 0;
    padding:20px 22px 10px;
  }
  .map-stage.focused .map-world{
    transform:translateY(-22%) scale(.7)!important;
  }
  .city-step{bottom:29px}
  .city-step-prev{left:18px}
  .city-step-next{right:18px}
  .map-stage.focused .city-rail{
    left:66px;
    right:66px;
  }
  .map-progress{
    left:66px;
    right:66px;
    bottom:16px;
  }
}

@media(max-width:560px){
  .city-panel h3{font-size:30px}
  .panel-main strong{font-size:50px}
  .city-meta{grid-template-columns:1fr}
  .city-meta span+span{padding-top:10px}
}

@media(min-width:901px){
  .map-stage.focused .map-world{
    top:74px;
    right:474px;
    bottom:92px;
    left:24px;
    transform:none!important;
    transform-origin:center;
  }

  .map-stage.focused .map-3d-object{
    object-position:center;
  }
}

@media(min-width:901px) and (max-width:1200px){
  .map-stage.focused .map-world{right:420px}
}

/* Visão geral: fundo contínuo e mapa centralizado com folga para a navegação. */
.map-stage:not(.focused){
  background:#d7d6d8!important;
}

.map-stage:not(.focused) .map-world{
  inset:2% 2% 11%;
  transform:translateY(-8px) scale(.96);
  transform-origin:center;
}

@media(max-width:900px){
  .map-stage:not(.focused) .map-world{
    inset:3% 1.5% 14%;
    transform:translateY(-4px) scale(.96);
  }
}
