/*
Theme Name: legamiente
Author: legamiente
Description: A minimal WordPress theme for the 3D map.
Version: 1.0
*/
body {
  background-color: #143CF0 !important;
  margin: 0;
  padding: 0;
}

canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  /* Set a lower z-index for the canvas */
}


h1 {
  color: white !important;
  font-size: 2rem;
  position: absolute;
  top: 20px;
  left: 20px;
}

.container {
  display: flex;
  flex-direction: row;
}


#luoghi-submenu,
#associazioni-submenu,
.submenu-content,
#eventi-section,
#upcoming-events-box,
#event-details-upcoming {
  font-size: 14px !important;
  /* ≈ 4 mm */
  font-weight: 300 !important;
  line-height: 1.6 !important;
}

.location-list li:hover {
  background: rgba(255, 255, 255, 0.3);
}

/***************************************************************
     * RESET / BASE
    ***************************************************************/

/* === FONT TESTO (W3) ===================================== */
body {
  margin: 0;
  padding: 0;
  font-family: "OpenSans", serif;
  font-weight: 600;
  /* W3 */
  font-size: 9.5px;
  /* ≈ 2,5 mm (1 mm ≈ 3.78 px) */
  line-height: 1.45;
}

/* === FONT TITOLI / MENU (W6) ============================== */
.top-menu li,
.menu-items-left li,
.menu-items-right li,
h1,
h2,
h3,
h4,
h5,
h6,
.submenu-header {
  font-family: "OpenSans", serif;
  font-weight: 600;
  /* W6 */
  font-size: 19px;
  /* ≈ 5 mm */
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#sidebar-scroll-wrapper {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  /* Start narrow, expand when panel open via JS class */
  width: 280px;
  transition: width 0.3s;
  pointer-events: auto;
  /* Ensure scrollbar is usable */
  scrollbar-width: none;
  /* Hide scrollbar for cleaner look if desired, or keep it */
  -ms-overflow-style: none;
}

/* Optional: show scrollbar if user prefers, but existing had none. Keeping none for consistency */
#sidebar-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

#sidebar-scroll-wrapper.sidebar-expanded {
  width: 750px;
  /* Accommodate list (250) + gap (20) + panel (400) + scrollbar/padding */
}

.location-list {
  position: relative;
  /* Changed from absolute */
  top: 0;
  left: 10px;
  width: 250px;
  background: rgba(20, 60, 240, 0.2);
  padding: 20px;
  color: #fff;
  border-radius: 0;
  /* Remove internal scrolling */
  max-height: none;
  overflow-y: visible;
  margin-bottom: 20px;
  /* Space at bottom */
}

/***************************************************************
       * TOP MENU
      ***************************************************************/
.top-menu {
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 2rem;
  background: rgba(20, 60, 240, .20);
  color: #fff;
  z-index: 20;
  backdrop-filter: blur(2px);
  box-sizing: border-box;
}

.menu-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.menu-items-left {
  display: inline-flex;
  gap: 2rem;
}

.menu-items-right {
  display: inline-flex;
  gap: 2rem;
  margin-left: auto;
}

.menu-items-left li,
.menu-items-right li {
  cursor: pointer;
  font-weight: bold;
  transition: color 0.2s;
}

.menu-items-left li:hover,
.menu-items-right li:hover {
  color: rgb(179, 179, 179);
}

.menu-items-left li.active {
  color: #fff !important;
  text-decoration: none;
  border-bottom: 2px solid #fff;
  padding-bottom: 2px;
}

.mobile-menu-toggle {
  display: none;
  /* Hidden by default, shown via media query for mobile */
}

/***************************************************************
       * MAIN CONTAINER & (optional) CANVAS
      ***************************************************************/
.container {
  position: relative;
  padding-top: 64px;
  /* This should accommodate the fixed menu height on desktop */
}

#scene {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  /* Changed from 1 to -1 to be behind all content */
  display: block;
}

/***************************************************************
       * LOCATION LIST SECTIONS
      ***************************************************************/
#eventi-section {
  display: block;
}

.location-list li {
  background: transparent;
  color: #fff;
  margin: 8px 0;
  padding: 8px;
  font-size: 14px;
  font-weight: 300;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.location-list li:hover {
  background: rgba(255, 255, 255, 0.2);
}

.location-list li.active-submenu {
  background: #fff;
  color: #143CF0;
}


/***************************************************************
       *sub‐menu 
      ***************************************************************/
#luoghi-submenu {
  display: none;
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  width: auto;
  min-width: 500px;
  max-width: 700px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.9s ease;
}

