/* TalleIA · sistema de botones "acuoso" sobre vidrio grafito: superficies con brillo suave, compresión breve al tocar
   y una gota de luz que nace donde se toca. Todo con transform, opacity y fondos (sin recalcular el diseño).
   Variantes: .boton--primario · .boton--secundario · .boton--enlace · .opcion (seleccionable) · .chip · .flecha (ícono)
   Estados: reposo · hover · foco (anillo doble) · pulsación · carga [aria-busy] · selección [aria-pressed]
            · éxito [data-estado="ok"] · deshabilitado [disabled] */
:root {
  --b-radio: 16px;
  --b-alto: 46px;
  --b-alto-grande: 54px;
  --b-alto-chico: 38px;
  --b-rapido: 110ms;
  --b-normal: 280ms;
  --b-curva: cubic-bezier(.22, 1, .36, 1);          /* desacelera sin pasarse: sin rebote */
  --b-foco: 0 0 0 2px var(--fondo), 0 0 0 4px var(--texto);   /* anillo doble: oscuro + blanco */
  --b-luz: rgba(255, 255, 255, .38);                /* brillo que sigue al puntero */
  --b-gota: rgba(255, 255, 255, .45);               /* gota al tocar */
}

/* ---------- Base común ---------- */
.boton, .opcion, .chip, .flecha {
  --x: 50%; --y: 50%;
  position: relative; isolation: isolate; overflow: hidden;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; /* respuesta inmediata al toque */
  cursor: pointer; font: inherit;
  transition: transform var(--b-normal) var(--b-curva), box-shadow var(--b-normal) var(--b-curva), background-color var(--b-normal), border-color var(--b-normal), color var(--b-normal);
}
/* Brillo que sigue al puntero (aparece con hover) */
.boton::before, .opcion::before, .chip::before, .flecha::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(140px circle at var(--x) var(--y), var(--b-luz), transparent 65%);
  opacity: 0; transition: opacity var(--b-normal) var(--b-curva);
}
/* Gota de luz que nace en el punto de contacto y se disuelve (una sola vez por toque) */
.boton::after, .opcion::after, .chip::after, .flecha::after {
  content: ""; position: absolute; z-index: -1; left: var(--x); top: var(--y); width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: var(--b-gota); opacity: 0; transform: scale(0); pointer-events: none;
}
.gota::after { animation: gota 520ms var(--b-curva); }
@keyframes gota { 0% { opacity: 1; transform: scale(0); } 100% { opacity: 0; transform: scale(16); } }
@media (hover: hover) {
  .boton:hover::before, .opcion:hover::before, .chip:hover::before, .flecha:hover::before { opacity: 1; }
}
/* Pulsación: compresión corta al bajar y recuperación suave al soltar (mouse, dedo o teclado) */
.boton:active, .opcion:active, .chip:active, .flecha:active, .pulsado { transform: scale(.97); transition-duration: var(--b-rapido); }
.boton:focus-visible, .opcion:focus-visible, .chip:focus-visible, .flecha:focus-visible { outline: none; box-shadow: var(--b-foco); }

/* ---------- Botón ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--b-alto); padding: 0 20px; border-radius: var(--b-radio); border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
.boton--grande { min-height: var(--b-alto-grande); padding: 0 26px; font-size: 1rem; border-radius: 18px; }
.boton--chico { min-height: var(--b-alto-chico); padding: 0 14px; font-size: .88rem; border-radius: 13px; }

/* Primario: tornasolado oscuro con reflejo arriba; al pasar el mouse el tono se desliza. Texto blanco ≥ 5:1 */
.boton--primario {
  --b-luz: rgba(255, 255, 255, .3); --b-gota: rgba(255, 255, 255, .45);
  color: #ffffff; border-color: rgba(255, 255, 255, .22);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 55%), var(--tornasol);
  background-size: 100% 100%, 220% 100%; background-position: 0 0, 0% 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 4px rgba(0, 0, 0, .3), 0 10px 24px -12px rgba(110, 120, 220, .45);
  transition: transform var(--b-normal) var(--b-curva), box-shadow var(--b-normal) var(--b-curva), color var(--b-normal), border-color var(--b-normal), background-position .9s var(--suave);
}
@media (hover: hover) { .boton--primario:hover { background-position: 0 0, 100% 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 4px rgba(0, 0, 0, .3), 0 12px 30px -10px rgba(170, 120, 200, .55); } }
.boton--primario:active { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .45), 0 4px 10px -8px rgba(110, 120, 220, .4); }
.boton--primario:focus-visible { box-shadow: var(--b-foco), inset 0 1px 0 rgba(255, 255, 255, .35); }

/* Secundario: vidrio ahumado con borde claro */
.boton--secundario {
  --b-luz: rgba(255, 255, 255, .16); --b-gota: rgba(255, 255, 255, .3);
  color: var(--texto); border-color: var(--borde-fuerte);
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
@media (hover: hover) { .boton--secundario:hover { background-color: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .4); } }

