/* =====================================================================
   MAPPA INTERATTIVA DEI BLOCCHI
   Componenti isolati con prefisso .block-map- per evitare collisioni.
   ===================================================================== */

html,body{
  max-width:100%;
  overflow-x:hidden;
}

.block-map-section{
  position:relative;
  width:100%;
  max-width:100%;
  overflow:hidden;
}
/* Mantiene la stessa larghezza massima (1140px) delle altre sezioni. */
.block-map-section .wrap{
  min-width:0;
}
.block-map-shell,
.block-map-main,
.block-map-scroll{
  min-width:0;
  max-width:100%;
}
.block-map-header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:28px;
}
.block-map-header .lead{
  margin:16px 0 0;
  max-width:780px;
}
.block-map-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  flex:none;
}
.block-map-actions .card-link{
  margin-top:0;
}
.dark .block-map-actions .card-link{
  color:#fff;
  border-color:rgba(134,203,228,.72);
}
.dark .block-map-actions .card-link:hover{
  color:var(--ink);
  background:#86CBE4;
  border-color:#86CBE4;
}

.block-map-zone-nav{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:9px;
  margin-top:30px;
}
.block-map-zone-nav-label{
  margin-right:4px;
  color:var(--muted-d);
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.block-map-zone-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  padding:0;
  border:1.5px solid rgba(255,255,255,.34);
  border-radius:50%;
  background:transparent;
  color:#fff;
  font-family:'Anton',sans-serif;
  font-size:1.1rem;
  line-height:1;
  cursor:pointer;
  transition:transform .15s,background .15s,color .15s,border-color .15s;
}
.block-map-zone-chip:hover,
.block-map-zone-chip:focus-visible{
  transform:translateY(-2px);
  border-color:var(--giallo);
  outline:none;
}
.block-map-zone-chip[aria-pressed="true"]{
  border-color:var(--giallo);
  background:var(--giallo);
  color:var(--ink);
}

.block-map-shell{
  display:grid;
  grid-template-columns:minmax(0,1.75fr) minmax(300px,.75fr);
  gap:24px;
  align-items:start;
  margin-top:16px;
}
.block-map-main{
  min-width:0;
}
.block-map-scroll-hint{
  display:none;
  margin:0 0 10px;
  color:var(--muted-d);
  font-size:.78rem;
  font-weight:700;
}
.block-map-scroll{
  min-width:0;
}
.block-map-canvas{
  position:relative;
  isolation:isolate;
  width:100%;
  aspect-ratio:1190.25 / 842.25;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.18);
  border-radius:18px;
  background:#fff;
  box-shadow:0 20px 54px rgba(0,0,0,.28);
}
.block-map-canvas img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
}
.block-map-hotspot{
  position:absolute;
  z-index:3;
  left:var(--x);
  top:var(--y);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:clamp(34px,3.55vw,44px);
  aspect-ratio:1;
  padding:0;
  transform:translate(-50%,-50%);
  border:3px solid #fff;
  border-radius:50%;
  background:rgba(35,111,137,.94);
  color:#fff;
  box-shadow:0 7px 18px rgba(0,0,0,.42),0 0 0 4px rgba(46,143,176,.24);
  font-family:'Anton',sans-serif;
  font-size:clamp(1rem,1.7vw,1.32rem);
  line-height:1;
  cursor:pointer;
  transition:transform .15s,background .15s,color .15s,box-shadow .15s;
  touch-action:manipulation;
}
.block-map-hotspot::after{
  content:"";
  position:absolute;
  inset:-10px;
  border-radius:50%;
}
.block-map-hotspot:hover,
.block-map-hotspot:focus-visible{
  z-index:4;
  transform:translate(-50%,-50%) scale(1.1);
  outline:none;
  background:var(--azzurro);
  box-shadow:0 9px 24px rgba(0,0,0,.46),0 0 0 5px rgba(242,193,78,.48);
}
.block-map-hotspot[aria-pressed="true"]{
  z-index:4;
  background:var(--giallo);
  color:var(--ink);
  box-shadow:0 9px 24px rgba(0,0,0,.46),0 0 0 5px rgba(242,193,78,.52);
}

.block-map-legend{
  display:flex;
  flex-wrap:wrap;
  gap:8px 14px;
  margin:16px 0 0;
  padding:0;
  list-style:none;
  color:var(--muted-d);
  font-size:.72rem;
  font-weight:700;
}
.block-map-legend li{
  display:inline-flex;
  align-items:center;
  gap:7px;
}
.block-map-legend-dot{
  width:13px;
  height:13px;
  flex:none;
  border:1px solid rgba(255,255,255,.28);
  border-radius:50%;
}

