/* assets/css/navigazione.css */
/* Miaterra — menu scene, progresso, home, toggle menu, bussola */

/* ---------- Menu scene ---------- */
.hm-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: var(--hm-z-nav);
  background: linear-gradient(to top, rgba(7,16,7,.92), rgba(7,16,7,0));
  padding: var(--hm-sp-4) var(--hm-sp-3) var(--hm-sp-3);
  pointer-events: none;
  transition: opacity var(--hm-t-med) var(--hm-ease), transform var(--hm-t-med) var(--hm-ease);
}
.hm-nav.nascosta {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}
.hm-nav-lista {
  display: flex;
  gap: var(--hm-sp-2);
  overflow-x: auto;
  padding: var(--hm-sp-2) 0;
  scrollbar-width: thin;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}
.hm-nav-lista::-webkit-scrollbar { height: 4px; }
.hm-nav-lista::-webkit-scrollbar-thumb { background: rgba(255,224,102,.4); border-radius: 2px; }

.hm-nav-item {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: rgba(31, 77, 31, 0.28);
  color: var(--hm-crema);
  border: 1px solid rgba(255, 224, 102, 0.35);
  border-radius: var(--hm-radius-pill);
  font: inherit; font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform var(--hm-t-fast) var(--hm-ease),
              background var(--hm-t-fast) var(--hm-ease),
              border-color var(--hm-t-fast) var(--hm-ease);
}
.hm-nav-item:hover,
.hm-nav-item:focus-visible {
  background: rgba(50, 112, 45, 0.45);
  border-color: var(--hm-ambra-500);
  transform: translateY(-2px);
  outline: none;
}
.hm-nav-item.attiva {
  background: rgba(255, 224, 102, 0.55);
  color: var(--hm-verde-900);
  border-color: var(--hm-ambra-300);
  font-weight: 600;
}
.hm-nav-item .hm-nav-tipo {
  font-size: 11px; opacity: .85;
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: var(--hm-radius-pill);
}

/* ---------- FAB circolari ---------- */
.hm-home,
.hm-progresso-circolare,
.hm-nav-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(7, 16, 7, 0.85);
  color: var(--hm-ambra-500);
  border: 1px solid rgba(255, 224, 102, 0.35);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: transform var(--hm-t-fast) var(--hm-ease), background var(--hm-t-fast) var(--hm-ease);
  z-index: var(--hm-z-fab);
  padding: 0;
  box-sizing: border-box;
}
.hm-home:hover,
.hm-progresso-circolare:hover,
.hm-nav-toggle:hover {
  transform: scale(1.08);
  background: rgba(31, 77, 31, 0.95);
}
.hm-home:focus-visible,
.hm-progresso-circolare:focus-visible,
.hm-nav-toggle:focus-visible {
  outline: 3px solid var(--hm-ambra-300);
  outline-offset: 3px;
}

.hm-home {
  position: fixed;
  top: max(var(--hm-sp-3), env(safe-area-inset-top));
  left: max(var(--hm-sp-3), env(safe-area-inset-left));
}
.hm-progresso-circolare {
  position: fixed;
  top: max(var(--hm-sp-3), env(safe-area-inset-top));
  right: max(var(--hm-sp-3), env(safe-area-inset-right));
  cursor: pointer;
}
.hm-nav-toggle {
  position: fixed;
  top: calc(max(var(--hm-sp-3), env(safe-area-inset-top)) + 56px);
  right: max(var(--hm-sp-3), env(safe-area-inset-right));
  border-color: var(--hm-ambra-500);
}

/* ---------- Anello di progresso ---------- */
.hm-progresso-circolare .hm-anello {
  position: absolute;
  top: 0; left: 0;
  width: 48px; height: 48px;
  transform: rotate(-90deg);
  pointer-events: none;
}
.hm-progresso-circolare .hm-anello-sfondo {
  fill: none;
  stroke: rgba(255,255,255,.15);
  stroke-width: 3;
}
.hm-progresso-circolare .hm-anello-riempimento {
  fill: none;
  stroke: var(--hm-ambra-500);
  stroke-width: 3;
  stroke-linecap: round;
  /* circonferenza = 2 * pi * 20 = 125.66 */
  stroke-dasharray: 125.66;
  stroke-dashoffset: 125.66;
  transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}
