/* ─── Responsive Overrides ───────────────────────────────────────────────── */
/* Breakpoints: 1280px (wide desktop), 1024px (laptop), 768px (tablet),       */
/*              480px (large mobile), 375px (small mobile).                   */

/* ── 1280px: slight padding reduction ─────────────────────────────────── */
@media (max-width: 1280px) {
  :root {
    --padding-page: 40px;
    --gap-sections: 100px;
  }

  .hero__copy        { width: 500px; }
  .image-block--hero { width: 420px; }
  .image-block--hero .image-block__rotator { width: 420px; }
  .image-block--hero .image-block__frame   { width: 380px; height: 295px; }

  .solution__content    { width: 540px; }
  .image-block--section-left .image-block__frame { width: 320px; height: 480px; }
  .image-block--section-left .image-block__rotator { width: 340px; height: 480px; }

  .comparison__cards    { width: 100%; }
  .ppp-card__copy       { width: 480px; }
  .ppp-card__body       { width: 440px; }

}

/* Network cards:
   4 cards require 1184px exactly (4*278 + 3*24).
   Below that width switch to centered 2x2 to prevent overlap. */
@media (max-width: 1263px) {
  .network-cards {
    grid-template-columns: repeat(2, 278px);
    justify-content: center;
    justify-items: stretch;
  }
}

/* ── 1025px-1280px: prevent PPP text clipping ─────────────────────────── */
@media (min-width: 1025px) and (max-width: 1280px) {
  /* Keep hero CTAs on one row in narrow-desktop range */
  .hero .btn-group {
    flex-wrap: nowrap;
    gap: 16px;
  }

  .hero .btn-primary,
  .hero .btn-outline {
    padding: 16px 20px;
    font-size: 16px;
    line-height: 24px;
  }

  .ppp-card__copy {
    width: 52%;
    min-width: 0;
  }

  .ppp-card__body {
    width: 100%;
  }

  .ppp-card__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ppp-card__list-item {
    width: 100%;
    white-space: normal;
    align-items: flex-start;
  }

  .ppp-card__price {
    max-width: 300px;
  }
}

/* Desktop and above: hero CTAs side by side */
@media (min-width: 1025px) {
  .hero .btn-group {
    flex-wrap: nowrap;
  }
}

