/* =========================================================
   CotizadorIsapres — Responsive
   ========================================================= */

/* Base styles for article-body */
.article-body {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-inline: 24px;
}

/* ---- Desktop XL ---- */
@media (min-width: 1600px) {
  .hero { padding-top: calc(var(--header-h) + 64px); }
  .hero-picture { min-height: 540px; }
}

/* ---- Desktop / notebook ---- */
@media (max-width: 1279px) {
  .hero-grid {
    grid-template-columns: minmax(0, .95fr) minmax(390px, 1.05fr);
    gap: 36px;
  }
  .hero-picture { min-height: 430px; }
}

/* ---- Header tablet: evita wrap/desalineación antes del menú móvil ---- */
@media (max-width: 1120px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: #f8f9ff;
    box-shadow: -2px 0 20px rgba(0,0,0,0.08);
    border-radius: 20px 0 0 20px;
    backdrop-filter: blur(10px);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 150;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
  }
  .nav-links.open { right: 0; }
  .nav-links a {
    display: block;
    padding: 16px 0;
    border-bottom: 1px solid rgba(10,37,64,0.1);
    color: var(--azul);
    font-size: 18px;
    text-align: left;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(20px);
    transition: color 0.2s, padding-left 0.2s, opacity 0.3s ease, transform 0.3s ease;
  }
  .nav-links a:hover { color: var(--verde); padding-left: 4px; }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links.open a { opacity: 1; transform: translateX(0); }

  .nav-actions { flex-shrink: 0; }
  .nav-actions .btn { padding-inline: 16px; }
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--azul);
    z-index: 160;
    box-shadow: 0 4px 16px rgba(10,37,64,0.15);
  }
  .menu-overlay { display: none; }
}

/* ---- Desktop intermedio ---- */
@media (max-width: 1080px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .article-body { padding-inline: 28px; }
}

/* ---- Tablet: Hero apilado y formulario en flujo ---- */
@media (max-width: 1024px) {
  .hero {
    padding-top: calc(var(--header-h) + 42px);
    padding-bottom: 56px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
  }
  .hero-copy {
    max-width: 720px;
    margin-inline: auto;
    text-align: center;
  }
  .lead,
  .hero-benefits--compact {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-benefits { justify-content: center; }
  .hero-cta { justify-content: center; }
  .hero-trust { justify-content: center; }
  .hero-picture {
    max-width: 900px;
    min-height: 390px;
    margin-inline: auto;
  }
  .hero-shell > .quote-card { max-width: 820px; }
}

/* ---- Tablet angosto ---- */
@media (max-width: 920px) {
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 0; }
  .article-aside { position: static; margin-top: 16px; }
  .article-aside .toc { display: none; }
  .article-body { padding-inline: 32px; }
  .article-cover { width: 90%; margin-left: auto; margin-right: auto; }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer-brand { grid-column: auto; }
}

