/* FM Relazionale v0.1.0
 * Tutti gli stili strutturali del tema usano il prefisso fmrel- per ridurre
 * al minimo collisioni con Scaletta FM, Radar FM e altri plugin.
 */

:root {
  --fmrel-orange: #ff8c1a;
  --fmrel-orange-dark: #d96f00;
  --fmrel-blue: #165dff;
  --fmrel-blue-dark: #0b2f7a;
  --fmrel-dark: #111827;
  --fmrel-text: #243041;
  --fmrel-muted: #5f6b7a;
  --fmrel-light: #f6f8fb;
  --fmrel-white: #ffffff;
  --fmrel-border: rgba(17, 24, 39, 0.10);
  --fmrel-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  --fmrel-radius: 26px;
  --fmrel-container: 1180px;
}

html { scroll-behavior: smooth; }
body.fmrel-theme {
  margin: 0;
  background: var(--fmrel-white);
  color: var(--fmrel-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.fmrel-theme *, body.fmrel-theme *::before, body.fmrel-theme *::after { box-sizing: border-box; }
body.fmrel-theme img { max-width: 100%; height: auto; }
body.fmrel-theme a { text-underline-offset: 0.16em; }
body.fmrel-theme :focus-visible { outline: 3px solid var(--fmrel-orange); outline-offset: 3px; }

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

.fmrel-header {
  position: sticky; top: 0; z-index: 900;
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--fmrel-border);
}
.fmrel-header-inner {
  width: min(var(--fmrel-container), calc(100% - 36px)); margin: 0 auto;
  min-height: 82px; display: flex; align-items: center; gap: 24px;
}
.fmrel-brand { flex: 0 1 280px; min-width: 170px; }
.fmrel-brand-logo { display: inline-flex; align-items: center; text-decoration: none; }
.fmrel-brand-logo img, .fmrel-brand .custom-logo {
  display: block; width: auto; max-width: 260px; max-height: 58px; object-fit: contain;
}
.fmrel-primary-nav { margin-left: auto; }
.fmrel-menu, .fmrel-menu-fallback {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: 4px; margin: 0; padding: 0;
}
.fmrel-menu li, .fmrel-menu-fallback li { margin: 0; }
.fmrel-menu a, .fmrel-menu-fallback a {
  display: block; padding: 9px 10px; border-radius: 999px; text-decoration: none;
  color: #263244; font-size: 14px; font-weight: 700; white-space: nowrap;
  transition: color .2s ease, background .2s ease;
}
.fmrel-menu a:hover, .fmrel-menu a:focus-visible,
.fmrel-menu-fallback a:hover, .fmrel-menu-fallback a:focus-visible {
  background: #f0f4ff; color: var(--fmrel-blue);
}
.fmrel-menu .current-menu-item > a, .fmrel-menu .current_page_item > a { background: #eef3ff; color: var(--fmrel-blue); }
.fmrel-menu-toggle {
  display: none; width: 46px; height: 46px; border: 1px solid var(--fmrel-border);
  border-radius: 14px; background: #fff; padding: 10px; cursor: pointer;
}
.fmrel-menu-toggle > span:not(.screen-reader-text) { display: block; height: 2px; background: var(--fmrel-dark); margin: 5px 0; border-radius: 4px; }

.fmrel-main { min-height: 60vh; }
.fmrel-page-shell { width: min(var(--fmrel-container), calc(100% - 36px)); margin: 0 auto; padding: 72px 0 88px; }
.fmrel-front-shell { width: 100%; padding: 0; }
.fmrel-front-shell > .fmrel-entry { margin: 0; }
.fmrel-entry-header { max-width: 900px; margin-bottom: 42px; }
.fmrel-entry-header h1 { margin: 0; color: var(--fmrel-dark); font-size: clamp(2.35rem, 6vw, 4.8rem); line-height: .99; letter-spacing: -.055em; }
.fmrel-kicker { margin: 0 0 12px; color: var(--fmrel-orange-dark); font-size: .82rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 900; }
.fmrel-lead { color: var(--fmrel-muted); font-size: clamp(1.08rem, 1.5vw, 1.3rem); }

/* Solo il contenuto editoriale standard viene tipografato. Le app dei plugin
 * restano libere di usare i propri stili e componenti. */
.fmrel-entry:not(.fmrel-entry-front) > .fmrel-entry-content { max-width: 920px; }
.fmrel-reading-shell { max-width: 940px; }
.fmrel-article .fmrel-entry-content { max-width: 780px; margin: 0 auto; }
.fmrel-article .fmrel-entry-header { max-width: 900px; margin-inline: auto; }
.fmrel-entry-content > :first-child { margin-top: 0; }
.fmrel-entry-content p, .fmrel-entry-content li { font-size: 1.06rem; }
.fmrel-entry-content h2 { margin-top: 2.2em; font-size: clamp(1.8rem, 3vw, 2.7rem); letter-spacing: -.035em; }
.fmrel-entry-content h3 { margin-top: 1.8em; font-size: clamp(1.35rem, 2vw, 1.9rem); }
.fmrel-entry-content blockquote { margin: 2rem 0; padding: 1.3rem 1.5rem; border-left: 5px solid var(--fmrel-orange); background: var(--fmrel-light); border-radius: 0 18px 18px 0; }
.fmrel-featured-image { margin: 0 auto 42px; max-width: 980px; }
.fmrel-featured-image img { border-radius: var(--fmrel-radius); box-shadow: var(--fmrel-shadow); }

.fmrel-post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.fmrel-post-card { overflow: hidden; border: 1px solid var(--fmrel-border); border-radius: 24px; background: #fff; box-shadow: 0 12px 34px rgba(15,23,42,.06); }
.fmrel-card-image { display: block; aspect-ratio: 16/10; overflow: hidden; }
.fmrel-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.fmrel-card-image:hover img { transform: scale(1.02); }
.fmrel-card-body { padding: 22px; }
.fmrel-card-body small { color: var(--fmrel-muted); }
.fmrel-card-body h2 { margin: 8px 0 10px; font-size: 1.35rem; line-height: 1.2; }
.fmrel-card-body h2 a { color: var(--fmrel-dark); text-decoration: none; }
.fmrel-card-body p { color: var(--fmrel-muted); margin-bottom: 0; }
.fmrel-pagination { margin-top: 34px; }
.fmrel-post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 54px; padding-top: 26px; border-top: 1px solid var(--fmrel-border); }
.fmrel-post-nav > div:last-child { text-align: right; }
.fmrel-search-result { padding: 22px 0; border-bottom: 1px solid var(--fmrel-border); }
.fmrel-search-result h2 { margin: 0 0 6px; }

.fmrel-footer { background: var(--fmrel-dark); color: rgba(255,255,255,.84); }
.fmrel-footer-inner { width: min(var(--fmrel-container), calc(100% - 36px)); margin: 0 auto; min-height: 190px; padding: 42px 0; display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 28px; align-items: center; }
.fmrel-footer strong { color: #fff; }
.fmrel-footer p { margin: 5px 0 0; color: rgba(255,255,255,.65); }
.fmrel-footer ul { list-style: none; padding: 0; margin: 0; }
.fmrel-footer a { color: #fff; }
.fmrel-footer small { color: rgba(255,255,255,.58); }

.fmrel-whatsapp { position: fixed; z-index: 850; right: 20px; bottom: 20px; display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 11px 17px; border-radius: 999px; background: var(--fmrel-dark); color: #fff !important; text-decoration: none; font-weight: 800; box-shadow: 0 14px 32px rgba(15,23,42,.24); }
.fmrel-whatsapp:hover { background: var(--fmrel-blue); transform: translateY(-1px); }
.fmrel-button { display: inline-flex; padding: 12px 18px; border-radius: 999px; background: var(--fmrel-dark); color: #fff !important; text-decoration: none; font-weight: 800; }
.fmrel-404 { max-width: 820px; }
.fmrel-404 h1 { font-size: clamp(2rem, 5vw, 4.6rem); line-height: 1; letter-spacing: -.05em; }

.screen-reader-text { border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; word-wrap: normal !important; }

/* Integrità plugin: il tema non usa selettori generici su form, table, button,
 * input, .card o .button fuori dai propri wrapper fmrel-. */

@media (max-width: 980px) {
  .fmrel-header-inner { min-height: 72px; }
  .fmrel-brand { flex: 1 1 auto; }
  .fmrel-brand-logo img, .fmrel-brand .custom-logo { max-width: 220px; max-height: 50px; }
  .fmrel-menu-toggle { display: block; margin-left: auto; }
  .fmrel-primary-nav { position: absolute; left: 0; right: 0; top: 100%; padding: 0 18px 18px; background: rgba(255,255,255,.98); border-bottom: 1px solid var(--fmrel-border); transform-origin: top; display: none; }
  .fmrel-primary-nav.is-open { display: block; }
  .fmrel-menu, .fmrel-menu-fallback { display: block; width: min(var(--fmrel-container), 100%); margin: 0 auto; padding: 8px; background: #fff; border: 1px solid var(--fmrel-border); border-radius: 18px; box-shadow: var(--fmrel-shadow); }
  .fmrel-menu a, .fmrel-menu-fallback a { padding: 11px 12px; border-radius: 10px; }
  .fmrel-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fmrel-footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .fmrel-header-inner, .fmrel-page-shell, .fmrel-footer-inner { width: min(100% - 24px, var(--fmrel-container)); }
  .fmrel-page-shell { padding: 48px 0 64px; }
  .fmrel-front-shell { width: 100%; padding: 0; }
  .fmrel-brand-logo img, .fmrel-brand .custom-logo { max-width: 185px; max-height: 46px; }
  .fmrel-entry-header h1 { font-size: clamp(2rem, 12vw, 3.6rem); }
  .fmrel-post-grid { grid-template-columns: 1fr; }
  .fmrel-post-nav { grid-template-columns: 1fr; }
  .fmrel-post-nav > div:last-child { text-align: left; }
  .fmrel-whatsapp { left: 12px; right: 12px; bottom: 12px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
