/* ============================================================
   SnapX — UX Polish (ui-ux-pro-max guidelines)
   Touch targets · focus · spacing · motion · safe areas
   ============================================================ */

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 240ms;
}

/* ── Focus & accessibility ── */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--flash-blue, #2B5CFF);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--flash-ink);
  color: var(--flash-surface);
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--flash-radius-pill);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-4);
}

/* ── Touch targets ≥ 44px ── */
.btn,
.flash-btn,
.duration-chip,
.dissolve-chip,
.sticker-add-btn,
.reaction-btn,
.radio-option,
.tier-option,
.upload-zone,
.btn-reveal,
.btn-ghost,
.btn-copy,
.lp-nav-btn,
.lp-sticky-cta {
  min-height: 44px;
}

.reaction-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
}

/* Press feedback without layout shift */
.btn-primary:active:not(:disabled),
.flash-btn:active,
.btn-reveal:active:not(:disabled),
.duration-chip:active,
.sticker-add-btn:active {
  transform: scale(0.97) !important;
  opacity: 0.9;
  transition-duration: var(--duration-fast);
}

body.flash-light .btn-primary:hover:not(:disabled),
body.flash-light .flash-btn:hover {
  transform: none;
  box-shadow: 0 6px 24px rgba(43, 92, 255, 0.42);
}

/* Disabled clarity */
.btn:disabled,
.duration-chip:disabled,
.dissolve-chip:disabled,
#step1Next:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.25);
  box-shadow: none !important;
}

/* ── Wizard step transitions ── */
.wizard-panel.is-active {
  animation: uxStepIn var(--duration-normal) var(--ease-spring) both;
}

@keyframes uxStepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wizard-step-dot.active .dot-num {
  transform: scale(1.08);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.dot-num {
  min-width: 40px;
  min-height: 40px;
}

/* ── Upload zone affordance ── */
body.flash-light .upload-zone {
  border: 2px dashed rgba(43, 92, 255, 0.4);
  background: rgba(43, 92, 255, 0.04);
  transition: border-color var(--duration-normal), background var(--duration-normal), box-shadow var(--duration-normal);
}

body.flash-light .upload-zone:hover {
  border-color: var(--flash-blue);
  background: rgba(43, 92, 255, 0.07);
}

body.flash-light .upload-zone:focus-visible {
  border-color: var(--flash-blue);
  box-shadow: 0 0 0 4px rgba(43, 92, 255, 0.18);
}

body.flash-light .upload-zone.dragover {
  border-color: var(--flash-pink);
  border-style: solid;
  background: rgba(255, 62, 181, 0.08);
}

body.flash-light .upload-zone.has-file {
  border-color: var(--flash-pink);
  background: rgba(255, 62, 181, 0.06);
}

.upload-ring {
  transition: transform var(--duration-normal) var(--ease-spring);
}

body.flash-light .upload-zone:hover .upload-ring {
  transform: scale(1.06);
}

.step1-thumb {
  animation: uxStepIn 0.28s ease both;
  border-radius: var(--flash-radius);
  overflow: hidden;
}

/* ── Form scanability ── */
body.flash-light .form-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--flash-muted);
  margin-bottom: var(--space-2);
}

body.flash-light .step-desc,
body.flash-light .field-hint {
  color: #5c5c6e;
  line-height: 1.55;
}

body.flash-light .form-input {
  min-height: 48px;
  padding: 14px 16px;
  border-radius: var(--flash-radius);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

body.flash-light .form-textarea {
  min-height: 72px;
}

/* ── Tier & chips selection ── */
.tier-option {
  position: relative;
  min-height: 72px;
  transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast);
}

.tier-option:active {
  transform: scale(0.98);
}

.tier-option.active {
  box-shadow: 0 0 0 3px rgba(43, 92, 255, 0.12);
}

.tier-option.active::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--flash-blue);
}

.duration-chip,
.dissolve-chip {
  min-width: 44px;
  transition: all var(--duration-fast) ease;
}

.duration-chip:active,
.dissolve-chip:active {
  transform: scale(0.95);
}

/* ── Wizard actions mobile ── */
.wizard-actions {
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

.wizard-actions .btn-primary { flex: 1 1 140px; }
#previewSenderBtn { flex: 0 1 auto; min-width: 100px; }

/* ── Errors ── */
.alert-error {
  border-left: 3px solid #ef4444;
  animation: uxShake 0.35s ease;
  border-radius: var(--flash-radius);
}

@keyframes uxShake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
}

/* ── Viewer UX ── */
.btn-reveal {
  min-height: 54px;
  width: 100%;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.pv-reveal-panel {
  padding: var(--space-5) var(--space-4);
}

.reveal-hint {
  margin-top: var(--space-3);
  font-size: 11px;
  opacity: 0.85;
}

.countdown-number {
  font-family: var(--font-display);
  font-weight: 800;
}

/* ── Landing scroll anchors ── */
#how,
#demo {
  scroll-margin-top: 80px;
}

.lp-hero-flash {
  padding-top: var(--space-2);
}

.lp-section-label {
  margin-bottom: var(--space-4);
}

/* ── Safe areas ── */
.creator-page,
.lp-flash,
.status-page {
  padding-bottom: max(96px, calc(env(safe-area-inset-bottom) + 72px));
}

.lp-sticky-cta {
  bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: 24px !important;
  padding-right: 24px !important;
}

.btn-sticky-mobile {
  margin-top: var(--space-4);
  margin-bottom: env(safe-area-inset-bottom);
}

/* ── Result success ── */
.result-screen {
  animation: uxStepIn 0.35s ease both;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
}

/* ── Preview modal ── */
.preview-modal-card {
  animation: uxStepIn 0.22s ease both;
  max-height: 90vh;
  overflow-y: auto;
}

.preview-modal-backdrop {
  background: rgba(16, 16, 20, 0.55);
}

/* ── Status page ── */
.status-card {
  transition: box-shadow var(--duration-normal) ease;
}

.status-card:hover {
  box-shadow: 0 8px 32px rgba(16, 16, 20, 0.08);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .wizard-panel.is-active,
  .step1-thumb,
  .result-screen,
  .preview-modal-card,
  .lp-demo-phase,
  .flash-wiggle,
  .status-pulse,
  .upload-ring {
    animation: none !important;
    transition: none !important;
  }

  .btn-primary:hover:not(:disabled),
  .flash-btn:hover {
    transform: none !important;
  }
}

/* ── Small phones ── */
@media (max-width: 380px) {
  .tier-toggle { grid-template-columns: 1fr; }
  .wizard-actions { flex-direction: column; }
  .wizard-actions .btn,
  .wizard-actions .flash-btn { width: 100%; }
  .lp-stickers { gap: var(--space-2); }
}
