/* =========================================================
   Al Día Consultoría: estilos
   Dirección "Señal": fondo claro frío, tinta azul noche,
   índigo eléctrico como acento y amarillo señal para destacar.
   Mobile-first: las reglas base son para móvil y las
   media queries amplían a tablet/escritorio.
   ========================================================= */

@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/onest-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Paleta: cambia aquí los colores de toda la web */
  --bg: #F3F4FA;          /* fondo general */
  --surface: #FFFFFF;     /* tarjetas y formulario */
  --ink: #15173A;         /* texto principal y bandas oscuras */
  --ink-2: #474A6E;       /* texto secundario */
  --ink-3: #5B5E84;       /* notas pequeñas */
  --line: #D9DBEA;        /* bordes suaves */
  --accent: #4433FF;      /* índigo: botón de enviar, enlaces, iconos */
  --accent-strong: #2C1FD0;
  --accent-soft: #E7E4FF;
  --signal: #FFD84D;      /* amarillo: detalles sobre fondo oscuro */
  --on-dark: #FFFFFF;
  --on-dark-2: #D3D5EE;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --whatsapp: #128C4A;

  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Escala tipográfica (móvil) */
  --fs-hero: clamp(2.35rem, 1.6rem + 3.6vw, 4rem);
  --fs-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-h3: 1.125rem;
  --fs-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --tap: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.08; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--on-dark);
  padding: 12px 16px; border-radius: 10px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--on-dark); }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
}
.wrap-narrow { max-width: 760px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap);
  padding: 0 28px;
  border: 0; border-radius: var(--radius-pill);
  font: inherit; font-size: 1.0625rem; font-weight: 700; line-height: 1.2;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--on-dark); }
.btn-primary:hover { background: #262A5C; color: var(--on-dark); }
.btn-accent { background: var(--accent); color: var(--on-dark); }
.btn-accent:hover { background: var(--accent-strong); color: var(--on-dark); }
.btn-accent[disabled] { opacity: .7; cursor: progress; }
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { background: #0E713B; color: #fff; }
.btn-whatsapp svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.btn-block { display: flex; width: 100%; }

/* ---------- Cabecera ---------- */
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em;
  min-height: 44px;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  display: grid; place-items: center; flex: none;
}
.brand-mark span { width: 11px; height: 11px; border-radius: 50%; background: var(--signal); }
.header-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  font-weight: 700; text-decoration: none;
}

/* ---------- Hero ---------- */
.hero { padding-block: 12px 48px; }
.hero-grid { display: grid; gap: 32px; }
.hero-copy { display: grid; gap: 18px; align-content: start; }
.hero h1 {
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.04;
}
.lead { font-size: var(--fs-lead); color: var(--ink-2); max-width: 36ch; }
.hero-cta { display: grid; gap: 10px; margin-top: 6px; }
.cta-note { font-size: var(--fs-small); color: var(--ink-3); }

/* Demo de chat: el elemento memorable de la página */
.chat-demo { margin: 0; display: grid; gap: 10px; }
.chat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(21,23,58,.04), 0 24px 48px -16px rgba(68,51,255,.28);
  display: grid; gap: 12px;
}
.chat-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center; font-weight: 800; font-size: .875rem;
}
.chat-who { display: grid; line-height: 1.3; }
.chat-who span { font-size: .8125rem; color: var(--ink-3); }
.chat-body { display: grid; gap: 8px; }
.bubble {
  max-width: 84%; padding: 10px 14px; font-size: .9688rem; line-height: 1.4;
}
.bubble-in { justify-self: start; background: #ECEDF6; border-radius: 18px 18px 18px 5px; }
.bubble-out { justify-self: end; background: var(--accent); color: var(--on-dark); border-radius: 18px 18px 5px 18px; }
.chat-badge {
  display: flex; align-items: center; gap: 6px; justify-self: end;
  font-size: .8125rem; font-weight: 700; color: var(--accent-strong);
}
.chat-badge svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; flex: none; }
.chat-demo figcaption { font-size: .8125rem; color: var(--ink-3); text-align: center; }