/* ── 1024px: two-column → stacked, reduced font sizes ─────────────────── */
@media (max-width: 1024px) {
  :root {
    --padding-page: 32px;
    --gap-sections: 80px;
    --size-h1: 48px;
    --lh-h1: 54px;
    --size-h2: 38px;
    --lh-h2: 43.2px;
  }

  .nav__links       { display: none; }
  .nav__hamburger   { display: none; }

  /* Hero: stack vertically */
  .hero__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
  }

  .hero {
    overflow: visible;
  }

  .hero__copy             { width: 100%; }
  .image-block--hero {
    width: min(100%, 498px);
    height: auto;
    margin-inline: auto;
    overflow: visible;
  }
  .image-block--hero .image-block__rotator {
    position: relative;
    width: min(100%, 498px);
    aspect-ratio: 498 / 404;
    height: auto;
    left: 0;
    top: 0;
    margin-inline: auto;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .image-block--hero .image-block--rot-pos-7 {
    width: 92.37%;
  }
  .image-block--hero .image-block__frame {
    width: 100%;
    aspect-ratio: 460 / 353;
    height: auto;
  }

  /* Solution: stack */
  .solution__inner {
    flex-direction: column;
    gap: 40px;
  }

  .solution__content    { width: 100%; }
  .image-block--section-left  {
    width: min(100%, 410px);
    height: auto;
    margin-inline: auto;
    overflow: visible;
  }
  .image-block--section-left .image-block__rotator {
    width: min(100%, 410px);
    aspect-ratio: 410 / 582;
    height: auto;
    margin-inline: auto;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .image-block--section-left .image-block--rot-neg-3 {
    width: 93.66%;
  }
  .image-block--section-left .image-block__frame {
    width: 100%;
    aspect-ratio: 384 / 564;
    height: auto;
  }

  /* Benefit content group: stack */
  .benefit__content-group {
    flex-direction: column;
    gap: 40px;
  }

  /* Dipendenti: align feature list like Aziende (left-aligned text block) */
  #state-dipendenti .benefit__list {
    width: 100%;
    align-self: stretch;
    text-align: left;
  }

  .image-block--section-right {
    width: min(100%, 633px);
    margin-inline: auto;
    overflow: visible;
  }
  .image-block--section-right .image-block__rotator {
    width: min(100%, 633px);
    aspect-ratio: 633 / 471;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .image-block--section-right .image-block--rot-pos-4 {
    width: 95.89%;
  }
  .image-block--section-right .image-block__frame {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 607 / 433;
    height: auto;
  }
  .image-block__frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* CTA form: stack */
  .cta-form__inner {
    flex-direction: column;
    gap: 40px;
    padding: 40px 32px;
  }

  .cta-form__form { width: 100%; }

  /* Comparison: stack */
  .comparison__cards {
    flex-direction: column;
    gap: var(--gap-items);
  }

  /* Keep 4-card groups in allowed layouts only: 4-up or 2x2 */
  .stats__cards,
  .steps {
    grid-template-columns: 1fr 1fr;
  }

  /* PPP card: stack */
  .ppp-card {
    flex-direction: column;
    gap: 32px;
    padding: 32px;
  }

  .ppp-card__copy { width: 100%; }
  .ppp-card__body { width: 100%; }

  .ppp-card__price {
    width: 100%;
    height: 240px;
  }

  /* Actors: stack */
  .actors-grid {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
  }

  .actor-card { width: 280px; }

  /* Dashboard mockup */
  .dashboard__mockup-wrap img.mockup-main { width: 100%; }
  .dashboard__mockup-wrap img.mockup-phone { display: none; }
}

/* ── 575px-1024px: center hero CTAs in-page ───────────────────────────── */
@media (min-width: 575px) and (max-width: 1024px) {
  .hero .btn-group {
    justify-content: center;
    align-self: center;
  }
}

/* ── 769px-1024px: reduce decorative SVG overlays ─────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .image-block__overlay--hero-vectorized {
    transform: scale(0.6);
    transform-origin: left bottom;
  }

  .image-block__overlay--section-vec {
    transform: scale(0.6);
    transform-origin: right bottom;
  }

  .image-block__overlay--section-left-vec {
    transform: scale(0.6);
    transform-origin: right bottom;
  }
}

/* ── 768px: single column, simplified ─────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --nav-height: 72px;
    --padding-page: 36px;
    --gap-sections: 60px;
    --gap-content: 40px;
    --size-h1: 40px;
    --lh-h1: 46px;
    --size-h2: 32px;
    --lh-h2: 36px;
    --size-h3: 26px;
    --lh-h3: 30px;
    --size-body-lg: 17px;
    --lh-body-lg: 26px;
  }

  .state-selector {
    width: calc(100% - 72px);
    max-width: 460px;
    margin: 14px auto 10px;
    padding: 8px;
    position: relative;
    top: 0;
  }

  .scroll-top {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    font-size: 24px;
  }

  .state-selector__tab {
    display: none;
  }

  .state-selector__mobile {
    display: block;
  }

  /* Stats: stacked cards */
  .stats__cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
  }

  .stat-card { width: 100%; }

  /* Steps: stacked cards */
  .steps {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
  }

  .step-card { min-width: 0; }
  .step-card__title { white-space: normal; }

  /* Network cards: stacked cards */
  .network-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
    justify-content: center;
    justify-items: stretch;
  }

  .network-card {
    width: 100%;
    max-width: none;
  }

  .benefit-card__photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .network-card__desc {
    width: 100%;
  }

  /* Verified section: stack */
  .verified-section {
    flex-direction: column;
    gap: 32px;
  }

  /* Info chips: single column on small screens */
  .info-chips-grid {
    grid-template-columns: 1fr;
  }

  .info-chip { white-space: normal; }

  .verified-list {
    grid-template-columns: 1fr;
  }

  .verified-list__item {
    width: 100%;
    white-space: normal;
    align-items: flex-start;
  }

  /* PPP bullets: stacked to avoid overlap */
  .ppp-card__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ppp-card__list-item {
    width: 100%;
    white-space: normal;
    align-items: flex-start;
  }

  /* Section side paddings: rely on shared page padding only */
  .stats,
  .how-to,
  .comparison,
  .dashboard {
    padding-inline: 0;
  }

  /* Footer */
  .footer__inner    { padding-inline: var(--padding-page); }
  .footer__logo     { align-self: center; }
  .footer__meta     { flex-direction: column; gap: 8px; align-items: center; text-align: center; white-space: normal; }
}

/* ── 480px: mobile ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --size-h1: 34px;
    --lh-h1: 40px;
    --size-h2: 28px;
    --lh-h2: 33.6px;
    --size-stat: 44px;
  }

  .btn-group { flex-direction: column; gap: 12px; }
  .btn-primary,
  .btn-outline { width: 100%; justify-content: center; }

  /* Network cards: single column */
  .network-cards { grid-template-columns: 1fr; justify-content: center; justify-items: stretch; }

  /* Actors: single column */
  .actors-grid    { flex-direction: column; align-items: center; }
  .actor-card     { width: 100%; }

  .comparison-card { padding: 24px 20px; }

  .footer__meta p {
    width: 100%;
  }

  .image-block--hero .image-block__rotator { width: min(100%, 420px); }
  .image-block--section-left .image-block__rotator { width: min(100%, 360px); }
  .image-block--section-right .image-block__rotator { width: min(100%, 560px); }
}

/* ── 481px-564px: full-width CTAs ─────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 564px) {
  .btn-group {
    width: 100%;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .btn-primary,
  .btn-outline { width: 100%; justify-content: center; }
}