/* ---- Mobile: menú lateral desplegable ---- */
@media (max-width: 768px) {
  .site-header { height: 64px; }
  .logo-mark svg { width: 24px; height: 24px; }
  .logo-text { font-size: 16px; }
  .nav-inner { padding-inline: 16px; }

  .hero {
    padding-top: calc(64px + 32px);
    padding-bottom: 48px;
  }
  .hero-copy h1 { font-size: clamp(2rem, 7vw, 2.8rem); }
  .hero-picture { min-height: 340px; border-radius: 22px; }

  .nav-links {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: #f8f9ff;
    box-shadow: -2px 0 20px rgba(0,0,0,0.08);
    border-radius: 20px 0 0 20px;
    backdrop-filter: blur(10px);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 150;
    padding: 48px 24px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .nav-links.open { right: 0; }
  .nav-links a {
    display: block;
    padding: 16px 0;
    border-bottom: 1px solid rgba(10,37,64,0.1);
    color: var(--azul);
    text-decoration: none;
    font-weight: 500;
    font-size: 18px;
    text-align: left;
    opacity: 0;
    transform: translateX(20px);
    transition: color 0.2s, padding-left 0.2s, opacity 0.3s ease, transform 0.3s ease;
  }
  .nav-links a:hover {
    color: var(--verde);
    padding-left: 4px;
  }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links.open a { opacity: 1; transform: translateX(0); }
  .nav-links.open a:nth-child(1) { transition-delay: 0.05s; }
  .nav-links.open a:nth-child(2) { transition-delay: 0.1s; }
  .nav-links.open a:nth-child(3) { transition-delay: 0.15s; }
  .nav-links.open a:nth-child(4) { transition-delay: 0.2s; }
  .nav-links.open a:nth-child(5) { transition-delay: 0.25s; }
  .nav-links.open a:nth-child(6) { transition-delay: 0.3s; }

  .nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }
  .nav-actions .btn-whatsapp {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 14px;
    order: 1;
  }
  .nav-toggle {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--azul);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 160;
    box-shadow: 0 4px 16px rgba(10,37,64,0.15);
  }
  .nav-toggle:hover { background: #f8f9ff; transform: scale(1.05); }
  .nav-toggle:active { transform: scale(0.95); }
  .nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--azul);
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
  }
  .nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .nav-actions .btn {
    order: 3;
    margin-right: 0;
    padding: 8px 16px;
    font-size: 14px;
  }

  .menu-overlay { display: none; }
}

/* ---- Mobile: imagen primero ---- */
@media (max-width: 767px) {
  .hero-grid { display: flex; flex-direction: column; }
  .hero-visual { order: 1; width: 100%; }
  .hero-copy { order: 2; text-align: left; }
  .hero-benefits { justify-content: flex-start; }
  .hero-cta { justify-content: flex-start; }
  .hero-trust { justify-content: flex-start; }
  .hero-shell > .quote-card { order: 3; }
}

/* ---- Mobile chico ---- */
@media (max-width: 560px) {
  .nav-links { width: 250px; }
  .nav-toggle { width: 44px; height: 44px; margin-right: 10px; }
  .nav-toggle span { width: 20px; }
  .nav-actions .btn-whatsapp { display: none; }
  .nav-actions .btn { padding: 8px 12px; font-size: 13px; }

  .container { padding-inline: 18px; }
  .hero { padding-top: calc(64px + 24px); }
  .hero-picture { min-height: min(78vw, 420px); }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .form-actions { grid-template-columns: 1fr; }
  .form-actions .btn { width: 100%; }
  .form-secure { align-items: flex-start; text-align: left; }

  .cards-4, .cards-3, .cards-grid, .timeline { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-grid { grid-template-columns: 1fr; }
  .logo-chip { min-width: 0; flex: 1 1 40%; }
  .article-body { padding-inline: 24px; }
  .article-cover { width: 85%; margin-left: auto; margin-right: auto; }
}

@media (max-width: 430px) {
  .hero-copy h1 { font-size: clamp(1.85rem, 9vw, 2.35rem); }
  .lead { font-size: 1rem; }
  .hero-picture { min-height: min(88vw, 380px); border-radius: 18px; }
  .quote-card { padding: 20px 16px; }
  .whatsapp-float { width: 54px; height: 54px; right: 16px; bottom: 16px; }
}

/* R22: Características de las Isapres — 2 columnas entre 561px y 920px */
@media (min-width: 561px) and (max-width: 920px) {
  #isapre-cards.cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px;
  }

  #isapre-cards .isapre-card {
    padding: 22px 20px;
  }

  #isapre-cards .isapre-card-logo {
    max-height: 48px;
  }

  #isapre-cards .isapre-card h3 {
    font-size: 1.08rem;
  }

  #isapre-cards .isapre-tag {
    font-size: 12.5px;
    line-height: 1.35;
  }

  #isapre-cards .isapre-card li {
    font-size: 13.5px;
    line-height: 1.45;
  }
}

