/* ================================================================
   Tamales SanJuanita — animated hero loop
   Replaces the previous 3D browser mockup. No Three.js, no Motion.
   ================================================================ */

.tsj-stage {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 8px 4px 4px;
}

/* Soft warm glow behind the phone */
.tsj-glow {
  position: absolute;
  inset: -8% -10% 12% -10%;
  background:
    radial-gradient(60% 50% at 70% 30%, rgba(255, 184, 77, 0.55), transparent 70%),
    radial-gradient(55% 50% at 25% 75%, rgba(255, 122, 62, 0.40), transparent 70%);
  filter: blur(28px);
  z-index: 0;
  pointer-events: none;
  animation: tsj-glow-drift 9s ease-in-out infinite alternate;
}

@keyframes tsj-glow-drift {
  from { transform: translate3d(-6px, 4px, 0) scale(1); }
  to   { transform: translate3d(8px, -6px, 0) scale(1.04); }
}

/* ---------- Phone frame ---------- */
.tsj-phone {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 9 / 18.5;
  background: #1A0F00;
  border: 2px solid #1A0F00;
  border-radius: 38px;
  padding: 10px;
  box-shadow:
    0 8px 0 #1A0F00,
    0 28px 50px rgba(26, 15, 0, 0.22),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04);
  z-index: 1;
  animation: tsj-phone-bob 6s ease-in-out infinite;
}

@keyframes tsj-phone-bob {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50%      { transform: translateY(-6px) rotate(0.4deg); }
}

.tsj-notch {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 86px; height: 18px;
  background: #1A0F00;
  border-radius: 0 0 14px 14px;
  z-index: 3;
}

.tsj-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #FFF8EC;
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
}

/* ---------- App header ---------- */
.tsj-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 16px 10px;
  border-bottom: 1px solid rgba(26, 15, 0, 0.08);
  flex-shrink: 0;
}

.tsj-app-title { display: flex; flex-direction: column; gap: 2px; }

.tsj-app-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.02em;
  color: #1A0F00;
}

.tsj-app-sub {
  font-size: 10.5px;
  color: rgba(26, 15, 0, 0.55);
  text-transform: capitalize;
}

.tsj-app-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--orange);
  border: 1.5px solid #1A0F00;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  box-shadow: 0 2px 0 #1A0F00;
}

/* ---------- Tabs ---------- */
.tsj-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 14px 8px;
  flex-shrink: 0;
  overflow: hidden;
}

.tsj-tab {
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  color: rgba(26, 15, 0, 0.55);
  background: transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tsj-tab.active {
  background: #1A0F00;
  color: #fff;
}

.tsj-tab em {
  font-style: normal;
  font-size: 9.5px;
  background: var(--orange);
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

/* ---------- Cards list ---------- */
.tsj-list {
  list-style: none;
  margin: 0;
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

.tsj-card {
  background: #fff;
  border: 1.5px solid rgba(26, 15, 0, 0.92);
  border-radius: 14px;
  padding: 10px 11px;
  box-shadow: 0 2px 0 #1A0F00;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1),
              box-shadow 0.25s ease,
              opacity 0.4s ease;
  position: relative;
}

.tsj-card.is-tapped {
  transform: scale(0.97);
  box-shadow: 0 0 0 #1A0F00;
}

.tsj-card.is-leaving {
  animation: tsj-card-leave 0.55s cubic-bezier(.5,0,.75,0) forwards;
}

@keyframes tsj-card-leave {
  0%   { transform: translateX(0) scale(1); opacity: 1; }
  60%  { transform: translateX(28%) scale(0.98); opacity: 0.4; }
  100% { transform: translateX(110%) scale(0.92); opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -8px; }
}

.tsj-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.tsj-card-main { min-width: 0; flex: 1; }

.tsj-card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: -0.01em;
  color: #1A0F00;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.tsj-card-when {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 11px;
  color: rgba(26, 15, 0, 0.55);
  font-weight: 500;
  margin-left: 4px;
}

.tsj-card-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tsj-chip {
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #FFF1DD;
  border: 1px solid rgba(26, 15, 0, 0.12);
  color: #6B3A0F;
  white-space: nowrap;
}

/* ---------- Status badge ---------- */
.tsj-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  background: #ECE6DA;
  color: rgba(26, 15, 0, 0.65);
  border: 1px solid rgba(26, 15, 0, 0.10);
  flex-shrink: 0;
  transition: background 0.45s ease, color 0.45s ease, border-color 0.45s ease;
}

.tsj-badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(26, 15, 0, 0.45);
  flex-shrink: 0;
  transition: background 0.45s ease, box-shadow 0.45s ease;
}

