/**
 * Refinamiento móvil premium — footer compacto, menú diferenciado, contraste, hero.
 */

: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-bg: #f6f8f6;
  --cg-white: #ffffff;
  --cg-text: #10231a;
  --cg-muted: #4f5f58;
  --cg-border: #dde7e1;
}

body {
  color: var(--cg-text);
}

/* —— Menú móvil: panel claro, no parecido al footer verde —— */
@media (max-width: 900px) {
  html.cgc-nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 61, 46, 0.28);
    pointer-events: auto;
  }

  .primary-nav.is-open,
  #nav-links.open,
  .recipe-nav .nav-links.is-open {
    position: fixed !important;
    top: calc(66px + env(safe-area-inset-top, 0px)) !important;
    left: 12px !important;
    right: 12px !important;
    z-index: 1102 !important;
    display: flex !important;
    flex-direction: column !important;
    max-height: min(72dvh, calc(100dvh - 88px)) !important;
    margin: 0 !important;
    padding: 10px 10px 14px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--cg-bg) !important;
    border: 1px solid var(--cg-border) !important;
    border-radius: 18px !important;
    box-shadow: 0 20px 48px rgba(15, 61, 46, 0.12) !important;
  }

  body.cgc-home-page #nav-links.open {
    background: var(--cg-white) !important;
  }

  body:not(.cgc-home-page) .primary-nav.is-open {
    top: calc(72px + env(safe-area-inset-top, 0px)) !important;
  }

  .primary-nav.is-open .menu,
  #nav-links.open {
    gap: 2px !important;
  }

  .primary-nav.is-open .menu > li > a,
  #nav-links.open > li > a,
  .primary-nav.is-open .menu a,
  #nav-links.open li a {
    min-height: 44px !important;
    padding: 10px 12px !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    color: var(--cg-text) !important;
    border-radius: 12px !important;
    letter-spacing: normal !important;
    text-transform: none !important;
  }

  .primary-nav.is-open .calculator-submenu a,
  #nav-links.open .nav-dropdown a {
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    color: var(--cg-muted) !important;
    padding: 9px 12px 9px 16px !important;
    min-height: 40px !important;
  }

  .primary-nav.is-open .calculator-submenu,
  #nav-links.open .nav-dropdown {
    margin: 0 0 6px !important;
    padding: 4px 0 !important;
    background: var(--cg-green-100) !important;
    border-radius: 12px !important;
    border: 1px solid var(--cg-border) !important;
  }

  #nav-links.open .nav-cta,
  .primary-nav.is-open .header-cta {
    margin-top: 6px !important;
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
    color: var(--cg-white) !important;
    background: var(--cg-green-900) !important;
  }

  .menu-toggle[aria-expanded="true"],
  .mobile-toggle[aria-expanded="true"] {
    background: var(--cg-green-100) !important;
    border-color: var(--cg-green-700) !important;
    color: var(--cg-green-900) !important;
  }
}

/* —— Footer móvil compacto —— */
@media (max-width: 900px) {
  .cgc-premium-footer {
    padding: 28px 0 calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    margin-top: 32px !important;
  }

  .cgc-premium-footer__shell {
    width: min(100% - 28px, 1320px) !important;
  }

  .cgc-premium-footer .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px 14px !important;
  }

  .cgc-premium-footer .footer-brand-block {
    grid-column: 1 / -1 !important;
  }

  .cgc-premium-footer .footer-brand-block > p:not(.footer-disclaimer) {
    font-size: 0.86rem !important;
    line-height: 1.5 !important;
    margin-top: 8px !important;
    max-width: none !important;
  }

  .cgc-premium-footer .footer-disclaimer {
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
    margin-top: 8px !important;
    opacity: 1 !important;
    color: rgba(255, 255, 255, 0.72) !important;
  }

  .cgc-premium-footer .footer-col h2 {
    font-size: 0.68rem !important;
    letter-spacing: 0.07em !important;
    margin: 0 0 8px !important;
    font-weight: 800 !important;
  }

  .cgc-premium-footer .footer-links {
    gap: 6px !important;
    font-size: 0.9rem !important;
  }

  .cgc-premium-footer .footer-links a {
    font-size: 0.9rem !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    color: rgba(255, 255, 255, 0.82) !important;
    word-break: break-word;
  }

  .cgc-premium-footer .footer-social {
    margin-top: 10px !important;
    gap: 8px !important;
  }

  .cgc-premium-footer .footer-social__link {
    width: 38px !important;
    height: 38px !important;
    font-size: 0.65rem !important;
  }

  .cgc-premium-footer .footer-bottom {
    margin-top: 18px !important;
    padding-top: 14px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    font-size: 0.8rem !important;
    line-height: 1.45 !important;
    color: rgba(255, 255, 255, 0.7) !important;
  }
}