.block-map-panel{
  position:sticky;
  top:88px;
  min-height:420px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  color:var(--ink);
  box-shadow:0 20px 54px rgba(0,0,0,.24);
  padding:24px;
}
.block-map-panel::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:5px;
  background:var(--azzurro);
}
.block-map-panel-head{
  display:flex;
  align-items:center;
  gap:14px;
  padding-right:38px;
}
.block-map-zone-mark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:54px;
  height:54px;
  flex:none;
  border-radius:50%;
  background:var(--azzurro);
  color:#fff;
  font-family:'Anton',sans-serif;
  font-size:1.8rem;
  line-height:1;
}
.block-map-panel-kicker{
  margin:0 0 4px;
  color:var(--azzurro-d);
  font-size:.68rem;
  font-weight:800;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.block-map-panel h3{
  margin:0;
  color:var(--ink);
  font-family:'Anton',sans-serif;
  font-size:1.72rem;
  line-height:1;
}
.block-map-panel-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:18px 0 0;
  padding-bottom:14px;
  border-bottom:1px solid var(--line);
  color:var(--muted);
  font-size:.82rem;
  font-weight:700;
}
.block-map-list{
  display:grid;
  gap:9px;
  margin:16px 0 0;
  padding:0;
  list-style:none;
}
.block-map-item{
  --block-accent:var(--ink);
  --block-circle:#242424;
  --block-circle-text:#fff;
  --block-circle-border:#242424;
  --block-pill:#242424;
  --block-pill-text:#fff;
  display:grid;
  grid-template-columns:36px minmax(0,1fr);
  gap:11px;
  align-items:center;
  min-width:0;
  border:1px solid var(--line);
  border-left:4px solid var(--block-accent);
  border-radius:12px;
  background:var(--cream);
  padding:10px 11px 10px 9px;
}
.block-map-item--very-easy{
  --block-accent:#9A7200;
  --block-circle:#F2C14E;
  --block-circle-text:#2E2D28;
  --block-circle-border:#D5A527;
  --block-pill:#F2C14E;
  --block-pill-text:#2E2D28;
}
.block-map-item--easy{
  --block-accent:#777166;
  --block-circle:#fff;
  --block-circle-text:#2E2D28;
  --block-circle-border:#AAA395;
  --block-pill:#fff;
  --block-pill-text:#2E2D28;
}
.block-map-item--medium{
  --block-accent:#347C49;
  --block-circle:#53A66A;
  --block-circle-text:#142719;
  --block-circle-border:#3C8B52;
  --block-pill:#53A66A;
  --block-pill-text:#142719;
}
.block-map-item--advanced{
  --block-accent:#236F89;
  --block-circle:#2E8FB0;
  --block-circle-text:#fff;
  --block-circle-border:#236F89;
  --block-pill:#2E8FB0;
  --block-pill-text:#fff;
}
.block-map-item--hard{
  --block-accent:#A93636;
  --block-circle:#C64545;
  --block-circle-text:#fff;
  --block-circle-border:#A93636;
  --block-pill:#C64545;
  --block-pill-text:#fff;
}
.block-map-item--very-hard{
  --block-accent:#242424;
  --block-circle:#242424;
  --block-circle-text:#fff;
  --block-circle-border:#111;
  --block-pill:#242424;
  --block-pill-text:#fff;
}
.block-map-number{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border:2px solid var(--block-circle-border);
  border-radius:50%;
  background:var(--block-circle);
  color:var(--block-circle-text);
  font-family:'Anton',sans-serif;
  font-size:1rem;
  line-height:1;
}
.block-map-item-body{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px 10px;
  align-items:center;
  min-width:0;
}
.block-map-name{
  min-width:0;
  overflow-wrap:anywhere;
  color:var(--block-accent);
  font-size:.86rem;
  font-weight:800;
  line-height:1.28;
}
.block-map-difficulty{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  flex:none;
  border:1px solid var(--block-circle-border);
  border-radius:999px;
  background:var(--block-pill);
  color:var(--block-pill-text);
  padding:3px 8px;
  font-size:.62rem;
  font-weight:800;
  letter-spacing:.025em;
  line-height:1;
  white-space:nowrap;
}
.block-map-close{
  display:none;
  position:absolute;
  z-index:2;
  top:14px;
  right:14px;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--cream);
  color:var(--ink);
  font-size:1.35rem;
  line-height:1;
  cursor:pointer;
}
.block-map-close:hover,
.block-map-close:focus-visible{
  outline:none;
  border-color:var(--azzurro);
  color:var(--azzurro-d);
}
.block-map-backdrop{
  display:none;
}