.tsj-card[data-state="pendiente"]   .tsj-badge { background:#ECE6DA; color:rgba(26,15,0,0.65); }
.tsj-card[data-state="pendiente"]   .tsj-badge-dot { background:rgba(26,15,0,0.45); }

.tsj-card[data-state="preparacion"] .tsj-badge { background:#FFE6CD; color:#9A4A12; border-color:rgba(232,90,31,0.25); }
.tsj-card[data-state="preparacion"] .tsj-badge-dot { background:#E85A1F; box-shadow:0 0 0 3px rgba(232,90,31,0.18); animation: tsj-pulse 1.6s ease-in-out infinite; }

.tsj-card[data-state="listo"]       .tsj-badge { background:#D9F2DE; color:#1F7A33; border-color:rgba(34,158,68,0.25); }
.tsj-card[data-state="listo"]       .tsj-badge-dot { background:#22C55E; box-shadow:0 0 0 3px rgba(34,197,94,0.20); }

.tsj-card[data-state="entregado"]   .tsj-badge { background:#1A0F00; color:#FFF8EC; border-color:#1A0F00; }
.tsj-card[data-state="entregado"]   .tsj-badge-dot { background:#FFB84D; }

@keyframes tsj-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(232,90,31,0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(232,90,31,0.05); }
}

/* ---------- Bottom nav ---------- */
.tsj-bottom {
  margin-top: auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(26, 15, 0, 0.08);
  background: #FFF8EC;
  flex-shrink: 0;
}

.tsj-bnav {
  font-size: 10px;
  font-weight: 600;
  color: rgba(26, 15, 0, 0.45);
  padding: 6px 10px;
  border-radius: 999px;
}

.tsj-bnav.active {
  color: #1A0F00;
  background: rgba(255, 184, 77, 0.30);
}

/* ---------- Animated finger ---------- */
.tsj-finger {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.18s ease;
  transform: translate3d(0, 0, 0);
  filter: drop-shadow(0 6px 8px rgba(26, 15, 0, 0.35));
}

.tsj-finger.is-visible { opacity: 1; }

.tsj-finger.is-tapping .tsj-ripple {
  animation: tsj-ripple 0.55s ease-out forwards;
}

.tsj-ripple {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 122, 62, 0.55);
  transform: scale(0);
  opacity: 0;
}

@keyframes tsj-ripple {
  0%   { transform: scale(0); opacity: 0.7; }
  100% { transform: scale(3.6); opacity: 0; }
}

/* ---------- Floating proof badge ---------- */
.tsj-proof-badge {
  position: absolute;
  bottom: 60px;
  left: -10px;
  background: #fff;
  border: 2px solid #1A0F00;
  border-radius: 14px;
  box-shadow: 0 6px 0 #1A0F00;
  padding: 9px 14px 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 4;
  transform: rotate(-3deg);
  animation: tsj-badge-bob 7s ease-in-out infinite;
}

@keyframes tsj-badge-bob {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50%      { transform: rotate(-2deg) translateY(-4px); }
}

.tsj-proof-badge strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: #1A0F00;
  letter-spacing: -0.01em;
  line-height: 1;
}

.tsj-proof-badge em {
  display: block;
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 11px;
  color: rgba(26, 15, 0, 0.6);
  margin-top: 2px;
}

.tsj-proof-pulse {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.20);
  animation: tsj-pulse-green 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes tsj-pulse-green {
  0%, 100% { box-shadow: 0 0 0 4px rgba(34,197,94,0.20); }
  50%      { box-shadow: 0 0 0 8px rgba(34,197,94,0.05); }
}

/* ---------- Caption under stage ---------- */
.tsj-caption {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 14px;
  color: rgba(26, 15, 0, 0.7);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.6);
  border: 1px dashed rgba(26, 15, 0, 0.25);
  backdrop-filter: blur(4px);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.tsj-caption:hover { color: var(--orange-deep); background: #fff; }

.tsj-caption strong {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 600;
  color: #1A0F00;
}

.tsj-caption-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 2px;
  border: 1.5px solid #1A0F00;
  font-style: normal;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tsj-stage { max-width: 360px; margin: 0 auto; }
  .tsj-phone { width: min(100%, 300px); }
  .tsj-proof-badge { bottom: 70px; left: 0; }
}

@media (max-width: 720px) {
  .tsj-stage { max-width: 320px; gap: 14px; }
  .tsj-phone { width: 280px; }
  .tsj-proof-badge { padding: 7px 11px; }
  .tsj-proof-badge strong { font-size: 12px; }
  .tsj-proof-badge em { font-size: 10px; }
}

/* Reduce motion: pause loops */
@media (prefers-reduced-motion: reduce) {
  .tsj-phone, .tsj-proof-badge, .tsj-glow,
  .tsj-card[data-state="preparacion"] .tsj-badge-dot,
  .tsj-proof-pulse {
    animation: none !important;
  }
}
