/* ============================================================
   Hero animation
   Self-contained styles for the animated app demo embedded in
   the homepage hero. All selectors live under .hero-animation
   so nothing leaks into the rest of the site.
   ============================================================ */

.hero-animation {
  position: relative;
  margin: 56px auto 0;
  max-width: 600px;
  width: 100%;
}

/* Fireworks canvas covers the whole viewport so bursts can travel
   beyond the device card. pointer-events:none keeps it inert. */
.hero-animation-fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ---------- mock app window ---------- */
.hero-animation .device {
  position: relative;
  background: linear-gradient(180deg, var(--color-surface-elevated), var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(255, 107, 53, 0.08);
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero-animation .device.celebrating { transform: scale(1.015); }

.hero-animation .device-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.hero-animation .dots { display: inline-flex; gap: 6px; }
.hero-animation .dot { width: 11px; height: 11px; border-radius: 50%; }
.hero-animation .dot.red    { background: #ff5f57; }
.hero-animation .dot.yellow { background: #febc2e; }
.hero-animation .dot.green  { background: #28c840; }

.hero-animation .device-title {
  color: var(--color-text-muted);
  font-weight: 500;
}

.hero-animation .device-status {
  margin-left: auto;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  transition: color 0.4s ease;
}
.hero-animation .device-status.complete { color: var(--color-success); }
.hero-animation .device-status.danger   { color: var(--color-primary); }

/* ---------- HUD: counter + progress ---------- */
.hero-animation .hud {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--color-border);
}

.hero-animation .hud-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.hero-animation .hud-value {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--color-text);
  transition: color 0.4s ease;
}
.hero-animation .hud-value.complete { color: var(--color-success); }

.hero-animation .hud-label {
  font-size: 13px;
  color: var(--color-text-muted);
}

.hero-animation .hud-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  overflow: hidden;
}

.hero-animation .hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), #ffa477);
  border-radius: 2px;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 16px rgba(255, 107, 53, 0.45);
}

/* ---------- sender list ---------- */
.hero-animation .sender-list {
  list-style: none;
  margin: 0;
  padding: 8px 8px 4px;
  min-height: 320px;
}

.hero-animation .sender-row {
  position: relative;
  display: grid;
  grid-template-columns: 24px 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 4px 0;
  border-radius: 10px;
  background: transparent;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.hero-animation .sender-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-animation .sender-row.selected {
  background: rgba(255, 107, 53, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 53, 0.32);
}

.hero-animation .sender-row.deleting {
  animation: hero-anim-row-shake 0.35s ease 0.05s 1;
}

.hero-animation .sender-row.deleted {
  opacity: 0;
  transform: translateX(120%) scale(0.95);
  pointer-events: none;
  margin: 0;
  padding: 0;
  height: 0;
  transition:
    opacity 0.5s ease,
    transform 0.6s cubic-bezier(0.7, 0, 0.84, 0),
    margin 0.4s ease 0.1s,
    padding 0.4s ease 0.1s,
    height 0.4s ease 0.1s;
}

@keyframes hero-anim-row-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

.hero-animation .checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-text-faint);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  opacity: 0;
}

.hero-animation .sender-row.checkboxes-visible .checkbox { opacity: 1; }

.hero-animation .sender-row.selected .checkbox {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.hero-animation .checkbox::after {
  content: "✓";
  font-size: 11px;
  color: white;
  font-weight: bold;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s, transform 0.2s cubic-bezier(0.5, 1.6, 0.7, 1);
}

.hero-animation .sender-row.selected .checkbox::after {
  opacity: 1;
  transform: scale(1);
}

.hero-animation .avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.hero-animation .sender-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}
.hero-animation .sender-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-animation .sender-email {
  font-size: 12px;
  color: var(--color-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-animation .sender-count {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.hero-animation .sender-row.selected .sender-count { color: var(--color-primary); }

.hero-animation .sender-row .sparkle {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
}

.hero-animation .sender-row.just-selected .sparkle {
  animation: hero-anim-sparkle 0.45s ease-out;
}

@keyframes hero-anim-sparkle {
  0%   { opacity: 0; box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.45); }
  40%  { opacity: 1; box-shadow: 0 0 24px 4px rgba(255, 107, 53, 0.45); }
  100% { opacity: 0; box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.45); }
}

/* ---------- action bar ---------- */
.hero-animation .action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
  transform: translateY(110%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}
.hero-animation .action-bar.visible {
  transform: translateY(0);
  opacity: 1;
}

.hero-animation .action-summary {
  font-size: 12px;
  color: var(--color-text-muted);
}
.hero-animation .action-summary strong { color: var(--color-text); }

.hero-animation .delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: default;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.4);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.hero-animation .delete-btn.pulse {
  animation: hero-anim-btn-pulse 1.4s ease-in-out infinite;
}

.hero-animation .delete-btn.pressed {
  transform: scale(0.94);
  box-shadow: 0 2px 6px rgba(255, 107, 53, 0.5);
  animation: none;
}

@keyframes hero-anim-btn-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(255, 107, 53, 0.4); }
  50%      { box-shadow: 0 4px 28px rgba(255, 107, 53, 0.8); }
}

/* ---------- celebration overlay ---------- */
.hero-animation .celebration {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(19, 19, 26, 0.86), rgba(10, 10, 15, 0.94));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 5;
}
.hero-animation .celebration.visible { opacity: 1; }

.hero-animation .celebration-number {
  font-size: 76px;
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-shadow: 0 0 40px rgba(255, 107, 53, 0.5);
  transform: scale(0.7);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hero-animation .celebration.visible .celebration-number { transform: scale(1); }

.hero-animation .celebration-label {
  margin-top: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ---------- clean inbox state (terminal frame) ---------- */
.hero-animation .clean-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.06), rgba(19, 19, 26, 0.95));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  z-index: 4;
  padding: 24px;
  text-align: center;
}
.hero-animation .clean-state.visible { opacity: 1; }

.hero-animation .clean-check {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 44px;
  font-weight: bold;
  box-shadow: 0 0 60px rgba(34, 197, 94, 0.5);
  transform: scale(0.5);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hero-animation .clean-state.visible .clean-check { transform: scale(1); }

.hero-animation .clean-state h3 {
  margin: 18px 0 6px;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
}
.hero-animation .clean-state p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* ---------- replay button (appears after animation settles) ---------- */
.hero-animation-replay {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.15s ease;
  font-family: inherit;
  backdrop-filter: blur(6px);
}

.hero-animation-replay:hover {
  background: rgba(0, 0, 0, 0.75);
  color: var(--color-primary);
}

.hero-animation-replay.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .hero-animation .hud-value { font-size: 24px; }
  .hero-animation .celebration-number { font-size: 56px; }
  .hero-animation .clean-check { width: 72px; height: 72px; font-size: 36px; }
  .hero-animation .clean-state h3 { font-size: 20px; }
  .hero-animation .device-title { display: none; }
  .hero-animation .sender-email { display: none; }
  .hero-animation .sender-list { min-height: 280px; }
}

/* ---------- reduced-motion fallback ----------
   Skip the whole story — just show the rest state directly. */
@media (prefers-reduced-motion: reduce) {
  .hero-animation .device,
  .hero-animation .device-status,
  .hero-animation .hud-value,
  .hero-animation .hud-progress-fill,
  .hero-animation .sender-row,
  .hero-animation .checkbox,
  .hero-animation .checkbox::after,
  .hero-animation .action-bar,
  .hero-animation .delete-btn,
  .hero-animation .celebration,
  .hero-animation .celebration-number,
  .hero-animation .clean-state,
  .hero-animation .clean-check {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