.submenu-header {
  font-weight: bold;
  margin: 0.5rem 0;
  cursor: pointer;
}

.submenu-header:hover {
  color: #ffd;
}

.submenu-content {
  margin-left: 1rem;
  border-left: 2px solid rgba(255, 255, 255, 0.3);
  padding-left: 1rem;
  display: none;
  line-height: 1.5;
  max-height: 600px;
  overflow-y: auto;
}

.login-button {
  color: white;
  text-decoration: none;
  font-weight: bold;
  padding: 8px 15px;
  border-radius: 5px;
  transition: color 0.3s ease;
}

.login-button:hover {
  color: #b3b3b3;
}

.upcoming-events-box {
  width: 250px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#event-details-upcoming {
  flex: 1;
  background: rgba(255, 255, 255, 0.93);
  color: #222;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.submenu-content a {
  color: #ffdd44;
  text-decoration: underline;
  font-weight: 600;
  word-break: break-all;
}

#luogo-event-details {
  position: absolute;
  max-width: 380px;
  z-index: 60;
}

#luoghi-panel,
#associazioni-panel,
#manifestazioni-panel {
  position: absolute;
  /* top will be set by JS relative to wrapper */
  left: calc(10px + 250px + 20px);
  width: 400px !important;
  background: #fff;
  color: #143CF0;
  padding: 0.8rem 1.6rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  border-radius: 0;
  z-index: 15;
  display: none;
  /* Removed max-height and overflow-y to let wrapper handle scroll */
  max-height: none;
  overflow-y: visible;
}

/* Custom Scrollbar for Panels - REMOVED since we defer to wrapper */
/* #luoghi-panel::-webkit-scrollbar... removed */

#luoghi-panel h2,
#manifestazioni-panel h2 {
  margin: 0 0 .7rem;
  font-size: 22px;
  font-weight: 600;
}

#luoghi-panel h4,
#manifestazioni-panel h4 {
  font-size: 1.25rem;
  margin: 1rem 0 0.25rem;
  font-weight: 600;
}

#luoghi-panel p,
#manifestazioni-panel p,
#manifestazioni-panel .manif-desc {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

#luoghi-panel a,
#manifestazioni-panel a {
  color: #143CF0;
  text-decoration: underline;
}

.panel-close,
#luoghi-panel-close,
#associazioni-panel-close,
#manifestazioni-panel-close,
#upcoming-panel-close,
#calendar-section-close {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  user-select: none;
}

body,
.location-list li,
#event-details-upcoming,
.submenu-content,
#upcoming-events-box {
  font-family: "OpenSans", serif;
  font-weight: 300;
  font-size: 9.5px;
  line-height: 1.45;
}

.top-menu li,
.menu-items-left li,
.menu-items-right li,
h1,
h2,
h3,
h4,
h5,
h6,
#luoghi-panel h4,
#manifestazioni-panel h4,
.submenu-header {
  font-family: "OpenSans", serif;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.2;
}

.location-list li {
  font-size: 19px;
  font-weight: 600;
  padding: 8px;
}

#luoghi-panel p,
#manifestazioni-panel p,
#manifestazioni-panel .manif-desc {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

#luoghi-panel a,
#manifestazioni-panel a {
  font-size: 1rem;
}

#associazioni-panel h4 {
  font: 600 19px/1.2 "OpenSans", serif;
  margin: 1rem 0 .25rem;
}

#associazioni-panel p,
#associazioni-panel a {
  font: 300 1rem/1.5 "OpenSans", serif;
  margin: 0 0 .75rem;
  color: #143CF0;
}

#calendar-section {
  position: absolute;
  left: calc(10px + 250px + 20px);
  top: 140px;
  max-width: 380px;
  background: #fff;
  color: #143CF0;
  padding: 0.8rem 1.6rem;
  border-radius: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  z-index: 15;
}

#upcoming-panel {
  position: absolute;
  left: calc(10px + 250px + 20px);
  top: 88px;
  width: 400px !important;
  /* Removed fixed width */
  /* Added max-width */
  background: #fff;
  color: #143CF0;
  padding: 0.8rem 1.6rem;
  border-radius: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  z-index: 15;
}

#upcoming-panel .event-block h4 {
  font: 600 19px/1.2 "OpenSans", serif;
  margin: 0 0 .25rem;
}

#upcoming-panel .event-block .meta,
#upcoming-panel .event-block .toggle-desc,
#upcoming-panel .event-block .descr {
  font-family: "OpenSans", serif;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.5;
}

