/* Colores de la marca (app/src/theme/colors.ts).
   Cobalto es el grupo; ámbar es lo tuyo y no se usa para decorar. */
:root {
  --cobalto: #2f4bd8;
  --cobalto-hondo: #243cb4;
  --cobalto-suave: #e3e9fd;
  --ambar: #e08700;
  --noche: #1b2140;
  --hielo: #eef3fd;
  --blanco: #ffffff;
  --texto-2: #4d5470;
  --linea: #dde3f2;
  --linea-fuerte: #c6cde0;
  --sombra: 0 18px 44px -18px rgba(33, 48, 110, 0.28);
  --fuente: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Como en la app: los controles usan la letra del sistema; Manrope es la voz de la marca. */
  --fuente-control: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
  --resorte: cubic-bezier(0.32, 0.72, 0, 1);
  --alto-barra: 52px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--alto-barra); interpolate-size: allow-keywords; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--blanco);
  color: var(--noche);
  font: 1.0625rem/1.75 var(--fuente);
}

.ancho {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
}

h1, h2, h3 {
  letter-spacing: -0.025em;
  line-height: 1.16;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 4.8vw, 3.7rem); font-weight: 800; }
h2 { font-size: clamp(1.85rem, 3.5vw, 2.75rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
h1 em, h2 em, h3 em { font-style: normal; color: var(--cobalto); }
p { margin: 0 0 1.2em; max-width: 60ch; color: var(--texto-2); }

a { color: var(--cobalto); }
:focus-visible { outline: 3px solid var(--cobalto); outline-offset: 3px; }

.saltar { position: absolute; left: -999px; }
.saltar:focus { left: 12px; top: 12px; background: var(--blanco); padding: 8px 14px; z-index: 5; }

/* Botones: cápsulas que se hunden al presionarlas */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 28px;
  border-radius: 980px;
  background: var(--cobalto);
  color: #fff;
  font: 600 1.02rem var(--fuente-control);
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 0.25s ease, transform 0.4s var(--resorte);
}
.boton:hover { background: var(--cobalto-hondo); }
.boton:active { transform: scale(0.96); transition-duration: 0.08s; }
.boton-suave { background: var(--cobalto-suave); color: var(--cobalto); }
.boton-suave:hover { background: #d3dcfb; }
.boton-claro { background: #fff; color: var(--cobalto); }
.boton-claro:hover { background: var(--hielo); }
.boton[hidden] { display: none; }

/* Barra de arriba: delgada y de vidrio; la línea aparece al bajar */
.barra {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(238, 243, 253, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 transparent;
  font-family: var(--fuente-control);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
.barra.con-linea { background: rgba(255, 255, 255, 0.76); box-shadow: 0 0.5px 0 rgba(27, 33, 64, 0.18); }
.barra-fila { display: flex; align-items: center; gap: 12px; height: var(--alto-barra); }
.marca {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-right: auto;
  color: var(--noche);
  text-decoration: none;
  font: 800 1.15rem var(--fuente);
  letter-spacing: -0.035em;
}
.marca img { width: 24px; height: 24px; }
.barra nav { position: relative; display: flex; gap: 4px; margin-right: 8px; }
.barra nav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 34px;
  padding-inline: 14px;
  border-radius: 980px;
  color: var(--noche);
  font-size: 0.84rem;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.25s ease;
}
.barra nav a:hover, .barra nav a[aria-current] { opacity: 1; }
.indicador {
  position: absolute;
  left: 0;
  top: 0;
  height: 34px;
  border-radius: 980px;
  background: rgba(27, 33, 64, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s var(--resorte), width 0.45s var(--resorte), opacity 0.25s ease;
}
.boton-barra { min-height: 32px; padding: 4px 16px; font-size: 0.82rem; }

.menu-boton {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.menu-boton span {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--noche);
  transition: transform 0.4s var(--resorte);
}
.menu-boton span:first-child { top: 18px; }
.menu-boton span:last-child { top: 25px; }
.menu-abierto .menu-boton span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-abierto .menu-boton span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* Portada */
.portada { background: linear-gradient(180deg, var(--hielo) 0%, #f4f7fe 100%); overflow: hidden; }
.portada-fila {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: center;
  padding-block: clamp(36px, 6vw, 80px);
}
.entrada { font-size: 1.15rem; max-width: 42ch; }
.acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.estado { font-size: 0.9rem; margin: 20px 0 0; max-width: 44ch; }

.escena { display: block; width: 100%; height: auto; overflow: visible; }
.portada-escena { text-align: right; min-width: 0; }
.pausa {
  min-height: 44px;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--texto-2);
  font: 500 0.82rem var(--fuente-control);
  text-decoration: underline;
  cursor: pointer;
}

/* Secciones */
.seccion { padding-block: clamp(64px, 9vw, 120px); }
.hielo { background: var(--hielo); }
.centrada { text-align: center; }
.centrada p { margin-inline: auto; }
.titulo-centrado { text-align: center; margin-bottom: 1.4em; }
.dos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 7vw, 100px); align-items: center; }

/* Tarjetas flotantes con preguntas */
.burbujas { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.burbujas li {
  display: flex;
  gap: 18px;
  align-items: center;
  background: var(--blanco);
  border-radius: 16px;
  padding: 22px 26px;
  box-shadow: var(--sombra);
  margin-right: 32px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.burbujas li:nth-child(even) { margin: 0 0 0 32px; }
.burbujas li:nth-child(2) { transition-delay: 0.12s; }
.burbujas li:nth-child(3) { transition-delay: 0.24s; }
.burbujas li:nth-child(4) { transition-delay: 0.36s; }
.burbujas.por-entrar li { opacity: 0; transform: translateY(24px); }
.burbujas b, .burbujas span { display: block; line-height: 1.5; }
.burbujas span { color: var(--texto-2); font-size: 0.95rem; }
/* Una persona sin rostro ni nombre: no son testimonios. */
.cara {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, var(--cobalto) 0 10px, transparent 11px),
    radial-gradient(circle at 50% 100%, var(--cobalto) 0 19px, transparent 20px),
    var(--cobalto-suave);
}

/* Tres pasos con íconos de línea */
.pasos {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px;
  margin: 56px 0 0;
  padding: 0;
}
.pasos svg { width: 56px; height: 56px; fill: none; stroke: var(--noche); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 20px; }
.pasos p { margin-bottom: 0; }

/* Bloques alternados de texto e ilustración */
.fila {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 6vw, 90px);
  align-items: center;
}
.fila + .fila { margin-top: clamp(48px, 8vw, 100px); }
.fila h3 { font-size: clamp(1.6rem, 2.8vw, 2.15rem); font-weight: 800; }
.al-reves > div { order: 2; }

/* Pantallas de la app */
.telefonos { display: flex; justify-content: center; align-items: center; gap: clamp(8px, 3vw, 36px); margin: 48px 0 28px; }
.telefonos img {
  display: block;
  width: min(280px, 31%);
  height: auto;
  border-radius: 13% / 6%;
  box-shadow: var(--sombra);
}
.telefonos img:nth-child(2) { width: min(310px, 35%); }

/* Calculadora */
.cuenta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.tarjeta { background: var(--blanco); border-radius: 20px; padding: clamp(18px, 3vw, 34px); box-shadow: var(--sombra); min-width: 0; }
.rueda { position: relative; width: min(340px, 100%); margin-inline: auto; aspect-ratio: 1; }
.rueda svg { width: 100%; height: 100%; display: block; }
.rueda path { fill: none; stroke-width: 20; cursor: pointer; transition: stroke 0.35s ease, stroke-width 0.35s var(--resorte), opacity 0.2s ease; }
@media (hover: hover) { .rueda path:hover { opacity: 0.65; } }
.rueda path.antes { stroke: var(--cobalto); }
.rueda path.tuyo { stroke: var(--ambar); stroke-width: 30; }
.rueda path.despues { stroke: var(--linea-fuerte); }
.rueda-centro {
  position: absolute;
  inset: 17%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 1.35;
  color: var(--texto-2);
  font-size: 0.9rem;
  pointer-events: none;
}
.rueda-centro b { color: var(--noche); }
.rueda-centro strong {
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--noche);
  font-variant-numeric: tabular-nums;
}
.rueda-centro strong.largo { font-size: clamp(1.2rem, 3vw, 1.6rem); }

.leyenda {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  list-style: none;
  padding: 0;
  margin: 14px 0 22px;
  font-size: 0.82rem;
  color: var(--texto-2);
}
.leyenda i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.p-antes { background: var(--cobalto); }
.p-tuyo { background: var(--ambar); }
.p-despues { background: var(--linea-fuerte); }

.controles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.campo { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; font-size: 0.88rem; color: var(--texto-2); min-width: 0; }
.campo b { color: var(--noche); }
.campo-ancho { grid-column: 1 / -1; }
/* Se dibuja a mano: con accent-color ámbar el navegador oscurece la guía. */
.campo input[type='range'] { appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
.campo input[type='range']::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--linea); }
.campo input[type='range']::-moz-range-track { height: 6px; border-radius: 3px; background: var(--linea); }
.campo input[type='range']::-webkit-slider-thumb { appearance: none; width: 28px; height: 28px; margin-top: -11px; border: 3px solid #fff; border-radius: 50%; background: var(--ambar); box-shadow: 0 2px 8px rgba(27, 33, 64, 0.28); transition: transform 0.35s var(--resorte); }
.campo input[type='range']:active::-webkit-slider-thumb { transform: scale(1.2); }
.campo input[type='range']::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--ambar); }
.campo input[type='text'] {
  font: 600 1.05rem var(--fuente-control);
  color: var(--noche);
  background: var(--hielo);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  width: 100%;
  min-height: 48px;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.campo input[type='text']:focus { outline: none; background: #fff; border-color: var(--cobalto); box-shadow: 0 0 0 4px rgba(47, 75, 216, 0.2); }

/* Contador de personas, como el de iOS */
.contador { display: flex; align-items: center; justify-content: space-between; background: var(--hielo); border-radius: 12px; padding: 2px; min-height: 48px; }
.contador output { font: 600 1.05rem var(--fuente-control); color: var(--noche); font-variant-numeric: tabular-nums; }
.contador button {
  width: 52px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--noche);
  font: 500 1.35rem var(--fuente-control);
  box-shadow: 0 1px 4px rgba(27, 33, 64, 0.12);
  cursor: pointer;
  transition: transform 0.35s var(--resorte), background-color 0.2s ease, opacity 0.2s ease;
}
.contador button:active:not(:disabled) { transform: scale(0.9); background: var(--cobalto-suave); transition-duration: 0.08s; }
.contador button:disabled { opacity: 0.35; box-shadow: none; cursor: default; }
.rueda-centro strong, .contador output { display: inline-block; }
.nota { font-size: 0.85rem; margin: 16px auto 0; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 800; font-size: 1.1rem; padding-bottom: 14px; }
th, td { border-top: 1px solid var(--linea); padding: 13px 0; vertical-align: top; }
th { text-align: left; font-weight: 500; padding-right: 12px; }
th small { display: block; color: var(--texto-2); font-size: 0.8rem; }
td { text-align: right; font-weight: 700; white-space: nowrap; }
.total th, .total td { font-weight: 800; font-size: 1.18rem; border-top: 2px solid var(--noche); }

/* Si algo sale mal */
.casos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 48px; text-align: left; }
.casos > div { background: var(--hielo); border-radius: 16px; padding: 30px; }
.casos p { margin: 0; }

/* Preguntas */
.preguntas { max-width: 820px; }
details { background: var(--blanco); border-radius: 18px; margin-bottom: 12px; padding-inline: 24px; transition: box-shadow 0.3s ease; }
details[open] { box-shadow: var(--sombra); }
summary { position: relative; list-style: none; cursor: pointer; font-weight: 700; padding: 18px 40px 18px 0; }
summary::-webkit-details-marker { display: none; }
/* Un "+" que se vuelve "−" al abrir */
summary::before, summary::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 14px;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: var(--cobalto);
  transition: transform 0.4s var(--resorte);
}
summary::after { transform: rotate(90deg); }
details[open] summary::after { transform: rotate(0deg); }
details p { margin: 0; padding-bottom: 20px; }
details::details-content { height: 0; overflow: clip; transition: height 0.4s var(--resorte), content-visibility 0.4s allow-discrete; }
details[open]::details-content { height: auto; }

