/* ============================================================
   Fastpol Target Section – Frontend Styles v1.5.0
   Fix: mobile layout, font sizing, adaptive heights, scroll,
        settings UX improvements
   ============================================================ */

/* ── CSS Custom Properties ── */
.fpats-section {
  /* Colori */
  --fpats-bg:        #0c0c18;
  --fpats-accent:    #e8613a;
  --fpats-accent-10: rgba(232,97,58,0.10);
  --fpats-accent-15: rgba(232,97,58,0.15);
  --fpats-accent-18: rgba(232,97,58,0.18);
  --fpats-accent-20: rgba(232,97,58,0.20);
  --fpats-accent-25: rgba(232,97,58,0.25);
  --fpats-transition: 0.52s cubic-bezier(0.4,0,0.2,1);

  /* Font size desktop (sovrascrivibili dal pannello WPBakery) */
  --fpats-fs-tag:        11px;
  --fpats-fs-title:      clamp(26px, 3vw, 40px);
  --fpats-fs-subtitle:   15px;
  --fpats-fs-panel-name: 17px;
  --fpats-fs-panel-pain: 13px;
  --fpats-fs-pill:       11px;
  --fpats-fs-btn:        14px;

  /* Font size mobile – valori aumentati per leggibilità */
  --fpats-fs-tag-mob:        11px;
  --fpats-fs-title-mob:      26px;
  --fpats-fs-subtitle-mob:   14px;
  --fpats-fs-panel-name-mob: 17px;
  --fpats-fs-panel-pain-mob: 13.5px;
  --fpats-fs-pill-mob:       11px;
  --fpats-fs-label-mob:      13px;
  --fpats-fs-btn-mob:        14px;
}

/* ── Wrapper ── */
.fpats-section {
  font-family: inherit;
  background-color: var(--fpats-bg);
  padding: 60px 40px 50px;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

/* ── Header ── */
.fpats-head {
  text-align: center;
  margin-bottom: 40px;
}
.fpats-tag {
  display: block;
  font-size: var(--fpats-fs-tag);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--fpats-accent);
  font-weight: 700;
  margin-bottom: 12px;
}
.fpats-title {
  font-size: var(--fpats-fs-title);
  font-weight: 800;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.15;
}
.fpats-sub {
  font-size: var(--fpats-fs-subtitle);
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Panels container ── */
.fpats-panels {
  display: flex;
  flex-direction: row;
  gap: 7px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ── Singolo panel ── */
.fpats-panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  transition: flex var(--fpats-transition);
  border: 0.5px solid rgba(255,255,255,0.07);
}
.fpats-panel:hover,
.fpats-panel--active { flex: 3.5 1 0; }
.fpats-panel:focus-visible {
  outline: 2px solid var(--fpats-accent);
  outline-offset: 2px;
}

/* ── Background image ── */
.fpats-panel__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  transition: transform 0.6s ease;
  will-change: transform;
}
.fpats-panel:hover .fpats-panel__bg,
.fpats-panel--active .fpats-panel__bg { transform: scale(1.04); }
.fpats-panel__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(12,12,24,0.95) 0%,
    rgba(12,12,24,0.65) 45%,
    rgba(12,12,24,0.30) 100%
  );
}

/* ── Glow ── */
.fpats-panel__glow {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(to top, var(--fpats-accent-18) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 1;
}
.fpats-panel:hover .fpats-panel__glow,
.fpats-panel--active .fpats-panel__glow { opacity: 1; }

/* ── Numero decorativo (desktop) ── */
.fpats-panel__num {
  position: absolute;
  top: 16px; left: 18px;
  font-size: clamp(32px, 3.5vw, 52px);
  font-weight: 800;
  color: var(--fpats-accent-15);
  line-height: 1;
  z-index: 2;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  user-select: none;
}
.fpats-panel:hover .fpats-panel__num,
.fpats-panel--active .fpats-panel__num {
  opacity: 0;
  transform: translateY(-8px);
}

/* ── Label verticale (desktop) ── */
.fpats-panel__label {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  letter-spacing: 2px;
  z-index: 2;
  transition: opacity 0.25s ease;
  pointer-events: none;
  user-select: none;
  text-transform: uppercase;
}
.fpats-panel:hover .fpats-panel__label,
.fpats-panel--active .fpats-panel__label { opacity: 0; }

/* ── Content wrapper ── */
.fpats-panel__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  z-index: 3;
}

