/* Ajustes móviles con Bootstrap 5.
   Se cargan después de los estilos existentes para suavizar la vista en pantallas pequeñas
   sin alterar el diseño de escritorio. */

@media (max-width: 991.98px) {
  /* Hero + navegación */
  .hero {
    height: auto;
    min-height: 70vh;
    padding: 4.75rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .hero__bg {
    object-position: center 20%;
  }

  .site-logo {
    position: static;
    height: 64px;
    margin: 0 auto 0.5rem;
  }

  .site-logo__img {
    height: 150px;
    transform: translate(-10px, -5px);
  }

  .contact-btn {
    position: static;
    margin: 0.75rem auto 0;
    font-size: 0.95rem;
    padding: 0.55rem 1.1rem;
    width: auto;
  }

  .site-nav {
    position: static;
    transform: none;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 14px;
    margin: 0 auto 0.75rem;
  }

  .site-nav__link {
    font-size: 1rem;
    color: #fff;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    line-height: 1.2;
  }

  /* Banner home: tamaño h1 en móviles/anchos medios */
  .banner__content h1 {
    font-size: clamp(3.2rem, 9vw, 4.8rem) !important;
    line-height: 1.2;
    margin: 0 auto;
    padding: 0.5rem 0;
  }

  .hero__content {
    padding: 0;
    margin: 0 auto;
    text-align: center;
    max-width: 680px;
  }

  .hero__content h1 {
    font-size: clamp(1.9rem, 6vw, 2.6rem);
  }

  .hero__content p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.92);
    margin-top: 0.75rem;
  }

  /* Pills */
  .hero__pills {
    position: static;
    transform: none;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0;
    width: 100%;
    max-width: 780px;
    margin: 1rem auto 0;
  }

  .pill {
    height: auto;
    min-height: 0;
    border-radius: 22px;
    padding: 1rem 1.25rem;
    flex-direction: column;
    text-align: center;
  }

  .pill--left,
  .pill--right {
    flex: 1 1 auto;
    transform: none;
    justify-content: center;
    margin: 0 auto;
    text-align: center;
  }

  .pill--right {
    padding-right: 0;
    width: 100%;
    max-width: 80px;
    height: 60px;
    margin: 0 auto;
  }

  .pill--right .pill_title2 {
    padding-right: 0;
    text-align: center;
  }

  .pill_title2__line2 {
    margin-right: 0;
    display: inline;
    width: 100%;
    text-align: center;
  }

  .pill__icon {
    width: 96px;
    height: 96px;
    margin: 0.35rem auto 0;
  }

  .hero__pills.is-contact .pill--right.is-center .pill__icon,
  .hero__pills.is-whoare .pill--right.is-center .pill__icon {
    margin-left: -20px;
  }

  /* Version home (sin clases de ruta): pill derecha más ancha para el texto */
  .hero__pills:not(.is-contact):not(.is-whoare) .pill--right {
    max-width: 320px;
    height: auto;
    padding: 1rem 1.4rem;
  }

  .hero__pills:not(.is-contact):not(.is-whoare) .pill_title2__line2 {
    display: block;
  }

  /* Home cards */
  .services-cta {
    margin-top: -2.25rem;
    padding: 0.75rem 0.75rem 2rem !important;
  }

  .services-cta__inner {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    gap: 1.75rem;
  }

  .service-card-wrap::before {
    top: -1rem;
    left: -0.75rem;
    width: calc(100% + 0.75rem);
    height: calc(100% + 0.75rem);
  }

  .service-card {
    padding: 1.4rem 1.3rem 1.5rem;
    transform: none;
    border: 1px solid rgba(0,0,0,0.04);
    background: linear-gradient(160deg, #bfa586 0%, #b69b77 55%, #a8835a 100%);
    box-shadow: 0 16px 30px rgba(0,0,0,0.14);
    border-radius: 26px;
  }

  .service-card__titulo {
    color: #fdf8f2;
    line-height: 1.2;
    margin-bottom: 0.65rem;
  }

  .service-card__subtitulo {
    color: rgba(36, 26, 18, 0.85);
  }

  .service-card-wrap::before {
    display: none;
  }

  /* Servicios page */
  .service-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.15rem;
  }

  .services-categories {
    padding-inline: 0.75rem;
    gap: 2.5rem;
  }

  .services-hero {
    margin: 4.5rem auto 2rem;
    padding: 2.5rem 1rem 1.25rem;
  }

  .services-hero__subtitle {
    transform: none;
    font-size: 1rem;
    line-height: 1.45;
    margin-top: 0.35rem;
  }

  .service-category__header {
    align-items: flex-start;
  }

  .service-category__title {
    font-size: 1.4rem;
    line-height: 1.2;
    margin: 0 0 0.35rem 0;
  }

  .service-category__description {
    font-size: 0.98rem;
    line-height: 1.5;
    margin: 0 0 60px 0;
    transform: none !important;
    margin-top: 0.35rem;
  }

  .service-card__popover {
    display: none !important;
  }

  .service-card__face {
    min-height: 0;
  }

  .services-selection {
    width: calc(100% - 2rem);
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    transform: translateY(150%);
  }

  .services-selection.is-visible {
    transform: translateY(0);
  }

  .services-selection__inner {
    max-height: 70vh;
  }

  .services-selection__content {
    max-height: 150px;
    overflow-y: auto;
  }


  .services-selection__footer {
    margin-top: auto;
    padding: 1rem 1.5rem 1.4rem;
    display: flex;
    justify-content: center;
  }

  .services-selection__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(320px, 100%);
    padding: 0.85rem 1.2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #6b3f2b, #a56c44);
    color: #fef7ed;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    transition: filter 0.2s ease, transform 0.2s ease;
  }
  .services-end-subtitle,
  .services-end-subtitle-service {
    padding: 0 1rem;
    font-size: 1.15rem;
  }

  /* Contactanos */
  .contactanos {
    padding: 28px 12px 64px;
  }

  .contactanos__card {
    padding: 24px 18px;
    grid-template-columns: 1fr;
  }
  .services-dropdown {
    left: 0 !important;
    right: 0 !important;
    bottom: 1rem;
    padding: 0 1rem;
  }
  .services-dropdown__panel {
    max-width: 480px;
    width: 100%;
    min-width: 0;
    margin: 0 auto;
  }
  .contactanos__info {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 14px;
    text-align: center;
  }
  .contactanos__info-logo {
    width: 100%;
    justify-content: center;
  }
  .contactanos__info-logo img {
    max-width: 140px;
  }
  .contactanos__info-title {
    font-size: 18px;
  }
  .contactanos__list {
    font-size: 0.9rem;
    width: 100%;
    text-align: center;
    justify-items: center;
  }

  /* Quienes somos */
  .qs-about {
    padding: 26px 0 40px;
  }

  .qs-card {
    grid-template-columns: 1fr;
    padding: 18px 16px;
  }

  .qs-person__grid {
    grid-template-columns: 1fr;
  }

  .qs-person__imagewrap {
    height: auto;
  }

  .qs-person__quote-qs {
    margin: 16px 20px 0;
    padding: 14px 12px;
    background: rgba(82, 77, 70, 0.08);
    border-radius: 16px;
    font-size: 1rem;
  }

  /* Stats en /quienes_somos: quitar líneas separadoras y compactar */
  .qs-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(100px, 1fr));
    justify-items: center;
    gap: 12px;
  }
  .h1-subtitulo-qs {
    padding: 0 20px;
    font-size: 1.05rem;
  }

  .qs-stat {
    width: 100%;
    max-width: 200px;
    padding: 0 4px 10px;
  }

  .qs-stat + .qs-stat::before {
    display: none;
  }

  .qs-stat__num {
    font-size: 32px;
  }

  .qs-stat__label {
    font-size: 11px;
    letter-spacing: 0.22em;
  }

  /* Segunda persona: apila imagen + texto y centra en móviles */
  .qs-person--two {
    padding: 28px 0 36px;
  }
  .qs-person--two .qs-person__grid {
    grid-template-columns: 1fr;
    align-items: center;
    text-align: center;
    gap: 18px;
  }

  .qs-person--two .qs-person__imagewrap {
    height: auto;
    max-width: 240px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
  }

  .qs-person--two .qs-person__image {
    width: 100%;
    max-width: 240px;
    height: auto;
    border-radius: 20px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 24px rgba(0,0,0,0.15);
  }

  .qs-person--two .qs-person__text {
    font-size: 1rem;
    line-height: 1.8;
    padding: 0 10px;
  }

  .qs-person--two .qs-person__quote-qs {
    margin: 16px auto 0;
    padding: 18px 18px;
    background: rgba(82, 77, 70, 0.08);
    border-radius: 18px;
    font-size: 1.05rem;
    line-height: 1.6;
    width: min(360px, 100%);
  }
}