/* Única animación: los mensajes entran en orden una vez al cargar */
@media (prefers-reduced-motion: no-preference) {
  .chat-body .bubble { animation: bubble-in .45s cubic-bezier(.2,.8,.2,1) backwards; }
  .chat-body .bubble:nth-child(1) { animation-delay: .25s; }
  .chat-body .bubble:nth-child(2) { animation-delay: 1.05s; }
  .chat-body .bubble:nth-child(3) { animation-delay: 1.85s; }
  .chat-body .bubble:nth-child(4) { animation-delay: 2.55s; }
  .chat-badge { animation: fade-in .4s ease 3.1s backwards; }
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

/* ---------- Secciones ---------- */
.section { padding-block: 56px; }
.section-tight { padding-top: 8px; }
.section h2, .band-dark h2 {
  font-size: var(--fs-h2); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 24px;
}

/* Problema: banda oscura */
.band-dark { background: var(--ink); color: var(--on-dark); padding-block: 56px; }
.pains { display: grid; gap: 0; }
.pains li {
  display: grid; gap: 6px;
  padding-block: 18px;
  border-top: 1px solid rgba(255,255,255,.14);
}
.pains li:last-child { border-bottom: 1px solid rgba(255,255,255,.14); }
.pain-tag {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; color: var(--signal); line-height: 1.1;
}
.pains p { color: var(--on-dark-2); font-size: 1.0313rem; max-width: 56ch; }
.pains strong { color: var(--on-dark); }

/* Servicios */
.services { display: grid; gap: 12px; }
.service {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--surface); border-radius: var(--radius-md); padding: 18px;
}
.service-icon {
  flex: none; width: 48px; height: 48px; border-radius: 14px;
  background: var(--accent-soft); display: grid; place-items: center;
}
.service-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.service h3 { font-size: var(--fs-h3); font-weight: 700; margin-bottom: 4px; letter-spacing: -0.01em; }
.service p { color: var(--ink-2); font-size: .9688rem; }

/* Pasos: es una secuencia real, por eso va numerada */
.steps { display: grid; gap: 0; counter-reset: paso; }
.steps li {
  counter-increment: paso;
  position: relative;
  display: grid; gap: 4px;
  padding: 0 0 28px 64px;
}
.steps li::before {
  content: counter(paso);
  position: absolute; left: 0; top: -4px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--signal);
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.125rem;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 21px; top: 46px; bottom: 2px;
  width: 2px; background: var(--line);
}
.steps li:last-child { padding-bottom: 0; }
.steps h3 { font-size: var(--fs-h3); font-weight: 700; padding-top: 6px; }
.steps p { color: var(--ink-2); max-width: 52ch; }

/* ---------- Formulario ---------- */
.form-section { padding-top: 24px; }
.form-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--accent);
  padding: 24px 18px;
  max-width: 720px; margin-inline: auto;
}
.form-card h2 { margin-bottom: 8px; }
.form-intro { color: var(--ink-2); margin-bottom: 24px; }

#lead-form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field-row { display: grid; gap: 20px; }
.field > label, .field > legend { font-weight: 700; font-size: .9688rem; padding: 0; }
.field > legend { margin-bottom: 8px; }
.optional { font-weight: 400; color: var(--ink-3); font-size: .875rem; margin-left: 4px; }

