/*
Theme Name: CreceMED Premium
Theme URI: https://crecemed.com
Description: Tema hijo de Hello Elementor para CreceMED. Sistema de diseño premium (tokens globales, tipografía fluida, accesibilidad WCAG AA y rendimiento Core Web Vitals). Todo el layout es editable desde Elementor.
Author: Equipo CreceMED
Version: 2.4.3
Template: hello-elementor
Requires PHP: 8.0
License: GPLv2 or later
Text Domain: crecemed-premium
*/

/* =========================================================
   1. TOKENS GLOBALES (sincronizados con el Kit de Elementor)
   ========================================================= */
:root {
  /* Color */
  --cm-ink: #0b2540;
  --cm-ink-soft: #143a5c;
  --cm-accent: #6f9f2f;      /* verde salud CreceMED */
  --cm-accent-strong: #5b8624;
  --cm-teal: #12a3a0;
  --cm-bg: #ffffff;
  --cm-surface: #f5f8f5;
  --cm-surface-alt: #eef3f8;
  --cm-border: #dbe3ea;
  --cm-text: #1b2b3a;
  --cm-text-muted: #4c6070;
  --cm-white: #ffffff;

  /* Tipografía fluida */
  --cm-font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cm-font-display: "Sora", var(--cm-font-sans);
  --cm-h1: clamp(2rem, 1.4rem + 3vw, 3.5rem);
  --cm-h2: clamp(1.55rem, 1.2rem + 1.7vw, 2.35rem);
  --cm-h3: clamp(1.2rem, 1.05rem + 0.8vw, 1.5rem);
  --cm-body: clamp(1rem, 0.97rem + 0.18vw, 1.125rem);

  /* Espaciado y forma */
  --cm-radius: 18px;
  --cm-radius-lg: 28px;
  --cm-space-section: clamp(3.5rem, 2rem + 6vw, 7rem);
  --cm-shadow-sm: 0 2px 8px rgba(11, 37, 64, 0.06);
  --cm-shadow: 0 18px 40px -22px rgba(11, 37, 64, 0.35);
  --cm-maxw: 1180px;
}

/* =========================================================
   2. BASE / LEGIBILIDAD
   ========================================================= */
body {
  font-family: var(--cm-font-sans);
  font-size: var(--cm-body);
  line-height: 1.7;
  color: var(--cm-text);
  background: var(--cm-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--cm-font-display);
  color: var(--cm-ink);
  line-height: 1.22;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--cm-h1); font-weight: 800; }
h2 { font-size: var(--cm-h2); font-weight: 700; }
h3 { font-size: var(--cm-h3); font-weight: 700; }

p, li { max-width: 72ch; }
.cm-prose p + p { margin-top: 1.05em; }

a { color: var(--cm-accent-strong); text-underline-offset: 3px; }
a:hover { color: var(--cm-ink); }

img, video { max-width: 100%; height: auto; }

/* =========================================================
   3. ACCESIBILIDAD (WCAG 2.1 AA)
   ========================================================= */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--cm-teal);
  outline-offset: 2px;
  border-radius: 6px;
}
.cm-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--cm-ink);
  color: var(--cm-white);
  padding: 12px 20px;
  border-radius: 0 0 12px 0;
  font-weight: 600;
}
.cm-skip-link:focus { left: 0; color: var(--cm-white); }
.cm-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
/* Área táctil mínima 44x44 en móvil */
@media (max-width: 767px) {
  .elementor-button,
  .cm-btn,
  .wpcf7-submit { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   4. COMPONENTES REUTILIZABLES
   ========================================================= */
.cm-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--cm-accent-strong);
  background: rgba(111, 159, 47, 0.12);
  padding: 7px 14px; border-radius: 999px;
}

.cm-card {
  background: var(--cm-white);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  padding: clamp(1.25rem, 1rem + 1vw, 2rem);
  box-shadow: var(--cm-shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  height: 100%;
}
.cm-card:hover { transform: translateY(-4px); box-shadow: var(--cm-shadow); }

.cm-section { padding-block: var(--cm-space-section); }
.cm-section--surface { background: var(--cm-surface); }
.cm-section--ink { background: var(--cm-ink); color: #e8eef4; }
.cm-section--ink h1, .cm-section--ink h2, .cm-section--ink h3 { color: var(--cm-white); }

/* Botones: variantes del sistema, sin colores sueltos en cada página */
.cm-btn,
.elementor-button.cm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; border-radius: 999px;
  padding: 14px 28px; text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.cm-btn--primary { background: var(--cm-accent); color: var(--cm-white); }
.cm-btn--primary:hover { background: var(--cm-accent-strong); color: var(--cm-white); transform: translateY(-2px); }
.cm-btn--ink { background: var(--cm-ink); color: var(--cm-white); }
.cm-btn--ghost { border: 2px solid var(--cm-border); color: var(--cm-ink); background: transparent; }

/* FAQ accesible (details/summary nativo, indexable por Google) */
.cm-faq__item { border-bottom: 1px solid var(--cm-border); }
.cm-faq__item summary {
  cursor: pointer; list-style: none; padding: 20px 44px 20px 0;
  font-weight: 700; font-family: var(--cm-font-display); color: var(--cm-ink);
  position: relative;
}
.cm-faq__item summary::-webkit-details-marker { display: none; }
.cm-faq__item summary::after {
  content: "+"; position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%); font-size: 1.5rem; color: var(--cm-accent-strong);
}
.cm-faq__item[open] summary::after { content: "\2212"; }
.cm-faq__item > div { padding-bottom: 20px; color: var(--cm-text-muted); }

/* Breadcrumbs */
.cm-breadcrumbs { font-size: 0.875rem; color: var(--cm-text-muted); padding-block: 14px; }
.cm-breadcrumbs a { color: var(--cm-text-muted); }
.cm-breadcrumbs a:hover { color: var(--cm-accent-strong); }

/* Aviso médico */
.cm-medical-notice {
  border-left: 4px solid var(--cm-teal);
  background: var(--cm-surface-alt);
  border-radius: 0 var(--cm-radius) var(--cm-radius) 0;
  padding: 18px 22px; font-size: 0.95rem; color: var(--cm-text-muted);
}

/* Estabilidad de layout (CLS) */
.cm-media { aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--cm-radius); }
.cm-media img { width: 100%; height: 100%; object-fit: cover; }
