/* ==========================================================================
   Chile es Tuyo · Landing "Ayúdanos a mejorar"
   Prefijo: cet-   |   Hoja única de frontend (la encola CET_Front solo donde está el shortcode)
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------ */
.cet-landing {
  --cet-red:        #C4122F;
  --cet-red-dark:   #A20F27;
  --cet-navy:       #1C3A6B;
  --cet-navy-dark:  #142B50;
  --cet-ink:        #1B1D24;
  --cet-ink-2:      #4A4E5A;
  --cet-ink-3:      #7A7F8C;
  --cet-line:       #E3E5EA;
  --cet-surface:    #FFFFFF;
  --cet-surface-2:  #F6F7F9;
  --cet-green:      #1E8E4E;
  --cet-focus:      #2F6FED;
  --cet-radius:     12px;
  --cet-radius-sm:  8px;
  --cet-shadow:     0 1px 2px rgba(20, 24, 40, .04), 0 4px 16px rgba(20, 24, 40, .06);
  /* Tipografía: en WordPress hereda la del theme; aquí un stack neutro de respaldo. */
  --cet-font: inherit;

  /* Alto del encabezado fijo del theme; lo define templates/landing.php desde el ajuste del admin. */
  --cet-header-offset: 0px;

  font-family: var(--cet-font);
  color: var(--cet-ink);
  /* Fondo propio: hay themes (como el de chileestuyo.cl) con body oscuro. */
  background: #fff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.cet-landing *,
.cet-landing *::before,
.cet-landing *::after { box-sizing: border-box; }

.cet-landing button,
.cet-landing input,
.cet-landing select { font: inherit; color: inherit; }

/* Honeypot anti-bots: fuera de pantalla, no display:none (algunos bots lo detectan). */
.cet-landing .cet-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.cet-container {
  width: min(100% - 32px, 1040px);
  margin-inline: auto;
}

/* --- Hero ---------------------------------------------------------------- */
.cet-hero {
  position: relative;
  isolation: isolate;
  color: #fff;
  text-align: center;
  /* Arriba se suma el alto del encabezado fijo del sitio, que flota sobre la página. */
  padding: calc(var(--cet-header-offset) + clamp(40px, 6vw, 72px)) 0 clamp(48px, 6vw, 72px);
  overflow: hidden;
}
.cet-hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* La imagen (con capa oscura para contraste AA) la inyecta templates/landing.php como estilo inline,
     porque se elige desde wp-admin. Aquí solo el color de respaldo. */
  background-color: #262C3F;
  background-size: cover;
  background-position: center;
}
.cet-hero__title {
  margin: 0 0 20px;
  font-size: clamp(34px, 5.5vw, 56px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.01em;
}
.cet-hero__lead {
  max-width: 640px;
  margin: 0 auto 36px;
  font-size: clamp(16px, 1.6vw, 18px);
  color: rgba(255, 255, 255, .92);
}
.cet-hero__lead strong { font-weight: 700; color: #fff; }

.cet-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
  justify-content: center;
  gap: 16px;
}
.cet-step__link {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  text-align: left;
  text-decoration: none;
  color: var(--cet-ink);
  background: var(--cet-surface);
  border-radius: var(--cet-radius);
  padding: 18px 18px 18px 16px;
  box-shadow: var(--cet-shadow);
  min-height: 100%;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cet-step__link:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 24, 40, .18); }
.cet-step--optional .cet-step__link { background: #E9EBF0; }
.cet-step__num {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  color: #fff;
  background: var(--cet-red);
}
.cet-step--optional .cet-step__num { background: var(--cet-navy); }
.cet-step__body { display: grid; gap: 2px; }
.cet-step__kicker {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cet-red);
}
.cet-step--optional .cet-step__kicker { color: var(--cet-ink-3); }
.cet-step__title { font-weight: 700; font-size: 16px; }
.cet-step__desc { font-size: 13px; color: var(--cet-ink-2); }

