/**
 * Sistema de contraste CuidateGratis — bloques oscuros / imagen vs bloques claros.
 * Corrige textos invisibles por herencia global (section-title oscuro sobre fondos oscuros).
 */

/* —— Variables de superficie —— */
:root {
  --cg-green-900: #0f3d2e;
  --cg-green-800: #123f31;
  --cg-green-700: #1f6b45;
  --cg-green-100: #eaf5ee;
  --cg-blue-700: #1f6f8b;
  --cg-gold-500: #e5b91e;
  --cg-white: #ffffff;
  --cg-bg: #f6f8f6;
  --cg-text: #10231a;
  --cg-muted: #4f5f58;
  --cg-border: #dde7e1;
  --cg-on-dark: #ffffff;
  --cg-on-dark-soft: rgba(255, 255, 255, 0.88);
  --cg-on-dark-muted: rgba(255, 255, 255, 0.78);
}

/* —— Texto en bloques claros (sin !important agresivo en títulos de bloques oscuros) —— */
body.cgc-home-page .quick-intro .section-title,
body.cgc-home-page .recommended .section-title,
body.cgc-home-page .path-section > .container > .section-head .section-title,
body.cgc-home-page .section:not(.lead):not(.home-pro) > .container > .section-head .section-title,
body.cgc-home-page .testimonials .section-title {
  color: var(--cg-text) !important;
}

body.cgc-home-page .calculator-promo .section-title,
body.cgc-home-page .calculator-promo .section-sub {
  color: var(--cg-text) !important;
}

body.cgc-home-page .calculator-promo .section-sub,
body.cgc-home-page .quick-note,
body.cgc-home-page .recommended-legal {
  color: var(--cg-muted) !important;
}

/* —— Superficie oscura: newsletter / guía gratuita —— */
.lead-inner {
  position: relative;
  isolation: isolate;
}

.lead-inner > * {
  position: relative;
  z-index: 2;
}

body.cgc-home-page .lead .section-kicker,
body.cgc-home-page .lead-inner .section-kicker,
body.cgc-home-page .lead .section-title,
body.cgc-home-page .lead-inner .section-title,
body.cgc-home-page .lead-inner h2.section-title {
  color: var(--cg-on-dark) !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

.lead .section-sub,
.lead-inner .section-sub {
  color: var(--cg-on-dark-soft) !important;
  opacity: 1 !important;
}

.lead-nota,
.lead-nota a {
  color: var(--cg-on-dark-muted) !important;
}

.lead-inner .newsletter-consent,
.lead-inner .newsletter-consent label {
  color: var(--cg-on-dark-soft) !important;
}

.lead-inner .email-form button {
  background: var(--cg-white) !important;
  color: var(--cg-green-900) !important;
  font-weight: 700 !important;
}

/* —— Cuídate PRO —— */
.home-pro-hero {
  position: relative;
  isolation: isolate;
}

.home-pro-hero__copy {
  position: relative;
  z-index: 2;
}

.home-pro-hero__media {
  z-index: 0;
}

.home-pro-hero__media::after {
  z-index: 1 !important;
  pointer-events: none !important;
}

.home-pro-hero__copy .section-kicker {
  color: #c8e6d4 !important;
}

body.cgc-home-page .home-pro-hero__copy .section-title,
body.cgc-home-page .home-pro-hero__copy h2.section-title {
  color: var(--cg-on-dark) !important;
  text-shadow: 0 2px 12px rgba(8, 35, 24, 0.35) !important;
  opacity: 1 !important;
}

.home-pro-hero__copy .section-sub {
  color: var(--cg-on-dark-soft) !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

.home-pro-list,
.home-pro-list li {
  color: var(--cg-on-dark-soft) !important;
  opacity: 1 !important;
}

.home-pro-actions .btn-primary {
  color: var(--cg-on-dark) !important;
}

.home-pro-actions .btn-secondary {
  color: var(--cg-on-dark) !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

@media (max-width: 900px) {
  .home-pro-hero__media::after {
    background: linear-gradient(
      180deg,
      rgba(15, 61, 46, 0.35) 0%,
      rgba(15, 61, 46, 0.5) 45%,
      rgba(15, 61, 46, 0.82) 72%,
      rgba(15, 61, 46, 0.94) 100%
    ) !important;
  }

  .home-pro-hero {
    min-height: clamp(320px, 58vh, 440px) !important;
  }

  .home-pro-hero__copy {
    padding: 22px 18px 28px !important;
  }

  .home-pro-hero__copy .section-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem) !important;
    line-height: 1.12 !important;
  }
}

/* —— Ruta sugerida (panel con imagen) —— */
.path-result {
  position: relative;
  isolation: isolate;
  color: var(--cg-on-dark-soft) !important;
}

.path-result > * {
  position: relative;
  z-index: 2;
}

.path-result::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(15, 61, 46, 0.78) 0%,
    rgba(15, 61, 46, 0.65) 50%,
    rgba(15, 61, 46, 0.55) 100%
  );
  pointer-events: none;
}

.path-result > span:first-child {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82) !important;
  margin-bottom: 6px;
}