/* Enlace: acción de menor peso, con subrayado que se completa al pasar */
.boton--enlace {
  --b-luz: transparent; --b-gota: rgba(157, 183, 255, .2);
  min-height: 44px; padding: 0 8px; color: var(--acento); background: transparent;
  background-image: linear-gradient(currentColor, currentColor); background-size: 0 1.5px; background-position: 8px calc(100% - 10px); background-repeat: no-repeat;
}
@media (hover: hover) { .boton--enlace:hover { background-size: calc(100% - 16px) 1.5px; } }
.boton--enlace { transition: transform var(--b-normal) var(--b-curva), background-size var(--b-normal) var(--b-curva), box-shadow var(--b-normal); }

/* Carga: el texto sigue visible y aparece un indicador; el botón no acepta otro toque */
.boton[aria-busy="true"] { cursor: progress; pointer-events: none; }
.boton[aria-busy="true"] .boton__giro { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite; }
@keyframes girar { to { transform: rotate(1turn); } }

/* Éxito: verde con tilde (no depende solo del color) */
.boton[data-estado="ok"] { color: #06291c; background: linear-gradient(180deg, #a7f3d0, var(--exito)); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 8px 18px -10px rgba(110, 231, 183, .6); }
.boton__tilde { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* Deshabilitado: plano, sin brillo ni gota, con contraste legible */
.boton:disabled, .opcion:disabled, .flecha:disabled { background: rgba(255, 255, 255, .04); color: var(--texto-3); border: 1px dashed var(--borde-fuerte); box-shadow: none; cursor: not-allowed; transform: none; }
.boton:disabled::before, .boton:disabled::after, .flecha:disabled::before, .flecha:disabled::after { display: none; }

/* ---------- Opción seleccionable (tarjeta) ---------- */
.opcion {
  --b-luz: rgba(255, 255, 255, .12); --b-gota: rgba(255, 255, 255, .25);
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 14px 16px; text-align: left;
  border-radius: 18px; border: 1.5px solid var(--borde); background: var(--vidrio-interior); color: var(--texto);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
@media (hover: hover) { .opcion:hover { border-color: rgba(255, 255, 255, .35); background-color: rgba(255, 255, 255, .09); } }
.opcion__texto { display: grid; gap: 2px; flex: 1; min-width: 0; }
.opcion__titulo { font-weight: 600; line-height: 1.3; }
.opcion__detalle { font-size: .86rem; color: var(--texto-2); line-height: 1.4; }
/* Marca de selección: aro vacío → círculo plateado con tilde oscura */
.opcion__marca { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); background: transparent center / 14px no-repeat; transition: background-color var(--b-normal), border-color var(--b-normal), transform var(--b-normal) var(--b-curva); }
.opcion[aria-pressed="true"] { border-color: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), inset 0 1px 0 rgba(255, 255, 255, .3); }
.opcion[aria-pressed="true"] .opcion__marca { border-color: transparent; background-color: #dfe2e7; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5 8.5 14 15 6.5' fill='none' stroke='%23121316' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.opcion__muestra { width: 28px; height: 28px; flex-shrink: 0; border-radius: 10px; background: var(--muestra); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), inset 0 6px 10px -6px rgba(255, 255, 255, .7); }

/* ---------- Chip (respuesta ya dada, se toca para cambiarla) ---------- */
.chip {
  --b-luz: rgba(255, 255, 255, .14); --b-gota: rgba(255, 255, 255, .25);
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px 6px 12px; border-radius: 14px;
  border: 1px solid var(--borde); background: var(--vidrio-interior); color: var(--texto); font-size: .88rem; text-align: left;
}
.chip__clave { color: var(--texto-2); font-size: .78rem; }
.chip__editar { font-size: .78rem; font-weight: 600; color: var(--tinta-plata); padding: 3px 8px; border-radius: 9px; background: #dfe2e7; }
.chip[aria-current="step"] { border-color: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); }

/* ---------- Ícono (flechas del carrusel) ---------- */
.flecha {
  --b-luz: rgba(255, 255, 255, .16); --b-gota: rgba(255, 255, 255, .3);
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  border: 1px solid var(--borde-fuerte); background: rgba(255, 255, 255, .07); color: var(--texto);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.flecha svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Movimiento reducido: mismos estados, sin desplazamientos ni gotas ---------- */
@media (prefers-reduced-motion: reduce) {
  .boton, .opcion, .chip, .flecha { transition: background-color .01ms, border-color .01ms, color .01ms, box-shadow .01ms; }
  .boton:active, .opcion:active, .chip:active, .flecha:active, .pulsado { transform: none; }
  .gota::after { animation: none; }
  .boton::before, .opcion::before, .chip::before, .flecha::before { transition: none; }
}