/* --- Secciones ------------------------------------------------------------ */
.cet-section {
  padding: clamp(48px, 6vw, 80px) 0 0;
  /* Al saltar a una etapa (anclas del hero o tras enviar), que no quede bajo el encabezado fijo. */
  scroll-margin-top: var(--cet-header-offset);
}
.cet-section--2 { padding-bottom: clamp(56px, 7vw, 96px); }

.cet-section__head {
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--cet-line);
}
.cet-tagline { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 13px; }
.cet-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px; font-weight: 700;
  color: #fff; background: var(--cet-red);
}
.cet-tag--navy { background: var(--cet-navy); }
.cet-tagline__text { color: var(--cet-red); }
.cet-tagline__text--navy { color: var(--cet-navy); }
.cet-section__title {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
}
.cet-section__sub { margin: 0; color: var(--cet-ink-2); font-size: 15px; }
.cet-section__sub--navy { color: var(--cet-navy); font-weight: 500; }

.cet-text { color: var(--cet-ink-2); font-size: 16px; margin: 0 0 24px; }

/* --- Tarjetas y preguntas ------------------------------------------------- */
/* Con .cet-landing delante para ganarle a estilos genéricos del theme sobre contenedores. */
.cet-landing .cet-card {
  background: var(--cet-surface);
  border: 1px solid var(--cet-line);
  border-radius: var(--cet-radius);
  padding: 22px 24px;
}
.cet-form { display: grid; gap: 16px; }

.cet-question__label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 14px;
}
.cet-question__hint { margin: 4px 0 0; font-size: 12px; color: var(--cet-ink-3); }

/* Preguntas con etiqueta a la izquierda y campo a la derecha (P3–P6).
   Flex con bases fijas: la etiqueta ocupa 200px y el campo necesita al menos 320px;
   si no caben juntos, el campo baja solo a la línea siguiente. Sin media queries. */
.cet-question--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
}
.cet-question--inline .cet-question__label { margin: 0; }
.cet-question--inline .cet-question__side { flex: 1 0 200px; max-width: 100%; }
.cet-question--inline .cet-question__field { flex: 999 1 320px; min-width: 0; }
@media (min-width: 761px) {
  /* En escritorio la etiqueta no crece: columna fija de 200px como en el diseño. */
  .cet-question--inline .cet-question__side { flex: 0 0 200px; }
}

/* Alternativas: cada una parte de un ancho fijo y se reacomoda según el espacio.
   Crecen para llenar la fila, así la última ("Otro") ocupa el ancho que sobra. */
.cet-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cet-option { flex: 1 1 280px; min-width: 0; }
.cet-question--inline .cet-option { flex-basis: 200px; }

