/* El perro del buscador (perro.js). Tamaño de la letra, movimientos suaves. */

/* La tira de 4 cuadros del perro agachado buscando (img/perro-busca.png, hecha con Gemini).
   Va 1-2-3-4-3-2: la nariz barre el piso de un lado al otro. */
.perro-cuadros { display: block; width: 100%; height: 100%; background: url("img/perro-busca.webp") 0 0 / 400% 100% no-repeat; }

/* 1. Perrito dentro del campo, en la orilla derecha junto a la X, mirando hacia lo que escribes. */
.seg.que { position: relative; }
.seg.que.con-perrito input { padding-right: 48px; }
.perrito { position: absolute; left: 0; top: 0; width: 39px; height: 32px; pointer-events: none;
  opacity: 0; transform: scaleX(-1) translateY(3px); transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.perrito.ve { opacity: 1; transform: scaleX(-1); }
.perrito.ve .perro-cuadros, .olfato.nada .perro-cuadros { animation: perro-busca 1.8s steps(1, end) infinite, perro-ronda 3.6s ease-in-out infinite; }

/* 2. Al buscar: se voltea y trota tranquilo hacia la lupa. */
.perrito.trota { animation: perro-trota .65s var(--ease-in-out) forwards; transition: none; }
.perrito.trota .perro-cuadros { animation: perro-paso .16s ease-in-out infinite alternate; background-position: 33.333% 0; }

/* 3. Fuera de la caja: entra corriendo, el pin llega como frisbee, brinca, lo atrapa y se sienta con él al centro.
   La escena la mueve perro.js cuadro por cuadro (atrapa()). */
.olfato { display: none; position: relative; height: 116px; margin: 4px auto 0; max-width: 920px; overflow: hidden; }
.olfato.llego, .olfato.nada, .olfato.juega { display: block; }
.olfato > * { position: absolute; left: 0; }
.olfato-carrera { bottom: 0; width: 120px; height: 72.5px; display: none; transform-origin: 50% 50%; will-change: transform;
  background: url("img/perro-carrera.webp") 0 0 / 700% 100% no-repeat; }
.olfato-pin { top: 0; width: 24.5px; height: 32.6px; z-index: 2; display: none; will-change: transform; }
.olfato-pin svg { display: block; width: 100%; height: 100%; }
.olfato-sentado { bottom: 0; width: 56px; display: none; transform-origin: 50% 100%; }
.olfato-sentado svg { display: block; width: 100%; height: auto; }
.olfato.juega .olfato-carrera, .olfato.juega .olfato-pin, .olfato.juega .olfato-sentado, .olfato.llego .olfato-sentado { display: block; }
.olfato.llego:not(.juega) .olfato-sentado { left: calc(50% - 28px); }
.olfato-husmea { display: none; left: calc(50% - 29px); bottom: 34px; width: 58px; height: 48px; }
.olfato.nada .olfato-husmea { display: block; }
.olfato-texto { bottom: 30px; margin: 0; font-weight: 700; font-size: var(--text-sm, 15px); color: var(--color-ink); white-space: nowrap; }
.olfato.llego:not(.juega) .olfato-texto { left: calc(50% + 38px); }
.olfato.nada .olfato-texto { left: 0; right: 0; bottom: 6px; text-align: center; white-space: normal; color: var(--color-muted); }
.olfato.llego .olfato-texto, .olfato.nada .olfato-texto { animation: perro-aparece var(--dur-long) var(--ease-out) both; }

@keyframes perro-busca {
  0% { background-position: 0 0; }
  16.67% { background-position: 33.333% 0; }
  33.33% { background-position: 66.667% 0; }
  50% { background-position: 100% 0; }
  66.67% { background-position: 66.667% 0; }
  83.33% { background-position: 33.333% 0; }
}
/* Pasito hacia el texto y de regreso. */
@keyframes perro-ronda { 0%, 100% { translate: 0 0; } 50% { translate: 3px 0; } }
@keyframes perro-paso { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
@keyframes perro-trota { 0% { transform: scaleX(-1); opacity: 1; } 18% { transform: scaleX(1); opacity: 1; } 100% { transform: translateX(90px) scaleX(1); opacity: 0; } }
@keyframes perro-sienta { 0% { opacity: 0; transform: translateY(6px) scale(.92); } 70% { opacity: 1; transform: translateY(-1px) scale(1.01); } 100% { opacity: 1; transform: none; } }
@keyframes perro-aparece { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .perrito, .perro-cuadros, .olfato-carrera, .olfato-sentado, .olfato-texto { animation: none !important; transition: none !important; }
}

/* --- Búsqueda «trabajando» (app.js): los pasos aparecen uno por uno con su conteo real */
.trabajando { padding: var(--space-xl, 32px) var(--space-lg, 24px); display: grid; justify-items: center; }
.trabaja { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; width: min(100%, 30em); }
.trabaja li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; font-weight: 600; color: var(--color-ink);
  animation: perro-aparece var(--dur-long, .4s) var(--ease-out, ease-out) both; }
.trabaja small { color: var(--color-muted); font-weight: 600; font-size: var(--text-sm, 15px); white-space: nowrap; opacity: 0; transition: opacity .2s ease; }
.trabaja li.listo small { opacity: 1; }
.trabaja .marca { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--color-rule, #d9d2c5); border-top-color: var(--color-accent, #2f6b5a); }
.trabaja li.va .marca { animation: trabaja-gira .7s linear infinite; }
.trabaja li.listo .marca { border-color: var(--color-accent, #2f6b5a); background: var(--color-accent, #2f6b5a)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat; }
@keyframes trabaja-gira { to { transform: rotate(360deg); } }
@media (max-width: 480px) { .trabaja li { grid-template-columns: 22px 1fr; } .trabaja small { grid-column: 2; } }

/* --- Sin resultados: el perrito triste y la invitación a aparecer gratis */
.vacio.triste .perro-triste { width: 96px; height: auto; animation: perro-aparece var(--dur-long, .4s) var(--ease-out, ease-out) both; }
.vacio.triste .gratis { color: var(--color-ink); font-weight: 600; margin-top: var(--space-xs, 8px); }
.vacio.triste .boton { text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .trabaja li, .trabaja li.va .marca, .vacio.triste .perro-triste { animation: none !important; } }
