/* CTA Buttons - Responsive Layout */

/* Auto-stack buttons when text would wrap */
@media screen and (max-width: 1280px) {
  .cta-section {
    padding: 4rem 3rem;
  }

  .cta-buttons {
    gap: 1.5rem;
  }

  .cta-text {
    font-size: 2rem;
  }

  .cta-arrow {
    font-size: 2rem;
  }
}

/* Stack buttons vertically when screen is too narrow for side-by-side */
@media screen and (max-width: 1024px) {
  .cta-section {
    padding: 3rem 2rem;
  }

  .cta-buttons {
    flex-direction: column;
    gap: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
  }

  .cta-box {
    width: 100%;
    padding: 1.5rem 2rem;
  }

  .cta-text {
    font-size: 1.75rem;
  }

  .cta-arrow {
    font-size: 1.75rem;
  }
}

/* Medium screens - ensure stacking */
@media screen and (max-width: 900px) {
  .cta-buttons {
    flex-direction: column !important;
    align-items: stretch;
    gap: 1rem;
  }

  .cta-box {
    width: 100%;
    max-width: none;
    padding: 1.25rem 1.75rem;
  }

  .cta-text {
    font-size: 1.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Small screens */
@media screen and (max-width: 768px) {
  .cta-section {
    padding: 2.5rem 1.5rem;
  }

  .cta-buttons {
    flex-direction: column !important;
    gap: 0.875rem;
  }

  .cta-box {
    padding: 1.125rem 1.5rem;
  }

  .cta-text {
    font-size: 1.25rem;
  }

  .cta-arrow {
    font-size: 1.25rem;
  }
}

/* Very small screens */
@media screen and (max-width: 480px) {
  .cta-section {
    padding: 2rem 1rem;
  }

  .cta-buttons {
    gap: 0.75rem;
  }

  .cta-box {
    padding: 1rem 1.25rem;
  }

  .cta-text {
    font-size: 1.125rem;
  }

  .cta-arrow {
    font-size: 1.125rem;
  }
}

/* Container query fallback - stack when buttons are cramped */
@container (max-width: 800px) {
  .cta-buttons {
    flex-direction: column;
  }
}

/* Detect text wrapping and force stacking */
@media screen and (min-width: 768px) and (max-width: 1280px) {
  /* Calculate based on French text length */
  /* "Demander une démo" = ~17 chars, "Réserver un appel" = ~17 chars */
  /* At 2rem font size, approximately 30px per character width */

  .cta-buttons {
    /* Use flexbox wrapping as fallback */
    flex-wrap: wrap;
  }

  .cta-box {
    /* Min width to prevent text wrapping */
    min-width: 280px;
    flex: 1 1 45%;
  }

  /* If container is too narrow for both, stack them */
  @media (max-width: 1024px) {
    .cta-buttons {
      flex-direction: column;
      flex-wrap: nowrap;
    }

    .cta-box {
      flex: 1 1 100%;
      width: 100%;
      max-width: 500px;
      margin: 0 auto;
    }
  }
}

/* Ensure text doesn't wrap within buttons */
.cta-text {
  white-space: nowrap;
  display: inline-block;
}

/* But allow wrapping on very small screens */
@media screen and (max-width: 400px) {
  .cta-text {
    white-space: normal;
    line-height: 1.3;
  }

  .cta-box {
    flex-direction: row;
    align-items: center;
    text-align: left;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .cta-arrow {
    align-self: center;
  }
}

/* Progressive font scaling to prevent wrapping */
@media screen and (min-width: 1024px) and (max-width: 1280px) {
  .cta-text {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
  }

  .cta-arrow {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
  }
}

/* High priority rule: Stack when text would definitely wrap */
@media screen and (max-width: 1100px) {
  .cta-section .cta-buttons {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .cta-section .cta-box {
    width: 100% !important;
    max-width: 500px !important;
    margin: 0 auto !important;
  }
}