/* Explorex – Mappa Luoghi (Single)
   Layout definitivo:
   - Desktop: 2 colonne, sidebar in alto accanto all'hero
   - Mobile: prima sidebar poi contenuto (stack)
   Protezioni:
   - blocchi Gutenberg wide/full confinati nella colonna sinistra
   - niente overlay/sovrapposizioni con la sidebar
*/

:root{
  --explorex-ml-radius: 18px;
  --explorex-ml-gap: 28px;
  --explorex-ml-border: rgba(0,0,0,.08);
}

/* Wrapper */
.explorex-ml-single{
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.explorex-ml-single__top{ margin: 6px 0 14px; }

.explorex-ml-single__back{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  opacity: .85;
}
.explorex-ml-single__back:hover{ opacity: 1; }

/* =========================
   GRID (DESKTOP)
   ========================= */

.explorex-ml-single__grid{
  display: grid !important;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) !important;
  grid-template-areas: "left side" !important;
  gap: var(--explorex-ml-gap) !important;
  align-items: start !important;
}

/* i grid items DEVONO poter restringersi */
.explorex-ml-single__grid > *{
  min-width: 0 !important;
}

/* Aree (per poter cambiare ordine su mobile) */
.explorex-ml-single__left{ grid-area: left; }
.explorex-ml-single__side{ grid-area: side; }

/* Colonna sinistra sempre sopra (mai coperta) */
.explorex-ml-single__left{
  position: relative !important;
  z-index: 2 !important;
  min-width: 0 !important;
}

/* Sidebar: nel flusso, niente overlay */
.explorex-ml-single__side{
  position: relative !important;
  z-index: 1 !important;
  min-width: 0 !important;
  float: none !important;
  transform: none !important;
  opacity: 1 !important;
  width: auto !important;
  max-width: 100% !important;
}

/* =========================
   HERO 16:9
   ========================= */

.explorex-ml-single__hero{
  width: 100%;
  border-radius: var(--explorex-ml-radius);
  overflow: hidden;
  background: #f5f5f5;
  aspect-ratio: 16 / 9;
}

.explorex-ml-single__hero img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.explorex-ml-single__hero-empty{
  display: grid;
  place-items: center;
  height: 100%;
  color: rgba(0,0,0,.55);
}

/* =========================
   META / TITLES
   ========================= */

.explorex-ml-single__meta{ margin-top: 16px; }

.explorex-ml-single__badge{
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: #f6b100;
  color: #111;
  margin-bottom: 10px;
}

.explorex-ml-single__title{
  margin: 0 0 12px;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.1;
}

/* =========================
   CONTENUTO (Gutenberg-proof)
   ========================= */

/* Disinnesca le variabili globali Gutenberg che portano i blocchi a 1064px */
.explorex-ml-single__left{
  --wp--style--global--content-size: 100% !important;
  --wp--style--global--wide-size: 100% !important;
}

.explorex-ml-single__content{
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Blocchi principali non devono mai superare il parent */
.explorex-ml-single__left > .explorex-ml-single__hero,
.explorex-ml-single__left > .explorex-ml-single__meta,
.explorex-ml-single__left > .explorex-ml-single__title,
.explorex-ml-single__left > .explorex-ml-single__content{
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Blocchi Gutenberg: niente max-width "wide" dentro la colonna */
.explorex-ml-single__content .wp-block,
.explorex-ml-single__content .wp-block-group,
.explorex-ml-single__content .wp-block-columns,
.explorex-ml-single__content .wp-block-column{
  max-width: 100% !important;
}

/* alignwide/alignfull spesso usano margini negativi */
.explorex-ml-single__content .alignwide,
.explorex-ml-single__content .alignfull{
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Media sempre contenuti */
.explorex-ml-single__content img,
.explorex-ml-single__content iframe,
.explorex-ml-single__content video{
  max-width: 100%;
  height: auto;
}

/* Tabelle: non rompono layout, scorrono internamente */
.explorex-ml-single__content table{
  display: block;
  width: 100%;
  max-width: 100% !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* =========================
   SIDEBAR UI
   ========================= */

.explorex-ml-single__map{
  width: 100%;
  height: 240px;
  border-radius: var(--explorex-ml-radius);
  overflow: hidden;
  border: 1px solid var(--explorex-ml-border);
  background: #f6f6f6;
}

.explorex-ml-single__info{
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--explorex-ml-radius);
  border: 1px solid var(--explorex-ml-border);
  background: #fff !important;
  opacity: 1 !important;
}

.explorex-ml-single__info h3{
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .7;
}

.explorex-ml-single__row{
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--explorex-ml-border);
}
.explorex-ml-single__row:first-of-type{ border-top: 0; }

.explorex-ml-single__label{
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
}

.explorex-ml-single__value{ font-size: 14px; }

.explorex-ml-single__chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.explorex-ml-single__chip{
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--explorex-ml-border);
  background: #f8f8f8;
  font-size: 12px;
}

.explorex-ml-single__cta{
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .02em;
}

/* =========================
   MOBILE: prima LEFT poi SIDEBAR
   ========================= */

/* Nota: alcuni temi/optimizer applicano regole responsive aggressive (es. display:flex)
   su wrapper generici. Qui forziamo lo stack in modo robusto sia per GRID che per FLEX. */
@media (max-width: 1024px){
  .explorex-ml-single .explorex-ml-single__grid{
    display: grid !important;
    grid-auto-flow: row !important;
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "left"
      "side" !important;
    gap: 18px !important;

    /* Se qualche regola esterna trasforma la grid in flex, questa garantisce comunque lo stack */
    flex-direction: column !important;
    flex-wrap: nowrap !important;
  }

  /* Ordine corretto anche in fallback flex */
  .explorex-ml-single .explorex-ml-single__left{ order: 0 !important; width: 100% !important; max-width: 100% !important; }
  .explorex-ml-single .explorex-ml-single__side{ order: 1 !important; width: 100% !important; max-width: 100% !important; }

  .explorex-ml-single .explorex-ml-single__map{ height: 220px; }

  .explorex-ml-single .explorex-ml-single__row{
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* Marker single (divIcon) */
.explorex-ml-single-pin{
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.explorex-ml-single-pin__dot{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #f6b100;
  box-shadow: 0 0 0 3px #111;
}
