/*
 * FM Relazionale v0.3.1 - ponte verso il sito HTML/CSS esistente.
 * Il menu viene governato qui con breakpoint a 900px: desktop = menu esteso,
 * tablet/mobile = hamburger. Le regole sono volutamente più specifiche del
 * CSS storico, che passava ad hamburger già a 1100px.
 */

.fmrel-skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 1000000;
  transform: translateY(-180%);
  padding: 10px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  text-decoration: none;
}
.fmrel-skip-link:focus { transform: translateY(0); }

/* ==========================================================
   NAVIGAZIONE UNICA: vale sia per il menu del tema sia per
   il menu già incorporato in Home / Contattami.
   ========================================================== */
.fm-sticky-nav {
  display: block !important;
}

.fm-sticky-nav .fm-nav-inner {
  width: min(96%, var(--fm-max, 1200px));
}

.fm-sticky-nav .fm-nav-links {
  display: flex !important;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fm-sticky-nav .fm-nav-toggle {
  display: none !important;
}

.fm-mobile-menu,
.fmrel-site-mobile-menu {
  display: none !important;
}

/* Desktop più stretto: teniamo comunque il menu completo. */
@media (min-width: 901px) and (max-width: 1180px) {
  .fm-sticky-nav .fm-nav-inner {
    width: min(98%, var(--fm-max, 1200px));
    gap: 10px;
  }

  .fm-sticky-nav .fm-nav-logo-text {
    font-size: .94rem;
  }

  .fm-sticky-nav .fm-nav-links {
    gap: 2px;
  }

  .fm-sticky-nav .fm-nav-links a {
    padding: 8px 8px;
    font-size: .86rem;
  }
}

/* Hamburger soltanto su tablet/mobile. */
@media (max-width: 900px) {
  .fm-sticky-nav .fm-nav-links {
    display: none !important;
  }

  .fm-sticky-nav .fm-nav-toggle {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .fm-mobile-menu.open,
  .fmrel-site-mobile-menu.open {
    display: flex !important;
  }
}

@media (min-width: 901px) {
  .fm-mobile-menu,
  .fm-mobile-menu.open,
  .fmrel-site-mobile-menu,
  .fmrel-site-mobile-menu.open {
    display: none !important;
  }
}

/* Ripristino esplicito su pagine dove il CSS del vecchio tema nascondeva header/footer generici. */
body.fmrel-theme .fmrel-site-navigation { display: block !important; }
body.fmrel-theme .fmrel-site-footer { display: block !important; }

/* Le pagine HTML FM sono già full-width: nessuna cornice o larghezza del tema. */
body.fmrel-legacy-content .fmrel-main,
body.fmrel-legacy-content .fmrel-entry,
body.fmrel-legacy-content .fmrel-entry-legacy {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Evita margini editoriali del tema sui contenuti HTML già progettati. */
.fmrel-entry-front,
.fmrel-entry-legacy { margin: 0; padding: 0; }

/* Il footer riprende il credito già usato sul sito. */
.fmrel-site-footer { width: 100%; }

/* Pulsante flottante del tema: stessa forma del sito attuale, senza interferire con plugin. */
.fmrel-whatsapp { text-decoration: none !important; }

/* Non imponiamo stili ai contenitori applicativi dei plugin FM. */
body:not(.fmrel-legacy-content) .fmrel-main [class*="scaletta"],
body:not(.fmrel-legacy-content) .fmrel-main [class*="radar"] {
  max-width: none;
}

/* FM Podcast Hub: il tema non ridisegna i discendenti dello shortcode. */
body.fmrel-podcast-hub-page .fmrel-entry-legacy {
  overflow: visible;
}

/* ==========================================================
   CPT FM_EPISODE — passthrough visivo per FM Podcast Hub
   ========================================================== */
body.fmrel-single-fm-episode .fmrel-main,
body.fmrel-single-fm-episode .fmrel-entry-puntata {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Non imponiamo al plugin la gabbia editoriale di single.php. */
body.fmrel-single-fm-episode .fmrel-entry-puntata > * {
  max-width: none;
}

/* Se il plugin usa i componenti FM storici, manteniamo la stessa larghezza del sito. */
body.fmrel-single-fm-episode .fm-container {
  width: min(92%, var(--fm-max, 1200px));
  margin-left: auto;
  margin-right: auto;
}

/* Protezione: niente stili generici del tema su player e controlli plugin. */
body.fmrel-single-fm-episode audio,
body.fmrel-single-fm-episode video,
body.fmrel-single-fm-episode iframe {
  max-width: 100%;
}

body.fmrel-single-fm-episode .fmrel-post-nav,
body.fmrel-single-fm-episode .fmrel-entry-header,
body.fmrel-single-fm-episode .fmrel-featured-image {
  display: none !important;
}