/* ── Overlay ── */
.fpats-panel__overlay {
  opacity: 0;
  transition: opacity 0.38s ease;
}
.fpats-panel:hover .fpats-panel__overlay,
.fpats-panel--active .fpats-panel__overlay { opacity: 1; }

/* ── Icona ── */
.fpats-panel__ico {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--fpats-accent-15);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  border: 0.5px solid var(--fpats-accent-25);
  flex-shrink: 0;
}
.fpats-panel__ico svg { width: 19px; height: 19px; stroke: var(--fpats-accent); }

/* ── Expand content ── */
.fpats-panel__expand {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease 0.07s, transform 0.4s ease 0.07s;
}
.fpats-panel:hover .fpats-panel__expand,
.fpats-panel--active .fpats-panel__expand { opacity: 1; transform: translateY(0); }

.fpats-panel__name {
  font-size: var(--fpats-fs-panel-name);
  font-weight: 700;
  color: #fff;
  margin: 0 0 5px;
  line-height: 1.2;
}
.fpats-panel__pain {
  font-size: var(--fpats-fs-panel-pain);
  color: rgba(255,255,255,0.6);
  margin: 0 0 12px;
  line-height: 1.55;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Pills ── */
.fpats-panel__pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.fpats-pill {
  font-size: var(--fpats-fs-pill);
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--fpats-accent-10);
  border: 0.5px solid var(--fpats-accent-20);
  color: rgba(255,255,255,0.82);
  white-space: nowrap;
  font-weight: 500;
  line-height: 1.4;
}

/* ── CTA ── */
.fpats-bottom { text-align: center; margin-top: 30px; }
.fpats-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: inherit;
  font-size: var(--fpats-fs-btn);
  font-weight: 700;
  color: #fff;
  background: var(--fpats-accent);
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.3px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(232,97,58,0.28);
}
.fpats-btn:hover {
  background: #c94e28;
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(232,97,58,0.38);
  color: #fff;
  text-decoration: none;
}
.fpats-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.fpats-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  margin: 10px 0 0;
  font-weight: 400;
}

/* ============================================================
   RESPONSIVE – TABLET
   ============================================================ */

@media (max-width: 1200px) {
  .fpats-section { padding: 50px 28px 40px; }
  .fpats-panels  { gap: 5px; }
  .fpats-panel:hover, .fpats-panel--active { flex: 3 1 0; }
}

@media (max-width: 900px) {
  .fpats-section { padding: 44px 20px 36px; }
  .fpats-panels  { gap: 4px; }
  .fpats-panel:hover, .fpats-panel--active { flex: 2.8 1 0; }
  .fpats-panel__pain { display: none; }
}

/* ============================================================
   RESPONSIVE – MOBILE (≤768px)
   ============================================================ */