@media (min-width: 600px) and (max-width: 900px) {
  .cgc-premium-footer .footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* —— Botones: texto siempre visible —— */
.btn-primary,
.nav-cta,
.header-cta,
.button-primary,
.onboard-btn-primary,
.cg-calc-button,
.cg-catalog-cta,
.cg-more:not(.cg-reset),
.cg-add-food,
.cg-save-current,
.cg-tools-account .button,
.cg-register-submit,
.email-form button[type="submit"] {
  background: var(--cg-green-900) !important;
  color: var(--cg-white) !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  -webkit-text-fill-color: var(--cg-white) !important;
  mix-blend-mode: normal !important;
  filter: none !important;
}

.btn-primary *,
.cg-more:not(.cg-reset) *,
.cg-catalog-cta *,
.cg-calc-button * {
  color: inherit !important;
  opacity: 1 !important;
}

.btn-secondary,
.cg-reset,
.cg-calc-page .cg-reset {
  background: var(--cg-white) !important;
  color: var(--cg-green-900) !important;
  border: 1px solid var(--cg-border) !important;
}

/* —— Hero home móvil: card legible sobre imagen —— */
@media (max-width: 820px) {
  body.cgc-home-page .hero {
    min-height: clamp(520px, 88vh, 720px) !important;
  }

  body.cgc-home-page .hero-shell {
    min-height: calc(clamp(520px, 88vh, 720px) - 66px) !important;
  }

  body.cgc-home-page .hero-media::before {
    background: linear-gradient(
      180deg,
      transparent 0%,
      transparent 42%,
      rgba(246, 248, 246, 0.35) 58%,
      rgba(246, 248, 246, 0.75) 78%,
      rgba(246, 248, 246, 0.95) 100%
    ) !important;
  }

  body.cgc-home-page .hero-copy-inner {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(221, 231, 225, 0.9) !important;
    border-radius: 20px !important;
    padding: 16px 14px 18px !important;
    box-shadow: 0 10px 32px rgba(15, 61, 46, 0.1) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.cgc-home-page .hero h1 {
    color: var(--cg-text) !important;
    font-size: clamp(1.55rem, 6.2vw, 2rem) !important;
    line-height: 1.08 !important;
    max-width: none !important;
    text-shadow: none !important;
  }

  body.cgc-home-page .hero-sub {
    color: var(--cg-muted) !important;
    font-size: 0.94rem !important;
    text-shadow: none !important;
  }

  body.cgc-home-page .hero .proof-item strong {
    color: var(--cg-text) !important;
  }

  body.cgc-home-page .hero .proof-item small {
    color: var(--cg-muted) !important;
  }

  body.cgc-home-page .hero h1,
  body.cgc-home-page .hero .hero-sub,
  body.cgc-home-page .hero .proof-item span {
    text-shadow: none !important;
  }
}

/* —— Calculadoras: hero compacto, menos decoración —— */
@media (max-width: 820px) {
  body.cgc-page-tools .cg-calc-page {
    padding-top: 12px !important;
  }

  body.cgc-page-tools .cg-calc-page::after {
    opacity: 0.35 !important;
    height: 240px !important;
  }

  body.cgc-page-tools .cg-calc-top {
    margin-bottom: 8px !important;
    gap: 10px !important;
  }

  body.cgc-page-tools .cg-calc-title-icon {
    width: 64px !important;
    height: 64px !important;
    flex-basis: 64px !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 20px rgba(9, 39, 26, 0.08) !important;
  }

  body.cgc-page-tools .cg-calc-title-icon .cg-tool-icon,
  body.cgc-page-tools .cg-calc-title-icon .cg-tool-icon-wrap {
    width: 44px !important;
    height: 44px !important;
  }

  body.cgc-page-tools .cg-calc-title-icon::before {
    opacity: 0.35 !important;
    display: none !important;
  }

  body.cgc-page-tools .cg-calc-top h1 {
    font-size: clamp(1.45rem, 5.8vw, 1.85rem) !important;
  }

  body.cgc-page-tools .cg-calc-subcopy {
    font-size: 0.92rem !important;
    margin: 8px auto 12px !important;
    line-height: 1.5 !important;
    color: var(--cg-muted) !important;
  }

  body.cgc-page-tools .cg-calc-trustbar {
    margin-bottom: 16px !important;
    gap: 6px !important;
  }

  body.cgc-page-tools .cg-calc-trustbar span {
    font-size: 0.72rem !important;
    min-height: 28px !important;
    padding: 4px 9px !important;
  }

  body.cgc-page-tools .cg-rec-card {
    grid-template-columns: 44px minmax(0, 1fr) 16px !important;
    gap: 10px 12px !important;
    padding: 12px 14px !important;
    min-height: 0 !important;
  }

  body.cgc-page-tools .cg-rec-icon {
    width: 40px !important;
    height: 40px !important;
  }

  body.cgc-page-tools .cg-rec-icon .cg-tool-icon {
    width: 28px !important;
    height: 28px !important;
  }

  body.cgc-page-tools .cg-rec-card strong {
    font-size: 0.92rem !important;
    color: var(--cg-text) !important;
  }

  body.cgc-page-tools .cg-rec-card em {
    font-size: 0.82rem !important;
    color: var(--cg-muted) !important;
    display: block;
    overflow-wrap: anywhere;
  }

  body.cgc-page-tools .cg-rec-card > div {
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }
}

/* —— Cuenta: espacio antes del footer —— */
@media (max-width: 820px) {
  .cg-tools-account,
  .onboard-auth-card--primary {
    margin-bottom: 28px !important;
  }

  .cg-tools-account .button,
  .cg-register-submit,
  .onboard-btn-primary {
    font-size: 1rem !important;
    min-height: 48px !important;
    color: var(--cg-white) !important;
  }

  .cg-tools-account input::placeholder {
    color: #6a7a72 !important;
    opacity: 1 !important;
  }
}

/* —— Contraste global móvil —— */
@media (max-width: 820px) {
  .section-sub,
  .hero-sub,
  .cg-calc-subcopy,
  .cg-medical-note,
  .promo-legal,
  .recommended-legal,
  .lead-nota,
  p {
    color: var(--cg-muted) !important;
  }

  .section-title,
  h1,
  h2,
  h3 {
    color: var(--cg-text);
  }
}

/* —— Glows suavizados en cards —— */
@media (max-width: 820px) {
  .cg-catalog-card::before,
  .cg-rec-icon::before,
  .recommended-shell::before {
    opacity: 0.25 !important;
  }

  .cg-catalog-card,
  .cg-rec-card,
  .cg-premium-form {
    box-shadow: 0 10px 28px rgba(9, 39, 26, 0.08) !important;
  }
}
