/* Magical polish layer — subtle, global, respects reduced motion */

/* Smooth everything a little */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Hero entrance */
.hero {
  animation: magic-rise 0.55s ease-out both;
}
.badge {
  animation: magic-pop 0.5s ease-out 0.05s both;
}
@keyframes magic-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes magic-pop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* Trust pills / cards soft hover */
.trust-pill {
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.trust-pill:hover {
  transform: translateY(-1px);
}
.preset, .tab, .btn, .sister-link {
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.preset:active, .btn:active, .tab:active {
  transform: scale(0.98);
}
.btn-primary, .btn-p {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.btn-primary:hover, .btn-p:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

/* Result glow when numbers update */
.magic-flash {
  animation: magic-flash 0.55s ease;
}
@keyframes magic-flash {
  0% { box-shadow: 0 0 0 0 rgba(61, 139, 253, 0); }
  35% { box-shadow: 0 0 0 4px rgba(61, 139, 253, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(61, 139, 253, 0); }
}
.result .magic-pulse,
.result-box .magic-pulse,
.big.magic-pulse,
.result-main.magic-pulse {
  animation: magic-num 0.35s ease;
}
@keyframes magic-num {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Inputs feel alive */
input:focus, select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(61, 139, 253, 0.18);
}

/* Floating back-to-top */
.magic-top {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border, #2a3650);
  background: var(--surface, #121a2b);
  color: var(--text, #e8eef9);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.magic-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.magic-top:hover {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

/* Mobile sticky quick actions */
.magic-dock {
  display: none;
}
@media (max-width: 720px) {
  .magic-dock {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 55;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(18, 26, 43, 0.94);
    border: 1px solid var(--border, #2a3650);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
  .magic-dock button {
    flex: 1;
    border: 1px solid var(--border, #2a3650);
    background: var(--surface2, #1a2438);
    color: var(--text, #e8eef9);
    border-radius: 12px;
    padding: 11px 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
  }
  .magic-dock button.primary {
    background: linear-gradient(135deg, #2563eb, #3d8bfd);
    border-color: transparent;
    color: #fff;
  }
  body { padding-bottom: 78px; }
  .magic-top { bottom: 78px; }
}

/* Soft card lift */
.card, .result, .result-box {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover, .result:hover, .result-box:hover {
  border-color: var(--accent, #3d8bfd);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

/* Toast polish */
.toast {
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

@media print {
  .magic-top, .magic-dock { display: none !important; }
}

/* r2 global polish */
.cur-filters { width: 100%; }
#cur-search { max-width: 18rem; }
.corridor-chip { min-width: 3.1rem; }
#fx-status { min-height: 1em; }
#cur-active { white-space: nowrap; }

/* r3 polish */
.cur-popular .cur-pop { min-width: 3rem; }
#cur-region-btn { white-space: nowrap; }
#cur-status { display: inline-block; margin-left: 4px; }
@media (max-width: 560px) {
  #cur-search, #cur-more, #corridor { width: 100%; min-width: 0 !important; }
}