@media (max-width: 991.98px) {
  .hero {
    padding: 4rem 0.75rem 2.25rem;
  }

  /* Banner home: h1 más grande en móvil */
  .banner__content h1 {
    font-size: clamp(3.2rem, 9vw, 4.6rem) !important;
    line-height: 1.18;
    margin: 0 auto;
    padding: 0.5rem 0;
  }

  .site-logo,
  .contact-btn {
    width: 40%;
    justify-content: center;
  }

  .site-logo {
    margin-bottom: 0.35rem;
  }

  .site-nav {
    gap: 0.35rem;
  }

  .site-nav__link {
    font-size: 0.95rem;
  }

  .hero__content h1 {
    font-size: clamp(1.7rem, 7vw, 2.2rem);
  }

  .hero__content p {
    font-size: 0.98rem;
  }

  .hero__pills {
    margin-top: 0.5rem;
  }

  .pill {
    padding: 0.85rem 1rem;
  }

  .pill__icon {
    width: 84px;
    height: 84px;
  }

  .services-hero {
    padding: 2rem 0.85rem 1rem;
  }

  .service-card {
    padding: 1.05rem 1rem;
  }

  .services-selection__content {
    padding-inline: 1.1rem;
  }

  .services-selection__cta {
    width: 100%;
  }

  .services-cta__inner {
    gap: 1.25rem;
  }
}

/* Micro pantallas: asegurar que nada se desarme por debajo de ~580px */
@media (max-width: 479.98px) {
  /* Mantén la misma apariencia del breakpoint anterior,
     solo ajustamos tamaños mínimos para prevenir desbordes */
  .services-cta {
    padding: 0.6rem 0.75rem 1.6rem !important;
  }
  .services-cta__inner {
    width: 100%;
    gap: 1rem;
  }
  .service-card {
    padding: 1rem 0.9rem 1.2rem;
  }
  .service-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .contactanos-home {
    padding: 2rem 0.85rem;
  }
  .contact-form .contact-row {
    gap: 0.6rem;
  }
  .contact-form label {
    font-size: 0.95rem;
  }
  .contact-form input,
  .contact-form textarea,
  .contact-form .servicio-field .btn-servicio {
    font-size: 0.95rem;
  }
  .btn {
    font-size: 1.1rem;
    padding: 0.65rem 1.5rem;
  }
}