#upcoming-panel .event-block .toggle-desc {
  display: inline-block;
  margin-top: 0.25rem;
}

.up-track {
  min-height: 1px;
}

.up-nav {
  background: transparent;
  border: none;
  font: 600 24px/1 "OpenSans", serif;
  color: #143CF0;
  cursor: pointer;
  position: absolute;
  top: 8px;
}

#upcoming-prev {
  left: -28px;
}

#upcoming-next {
  right: -28px;
}

.up-dots {
  text-align: center;
  margin-top: 6px;
}

.up-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
  margin: 0 3px;
  cursor: pointer;
}

.up-dots .active {
  background: #143CF0;
}

.event-block {
  margin-bottom: 1.5rem;
}

.event-block h4 {
  font: 600 19px/1.2 "OpenSans", serif;
  margin: 0 0 .25rem;
}

.event-block h4 {
  cursor: pointer;
  /* pointer cursor ⇒ looks clickable   */
  text-decoration: underline;
  /* little visual clue                 */
}

.event-block .meta {
  font-size: 9.5px;
  margin: .25rem 0 0.75rem;
  color: #143CF0;
}

.event-block .meta {
  margin-bottom: 6px;
  line-height: 1.4;
}

.event-block .descr {
  margin: 0 0 8px;
}

.event-block .toggle-desc {
  font-size: 9.5px;
  color: #143CF0;
  text-decoration: underline;
}

#upcoming-panel .event-block .descr {
  margin: 0.75rem 0;
  line-height: 1.5;
}

#calendar-section {
  display: block;
}

.calendar-wrapper {
  display: flex;
  justify-content: center;
}

.calendar-grid {
  user-select: none;
}

.calendar-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  justify-content: center;
  font: 600 19px/1.2 "OpenSans", serif;
  margin-bottom: .5rem;
}

.calendar-prev,
.calendar-next {
  background: transparent;
  border: none;
  cursor: pointer;
  font: 600 20px/1 "OpenSans", serif;
  color: #143CF0;
}

.calendar-days-grid,
.calendar-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 24px);
  grid-auto-rows: 24px;
  gap: 0;
  border: 1px solid #143CF0;
  border-right: none;
  border-bottom: none;
}

.calendar-day,
.calendar-weekday-name {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #143CF0;
  border-bottom: 1px solid #143CF0;
  font: 600 9.5px/1 "OpenSans", serif;
  color: #143CF0;
}

.calendar-day-empty {
  background: transparent;
}

.calendar-day-today {
  background: #143CF010;
}

.event-count-badge {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #143CF0;
  color: #fff;
  font-size: 7px;
  line-height: 6px;
  text-align: center;
  position: absolute;
  top: 3px;
  left: 3px;
}

.event-count-badge:only-child:empty {}

#calendar-section {
  /* width:400px!important; */
  /* Removed fixed width */
  min-width: auto;
  /* Adjusted */
  max-width: 400px;
  /* Adjusted */
  padding-top: 30px;
}

.calendar-container-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 0;
}

.custom-calendar-container {
  position: static !important;
}

.calendar-container-wrapper {
  margin-top: 0 !important;
}

#calendar-section {
  padding: 2rem 1.6rem 1.6rem !important;
  /* top right/left bottom */
}

/* #calendar-section            { width:400px !important; } */
/* Removed fixed width */

.cal-track {
  margin-top: 22px;
}

.cal-track .event-block {
  margin-bottom: 24px;
}

.cal-track .event-block h4 {
  color: #143CF0;
}

.cal-track .event-block .meta,
.cal-track .event-block .descr,
.cal-track .event-block .toggle-desc {
  color: #143CF0;
}

.calendar-container-wrapper {
  flex-direction: column !important;
  align-items: center !important;
  gap: 22px;
}

#calendar-events-list {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.cal‑nav {
  background: transparent;
  border: none;
  font: 600 22px/1 "OpenSans", serif;
  color: #143CF0;
  cursor: pointer;
  margin: 0 8px;
  display: none !important;
}

.cal-dots {
  text-align: center;
  margin-top: 10px;
}

.cal-dots span {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: #ccc;
  margin: 0 3px;
  cursor: pointer;
}

.cal-dots span.active {
  background: #143CF0;
}

#calendar-events-list .cal-prev,
#calendar-events-list .cal-next {
  display: none !important;
}

#calendar-events-list {
  align-items: flex-start !important;
  text-align: left !important;
}