/* R22: desde 560px hacia abajo vuelve a 1 columna para móvil */
@media (max-width: 560px) {
  #isapre-cards.cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* R25: permitir overlay clickeable del menú móvil/tablet */
@media (max-width: 1120px) {
  .menu-overlay.open {
    display: block;
  }
}

/* R26: anular overlay del menú para no bloquear clics */
@media (max-width: 1120px) {
  .menu-overlay,
  .menu-overlay.open {
    display: none !important;
    pointer-events: none !important;
  }
}


/* R60: CTA "COTIZA FÁCIL" bajo imagen hero en mobile
   Reemplaza el intento de CTA en header para liberar espacio del logo y la hamburguesa. */
.mobile-hero-cta-wrap {
  display: none;
}

.mobile-hero-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 13px 30px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: #F97316;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: clamp(1.28rem, 6.2vw, 2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14), 0 3px 8px rgba(249, 115, 22, 0.12);
  transform-origin: center;
}

.mobile-hero-cta::before {
  content: "";
  position: absolute;
  inset: -40% auto -40% -70%;
  width: 42%;
  background: linear-gradient(115deg, transparent 0%, rgba(255,255,255,0.12) 38%, rgba(255,255,255,0.48) 50%, rgba(255,255,255,0.12) 62%, transparent 100%);
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: -1;
}

.mobile-hero-cta:hover,
.mobile-hero-cta:focus-visible {
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.15), 0 4px 10px rgba(249, 115, 22, 0.16);
}

.mobile-hero-cta:focus-visible {
  outline: 3px solid rgba(249, 115, 22, 0.34);
  outline-offset: 4px;
}

@media (max-width: 767px) {
  .mobile-hero-cta-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    pointer-events: auto;
  }

  .mobile-hero-cta--animated {
    animation: mobileHeroCtaPulse 2.7s ease-in-out infinite;
  }

  .mobile-hero-cta--animated::before {
    animation: mobileHeroCtaShine 2.7s ease-in-out infinite;
  }

  .mobile-hero-cta-wrap--home {
    order: 2;
    margin: -26px auto 18px;
    z-index: 3;
  }

  .hero-copy {
    order: 3;
  }

  .hero-shell > .quote-card {
    order: 4;
  }

  .landing-hero .mobile-hero-cta-wrap--landing {
    position: relative;
    z-index: 3;
    margin: -28px auto 16px;
    padding-inline: 18px;
  }

  .landing-hero .landing-hero-inner {
    margin-top: 0 !important;
  }
}

@media (max-width: 430px) {
  .mobile-hero-cta {
    min-height: 52px;
    padding: 12px 28px;
    border-width: 2px;
    font-size: clamp(1.45rem, 7.6vw, 1.85rem);
  }

  .mobile-hero-cta-wrap--home {
    margin-top: -24px;
    margin-bottom: 16px;
  }

  .landing-hero .mobile-hero-cta-wrap--landing {
    margin-top: -27px;
    margin-bottom: 16px;
  }
}

@media (max-width: 360px) {
  .mobile-hero-cta {
    min-height: 48px;
    padding: 11px 22px;
    font-size: 1.35rem;
  }
}

@keyframes mobileHeroCtaPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14), 0 3px 8px rgba(249, 115, 22, 0.12);
  }
  50% {
    transform: scale(1.025);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16), 0 5px 12px rgba(249, 115, 22, 0.18);
  }
}

@keyframes mobileHeroCtaShine {
  0%, 44% {
    left: -70%;
    opacity: 0;
  }
  48% {
    opacity: 0.42;
  }
  72% {
    left: 130%;
    opacity: 0;
  }
  100% {
    left: 130%;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-hero-cta,
  .mobile-hero-cta::before {
    animation: none !important;
    transform: none !important;
  }
}
