/* estilo.css — la ropa del flujo del cliente: colores del negocio, mobile-first, botones
   grandes y contraste AA. Escrito a mano, sin librerías ni fuentes de fuera. */

/* ============================================================================
   1. VARIABLES Y BASE
   ============================================================================ */

:root {
  --rojo: #EC1C21;
  --rojo-oscuro: #B3151A;
  --crema: #FFF7EE;
  --marron: #784A31;
  --dorado: #E7C79A;
  --tinta: #0A0605;

  --papel: #FFFFFF;
  --raya: #E8DACA;
  --tenue: #6B4A38;

  --radio: 16px;
  --radio-chico: 10px;
  --sombra: 0 2px 10px rgba(10, 6, 5, .07), 0 12px 28px rgba(10, 6, 5, .06);
  --tipo: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 max(24px, env(safe-area-inset-bottom));
  background: var(--crema);
  color: var(--tinta);
  font: 400 17px/1.55 var(--tipo);
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 800; }
h1 { font-size: 2rem; letter-spacing: -.02em; }
h2 { font-size: 1.5rem; letter-spacing: -.01em; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }
p  { margin: 0 0 .8em; }
ul { margin: 0; padding: 0; list-style: none; }

/* Foco visible de verdad, en todo lo que se pueda enfocar. */
:focus-visible {
  outline: 3px solid var(--rojo-oscuro);
  outline-offset: 3px;
  border-radius: 6px;
}

.oculto-visual {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.salto {
  position: absolute;
  left: -9999px; top: 0;
  z-index: 20;
  background: var(--rojo-oscuro); color: #fff;
  padding: 10px 16px; border-radius: 0 0 var(--radio-chico) 0;
  text-decoration: none; font-weight: 700;
}
.salto:focus { left: 0; }

.centrada { text-align: center; }

/* ============================================================================
   2. CABECERA, MARCA Y SELECTOR DE IDIOMA
   ============================================================================ */

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  max-width: 640px;
  margin: 0 auto;
}

.marca { display: flex; align-items: center; gap: 8px; min-width: 0; }

.marca-punto {
  width: 14px; height: 14px; flex: none;
  border-radius: 50%;
  background: var(--rojo);
  box-shadow: 0 0 0 3px rgba(236, 28, 33, .18);
}

.marca-nombre {
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--marron);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.idiomas {
  display: flex;
  flex: none;
  background: var(--papel);
  border: 2px solid var(--raya);
  border-radius: 999px;
  padding: 3px;
}

.idioma-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--tenue);
  font: 700 .9rem/1 var(--tipo);
  letter-spacing: .04em;
  padding: 9px 14px;
  min-height: 38px;
  border-radius: 999px;
  cursor: pointer;
}
.idioma-btn[aria-pressed="true"] {
  background: var(--rojo-oscuro);
  color: #fff;
}

/* ============================================================================
   3. BARRA DE PROGRESO
   ============================================================================ */

.barra {
  max-width: 640px;
  margin: 0 auto 4px;
  padding: 0 16px;
}

.barra-riel {
  height: 8px;
  background: #F0E2D2;
  border-radius: 999px;
  overflow: hidden;
}

.barra-lleno {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--dorado), var(--rojo));
  border-radius: 999px;
  transition: width .28s ease;
}

.barra-texto {
  margin: 6px 2px 0;
  font-size: .82rem;
  font-weight: 700;
  color: var(--tenue);
  letter-spacing: .02em;
}

/* ============================================================================
   4. TARJETAS
   ============================================================================ */

.tarjetas {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 0;
}

.tarjeta {
  display: block;
  background: var(--papel);
  border: 1px solid var(--raya);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 22px 18px 20px;
  animation: entra .28s ease both;
}

@keyframes entra {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tarjeta { animation: none; }
  .barra-lleno, .subida-lleno { transition: none; }
}

.tarjeta h2 { outline-offset: 4px; }

.sub { color: var(--tenue); margin-bottom: 1.2em; }
.grande { font-size: 1.12rem; }
.ayuda { font-size: .88rem; color: var(--tenue); margin: 4px 0 0; }
.pie-suave { font-size: .8rem; color: var(--tenue); text-align: center; margin: 18px 0 0; }