#calendar-events-list h4 {
  font: 600 19px/1.2 "OpenSans", serif;
  margin: 0 0 .5rem;
}

#calendar-events-list .meta,
#calendar-events-list .descr,
#calendar-events-list .toggle-desc {
  font: 300 1rem/1.5 "OpenSans", serif;
  color: #143CF0;
}

#calendar-events-list .descr {
  margin-bottom: .75rem;
}

#calendar-events-list .cal-dots {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
}

#upcoming-panel .up-dots {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
}

#upcoming-panel>.up-dots {
  width: 100%;
  display: flex;
  justify-content: center;
}

#calendar-events-list>.cal-dots {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.cal-dots {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
}

#calendar-section {
  padding-top: 40px;
}

.calendar-header {
  font: 700 26px/1 "OpenSans", serif;
  margin-bottom: 1rem;
}

.calendar-prev,
.calendar-next {
  font-size: 28px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 50%;
  transition: background .2s;
}

.calendar-prev:hover,
.calendar-next:hover {
  background: #143CF015;
}

.calendar-weekday-row {
  grid-template-columns: repeat(7, 46px);
  grid-auto-rows: 32px;
}

.calendar-weekday-name {
  font: 600 14px/32px "OpenSans", serif;
  color: #143CF0;
  background: #143CF005;
}

.calendar-days-grid {
  grid-template-columns: repeat(7, 46px);
  grid-auto-rows: 46px;
  gap: 4px;
  border: none;
}

.calendar-day,
.calendar-day-empty {
  border: none;
  font: 600 15px/46px "OpenSans", serif;
  color: #143CF0;
  border-radius: 12px;
  transition: background .15s, color .15s;
}

.calendar-day:hover {
  background: #143CF015;
}

.calendar-day-today {
  background: #143CF020;
  box-shadow: 0 0 0 2px #143CF040 inset;
}

.event-count-badge {
  width: 10px;
  height: 10px;
  font-size: 8px;
  line-height: 10px;
  color: #fff;
  background: #143CF0 !important;
  border-radius: 50%;
  position: absolute;
  bottom: 4px;
  right: 4px;
}

.cal-dots span.active,
.up-dots span.active {
  background: #143CF0;
}

.calendar-day-selected {
  background: #143CF0 !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #143CF0 inset,
    0 2px 6px rgba(0, 0, 0, .15);
  border-radius: 12px;
}

.calendar-day {
  cursor: pointer;
  transition:
    background .15s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.calendar-day:not(.calendar-day-selected):hover {
  background: #143CF025;
  transform: translateY(-1px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

#llm-panel,
#manifestazioni-panel {
  position: absolute;
  left: calc(10px + 250px + 20px);
  background: #fff;
  color: #143CF0;
  padding: 0.8rem 1.6rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  border-radius: 0;
  z-index: 15;
  display: none;
  width: 400px !important;
  /* Removed fixed width */
  /* Added max-width */
}

#llm-panel,
#manifestazioni-panel {
  /* left: 10px !important; */
  /* This was for a specific mobile layout, review if still needed */
  /* top : 88px !important; */
  /* This was for a specific mobile layout, review if still needed */
  /* width: 400px !important; */
  /* Already handled by max-width above */
}

#llm-panel h4 {
  font: 600 19px/1.2 "OpenSans", serif;
  margin: 0 0 .5rem;
}

#llm-panel p {
  font: 300 1rem/1.5 "OpenSans", serif;
  margin: 0 0 .75rem;
}

/* Original Responsive for Mobile from user, kept for reference if needed */
/* @media (max-width: 768px) {
  .container {
      flex-direction: column;
  }
  .location-list {
       width: 100%; 
       text-align: center; 
  }
  canvas {
       width: 100vw !important;
       height: 80vh !important;
  }
} */

/* .container .location-list{
    top:60px; 
} */

/* === INIZIO MODIFICHE RESPONSIVE AGGIUNTE === */