input[type="text"], input[type="tel"], input[type="email"], input[type="search"], input[type="password"], select, textarea {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px evita el zoom automático en iOS */
  transition: border-color .15s ease, background-color .15s ease;
}
textarea { padding: 14px 16px; min-height: 96px; resize: vertical; line-height: 1.45; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2315173A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
  padding-right: 44px;
}
input::placeholder, textarea::placeholder { color: #7E81A3; }
input:hover, select:hover, textarea:hover { border-color: var(--line); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
[aria-invalid="true"] { border-color: var(--danger) !important; background: var(--danger-soft); }
.field-error { color: var(--danger); font-size: .875rem; font-weight: 600; }

/* Chips (checkbox) y selector segmentado (radio): input real, oculto visualmente */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .segmented label { position: relative; cursor: pointer; }
.chip input, .segmented input, .check input.visually-hidden {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.chip span {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: .9688rem; user-select: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.chip input:checked + span::before { content: "✓"; margin-right: 6px; color: var(--signal); }
.chip input:focus-visible + span, .segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; background: var(--bg); border-radius: 16px; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 6px;
  border-radius: 12px; font-weight: 600; font-size: .9688rem; text-align: center; user-select: none;
}
.segmented input:checked + span { background: var(--surface); color: var(--accent-strong); box-shadow: 0 1px 2px rgba(21,23,58,.12), 0 0 0 1.5px var(--accent); }

.check { display: flex; gap: 12px; align-items: center; min-height: 48px; font-size: .9688rem; cursor: pointer; }
.check input {
  flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer;
}
.consent { padding-top: 4px; }

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-status {
  padding: 14px 16px; border-radius: 12px; background: var(--danger-soft); color: var(--danger);
  font-weight: 600; font-size: .9375rem;
}

.gdpr {
  margin: 4px 0 0; padding-top: 16px; border-top: 1px solid var(--line);
  display: grid; gap: 6px; font-size: .8125rem; line-height: 1.45; color: var(--ink-3);
}
.gdpr div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
.gdpr dt { font-weight: 700; color: var(--ink-2); }
.gdpr dd { margin: 0; }

/* Confirmación */
.success { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 24px 0 8px; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.success-icon svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.success h2 { margin: 0; font-size: var(--fs-h2); }
.success h2:focus { outline: none; }
.success p { color: var(--ink-2); max-width: 40ch; }
.success .btn { margin-top: 6px; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border-radius: var(--radius-md); }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 60px; padding: 14px 18px;
  font-weight: 700; font-size: 1.0313rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 12px;
  border-right: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.faq details p { padding: 0 18px 18px; color: var(--ink-2); max-width: 62ch; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--on-dark-2); padding-block: 40px 120px; font-size: .9375rem; }
.footer-inner { display: grid; gap: 20px; }
.footer-brand { color: var(--on-dark); font-weight: 800; font-size: 1.125rem; margin-bottom: 4px; }
.site-footer a { color: var(--on-dark); display: inline-flex; min-height: 44px; align-items: center; }
.site-footer a:hover { color: var(--signal); }
.footer-contact, .footer-legal { display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-copy { font-size: .8125rem; color: #A9ACD0; }

/* ---------- CTA fija en móvil ---------- */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px var(--gutter-r) calc(10px + env(safe-area-inset-bottom, 0px)) var(--gutter);
  background: rgba(243,244,250,.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

/* ---------- Páginas legales ---------- */
.legal { padding-block: 24px 64px; }
.legal h1 { font-size: clamp(2rem, 1.6rem + 2vw, 2.75rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 12px; }
.legal .updated { color: var(--ink-3); font-size: var(--fs-small); margin-bottom: 32px; }
.legal h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; margin: 32px 0 10px; }
.legal p, .legal li { color: var(--ink-2); max-width: 68ch; }
.legal p + p { margin-top: 10px; }
.legal ul { list-style: disc; padding-left: 22px; display: grid; gap: 6px; margin-top: 10px; }
.legal table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.legal th { width: 32%; color: var(--ink); }
.legal td { color: var(--ink-2); }
.table-scroll { overflow-x: auto; background: var(--surface); border-radius: var(--radius-md); padding: 4px 8px; margin-top: 12px; }
.legal .back { display: inline-flex; min-height: 44px; align-items: center; font-weight: 700; margin-bottom: 8px; }
.legal-footer { padding-bottom: 40px; }

/* ---------- Tablet y escritorio ---------- */
@media (min-width: 640px) {
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-card { padding: 36px; }
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { padding-bottom: 40px; }
}

@media (min-width: 900px) {
  .hero { padding-block: 40px 88px; }
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center; }
  .hero-cta { justify-items: start; }
  .hero-cta .btn { padding: 0 36px; }
  .chat-card { padding: 22px; }
  .section, .band-dark { padding-block: 88px; }
  .section-tight { padding-top: 24px; }
  .pains { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
  .pains li, .pains li:last-child { border-bottom: 0; padding-top: 22px; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
  .steps li { padding: 64px 0 0; }
  .steps li::before { top: 0; }
  .steps li:not(:last-child)::after { left: 52px; right: -24px; top: 21px; bottom: auto; width: auto; height: 2px; }
  .footer-inner { grid-template-columns: 1.4fr 1fr 1fr; align-items: start; }
  .footer-contact, .footer-legal { flex-direction: column; }
  .footer-copy { grid-column: 1 / -1; }
}
