/*
Theme Name: FareMedia
Theme URI: https://faremedia.it/
Author: FareMedia
Description: Tema su misura per FareMedia Srl — concessionaria radiofonica. Home a sezioni modificabili con Elementor (widget FareMedia) + pagina Privacy e Cookie Policy. Nessun plugin obbligatorio.
Version: 2.0.1
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: faremedia
*/

/* ==========================================================================
   Il design usa stili inline sul markup (vedi parts/sezioni/*.php).
   Qui stanno solo: reset, animazioni, layout responsive, caroselli e stati hover.
   Le regole sotto sono quelle del progetto originale, invariate.
   ========================================================================== */

  html { scroll-behavior: smooth; }
  [id] { scroll-margin-top: 168px; }
  body { margin: 0; background: #000; }
  summary::-webkit-details-marker { display: none; }
  a { color: #a8ff81; }
  a:hover { color: #c6ff9f; }
  ::selection { background: #54ae3a; color: #000; }
  /* Sezioni chiare (verdi e hero): selezione blu con testo bianco */
  #home::selection, #home ::selection,
  #chi-siamo::selection, #chi-siamo ::selection,
  #copertura::selection, #copertura ::selection,
  #partner::selection, #partner ::selection,
  #contatti::selection, #contatti ::selection,
  [style*="background: #54ae3a"]::selection, [style*="background: #54ae3a"] ::selection,
  [style*="background: #fff"]::selection, [style*="background: #fff"] ::selection { background: #0079b8; color: #fff; }
  /* Blocchi neri dentro le sezioni chiare: resta la selezione verde */
  [style*="background: #000"]::selection, [style*="background: #000"] ::selection,
  [style*="background: #0d0d0d"]::selection, [style*="background: #0d0d0d"] ::selection { background: #54ae3a; color: #000; }
  [data-fm="marquee"]:hover, [data-fm="ticker"]:hover [data-fm="marquee"], [data-fm="radio-card"]:hover [data-fm="marquee"] { animation-play-state: paused; }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; animation-timeline: auto !important; }
  }
  @keyframes fmDial { from { transform: translateX(0); } to { transform: translateX(-50%); } }
  @keyframes fmGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes fmRise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  @keyframes fmPopIn { from { opacity: 0; transform: translateY(28px) scale(0.94); } to { opacity: 1; transform: none; } }
  @keyframes fmFadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes fmReveal { from { opacity: 0; } to { opacity: 1; } }
  @keyframes fmSheetUp { from { transform: translateY(100%); } to { transform: none; } }
  /* Righe dei marchi: l'animazione legata allo scroll solo dove il browser la supporta; altrove restano ferme e piene. */
  @supports not (animation-timeline: view()) {
    [data-fm="brand-rows"] > div { animation: none !important; opacity: 1 !important; transform: none !important; }
  }
  /* Carosello automatico Chi siamo: 4 immagini, 5 secondi ciascuna, dissolvenza di 1 secondo */
  @keyframes fmChiFade { 0% { opacity: 0; } 5% { opacity: 1; } 25% { opacity: 1; } 30% { opacity: 0; } 100% { opacity: 0; } }
  @keyframes fmChiDot { 0% { opacity: 0.45; width: 8px; } 5% { opacity: 1; width: 22px; } 25% { opacity: 1; width: 22px; } 30% { opacity: 0.45; width: 8px; } 100% { opacity: 0.45; width: 8px; } }
  [data-fm="chi-car"]:hover [data-fm="chi-slide"], [data-fm="chi-car"]:hover [data-fm="chi-dot"] { animation-play-state: paused; }
  [data-fm="chi-slide"] image-slot { display: block; width: 100%; height: 100%; }
  @keyframes fmBrandRow {
    0%   { transform: scale(0.74); opacity: 0.25; }
    42%  { transform: scale(1); opacity: 1; }
    58%  { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.58); opacity: 0.28; }
  }
  [data-fm="burger"] { display: none; }
  [data-fm="reg-track"]::-webkit-scrollbar { display: none; }
  [data-fm="car-bar"] { display: none !important; }
  [data-fm="sw"] { background: rgba(255,255,255,0.18); transition: background-color 220ms ease; }
  [data-fm="sw"] > span { transition: margin 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  [data-fm="sw"][data-on="true"] { background: rgba(168,255,129,0.35); }
  [data-fm="sw"][data-on="true"] > span { margin-left: auto; background: #a8ff81; }
  [data-fm="site"] { container: site / inline-size; overflow-x: clip; }
  [data-fm="map-card"] { width: auto !important; max-width: 610px; height: auto !important; }

  /* La barra completa richiede spazio: sotto i 1100px si passa al menu a scomparsa. */
  @container site (max-width: 1100px) {
    [data-fm="nav"] { display: none !important; }
    [data-fm="burger"] { display: flex !important; }
  }

  /* Tablet e sotto */
  @container site (max-width: 960px) {
    [data-fm="nav"] { display: none !important; }
    [data-fm="burger"] { display: flex !important; }
    [data-fm="rail"] { gap: 8px; }
    [data-fm="rail-link"] { display: none; }
    [data-fm="footer-col"] { border-left: 0; padding-left: 0; padding-right: 0; }
    [id] { scroll-margin-top: 96px; }
    h1 { font-size: clamp(34px, 6.6cqw, 60px) !important; }
    h2 { font-size: clamp(26px, 4.6cqw, 42px) !important; }
    h3 { font-size: clamp(20px, 3.2cqw, 30px) !important; }
    [style*="clamp(38px, 5vw, 60px)"] { font-size: clamp(34px, 6cqw, 56px) !important; }
    [style*="clamp(22px, 2.4vw, 30px)"] { font-size: clamp(19px, 2.8cqw, 26px) !important; }
    [data-fm="deco"] { display: none; }
    [data-fm="team-grid"] { grid-template-columns: repeat(2, 1fr) !important; }
    [data-fm="brand-rows"] { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: clamp(10px, 1.2vw, 16px) !important; }
    [data-fm="brand-rows"] > div { display: contents !important; animation: none !important; }
    #servizi div[style*="width: 356px"] { width: auto !important; max-width: 100% !important; box-sizing: border-box !important; }
    #home > div > div[style*="width: 1251px"] { width: auto !important; height: auto !important; max-width: 100% !important; }
    #home h1 { width: auto !important; height: auto !important; max-width: 100% !important; }
  }

  /* Smartphone */
  @container site (max-width: 620px) {
    [data-fm="ticker"] { display: none; }
    [data-fm="ticker-label"] { display: none; }
    [data-fm="legal"] { flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 18px 18px calc(88px + env(safe-area-inset-bottom)) !important; }
    [data-fm="legal"] p { font-size: 12px !important; line-height: 1.55 !important; }
    [data-fm="legal"] p + p { font-weight: 600 !important; letter-spacing: 0.06em; }
    [data-fm="hero-title"] { max-width: 100%; }
    header > div, section > div { padding-left: 18px !important; padding-right: 18px !important; }
    h1 { font-size: clamp(30px, 9cqw, 44px) !important; }
    h2 { font-size: clamp(24px, 6.6cqw, 34px) !important; }
    h3 { font-size: 20px !important; }
    [style*="clamp(38px, 5vw, 60px)"] { font-size: 36px !important; }
    [style*="letter-spacing: 0.3em"] { letter-spacing: 0.18em !important; }
    section { padding-top: 44px !important; padding-bottom: 52px !important; }
    [data-fm="marquee"] { animation-duration: 30s !important; }
    [data-fm="team-grid"] { grid-template-columns: 1fr !important; }
    [data-fm="cta-bar"] { display: flex !important; }
    [data-fm="rail"] { bottom: 88px !important; }
    [data-fm="brand-rows"] { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
    [data-fm="brand-rows"] > div { display: contents !important; animation: none !important; }
    [data-fm="brand-rows"] > div > div { height: 58px !important; padding: 9px !important; border-radius: 10px !important; }
    [data-fm="footer-menu"] { display: none !important; }
    [data-fm="cov-grid"] { grid-template-columns: 1fr !important; }
    [data-fm="cookie-actions"] { width: 100%; }
    [data-fm="cookie-actions"] > button { flex: 1 1 100%; }
    [data-fm="footer-brand"] { gap: 12px !important; margin-bottom: 32px !important; }
    [data-fm="footer-brand"] img { height: 42px !important; }
    [data-fm="footer-brand"] p:first-child { font-size: 26px !important; }
    [data-fm="footer-brand"] p:first-child span { font-size: 14px !important; }
    [data-fm="footer-brand"] p + p { font-size: 10px !important; letter-spacing: 0.04em !important; margin-top: 4px !important; }
    [data-fm="social-list"] { flex-direction: row !important; flex-wrap: wrap; gap: 12px !important; }
    [data-fm="social-list"] > a { width: 46px; height: 46px; justify-content: center; gap: 0 !important; border-radius: 999px; background: rgba(255,255,255,0.09); }
    [data-fm="social-label"] { display: none !important; }
    [data-fm="popup-bg"] { align-items: flex-end !important; padding: 0 !important; }
    [data-fm="popup-card"] { max-width: 100% !important; margin: auto 0 0 !important; border-radius: 22px 22px 0 0 !important; clip-path: none !important; padding: 26px 20px calc(24px + env(safe-area-inset-bottom)) !important; max-height: 92vh; overflow-y: auto; animation: fmSheetUp 340ms cubic-bezier(0.16, 0.84, 0.28, 1) both !important; }
    [data-fm="popup-card"] > div[style*="font-size: 30px"] { position: static !important; width: auto !important; height: auto !important; font-size: 19px !important; text-align: left !important; padding-right: 44px; margin: 0 0 14px !important; }
    [data-fm="popup-card"] p[style*="font: 500 32px"] { font-size: 25px !important; }
    [data-fm="popup-card"] button[aria-label="Chiudi"] { top: 12px !important; left: auto !important; right: 12px !important; }
    /* Header: su smartphone marchio e burger devono stare dentro i 390px */
    header > div:first-child { padding: 12px 14px !important; gap: 10px !important; flex-wrap: nowrap !important; }
    header > div:first-child > a:first-child { flex: 1 1 auto !important; min-width: 0; gap: 9px !important; }
    header > div:first-child > a:first-child img { height: 38px !important; }
    header > div:first-child > a:first-child > span { min-width: 0; }
    header > div:first-child > a:first-child p:first-child { font-size: 20px !important; white-space: normal !important; }
    header > div:first-child > a:first-child p:first-child span { font-size: 13px !important; }
    header > div:first-child > a:first-child p + p { font-size: 10px !important; letter-spacing: 0.06em !important; line-height: 1.35 !important; }
    /* Hero e card: neutralizza le larghezze fisse impostate a mano */
    #servizi div[style*="width: 356px"] { width: auto !important; max-width: 100% !important; box-sizing: border-box !important; }
    #home > div > div[style*="width: 1251px"] { width: auto !important; height: auto !important; max-width: 100% !important; gap: 32px !important; }
    #home h1 { width: auto !important; height: auto !important; max-width: 100% !important; }
    [data-fm="burger"] { width: 42px !important; height: 42px !important; flex: none !important; }
    [id] { scroll-margin-top: 72px; }
  }
  /* Caroselli: su tablet e mobile le griglie marcate diventano tracce scorrevoli con snap. */
  @container site (max-width: 960px) {
    [data-fm-carousel]:not([data-fm-carousel$="-m"]) {
      display: flex !important;
      grid-template-columns: none !important;
      overflow-x: auto;
      scroll-snap-type: x mandatory;
      scroll-behavior: smooth;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      align-items: stretch;
      padding-bottom: 4px;
    }
    [data-fm-carousel]::-webkit-scrollbar { display: none; }
    [data-fm-carousel]:not([data-fm-carousel$="-m"]) > * { flex: 0 0 clamp(258px, 54cqw, 400px); scroll-snap-align: start; min-width: 0; box-sizing: border-box; }
    [data-fm="team-grid"] { grid-template-columns: none !important; }
    [data-fm="charts"] > * { flex: 0 0 clamp(280px, 62cqw, 440px); }
    [data-fm="num-grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    [data-fm="car-bar"][data-scrollable="1"] { display: flex !important; }
  }
  @container site (max-width: 620px) {
    [data-fm-carousel] > * { flex: 0 0 min(84cqw, 320px); }
    /* Caroselli solo smartphone */
    [data-fm-carousel$="-m"] { display: flex !important; grid-template-columns: none !important; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; align-items: stretch; padding-bottom: 4px; max-width: none !important; justify-content: flex-start !important; }
    [data-fm="sectors"][data-fm-carousel] { padding-inline: calc((100% - min(84cqw, 320px)) / 2); scroll-padding-inline: calc((100% - min(84cqw, 320px)) / 2); box-sizing: border-box; }
    [data-fm="sectors"][data-fm-carousel] > * { scroll-snap-align: center; }
    [data-fm-carousel$="-m"] > * { flex: 0 0 min(84cqw, 320px); scroll-snap-align: start; min-width: 0; box-sizing: border-box; animation: none !important; }
    [data-fm="cov-grid"][data-fm-carousel] { gap: 8px !important; }
    [data-fm="cov-grid"][data-fm-carousel] > * { flex: 0 0 auto !important; white-space: nowrap; }
    [data-fm="brand-rows"][data-fm-carousel] { display: flex !important; flex-direction: row !important; gap: 12px !important; }
    [data-fm="brand-rows"][data-fm-carousel] > div { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
    [data-fm="charts"] > * { flex: 0 0 min(88cqw, 340px); }
    [data-fm="num-grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  }
  input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid #a8ff81; outline-offset: 2px; }
  /* Carosello automatico «Chi siamo» */
  [data-fm="chi-car"] image-slot, [data-fm="chi-car"] img { display: block; }

/* ---------- aggiunte del tema ---------- */
  [data-fm="skip"]:focus { top: 12px !important; outline: 2px solid #fff; outline-offset: 2px; }
  [hidden] { display: none !important; }
  .fm-photo { width: 100%; height: 100%; min-height: 120px; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; background: #151515; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.035) 0 10px, transparent 10px 20px); }
  .fm-photo span { font: 500 12px/1.4 'Poppins', sans-serif; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.42); text-align: center; }
  [data-fm-form] button[disabled] { cursor: wait; }

/* ---------- stati hover (generati dal design) ---------- */
  [data-fx-h1]:hover { border-color: #a8ff81 !important; }
  [data-fx-h2]:hover { color: #a8ff81 !important; background: rgba(255,255,255,0.07) !important; }
  [data-fx-h3]:hover { background: #a8ff81 !important; }
  [data-fx-h4]:hover { border-color: #a8ff81 !important; color: #a8ff81 !important; }
  [data-fx-h5]:hover { background-color: rgba(168,255,129,0.12) !important; }
  [data-fx-h6]:hover { transform: scale(1.02) !important; }
  [data-fx-h7]:hover { transform: translateY(-4px) !important; }
  [data-fx-h8]:hover { color: #a8ff81 !important; }
  [data-fx-h9]:hover { transform: scale(1.03) !important; }
  [data-fx-h10]:hover { background-color: #a8ff81 !important; color: #000 !important; }
  [data-fx-h11]:hover { border-color: #a8ff81 !important; background: rgba(255,255,255,0.1) !important; transform: scale(1.022) !important; }
  [data-fx-h12]:hover { border-color: #a8ff81 !important; transform: scale(1.03) !important; }
  [data-fx-h13]:hover { border-color: #e2231a !important; transform: scale(1.02) !important; }
  [data-fx-h14]:hover { transform: scale(1.08) !important; background-color: rgba(255,255,255,0.1) !important; }
  [data-fx-h15]:hover { border-color: #ffd400 !important; transform: scale(1.02) !important; }
  [data-fx-h16]:hover { border-color: #7c4dff !important; transform: scale(1.02) !important; }
  [data-fx-h17]:hover { background: #54ae3a !important; color: #000 !important; border-color: #54ae3a !important; }
  [data-fx-h18]:hover { transform: translateY(-4px) !important; border-color: #54ae3a !important; }
  [data-fx-h19]:hover { transform: scale(1.06) !important; background-color: rgba(255,255,255,0.07) !important; }
  [data-fx-h20]:hover { opacity: 0.8 !important; transform: translateY(-2px) !important; }
  [data-fx-h21]:hover { background: #141414 !important; transform: scale(1.02) !important; }
  [data-fx-h22]:hover { border-color: #a8ff81 !important; background-color: #0e0e0e !important; transform: scale(1.03) !important; }
  [data-fx-h23]:hover { transform: scale(1.09) !important; }
  [data-fx-h24]:hover { transform: scale(1.05) !important; }
  [data-fx-h25]:hover { text-decoration: underline !important; }
  [data-fx-h26]:hover { background: #c6ff9f !important; }
  [data-fx-h27]:hover { color: #54ae3a !important; }
  [data-fx-h28]:hover { background: rgba(255,255,255,0.16) !important; }
  [data-fx-h29]:hover { background-color: #a8ff81 !important; transform: scale(1.1) !important; }
  [data-fx-h30]:hover { background: #000 !important; color: #a8ff81 !important; }
  [data-fx-h31]:hover { color: #000 !important; }
  [data-fx-h32]:hover { background: #a8ff81 !important; color: #000 !important; }
  [data-fx-h33]:hover { border-color: rgba(168,255,129,0.5) !important; }
  [data-fx-h34]:hover { background: #2e7d1e !important; }
  [data-fx-h35]:hover { color: #2e7d1e !important; }

/* ---------- Elementor: le sezioni FareMedia occupano tutta la larghezza, senza spaziature aggiunte ---------- */
[data-fm="site"] .elementor-section > .elementor-container { max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; }
[data-fm="site"] .elementor-column > .elementor-widget-wrap { padding: 0 !important; }
[data-fm="site"] .elementor-widget { margin: 0 !important; }
[data-fm="site"] .e-con { --padding-top: 0px; --padding-right: 0px; --padding-bottom: 0px; --padding-left: 0px; --gap: 0px; }
[data-fm="site"] .elementor-widget-container > section, [data-fm="site"] .elementor-widget-container > div { margin: 0; }
