/* Diseño "Latte": tarjeta 3D Gran Coffee Shams (bosque #123A31, crema #F7F0E1, naranja #E07B1A, vino #6B1F1A). */

.tj-latte{
  --lt-bosque:#123A31;
  --lt-bosque-oscuro:#0A241E;
  --lt-bosque-claro:#1B5246;
  --lt-crema:#F7F0E1;
  --lt-naranja:#E07B1A;
  --lt-oro:#F2B36B;
  --lt-oro-luz:#FFE7B3;
  --lt-vino:#6B1F1A;
  --lt-serif:'Young Serif',Georgia,serif;
  --lt-grano:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 .92  0 0 0 0 .75  0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* Marco metálico exterior */
.tj-latte-obj{
  position:relative;isolation:isolate;width:100%;border-radius:26px;padding:5px;
  background:linear-gradient(138deg,#FFF2CB 0%,#F2B36B 18%,#A55418 38%,#FFE3A0 52%,#E07B1A 70%,#7A3D11 86%,#F7C97F 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7),inset 0 -2px 0 rgba(60,25,5,.45),0 14px 26px -14px rgba(18,58,49,.6),0 28px 42px -26px rgba(10,36,30,.75);
}
.tj-latte-obj.tj-completa{
  box-shadow:inset 0 1px 0 rgba(255,255,255,.78),inset 0 -2px 0 rgba(60,25,5,.45),0 0 0 1px rgba(255,231,168,.65),0 0 36px -6px rgba(224,123,26,.78),0 28px 42px -26px rgba(10,36,30,.75);
}
.tj-latte-obj::after{
  content:"";position:absolute;inset:5px;z-index:4;border-radius:21px;pointer-events:none;
  background:linear-gradient(108deg,transparent 40%,rgba(255,246,214,.48) 50%,transparent 60%);
  background-size:260% 100%;background-position:130% 0;mix-blend-mode:soft-light;
  animation:tj-lt-destello 8.5s ease-in-out infinite;
}

/* Cara interior verde bosque */
.tj-latte-cara{
  position:relative;overflow:hidden;border-radius:21px;color:var(--lt-crema);
  background:
    radial-gradient(92% 70% at 50% 48%,rgba(224,123,26,.16) 0%,transparent 64%),
    radial-gradient(120% 85% at 50% 44%,var(--lt-bosque-claro) 0%,var(--lt-bosque) 54%,var(--lt-bosque-oscuro) 100%);
  box-shadow:inset 0 0 0 1px rgba(247,240,225,.28),inset 0 0 38px rgba(0,0,0,.45);
}
.tj-latte-cara::after{
  content:"";position:absolute;inset:0;z-index:3;pointer-events:none;border-radius:inherit;
  background:var(--lt-grano);
}

/* Banda superior vino con tipografía Young Serif */
.tj-latte-banda{
  display:block;position:relative;z-index:2;width:100%;height:auto;
  filter:drop-shadow(0 4px 10px rgba(0,0,0,.35));
}
.tj-latte-banda-txt{
  font-family:var(--lt-serif);font-weight:400;fill:var(--lt-crema);
  font-size:20px;letter-spacing:.09em;
}

/* Escenario 3D de la taza */
.tj-latte-escena{
  position:relative;z-index:1;width:min(84%,284px);aspect-ratio:1;
  margin:-4% auto 2px;display:grid;place-items:center;
}
.tj-latte-halo{
  position:absolute;inset:4%;border-radius:50%;pointer-events:none;
  opacity:calc(.25 + var(--progreso,0) * .55);
  background:radial-gradient(circle,rgba(255,219,150,.55) 0%,rgba(224,123,26,.22) 48%,transparent 72%);
  transition:opacity .7s ease,transform .7s ease;
}
.tj-completa .tj-latte-halo{
  opacity:1;
  background:radial-gradient(circle,rgba(255,231,179,.75) 0%,rgba(224,123,26,.34) 48%,transparent 74%);
  animation:tj-lt-halo 3.2s ease-in-out infinite;
}
.tj-latte-posavasos{
  position:absolute;inset:7%;border-radius:50%;pointer-events:none;
  border:1px dashed rgba(242,179,107,.38);
  box-shadow:0 16px 26px -10px rgba(0,0,0,.62),inset 0 0 0 6px rgba(10,36,30,.24);
}
.tj-completa .tj-latte-posavasos{
  border-color:rgba(255,231,179,.72);
  animation:tj-lt-orbita 48s linear infinite;
}

/* Vapor sutil sobre la taza */
.tj-latte-vapor{
  position:absolute;top:2%;left:50%;width:34%;height:auto;
  transform:translateX(-50%);z-index:3;pointer-events:none;opacity:.68;
}
.tj-vapor-hilo{
  fill:none;stroke:var(--lt-crema);stroke-width:2.2;stroke-linecap:round;
  stroke-opacity:.55;stroke-dasharray:18 38;
  animation:tj-lt-vapor 3.8s linear infinite;
}
.tj-vapor-hilo-2{animation-delay:-1.3s;stroke-opacity:.72}
.tj-vapor-hilo-3{animation-delay:-2.6s}

/* Capas de imagen 560x560 + vertida */
.tj-latte-taza{
  position:relative;z-index:2;width:100%;aspect-ratio:1;
  filter:drop-shadow(0 12px 16px rgba(0,0,0,.5));
}
.tj-latte-img{
  display:block;width:100%;height:100%;object-fit:contain;user-select:none;
}
.tj-latte-prev,.tj-latte-actual{
  position:absolute;inset:0;
}
.tj-latte-prev{
  opacity:1;
  transition:opacity .72s cubic-bezier(.4,0,.2,1) .14s;
}
.tj-latte-actual{
  opacity:0;transform:scale(.982);
  transition:opacity .72s cubic-bezier(.22,.8,.3,1) .14s,transform .78s cubic-bezier(.22,.8,.3,1) .14s;
}
.tj-latte-animando .tj-latte-prev{opacity:0}
.tj-latte-animando .tj-latte-actual{opacity:1;transform:scale(1)}

/* Pequeña vertida animada sobre el café */
.tj-latte-vertida{
  position:absolute;inset:0;width:100%;height:100%;z-index:3;pointer-events:none;overflow:visible;
}
.tj-latte-chorro,.tj-latte-chorro-brillo{
  stroke-dasharray:290;stroke-dashoffset:290;opacity:0;
}
.tj-latte-onda{
  transform-origin:281px 272px;transform:scale(.25);opacity:0;
}
.tj-latte-animando .tj-latte-chorro,
.tj-latte-animando .tj-latte-chorro-brillo{
  animation:tj-lt-verter .92s cubic-bezier(.32,.08,.24,1) forwards;
}
.tj-latte-animando .tj-latte-onda{
  animation:tj-lt-onda .82s ease-out .22s forwards;
}
.tj-latte-animando .tj-latte-onda-2{
  animation-delay:.36s;
}

/* Celebración al completar */
.tj-latte-fiesta{
  position:absolute;inset:0;z-index:3;pointer-events:none;
}
.tj-latte-chispa{
  position:absolute;width:16px;height:16px;transform:translate(-50%,-50%) scale(.5);
  fill:var(--lt-oro-luz);opacity:0;filter:drop-shadow(0 0 6px rgba(224,123,26,.9));
}
.tj-completa .tj-latte-chispa{
  opacity:1;animation:tj-lt-chispa 2.4s ease-in-out infinite;
}
.tj-latte-particula{
  position:absolute;left:50%;top:50%;width:8px;height:8px;border-radius:50%;
  background:var(--c,var(--lt-oro));opacity:0;transform:translate(-50%,-50%) scale(.2);
}
.tj-completa.tj-latte-animando .tj-latte-particula{
  animation:tj-lt-confeti 1.05s cubic-bezier(.16,.88,.3,1) calc(.35s + var(--pd,0s)) forwards;
}

/* Pie: contador como granos de café */
.tj-latte-pie{
  position:relative;z-index:2;padding:2px 12px 14px;
}
.tj-latte-divisor{
  display:flex;align-items:center;justify-content:center;margin:0 auto 10px;width:82%;
}
.tj-latte-divisor::before,.tj-latte-divisor::after{
  content:"";flex:1;height:1px;
  background:linear-gradient(90deg,transparent,rgba(242,179,107,.55),transparent);
}
.tj-latte-divisor span{
  width:7px;height:7px;margin:0 8px;transform:rotate(45deg);
  border:1px solid var(--lt-oro);background:var(--lt-vino);
}
.tj-latte-granos{
  list-style:none;margin:0 auto;padding:0;
  display:flex;flex-wrap:wrap;justify-content:center;align-items:center;
  gap:6px;max-width:calc(var(--cols,8) * 32px);
}
.tj-latte-granos-compacto{
  gap:5px;max-width:calc(var(--cols,8) * 28px);
}
.tj-latte-grano{
  width:clamp(20px,6vw,25px);aspect-ratio:32/40;flex:0 0 auto;
  filter:drop-shadow(0 2px 3px rgba(0,0,0,.4));
}
.tj-latte-granos-compacto .tj-latte-grano{
  width:clamp(18px,5.2vw,22px);
}
.tj-latte-grano svg{display:block;width:100%;height:100%;overflow:visible}
.tj-grano-sig{animation:tj-lt-latido 2.4s ease-in-out infinite}
.tj-grano-premio{filter:drop-shadow(0 0 6px rgba(242,179,107,.55))}
.tj-latte-animando .tj-grano-nuevo{
  animation:tj-lt-grano .54s cubic-bezier(.22,1.28,.36,1) calc(.2s + var(--d,0ms)) both;
}

/* Ajuste fino a 320px */
@media (max-width:360px){
  .tj-latte-banda-txt{font-size:19px;letter-spacing:.07em}
  .tj-latte-pie{padding:2px 8px 12px}
  .tj-latte-granos{gap:4px}
}

/* Animaciones */
@keyframes tj-lt-destello{
  0%,58%{background-position:130% 0}
  100%{background-position:-30% 0}
}
@keyframes tj-lt-halo{
  0%,100%{transform:scale(.97);opacity:.86}
  50%{transform:scale(1.05);opacity:1}
}
@keyframes tj-lt-orbita{to{transform:rotate(360deg)}}
@keyframes tj-lt-vapor{
  from{stroke-dashoffset:56}
  to{stroke-dashoffset:0}
}
@keyframes tj-lt-verter{
  0%{stroke-dashoffset:290;opacity:0}
  12%{opacity:1}
  48%{stroke-dashoffset:0;opacity:1}
  82%{stroke-dashoffset:-150;opacity:.9}
  100%{stroke-dashoffset:-290;opacity:0}
}
@keyframes tj-lt-onda{
  0%{transform:scale(.22);opacity:.85}
  100%{transform:scale(4.6);opacity:0}
}
@keyframes tj-lt-chispa{
  0%,100%{opacity:.22;transform:translate(-50%,-50%) scale(.55) rotate(0deg)}
  50%{opacity:1;transform:translate(-50%,-50%) scale(1.12) rotate(18deg)}
}
@keyframes tj-lt-confeti{
  0%{opacity:0;transform:translate(-50%,-50%) scale(.3)}
  22%{opacity:1}
  100%{opacity:0;transform:translate(calc(-50% + var(--tx,0px)),calc(-50% + var(--ty,0px))) scale(1.1)}
}
@keyframes tj-lt-latido{
  0%,100%{transform:scale(1);opacity:.86}
  50%{transform:scale(1.1);opacity:1}
}
@keyframes tj-lt-grano{
  0%{opacity:0;transform:translateY(-10px) scale(.45) rotate(-18deg)}
  65%{opacity:1;transform:translateY(2px) scale(1.14) rotate(4deg)}
  100%{opacity:1;transform:translateY(0) scale(1) rotate(0deg)}
}

/* Accesibilidad: respetar prefers-reduced-motion */
@media (prefers-reduced-motion:reduce){
  .tj-latte *,
  .tj-latte *::before,
  .tj-latte *::after{
    animation:none!important;
    transition:none!important;
  }
  .tj-latte .tj-latte-prev,
  .tj-latte .tj-latte-vertida,
  .tj-latte .tj-latte-particula{
    display:none!important;
  }
  .tj-latte .tj-latte-actual{
    opacity:1!important;
    transform:none!important;
  }
}
