:root {
  --primary: #9A4100;
  --primary-container: #BD5611;
  --secondary: #066A67;
  --tertiary: #5644D0;
  --surface: #FFF8F5;
  --surface-alt: #FAF2EE;
  --on-surface: #1E1B19;
  --on-surface-muted: #5c5450;
  --radius: 20px;
}

/* Modo oscuro automático (preferencia del sistema) — se aplica salvo que
   haya una elección explícita guardada (ver [data-theme] más abajo). */
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #201a17;
    --surface-alt: #2b2320;
    --on-surface: #f3ece8;
    --on-surface-muted: #c9bdb6;
    --primary-container: #d8672a;
  }
}

/* Elección explícita del usuario (botón de tema), guardada en
   localStorage. Mismo peso de especificidad que la media query de
   arriba: gana por ir después en el archivo. */
:root[data-theme="light"] {
  --surface: #FFF8F5;
  --surface-alt: #FAF2EE;
  --on-surface: #1E1B19;
  --on-surface-muted: #5c5450;
  --primary-container: #BD5611;
}
:root[data-theme="dark"] {
  --surface: #201a17;
  --surface-alt: #2b2320;
  --on-surface: #f3ece8;
  --on-surface-muted: #c9bdb6;
  --primary-container: #d8672a;
}

/* Visualmente oculto pero legible por lectores de pantalla (técnica
   estándar - display:none no sirve, lo saca del árbol de accesibilidad). */
.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;
}
/* El skip-link se muestra al recibir foco (primer Tab de la página). */
.sr-only-focusable:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: 12px 20px;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  font-weight: 700;
  z-index: 100;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  scroll-behavior: smooth;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

header.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}
header.nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
header.nav .brand img { width: 36px; height: 36px; border-radius: 10px; }
header.nav a.cta {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 0 64px;
  gap: 20px;
}
.hero img.icon {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  box-shadow: 0 12px 30px rgba(154, 65, 0, 0.25);
}
.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  line-height: 1.15;
  margin: 0;
  max-width: 20ch;
}
.hero p.sub {
  color: var(--on-surface-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0;
}
.badge {
  display: inline-block;
  background: var(--surface-alt);
  color: var(--secondary);
  border: 1px solid var(--secondary);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 16px 30px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 10px 24px rgba(154, 65, 0, 0.3);
}
.download-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.download-btn.disabled {
  background: var(--surface-alt);
  color: var(--on-surface-muted);
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}
.download-note {
  font-size: 0.85rem;
  color: var(--on-surface-muted);
}

section.features {
  padding: 40px 0 64px;
}
section.features h2 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 36px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 24px;
}
.card .emoji { font-size: 1.8rem; margin-bottom: 12px; display: block; }
.card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--on-surface-muted); font-size: 0.92rem; line-height: 1.5; }

section.cta-final {
  text-align: center;
  padding: 56px 0 72px;
}
section.cta-final h2 { font-size: 1.5rem; margin-bottom: 8px; }
section.cta-final p { color: var(--on-surface-muted); margin-bottom: 28px; }

section.share {
  text-align: center;
  padding: 0 0 48px;
}
section.share > p {
  color: var(--on-surface-muted);
  font-size: 0.92rem;
  margin: 0 0 16px;
}
.share-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--on-surface);
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}
.share-btn svg { width: 20px; height: 20px; }
.share-btn[hidden] { display: none; }
.share-btn:hover { background: var(--primary-container); color: #fff; }
.share-btn:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}
.share-feedback {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--secondary);
  font-weight: 600;
}

footer {
  border-top: 1px solid var(--surface-alt);
  padding: 28px 0 40px;
  text-align: center;
  color: var(--on-surface-muted);
  font-size: 0.85rem;
}
footer a { color: inherit; }

.whatsapp-wrap {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 50;
}
.whatsapp-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}
.whatsapp-fab svg { width: 30px; height: 30px; fill: #fff; }
.whatsapp-fab:hover { filter: brightness(1.05); }

.whatsapp-bubble {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  background: var(--surface-alt);
  color: var(--on-surface);
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.whatsapp-bubble::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 100%;
  border: 7px solid transparent;
  border-top-color: var(--surface-alt);
}
.whatsapp-wrap:hover .whatsapp-bubble,
.whatsapp-fab:focus-visible + .whatsapp-bubble,
.whatsapp-wrap:focus-within .whatsapp-bubble {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.theme-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--on-surface);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  z-index: 50;
  cursor: pointer;
  padding: 0;
}
.theme-fab svg { width: 24px; height: 24px; }
.theme-fab:hover { filter: brightness(1.05); }
.theme-fab:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* Documentos legales (privacidad.html, terminos.html) — misma marca que el
   resto de la landing, pero con tipografía angosta para lectura larga. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--on-surface-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 8px 0 24px;
}
.back-link:hover { color: var(--on-surface); }

.legal {
  max-width: 700px;
  margin: 0 auto;
  padding-bottom: 64px;
}
.legal h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin: 0 0 8px;
}
.legal .updated {
  color: var(--on-surface-muted);
  font-size: 0.85rem;
  margin: 0 0 24px;
}
.legal .draft-notice {
  background: var(--surface-alt);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.9rem;
  margin: 0 0 32px;
}
.legal h2 {
  font-size: 1.15rem;
  margin: 36px 0 12px;
}
.legal p, .legal li {
  line-height: 1.65;
  color: var(--on-surface);
}
.legal ul { padding-left: 22px; margin: 8px 0; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--secondary); }