.hm-progresso-circolare .hm-anello-riempimento.completo { stroke: #6fae5f; }
.hm-progresso-circolare .hm-progresso-icona {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}
.hm-progresso-tooltip {
  position: absolute;
  top: 56px; right: 0;
  background: rgba(7,16,7,.95);
  color: var(--hm-crema);
  border: 1px solid rgba(255,224,102,.35);
  border-radius: var(--hm-radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--hm-t-fast) var(--hm-ease), transform var(--hm-t-fast) var(--hm-ease);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  text-align: right;
  z-index: var(--hm-z-tooltip);
}
.hm-progresso-circolare:hover .hm-progresso-tooltip,
.hm-progresso-circolare:focus-within .hm-progresso-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Bussola ---------- */
.hm-bussola {
  position: fixed;
  bottom: max(var(--hm-sp-3), env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--hm-z-bussola);
  height: 36px;
  min-width: 200px;
  background: rgba(7, 16, 7, 0.35);
  border: 1px solid rgba(255, 224, 102, 0.25);
  border-radius: 18px;
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  transition: opacity var(--hm-t-med) var(--hm-ease);
}
.hm-bussola.visibile { display: flex; }
.hm-bussola-tacca {
  width: 1px; height: 12px;
  background: rgba(255, 255, 255, 0.3);
}
.hm-bussola-freccia {
  color: var(--hm-ambra-500);
  font-size: 14px;
  transition: transform 0.2s linear;
}
.hm-bussola-gradi {
  font-size: 11px;
  font-family: monospace;
  color: var(--hm-ambra-300);
  min-width: 28px;
  text-align: center;
}
.hm-bussola-freccia-lato {
  color: rgba(255, 255, 255, 0.3);
  transition: color var(--hm-t-fast) var(--hm-ease),
              text-shadow var(--hm-t-fast) var(--hm-ease),
              transform var(--hm-t-fast) var(--hm-ease);
}
.hm-bussola-freccia-lato.attiva {
  color: var(--hm-ambra-500);
  text-shadow: 0 0 8px rgba(255, 224, 102, 0.8),
               0 0 16px rgba(255, 224, 102, 0.4);
  transform: scale(1.3);
}

/* ---------- Pannello: nascondi FAB ---------- */
.pannello { z-index: var(--hm-z-panel); }
body.pannello-aperto .hm-progresso-circolare,
body.pannello-aperto .hm-home,
body.pannello-aperto .hm-nav-toggle,
body.pannello-aperto .hm-bussola,
body.pannello-aperto .hm-freccia {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------- Pannellum controls ---------- */
#media-container .pnlm-controls-container {
  top: auto !important;
  left: auto !important;
  right: 16px !important;
  bottom: 80px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: var(--hm-z-pannellum);
}
#media-container .pnlm-controls-container .pnlm-control { margin: 0 !important; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .hm-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .hm-nav-lista { flex-direction: column; align-items: stretch; padding-bottom: 60px; }
  .hm-nav-item { justify-content: space-between; }
  #media-container .pnlm-controls-container { bottom: 140px !important; right: 12px !important; }
  .hm-nav-toggle { top: calc(max(var(--hm-sp-3), env(safe-area-inset-top)) + 52px); }
  .hm-bussola { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .hm-home, .hm-progresso-circolare, .hm-nav-toggle {
    width: 42px; height: 42px; font-size: 18px;
  }
  .hm-progresso-circolare { width: 42px; height: 42px; }
  .hm-progresso-circolare .hm-anello { width: 42px; height: 42px; }
  .hm-nav-toggle { top: calc(max(var(--hm-sp-3), env(safe-area-inset-top)) + 50px); }
  .hm-progresso-tooltip { font-size: 11px; padding: 6px 10px; }
  .hm-progresso-circolare .hm-progresso-icona { font-size: 18px; }
}