/* Contador con aspecto de detonador: cifras de siete segmentos y una mecha que se consume. Lo usan la barra de la oferta
   (landing, datos y pago de db12 y mg) y la segunda caja. Lo pinta /scripts/reloj-bomba.js; sin él se ve el texto. */
.bomba { /* la caja tiene que ser relative o sticky, por la mecha */
  background: #17110f; color: #fff;
  background-image: radial-gradient(120% 160% at 50% 0, #3a1512 0, #17110f 62%);
}
.bomba-icono { flex: none; display: block; width: 26px; height: 26px; }
.bomba-chispa { transform-origin: 19.5px 4.5px; animation: bomba-chispa .5s steps(2, jump-none) infinite; }

/* Pantalla */
.bomba .bomba-led {
  flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border: 2px solid #57504d; border-radius: 7px;
  background: #0d0303; box-shadow: inset 0 0 10px rgba(0, 0, 0, .9), 0 0 0 1px #000, 0 0 12px rgba(255, 40, 30, .35);
  font-size: 31px; line-height: 1; color: #ff3b30; white-space: nowrap;
}
.bomba-led[hidden], .bomba-led:empty { display: none; }
.bomba-cifra { position: relative; display: block; width: .56em; height: 1em; }
.bomba-cifra i { position: absolute; display: block; background: #ff3b30; opacity: .13; }
.bomba-cifra i.on { opacity: 1; filter: drop-shadow(0 0 3px rgba(255, 50, 40, .9)); }
.bomba-cifra i:nth-child(1), .bomba-cifra i:nth-child(4), .bomba-cifra i:nth-child(7) {
  left: .05em; width: .46em; height: .13em; clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%);
}
.bomba-cifra i:nth-child(1) { top: 0; }
.bomba-cifra i:nth-child(7) { top: .435em; }
.bomba-cifra i:nth-child(4) { bottom: 0; }
.bomba-cifra i:nth-child(2), .bomba-cifra i:nth-child(3), .bomba-cifra i:nth-child(5), .bomba-cifra i:nth-child(6) {
  width: .13em; height: .43em; clip-path: polygon(50% 0, 100% 14%, 100% 86%, 50% 100%, 0 86%, 0 14%);
}
.bomba-cifra i:nth-child(2) { top: .06em; right: 0; }
.bomba-cifra i:nth-child(3) { bottom: .06em; right: 0; }
.bomba-cifra i:nth-child(5) { bottom: .06em; left: 0; }
.bomba-cifra i:nth-child(6) { top: .06em; left: 0; }
.bomba-puntos { display: flex; flex-direction: column; justify-content: space-evenly; width: .16em; height: 1em; animation: bomba-puntos 1s steps(1) infinite; }
.bomba-puntos i { display: block; width: .15em; height: .15em; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 4px rgba(255, 50, 40, .9); }
.bomba-texto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Mecha: lo que queda de tiempo, con la chispa en la punta */
.bomba-mecha { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: #000; overflow: visible; pointer-events: none; }
.bomba-mecha::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--queda, 1) * 100%);
  background: repeating-linear-gradient(120deg, #ffc400 0 9px, #17110f 9px 18px);
}
.bomba-mecha::after {
  content: ''; position: absolute; top: 50%; left: min(calc(var(--queda, 1) * 100%), calc(100% - 12px)); width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 14%, #ffe27a 28%, #ff7a1a 48%, rgba(255, 60, 20, 0) 70%); animation: bomba-fuego .35s ease-in-out infinite alternate;
}

/* Último tercio: la pantalla late. Último tramo: late todo, una vez por segundo. Diez segundos: además tiembla. */
.bomba-aviso .bomba-led { animation: bomba-brillo 1s ease-in-out infinite; }
.bomba-critico { animation: bomba-alarma 1s ease-in-out infinite; }
.bomba-critico .bomba-cifra i { opacity: .07; }
.bomba-critico .bomba-cifra i.on { opacity: 1; background: #ff6a5e; }
.bomba-critico .bomba-led { border-color: #ff5a4f; animation: bomba-late 1s ease-in-out infinite; }
.bomba-final .bomba-led { animation: bomba-tiembla .3s linear infinite; }

/* Se acabó */
.bomba-apagada { background: #2b2624; animation: none; }
.bomba-apagada .bomba-led { border-color: #57504d; box-shadow: none; animation: none; }
.bomba-apagada .bomba-cifra i.on, .bomba-apagada .bomba-puntos { opacity: .55; filter: none; animation: none; }
.bomba-apagada .bomba-mecha, .bomba-apagada .bomba-chispa { display: none; }

@keyframes bomba-puntos { 50% { opacity: .15; } }
@keyframes bomba-chispa { to { transform: scale(.55) rotate(40deg); } }
@keyframes bomba-fuego { from { transform: scale(.75); } to { transform: scale(1.15); } }
@keyframes bomba-brillo { 50% { box-shadow: inset 0 0 10px rgba(0, 0, 0, .9), 0 0 0 1px #000, 0 0 22px 4px rgba(255, 50, 40, .8); } }
@keyframes bomba-alarma { 50% { background-color: #9f1212; background-image: radial-gradient(120% 160% at 50% 0, #c81e1e 0, #7f0d0d 62%); } }
@keyframes bomba-late { 12% { transform: scale(1.1); } 30% { transform: none; } }
@keyframes bomba-tiembla { 0%, 100% { transform: none; } 25% { transform: translate(-1.5px, 1px) rotate(-.8deg); } 75% { transform: translate(1.5px, -1px) rotate(.8deg); } }

@media (max-width: 400px) {
  .bomba .bomba-led { gap: 3px; padding: 5px 7px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .bomba, .bomba *, .bomba *::before, .bomba *::after { animation: none !important; }
}