/* Opción tipo radio "card". El input real queda accesible pero visualmente lo dibujamos nosotros. */
.cet-option,
.cet-chip,
.cet-device,
.cet-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.cet-option {
  padding: 12px 14px;
  border: 1px solid var(--cet-line);
  border-radius: var(--cet-radius-sm);
  font-size: 14px;
  color: var(--cet-ink-2);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.cet-option input,
.cet-chip input,
.cet-device input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
}
.cet-option::before,
.cet-device__dot {
  content: "";
  flex: 0 0 auto;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid #C5C9D3;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.cet-option:hover { border-color: #C5C9D3; background: var(--cet-surface-2); }
.cet-option:has(input:checked) {
  border-color: var(--cet-red);
  background: #FFF5F6;
  color: var(--cet-ink);
}
.cet-option:has(input:checked)::before,
.cet-device:has(input:checked) .cet-device__dot {
  border-color: var(--cet-red);
  box-shadow: inset 0 0 0 4px var(--cet-red);
}
.cet-option:has(input:focus-visible),
.cet-chip:has(input:focus-visible),
.cet-device:has(input:focus-visible),
.cet-check:has(input:focus-visible) {
  outline: 2px solid var(--cet-focus);
  outline-offset: 2px;
}

/* Chips de edad */
.cet-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.cet-chip {
  padding: 8px 16px;
  border: 1px solid #C5C9D3;
  border-radius: 999px;
  font-size: 14px;
  color: var(--cet-ink-2);
  transition: border-color .15s, background-color .15s, color .15s;
}
.cet-chip:hover { background: var(--cet-surface-2); }
.cet-chip:has(input:checked) {
  border-color: var(--cet-red);
  background: var(--cet-red);
  color: #fff;
  font-weight: 600;
}

/* Dispositivos */
.cet-devices { display: flex; flex-wrap: wrap; gap: 12px; }
.cet-device {
  flex: 1 1 150px;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 18px 12px 14px;
  border: 1px solid var(--cet-line);
  border-radius: var(--cet-radius-sm);
  text-align: center;
  transition: border-color .15s, background-color .15s;
}
.cet-device:hover { background: var(--cet-surface-2); }
.cet-device:has(input:checked) { border-color: var(--cet-red); background: #FFF5F6; }
.cet-device__icon {
  width: 26px; height: 26px;
  fill: none; stroke: var(--cet-navy); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.cet-device__name { font-size: 14px; font-weight: 600; }

/* Select */
.cet-select { position: relative; }
.cet-select select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 12px 40px 12px 14px;
  border: 1px solid #C5C9D3;
  border-radius: var(--cet-radius-sm);
  background: #fff;
  font-size: 14px;
  color: var(--cet-ink);
  cursor: pointer;
}
.cet-select select:invalid { color: var(--cet-ink-3); }
.cet-select::after {
  content: "";
  position: absolute;
  right: 16px; top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--cet-ink-2);
  border-bottom: 1.5px solid var(--cet-ink-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.cet-select select:focus-visible { outline: 2px solid var(--cet-focus); outline-offset: 1px; }

/* Errores */
.cet-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--cet-red);
}
.cet-landing .cet-card.is-invalid { border-color: var(--cet-red); }

/* Pie del formulario 1 */
.cet-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.cet-note {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-size: 13px; color: var(--cet-ink-2);
}
.cet-note svg {
  width: 16px; height: 16px;
  fill: var(--cet-green); stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.cet-note svg path { fill: none; }

.cet-form__status { margin: 0; font-size: 14px; }
.cet-form__status:empty { display: none; }
.cet-form__status.is-success { color: var(--cet-green); font-weight: 600; }
.cet-form__status.is-error { color: var(--cet-red); }

/* --- Botones ---------------------------------------------------------------- */
.cet-landing .cet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.cet-landing .cet-btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.cet-landing .cet-btn:active { transform: translateY(1px); }
.cet-landing .cet-btn:focus-visible { outline: 2px solid var(--cet-focus); outline-offset: 2px; }
.cet-landing .cet-btn--primary { background: var(--cet-red); color: #fff; }
.cet-landing .cet-btn--primary:hover { background: var(--cet-red-dark); }
.cet-landing .cet-btn--navy { background: var(--cet-navy); color: #fff; }
.cet-landing .cet-btn--navy:hover { background: var(--cet-navy-dark); }
.cet-landing .cet-btn--ghost { background: #fff; color: var(--cet-ink); border-color: #C5C9D3; }
.cet-landing .cet-btn--ghost:hover { background: var(--cet-surface-2); }
.cet-landing .cet-btn[disabled] { opacity: .6; cursor: default; }

/* --- Divisor entre etapas --------------------------------------------------- */
.cet-divider {
  display: flex; align-items: center; gap: 16px;
  margin: 40px 0 0;
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cet-ink-3);
}
.cet-divider::before,
.cet-divider::after { content: ""; flex: 1; height: 1px; background: var(--cet-line); }

/* --- Etapa 2 ------------------------------------------------------------------ */
.cet-callout {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 20px;
  padding: 14px 18px;
  background: #F7F6F1;
  border-left: 3px solid var(--cet-navy);
  border-radius: 0 var(--cet-radius-sm) var(--cet-radius-sm) 0;
  color: var(--cet-navy);
  font-weight: 500;
  font-size: 14px;
}
.cet-callout p { margin: 0; }
.cet-callout svg {
  flex: 0 0 auto; width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.cet-howto-block {
  border: 1px solid var(--cet-line);
  border-radius: var(--cet-radius);
  margin: 0 0 24px;
  padding: 16px 18px 18px;
  background: #fff;
}
.cet-howto-block__title {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px;
  font-weight: 600; font-size: 15px;
}
.cet-howto-block__icon {
  width: 18px; height: 18px;
  fill: none; stroke: var(--cet-navy); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.cet-howto { margin: 0; padding-left: 46px; color: var(--cet-ink-2); font-size: 14px; display: grid; gap: 8px; }
.cet-howto strong { color: var(--cet-ink); }

.cet-landing .cet-contact { padding: 28px 28px 24px; }
.cet-contact__title { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.cet-contact__sub { margin: 0 0 24px; font-size: 12px; color: var(--cet-ink-3); }

.cet-field { display: grid; gap: 6px; margin-bottom: 16px; }
.cet-field label { font-size: 12px; font-weight: 600; color: var(--cet-ink-2); }
.cet-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #C5C9D3;
  border-radius: var(--cet-radius-sm);
  background: #fff;
  font-size: 14px;
}
.cet-field input::placeholder { color: #A5AAB6; }
.cet-field input:focus-visible { outline: 2px solid var(--cet-focus); outline-offset: 1px; border-color: transparent; }
.cet-field.is-invalid input { border-color: var(--cet-red); }
.cet-field .cet-error { margin-top: 0; }
.cet-req { color: var(--cet-red); }
.cet-optional { font-weight: 400; color: var(--cet-ink-3); }
.cet-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.cet-consents {
  display: grid; gap: 10px;
  padding: 6px 0 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--cet-line);
}
.cet-check { font-size: 13px; color: var(--cet-ink-2); align-items: flex-start; }
.cet-check input {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  margin: 2px 0 0;
  accent-color: var(--cet-navy);
  cursor: pointer;
}
.cet-check a { color: var(--cet-navy); text-decoration: underline; }
.cet-check a:hover { color: var(--cet-navy-dark); }

.cet-contact__actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

/* Estado "Ahora no": ocultamos el formulario y dejamos un cierre amable. */
.cet-contact.is-dismissed > *:not(.cet-form__status) { display: none; }
.cet-contact.is-dismissed { text-align: center; color: var(--cet-ink-2); }

/* --- Aviso de encuesta cerrada ---------------------------------------------------- */
.cet-landing .cet-cerrada__card { text-align: center; padding: clamp(32px, 6vw, 56px) 24px; }
.cet-cerrada__card .cet-text { margin: 0 auto; max-width: 560px; }

/* --- Responsive --------------------------------------------------------------- */
@media (max-width: 760px) {
  .cet-landing .cet-card { padding: 18px 16px; }
  .cet-device { padding: 14px 8px 12px; }
  .cet-howto { padding-left: 18px; }
  .cet-landing .cet-contact { padding: 22px 16px; }
}
@media (max-width: 520px) {
  .cet-field-row { grid-template-columns: 1fr; gap: 0; }
  .cet-form__footer { flex-direction: column; align-items: stretch; }
  .cet-form__footer .cet-btn { justify-content: center; }
  .cet-contact__actions { flex-direction: column-reverse; }
  .cet-contact__actions .cet-btn { justify-content: center; }
  .cet-device { flex: 1 1 100%; flex-direction: row; justify-content: flex-start; text-align: left; padding: 12px 14px; }
  .cet-device__dot { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .cet-landing * { transition: none !important; } /* excepción documentada: accesibilidad, no pelea con CSS propio */
}