@media (max-width: 768px) {

  /* MOBILE STYLES */
  .container {
    flex-direction: column;
    padding-top: 56px;
    /* Adjusted for mobile fixed menu height */
    box-sizing: border-box;
  }

  /* Reset sidebar-scroll-wrapper for mobile - use normal document flow */
  #sidebar-scroll-wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
    z-index: 5 !important;
  }

  .location-list {
    width: 90%;
    margin: 0 auto;
    margin-top: 10px;
    text-align: left;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    background: rgba(20, 60, 240, 0.7);
    z-index: 5;
    padding: 1rem;
    border-radius: 8px;
    box-sizing: border-box;
    /* Scroll only if list exceeds available screen height */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - var(--mobBarH) - 30px);
  }

  .location-list ul li {
    text-align: left;
    font-size: 1rem;
  }

  canvas#scene {
    width: 100vw !important;
    height: 100vh !important;
    z-index: 0 !important;
  }

  :root {
    --mobBarH: 56px;
  }

  .top-menu {
    position: fixed !important;
    /* stays visible           */
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--mobBarH);
    z-index: 2000;
    /* above everything else   */
    background: rgba(20, 60, 240, .95);
    /* solid on scroll         */
    backdrop-filter: blur(4px);
  }

  .container {
    padding-top: var(--mobBarH);
  }

  .top-menu .menu-container {
    justify-content: space-between !important;
    width: 100% !important;
    align-items: center;
  }

  .menu-items-left,
  .menu-items-right {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: block !important;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    background: none;
    border: none;
  }

  .mobile-menu-popup {
    display: none;
    position: fixed;
    top: 50px;
    /* Adjusted based on typical mobile menu height (0.5rem padding + font) */
    left: 0;
    width: 100%;
    height: calc(100vh - 50px);
    background: rgba(10, 30, 180, 0.98);
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
    box-sizing: border-box;
  }

  .mobile-menu-popup.open {
    display: block !important;
  }

  .mobile-menu-popup ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-menu-popup ul li {
    padding: 1rem 0;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .mobile-menu-popup ul li:last-child {
    border-bottom: none;
  }

  .mobile-menu-popup ul li a,
  .mobile-menu-popup ul li span {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    display: block;
    font-weight: 600;
  }

  .mobile-menu-popup ul .login-button-mobile a {
    /* Corrected selector */
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: #fff;
    color: #143CF0;
    border-radius: 5px;
    margin-top: 1rem;
    font-weight: bold;
  }

  #luoghi-panel,
  #associazioni-panel,
  #manifestazioni-panel,
  #llm-panel,
  #calendar-section,
  #upcoming-panel {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 90% !important;
    max-width: 450px !important;
    margin: 1.5rem auto !important;
    float: none !important;
    padding: 1.5rem 1rem !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #143CF0 !important;
    z-index: 10 !important;
    /* Scroll isolation - prevent background map from scrolling */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-height: 60vh;
  }

  /* When a panel is open on mobile, hide the left menu, prevent body scroll, and show panel from top */
  body.mobile-panel-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  body.mobile-panel-open .location-list {
    display: none !important;
  }

  body.mobile-panel-open #luoghi-panel,
  body.mobile-panel-open #associazioni-panel,
  body.mobile-panel-open #manifestazioni-panel,
  body.mobile-panel-open #calendar-section,
  body.mobile-panel-open #upcoming-panel {
    margin-top: 10px !important;
    max-height: calc(100vh - var(--mobBarH) - 40px) !important;
    border-radius: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  #luoghi-panel h2,
  #luoghi-panel h4,
  #associazioni-panel h4,
  #manifestazioni-panel h4,
  #llm-panel h4,
  #upcoming-panel .event-block h4,
  #calendar-section .calendar-header {
    color: #143CF0 !important;
  }

  #luoghi-panel p,
  #associazioni-panel p,
  #manifestazioni-panel p,
  #manifestazioni-panel .manif-desc,
  #llm-panel p,
  #upcoming-panel .event-block .meta,
  #upcoming-panel .event-block .descr,
  #calendar-events-list .meta,
  #calendar-events-list .descr {
    color: #333 !important;
    font-size: 0.95rem;
  }

  .panel-close {
    color: #143CF0 !important;
    font-size: 1.8rem !important;
    top: 10px !important;
    right: 15px !important;
  }

  .custom-calendar-container {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    margin: 0 auto !important;
    width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .calendar-header,
  .calendar-prev,
  .calendar-next,
  .calendar-month-label,
  .calendar-weekday-name,
  .calendar-day {
    color: #143CF0 !important;
  }

  .calendar-day-today {
    background: #143CF01A !important;
  }

  /* Position calendar close button above navigation arrows - keeps < > symmetric */
  #calendar-section-close {
    top: 8px;
    right: 12px;
    font-size: 1.5rem !important;
    padding: 5px;
  }

  /* Add padding on top of calendar to make room for close button */
  #calendar-section {
    padding-top: 35px !important;
  }

  /* Override space-between to center the navigation arrows symmetrically */
  .calendar-header {
    justify-content: center !important;
    gap: 1rem !important;
  }

  /* Override height constraints for calendar section to prevent cropping events */
  #calendar-section,
  #upcoming-panel {
    max-height: none !important;
    overflow-y: visible !important;
  }

  body {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }

  .top-menu li,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .submenu-header {
    font-size: 1.1rem !important;
  }

  #luoghi-panel p,
  #associazioni-panel p,
  #llm-panel p {
    font-size: 1rem !important;
  }
}