/* Bienvenida */
.tarjeta-bienvenida { text-align: center; padding: 30px 18px 26px; }
.taza { margin: 4px auto 14px; line-height: 0; }

.pastillas {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 16px 0 22px;
}
.pastillas li {
  background: var(--crema);
  border: 1px solid var(--dorado);
  color: var(--marron);
  font-size: .84rem; font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
}

/* ============================================================================
   5. BOTONES
   ============================================================================ */

.boton {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 13px 22px;
  border: 2px solid var(--rojo-oscuro);
  border-radius: 999px;
  background: var(--rojo-oscuro);
  color: #fff;
  font: 700 1.02rem/1.2 var(--tipo);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.boton:hover { background: #9C1217; border-color: #9C1217; }
.boton:active { transform: translateY(1px); }

.boton-grande { width: 100%; min-height: 58px; font-size: 1.12rem; }

.boton-plano {
  background: var(--papel);
  color: var(--marron);
  border-color: var(--raya);
}
.boton-plano:hover { background: var(--crema); border-color: var(--dorado); }

.boton-chico { min-height: 42px; padding: 8px 16px; font-size: .92rem; }

.boton-parar { background: var(--tinta); border-color: var(--tinta); }
.boton-parar:hover { background: #2A1C18; border-color: #2A1C18; }

.boton-disparo { min-width: 190px; }

.boton[disabled] {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.botonera {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin: 14px 0 6px;
}

.navega {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--raya);
}
.navega .boton { flex: 1 1 130px; }
.navega .boton-grande { flex: 2 1 200px; }

/* ============================================================================
   6. CAMPOS DEL FORMULARIO
   ============================================================================ */

.campo { margin: 0 0 18px; }

label, legend, .firma-rotulo {
  display: block;
  font-weight: 700;
  font-size: .95rem;
  margin: 0 0 6px;
  color: var(--tinta);
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  border: 2px solid var(--raya);
  border-radius: var(--radio-chico);
  background: var(--papel);
  color: var(--tinta);
  font: 400 1.06rem/1.3 var(--tipo);
}
input::placeholder { color: #A9917F; }
input:focus { border-color: var(--rojo-oscuro); }

input[aria-invalid="true"] { border-color: var(--rojo-oscuro); background: #FFF4F4; }

.error {
  margin: 6px 0 0;
  color: var(--rojo-oscuro);
  font-size: .9rem;
  font-weight: 700;
}

fieldset { border: 0; margin: 0; padding: 0; }

.grupo {
  border: 2px dashed var(--dorado);
  border-radius: var(--radio);
  padding: 16px 14px 2px;
  margin: 0 0 18px;
  background: #FFFCF8;
}
.grupo legend { padding: 0 6px; color: var(--marron); }

.edad legend { margin-bottom: 10px; font-size: 1.02rem; }

.dos-botones { display: flex; flex-wrap: wrap; gap: 10px; }

.opcion {
  flex: 1 1 150px;
  appearance: none;
  min-height: 56px;
  padding: 12px 14px;
  border: 2px solid var(--raya);
  border-radius: var(--radio-chico);
  background: var(--papel);
  color: var(--tinta);
  font: 700 1rem/1.25 var(--tipo);
  cursor: pointer;
}
.opcion[aria-pressed="true"] {
  border-color: var(--rojo-oscuro);
  background: #FDEDED;
  color: var(--rojo-oscuro);
  box-shadow: inset 0 0 0 1px var(--rojo-oscuro);
}

/* ============================================================================
   7. AVISOS
   ============================================================================ */

.aviso {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: var(--radio-chico);
  font-size: .95rem;
  font-weight: 600;
  border-left: 5px solid;
}
.aviso-malo { background: #FDECEC; border-color: var(--rojo-oscuro); color: #7A0F13; }
.aviso-ojo  { background: #FFF6E7; border-color: var(--dorado); color: #6B4A0F; }

/* ============================================================================
   8. RESUMEN, DOCUMENTO Y CASILLAS
   ============================================================================ */

.resumen li {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--raya);
}
.resumen li:last-child { border-bottom: 0; }

.resumen-emoji { font-size: 1.5rem; line-height: 1.2; flex: none; width: 32px; text-align: center; }
.resumen-cuerpo { display: block; }
.resumen-cuerpo strong { display: block; margin-bottom: 2px; }
.resumen-cuerpo span { color: var(--tenue); font-size: .95rem; }

.documento-caja {
  margin: 18px 0;
  border: 1px solid var(--raya);
  border-radius: var(--radio-chico);
  background: var(--crema);
}
.documento-caja > summary {
  padding: 14px 16px;
  font-weight: 700;
  color: var(--marron);
  cursor: pointer;
  border-radius: var(--radio-chico);
  list-style: none;
}
.documento-caja > summary::-webkit-details-marker { display: none; }
.documento-caja > summary::before { content: "▸ "; color: var(--rojo); }
.documento-caja[open] > summary::before { content: "▾ "; }

.documento {
  max-height: 55vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 16px;
  font-size: .9rem;
  line-height: 1.6;
  color: #241512;
  border-top: 1px solid var(--raya);
}
.documento h3 { font-size: 1rem; margin-top: 14px; }
.documento h4 { margin-top: 16px; color: var(--rojo-oscuro); }
.doc-encabezado {
  margin-top: 14px;
  font-size: .78rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--marron);
}
.doc-cierre { font-style: italic; }
.doc-version { font-size: .78rem; color: var(--tenue); }

.casillas-titulo { margin: 22px 0 10px; }

.casillas li { margin: 0 0 10px; }

.casilla {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 14px;
  border: 2px solid var(--raya);
  border-radius: var(--radio-chico);
  background: var(--papel);
  font-weight: 400;
  cursor: pointer;
  margin: 0;
}
.casilla:hover { border-color: var(--dorado); }
.casilla input { position: absolute; opacity: 0; width: 28px; height: 28px; margin: 0; }

.casilla-marca {
  flex: none;
  width: 28px; height: 28px;
  border: 2px solid var(--marron);
  border-radius: 8px;
  background: var(--papel);
  position: relative;
}
.casilla-marca::after {
  content: "";
  position: absolute;
  left: 8px; top: 3px;
  width: 7px; height: 14px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(42deg) scale(.4);
  opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
}
.casilla input:checked ~ .casilla-marca {
  background: var(--rojo-oscuro);
  border-color: var(--rojo-oscuro);
}
.casilla input:checked ~ .casilla-marca::after { opacity: 1; transform: rotate(42deg) scale(1); }
.casilla input:focus-visible ~ .casilla-marca { outline: 3px solid var(--rojo-oscuro); outline-offset: 3px; }

.casilla-texto { font-size: .95rem; line-height: 1.45; }

/* ============================================================================
   9. FIRMA
   ============================================================================ */

.firma-bloque { margin: 0 0 20px; }

.firma-caja {
  position: relative;
  border: 2px solid var(--raya);
  border-radius: var(--radio-chico);
  background: #FFFDFA;
  overflow: hidden;
}
.firma-caja.firmando .firma-pista,
.firma-caja.firmando .firma-raya { opacity: 0; }

.lienzo {
  display: block;
  width: 100%;
  height: 190px;
  touch-action: none;       /* sin esto el dedo arrastra la página en vez de firmar */
  cursor: crosshair;
  position: relative;
  z-index: 2;
  background: transparent;
}

.firma-raya {
  position: absolute;
  left: 22px; right: 22px; bottom: 46px;
  height: 2px;
  background: var(--raya);
  z-index: 1;
}

.firma-pista {
  position: absolute;
  left: 0; right: 0; bottom: 20px;
  text-align: center;
  font-size: .85rem;
  color: #B39C8A;
  z-index: 1;
  pointer-events: none;
}

/* ============================================================================
   10. CÁMARA, SELFIE Y VIDEO
   ============================================================================ */

.visor {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 62vh;
  margin: 0 auto;
  border-radius: var(--radio);
  overflow: hidden;
  background: #1A100D;
  display: flex;
  align-items: center;
  justify-content: center;
}

#visor_video { aspect-ratio: 4 / 5; }

/* Mientras la cámara está apagada no hace falta un rectángulo negro del tamaño del celular:
   se achica para que el botón y el camino de repuesto se vean sin tener que bajar. */
.visor:has(> .visor-vacio:not([hidden])),
#visor_video:has(> .visor-vacio:not([hidden])) {   /* el id de arriba pesa más: hay que repetirlo */
  aspect-ratio: auto;
  min-height: 150px;
  background: var(--crema);
  border: 2px dashed var(--dorado);
}

.visor-medio {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* La cámara frontal se ve en espejo, como el espejo del baño. */
#camara_selfie, #camara_video { transform: scaleX(-1); }

.visor-vacio { color: var(--dorado); opacity: .55; }

.ovalo {
  position: absolute;
  left: 50%; top: 46%;
  width: 62%; height: 74%;
  transform: translate(-50%, -50%);
  border: 3px dashed rgba(255, 247, 238, .85);
  border-radius: 50% / 42%;
  pointer-events: none;
}

.cuenta {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 6rem; font-weight: 800; color: #FFF7EE;
  background: rgba(10, 6, 5, .45);
  text-shadow: 0 3px 14px rgba(0, 0, 0, .5);
}

.reloj {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(10, 6, 5, .68);
  color: #fff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: .95rem;
}
.reloj::before {
  content: "";
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--rojo);
  animation: late 1s steps(2, end) infinite;
}
@keyframes late { 50% { opacity: .2; } }

.otra-forma {
  text-align: center;
  font-size: .9rem;
  color: var(--tenue);
  margin: 16px 0 0;
}
.enlace-archivo {
  display: block;
  margin: 4px auto 0;
  font-weight: 700;
  font-size: .98rem;
  color: var(--rojo-oscuro);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px 4px;          /* área de toque decente, que esto es un dedo en un mostrador */
}
/* El input de archivo está escondido a la vista pero SÍ se enfoca con el teclado: cuando lo
   está, se le pinta el foco al rótulo, que es lo que la persona ve. */
.oculto-visual:focus-visible + .enlace-archivo,
.archivo-enfocado .enlace-archivo {
  outline: 3px solid var(--rojo-oscuro);
  outline-offset: 3px;
  border-radius: 4px;
}

.frase {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--crema);
  border-left: 5px solid var(--dorado);
  border-radius: var(--radio-chico);
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.4;
}

/* ============================================================================
   11. REPASO, SUBIDA Y PANTALLA DE LISTO
   ============================================================================ */

.repaso { margin: 0 0 16px; }
.repaso > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--raya);
}
.repaso dt { font-weight: 700; color: var(--tenue); font-size: .9rem; flex: none; }
.repaso dd {
  margin: 0;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.repaso-firma {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 0 6px;
}
#repaso_selfie {
  width: 82px; height: 104px;
  object-fit: cover;
  border-radius: var(--radio-chico);
  border: 2px solid var(--raya);
}
#repaso_trazo {
  flex: 1;
  max-height: 78px;
  object-fit: contain;
  object-position: left center;
}

.subida-riel {
  height: 18px;
  background: #F0E2D2;
  border-radius: 999px;
  overflow: hidden;
  margin: 22px 0 10px;
}
.subida-lleno {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--rojo), var(--rojo-oscuro));
  transition: width .2s linear;
}
.subida-texto { font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; }

.palomita { text-align: center; margin: 6px 0 12px; line-height: 0; }

.codigo {
  text-align: center;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--rojo-oscuro);
  background: var(--crema);
  border: 2px dashed var(--dorado);
  border-radius: var(--radio);
  padding: 14px 10px;
  margin: 6px 0 16px;
  word-break: break-all;
}

/* ============================================================================
   12. PANTALLAS GRANDES
   ============================================================================ */

@media (min-width: 700px) {
  body { font-size: 18px; }
  .tarjeta { padding: 30px 32px 26px; }
  h1 { font-size: 2.4rem; }
  .visor { max-width: 420px; }
  .lienzo { height: 220px; }
}

/* Modo de alto contraste del sistema: que no se pierda ningún borde. */
@media (prefers-contrast: more) {
  .boton-plano, .opcion, input, .casilla { border-color: var(--tinta); }
  .ayuda, .sub, .resumen-cuerpo span { color: #3B2A22; }
}