body.cgc-home-page .path-result h3,
body.cgc-home-page .path-result .section-title {
  color: var(--cg-on-dark) !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

.path-result .path-lead,
.path-result p.path-lead,
.path-result p {
  color: var(--cg-on-dark-soft) !important;
  opacity: 1 !important;
}

.path-result .path-insight {
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  backdrop-filter: none !important;
}

.path-result .path-insight strong {
  color: var(--cg-on-dark) !important;
  display: block;
  margin-bottom: 4px;
}

.path-result .path-insight p {
  color: var(--cg-on-dark-muted) !important;
  margin: 0;
}

.path-result .path-legal {
  color: var(--cg-on-dark-muted) !important;
  opacity: 1 !important;
}

.path-result .path-steps li {
  color: var(--cg-on-dark-soft) !important;
}

@media (max-width: 820px) {
  .path-result {
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* —— Recetas showcase —— */
.recipe-showcase-card {
  position: relative;
  isolation: isolate;
}

.recipe-showcase-card::after {
  z-index: 0 !important;
  opacity: 0.38 !important;
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 58%,
    rgba(8, 35, 24, 0.28) 80%,
    rgba(8, 35, 24, 0.52) 100%
  ) !important;
}

.recipe-showcase-copy,
.recipe-showcase-card .recipe-showcase-copy {
  position: relative;
  z-index: 2;
}

body.cgc-home-page .recipe-showcase-card .section-title,
body.cgc-home-page .recipe-showcase-card h2.section-title,
body.cgc-home-page .recipe-showcase-copy .section-title {
  color: var(--cg-on-dark) !important;
  text-shadow: 0 2px 12px rgba(8, 35, 24, 0.3) !important;
}

.recipe-showcase-copy .section-sub,
.recipe-showcase-card .section-sub,
.recipe-showcase-story {
  color: var(--cg-on-dark-soft) !important;
}

.recipe-count,
.recipe-count strong,
.recipe-count span {
  color: var(--cg-on-dark) !important;
}

.recipe-count span {
  color: var(--cg-on-dark-muted) !important;
}

.recipe-showcase-kicker {
  color: #d4f0dc !important;
}

.recipe-showcase-note {
  color: var(--cg-on-dark-muted) !important;
  z-index: 2;
}

@media (max-width: 820px) {
  .recipe-showcase-card {
    min-height: clamp(420px, 72vh, 560px) !important;
    padding: 24px 20px max(72px, calc(56px + env(safe-area-inset-bottom, 0px))) !important;
  }

  .recipe-showcase-card .section-title,
  .recipe-showcase-card h2.section-title {
    font-size: clamp(1.55rem, 6.5vw, 2.1rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.03em !important;
  }

  .recipe-count strong {
    font-size: clamp(2.2rem, 10vw, 3rem) !important;
  }
}

/* —— Más usadas: grid estable (icono | texto | chevron) —— */
#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo {
  display: grid !important;
  grid-template-columns: 72px minmax(0, 1fr) 44px !important;
  grid-template-rows: 1fr !important;
  align-items: center !important;
  justify-items: stretch !important;
  text-align: left !important;
  gap: 0 16px !important;
  padding: 14px 16px !important;
  min-height: 120px !important;
}

#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-tool-icon-wrap,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-tool-icon-wrap {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
  align-self: center !important;
  width: 56px !important;
  height: 56px !important;
  margin: 0 !important;
}

#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-catalog-card__body,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-catalog-card__body {
  grid-column: 2 !important;
  grid-row: 1 !important;
  padding: 0 !important;
  text-align: left !important;
  min-width: 0 !important;
}

#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-catalog-card__eyebrow,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-catalog-card__eyebrow {
  margin: 0 0 4px !important;
  letter-spacing: 0.06em !important;
  font-size: 0.65rem !important;
}

#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo h3,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo h3 {
  text-align: left !important;
  font-size: 1rem !important;
  margin: 0 0 4px !important;
}

#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo p,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo p {
  text-align: left !important;
  margin: 0 !important;
  max-width: none !important;
  font-size: 0.84rem !important;
}

#herramientas .home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-catalog-card__chevron,
.home-calc-grid a.home-calc-card.cg-catalog-card--photo .cg-catalog-card__chevron {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  align-self: center !important;
  margin: 0 !important;
}

/* —— Botones verdes: máxima prioridad en calculadoras —— */
.cg-calc-page a.cg-more,
.cg-calc-page .cg-calc-actions .cg-more,
.cg-calc-page .cg-catalog-cta,
.cg-calc-page .cg-calc-button,
body.cgc-page-tools .cg-calc-page a.cg-more {
  background: linear-gradient(135deg, var(--cg-green-900), var(--cg-green-700)) !important;
  color: var(--cg-white) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: var(--cg-white) !important;
}

.cg-calc-page a.cg-more span,
.cg-calc-page .cg-catalog-cta span {
  color: inherit !important;
}

/* —— Safe area en bloques finales —— */
.lead,
.home-pro,
.recipe-home-showcase,
.path-section,
.cgc-premium-footer {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
}