/* Cierre y pie */
.cierre {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  overflow: hidden;
  color: #fff;
  border-radius: 28px;
  padding: clamp(32px, 6vw, 72px) clamp(22px, 5vw, 64px);
  background:
    radial-gradient(90% 120% at 82% 40%, rgba(47, 75, 216, 0.75) 0%, rgba(47, 75, 216, 0) 62%),
    var(--noche);
  box-shadow: var(--sombra);
}
.cierre h2 { font-size: clamp(2.1rem, 4.2vw, 3.3rem); }
.cierre h2 em { color: #8399ff; }
.cierre p { color: rgba(255, 255, 255, 0.82); }
/* La vista previa del mensaje, como un globo de chat */
.mensaje { margin: 0 0 28px; }
.mensaje figcaption { font-size: 0.82rem; color: rgba(255, 255, 255, 0.65); margin-bottom: 8px; }
.mensaje blockquote {
  margin: 0;
  max-width: 42ch;
  padding: 16px 20px;
  border-radius: 20px 20px 20px 6px;
  background: #fff;
  color: var(--noche);
  font: 400 0.98rem/1.5 var(--fuente-control);
  overflow-wrap: anywhere;
}
.cierre :focus-visible { outline-color: #fff; }
.pie { padding-bottom: 40px; font-size: 0.85rem; }

@media (max-width: 900px) {
  .portada-fila, .dos, .fila, .cuenta, .casos, .cierre { grid-template-columns: minmax(0, 1fr); }
  .pasos { grid-template-columns: minmax(0, 1fr); }
  .al-reves > div { order: 0; }
  /* Sin JavaScript no hay botón de menú: los enlaces simplemente no se muestran. */
  .barra nav { display: none; }
  .menu-boton:not([hidden]) { display: block; }
  .indicador { display: none; }
  .con-js .barra nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100dvh - var(--alto-barra));
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 18px 32px;
    background: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
  }
  .con-js .barra nav a {
    height: 56px;
    padding: 0;
    flex: none;
    font: 600 1.6rem var(--fuente-control);
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.5s var(--resorte);
  }
  .menu-abierto .barra nav { opacity: 1; visibility: visible; }
  .menu-abierto .barra nav a { opacity: 1; transform: none; }
  .menu-abierto .barra nav a:nth-of-type(2) { transition-delay: 0.05s; }
  .menu-abierto .barra nav a:nth-of-type(3) { transition-delay: 0.1s; }
  .menu-abierto .barra { background: #fff; }
  .menu-abierto, .menu-abierto body { overflow: hidden; }
  .portada-escena { max-width: 600px; width: 100%; margin-inline: auto; }
}

@media (max-width: 560px) {
  .acciones .boton { width: 100%; }
  .burbujas li, .burbujas li:nth-child(even) { margin: 0; padding: 18px; }
  .controles { grid-template-columns: minmax(0, 1fr); }
  /* En pantallas angostas, solo la pantalla principal. */
  .telefonos img:not(:nth-child(2)) { display: none; }
  .telefonos img:nth-child(2) { width: min(290px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after, details::details-content { transition: none !important; }
  .boton:active, .contador button:active:not(:disabled) { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .barra, .barra.con-linea { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