@media (max-width: 768px) {

  .fpats-section {
    padding: 32px 16px 28px;
    overflow: visible;
  }

  .fpats-head { margin-bottom: 24px; }

  /* ── Font size mobile – variabili dedicate ── */
  .fpats-tag          { font-size: var(--fpats-fs-tag-mob); letter-spacing: 3px; }
  .fpats-title        { font-size: var(--fpats-fs-title-mob); }
  .fpats-sub          { font-size: var(--fpats-fs-subtitle-mob); line-height: 1.55; }
  .fpats-panel__name  { font-size: var(--fpats-fs-panel-name-mob); white-space: normal; }
  .fpats-panel__pain  {
    font-size: var(--fpats-fs-panel-pain-mob);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .fpats-pill         { font-size: var(--fpats-fs-pill-mob); padding: 4px 9px; }

  /* ── Colonne verticali ── */
  .fpats-panels {
    flex-direction: column !important;
    height: auto !important;
    gap: 6px;
    overflow: visible;
  }

  /* ── Pannello compresso – barra toccabile (64px invece di 56px) ── */
  .fpats-panel {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 64px !important;
    border-radius: 12px;
    transition: height 0.45s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
  }

  /* ── Pannello aperto – altezza adattiva con min/max ── */
  .fpats-panel--active {
    height: auto !important;
    min-height: 340px;
    max-height: 450px;
  }

  /* ── Contenuto scorrevole quando attivo ── */
  .fpats-panel--active .fpats-panel__content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Numero: centrato nella barra compressa ── */
  .fpats-panel__num {
    top: 50%;
    left: 16px;
    bottom: auto;
    transform: translateY(-50%);
    font-size: 20px;
    color: rgba(232,97,58,0.5);
    transition: opacity 0.25s, transform 0.25s;
  }
  .fpats-panel--active .fpats-panel__num {
    opacity: 0;
    transform: translateY(calc(-50% - 8px));
  }

  /* ── Label: orizzontale a destra, visibile solo compresso ── */
  .fpats-panel__label {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    transform: translateY(-50%) !important;
    top: 50% !important;
    left: auto !important;
    right: 16px !important;
    bottom: auto !important;
    font-size: var(--fpats-fs-label-mob);
    font-weight: 600;
    letter-spacing: 1.5px;
    opacity: 1;
    color: rgba(255,255,255,0.85);
    transition: opacity 0.25s ease;
  }
  .fpats-panel--active .fpats-panel__label { opacity: 0; }

  /* ── Content padding più generoso ── */
  .fpats-panel__content { padding: 18px 20px; }

  /* ── Icona ── */
  .fpats-panel__ico { width: 36px; height: 36px; margin-bottom: 10px; }
  .fpats-panel__ico svg { width: 17px; height: 17px; }

  /* ── Pills ── */
  .fpats-panel__pills { gap: 5px; margin-bottom: 12px; }

  /* ── CTA full-width ── */
  .fpats-btn {
    width: 100%;
    justify-content: center;
    font-size: var(--fpats-fs-btn-mob);
    padding: 14px 20px;
  }

  /* ── Hint: nascosto su mobile (non ha senso "passa sopra") ── */
  .fpats-hint--desktop { display: none; }
  .fpats-hint--mobile  { display: block; }
}

/* ── Desktop: mostra hint desktop, nascondi mobile ── */
@media (min-width: 769px) {
  .fpats-hint--mobile { display: none; }
}

/* ============================================================
   RESPONSIVE – MOBILE PICCOLO (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .fpats-section { padding: 24px 12px 20px; }

  .fpats-panel { height: 58px !important; }
  .fpats-panel--active {
    min-height: 310px;
    max-height: 420px;
  }

  .fpats-panel__num { font-size: 18px; }
  .fpats-panel__content { padding: 16px 16px; }

  .fpats-btn { font-size: 13.5px; padding: 13px 16px; }
}

/* ============================================================
   RESPONSIVE – MOBILE MOLTO PICCOLO (≤360px)
   ============================================================ */
@media (max-width: 360px) {
  .fpats-section { padding: 20px 10px 18px; }

  .fpats-panel { height: 54px !important; }
  .fpats-panel--active {
    min-height: 290px;
    max-height: 400px;
  }

  .fpats-title { font-size: 22px; }
  .fpats-panel__content { padding: 14px 14px; }
  .fpats-panel__name { font-size: 15px; }
  .fpats-panel__pain { font-size: 12.5px; }
}