.block-map-legend-dot--very-easy{background:#F2C14E}
.block-map-legend-dot--easy{background:#fff}
.block-map-legend-dot--medium{background:#53A66A}
.block-map-legend-dot--advanced{background:#2E8FB0}
.block-map-legend-dot--hard{background:#C64545}
.block-map-legend-dot--very-hard{background:#242424}

@media(max-width:1080px){
  .block-map-shell{grid-template-columns:minmax(0,1.55fr) minmax(290px,.8fr)}
  .block-map-panel{padding:21px}
}

@media(max-width:960px){
  .block-map-header{
    align-items:flex-start;
    flex-direction:column;
  }
  .block-map-shell{
    grid-template-columns:minmax(0,1fr);
    gap:18px;
  }

  /* Mobile: il pannello viene spostato via JS direttamente sotto <body>.
     Cosi e un vero overlay di viewport, non puo allargare la griglia della
     mappa e non genera la fascia vuota laterale su Android. */
  .block-map-panel{
    position:fixed;
    z-index:1001;
    top:50%;
    right:max(12px,env(safe-area-inset-right));
    bottom:auto;
    left:max(12px,env(safe-area-inset-left));
    display:flex;
    flex-direction:column;
    width:auto;
    max-width:620px;
    max-height:calc(100vh - 32px);
    max-height:calc(100dvh - 32px);
    min-height:0;
    overflow:hidden;
    margin:0 auto;
    border:1px solid var(--line);
    border-radius:18px;
    padding:24px;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transform:translateY(-50%) scale(.985);
    transition:opacity .18s ease,transform .18s ease,visibility 0s linear .18s;
    box-shadow:0 24px 70px rgba(0,0,0,.46);
  }
  .block-map-panel.is-open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    transform:translateY(-50%) scale(1);
    transition-delay:0s;
  }
  .block-map-panel .block-map-list{
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    padding-right:2px;
  }
  .block-map-close{
    display:inline-flex;
  }
  .block-map-backdrop{
    position:fixed;
    z-index:1000;
    inset:0;
    display:block;
    background:rgba(20,19,18,.68);
    -webkit-backdrop-filter:blur(3px);
    backdrop-filter:blur(3px);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .18s ease,visibility 0s linear .18s;
  }
  .block-map-backdrop.is-open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    transition-delay:0s;
  }
  body.block-map-panel-open{
    overflow:hidden;
    overscroll-behavior:none;
  }
}

@media(max-width:700px){
  .block-map-zone-nav{
    margin-top:24px;
  }
  .block-map-zone-chip{
    width:40px;
    height:40px;
  }
  .block-map-scroll-hint{
    display:block;
  }
  /* Mobile: la mappa occupa la larghezza disponibile e non viene piu
     forzata a 900px. Le coordinate percentuali dei punti restano valide. */
  .block-map-scroll{
    overflow:visible;
    margin-inline:0;
    padding:0;
  }
  .block-map-canvas{
    width:100%;
    max-width:100%;
  }
  .block-map-hotspot{
    width:clamp(26px,7.4vw,31px);
    border-width:2px;
    font-size:clamp(.8rem,3.8vw,.98rem);
    box-shadow:0 5px 13px rgba(0,0,0,.42),0 0 0 3px rgba(46,143,176,.24);
  }
  .block-map-hotspot::after{
    inset:-1px;
  }
  /* B-E sono molto ravvicinate nella stampa originale. Su telefono le
     etichette vengono distribuite leggermente per non sovrapporsi.
     Si impostano left/top direttamente per prevalere sui valori inline. */
  .block-map-hotspot[data-map-zone="B"]{left:65.2%;top:33.0%}
  .block-map-hotspot[data-map-zone="C"]{left:58.4%;top:23.4%}
  .block-map-hotspot[data-map-zone="D"]{left:51.2%;top:31.0%}
  .block-map-hotspot[data-map-zone="E"]{left:46.0%;top:42.0%}
  .block-map-legend{
    gap:8px 12px;
  }
}

@media(max-width:480px){
  .block-map-zone-nav{
    gap:8px;
  }
  .block-map-zone-nav-label{
    flex:0 0 100%;
    margin:0 0 2px;
  }
  .block-map-zone-chip{
    width:38px;
    height:38px;
  }
  .block-map-panel{
    right:max(8px,env(safe-area-inset-right));
    left:max(8px,env(safe-area-inset-left));
    max-height:calc(100vh - 16px);
    max-height:calc(100dvh - 16px);
    padding-right:18px;
    padding-left:18px;
  }
  .block-map-item{
    grid-template-columns:34px minmax(0,1fr);
    gap:9px;
    padding-right:9px;
  }
  .block-map-number{
    width:34px;
    height:34px;
    font-size:.94rem;
  }
  .block-map-item-body{
    grid-template-columns:minmax(0,1fr) auto;
    gap:7px 8px;
  }
  .block-map-name{
    font-size:.81rem;
  }
  .block-map-difficulty{
    padding-inline:7px;
    font-size:.58rem;
  }
}

@media(prefers-reduced-motion:reduce){
  .block-map-zone-chip,
  .block-map-hotspot,
  .block-map-panel,
  .block-map-backdrop{
    transition:none;
  }
}