/* TABLET AND DESKTOP STYLES (min-width: 769px) */
@media (min-width: 769px) {
  .top-menu {
    /* Sticky menu for PC */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
    background: rgba(20, 60, 240, 0.9) !important;
    /* Solid background for fixed menu */
    padding: 1rem 2rem !important;
    /* Desktop padding */
    box-sizing: border-box !important;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }

  .mobile-menu-toggle {
    display: none !important;
  }

  .menu-items-left,
  .menu-items-right {
    display: inline-flex !important;
  }

  .mobile-menu-popup {
    display: none !important;
  }

  /* Adjust container padding if not already sufficient by the base 64px */
  /* .container { padding-top: 64px; } */
  /* Already set globally, should be fine */
}

/* Tablet specific adjustments (if any, on top of min-width: 769px) */
@media (min-width: 769px) and (max-width: 992px) {
  .container {
    /* padding-top: 70px; */
    /* Base 64px should be fine */
  }

  /* Fix cropping: expand wrapper width for list + padding */
  #sidebar-scroll-wrapper {
    width: 290px;
    overflow-x: visible;
  }

  #sidebar-scroll-wrapper.sidebar-expanded {
    width: 700px;
  }

  .location-list {
    width: 220px;
    top: 0 !important;
    left: 10px !important;
    overflow: visible;
  }

  #luoghi-panel,
  #associazioni-panel,
  #manifestazioni-panel,
  #llm-panel,
  #calendar-section,
  #upcoming-panel {
    left: calc(10px + 220px + 20px) !important;
    max-width: calc(100vw - 280px - 40px) !important;
    width: auto !important;
  }
}

/* Smaller PC screens adjustments (if any, on top of min-width: 769px) */
@media (min-width: 993px) and (max-width: 1200px) {
  .container {
    /* padding-top: 70px; */
    /* Base 64px should be fine */
  }

  /* Fix cropping: expand wrapper width */
  #sidebar-scroll-wrapper {
    width: 300px;
    overflow-x: visible;
  }

  #sidebar-scroll-wrapper.sidebar-expanded {
    width: 720px;
  }

  .location-list {
    width: 240px;
    top: 0 !important;
    left: 10px !important;
    overflow: visible;
  }

  #luoghi-panel,
  #associazioni-panel,
  #manifestazioni-panel,
  #llm-panel,
  #calendar-section,
  #upcoming-panel {
    left: calc(10px + 240px + 20px) !important;
    max-width: calc(100vw - 300px - 40px) !important;
    width: auto !important;
  }
}

/* Canvas pointer events for mobile menu */
@media (max-width: 768px) {
  body.mobile-menu-is-open #scene {
    pointer-events: none !important;
  }
}

/* === DESKTOP / TABLET — lock only the “Questa settimana” box === */
@media (min-width: 769px) {
  #upcoming-panel {
    width: 400px !important;
    max-width: 400px !important;
  }
}

/* === hide the previous / next arrows inside the “Questa settimana” panel === */
@media (min-width: 769px) {

  /* desktop & tablet only */
  #upcoming-prev,
  #upcoming-next {
    /* both arrows share class .up-nav */
    display: none !important;
  }
}



/* === FINE MODIFICHE RESPONSIVE AGGIUNTE === */

@media (max-width: 768px) {
  #list-manifestazioni {
    width: 90% !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    margin: 1rem auto;
  }
}

/* Watermark Logo - Background layer */
.watermark-logo {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 5;
  pointer-events: none;
  background: rgba(20, 60, 240, 0.45);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.watermark-logo__img {
  height: auto;
  display: block;
}

.watermark-logo__img--comune {
  width: 120px;
}

.watermark-logo__img--castelli {
  width: 138px;
  margin-left: 6px;
}

@media (max-width: 768px) {
  .watermark-logo {
    z-index: 1;
    bottom: 10px;
    right: 10px;
    padding: 8px;
    gap: 8px;
  }

  .watermark-logo__img--comune {
    width: 80px;
  }

  .watermark-logo__img--castelli {
    width: 92px;
    margin-left: 4px;
  }
}
