/* ============================================================
   Zendt Payments — Motion & micro-interactions
   Load after page styles and responsive.css
   ============================================================ */

:root {
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --dur-fast: 180ms;
  --dur-med: 320ms;
  --dur-slow: 600ms;
}

/* Anchor scroll offset under fixed nav */
[id] {
  scroll-margin-top: calc(var(--nav-h, 68px) + 16px);
}

/* ---------- Page enter ---------- */
@keyframes page-enter {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

body.js-ready {
  animation: page-enter var(--dur-slow) var(--ease-out) both;
}

/* ---------- Scroll reveal (enhanced) ---------- */
.js-ready .reveal {
  opacity: 0;
  will-change: transform, opacity;
}

.js-ready .reveal.in {
  opacity: 1;
  transition:
    transform 800ms var(--ease-out),
    opacity 700ms var(--ease-out);
}

/* ---------- Interactive cards ---------- */
.feature,
.ph-card,
.step,
.ctable-mobile__card,
.calc,
.cline,
.foot__social a {
  transition:
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .feature:hover,
  .ph-card:hover,
  .step:hover,
  .ctable-mobile__card:hover {
    transform: translateY(-4px);
  }

  .calc:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 72px -28px rgba(0, 0, 0, 0.38);
  }

  :root[data-theme="light"] .calc:hover {
    box-shadow: 0 28px 72px -24px rgba(80, 50, 20, 0.28);
  }

  .foot__social a:hover {
    transform: translateY(-2px);
  }
}

/* ---------- Buttons ---------- */
.btn {
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translateY(-1px);
  }
}

.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 80ms;
}

/* ---------- Nav link underline ---------- */
.nav__links a:not(.btn):not(.nav__menu-cta) {
  position: relative;
}

.nav__links a:not(.btn):not(.nav__menu-cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 1px;
  background: var(--warm);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-med) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .nav__links a:not(.btn):not(.nav__menu-cta):hover::after,
  .nav__links a:not(.btn):not(.nav__menu-cta).is-active::after {
    transform: scaleX(1);
  }
}

.nav__links a:not(.btn):not(.nav__menu-cta).is-active::after {
  transform: scaleX(1);
}

.logo {
  transition: opacity var(--dur-fast) ease, transform var(--dur-med) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .logo:hover {
    opacity: 0.88;
    transform: translateY(-1px);
  }
}

/* ---------- Mobile menu item entrance ---------- */
@keyframes menu-item-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.nav.is-open .nav__mobile a:not(.btn),
body.menu-open .nav__mobile a:not(.btn),
.nav__links.is-open a:not(.nav__menu-cta) {
  animation: menu-item-in 420ms var(--ease-out) both;
}

.nav.is-open .nav__mobile a:not(.btn):nth-child(1),
body.menu-open .nav__mobile a:not(.btn):nth-child(1),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(1) { animation-delay: 40ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(2),
body.menu-open .nav__mobile a:not(.btn):nth-child(2),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(2) { animation-delay: 75ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(3),
body.menu-open .nav__mobile a:not(.btn):nth-child(3),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(3) { animation-delay: 110ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(4),
body.menu-open .nav__mobile a:not(.btn):nth-child(4),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(4) { animation-delay: 145ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(5),
body.menu-open .nav__mobile a:not(.btn):nth-child(5),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(5) { animation-delay: 180ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(6),
body.menu-open .nav__mobile a:not(.btn):nth-child(6),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(6) { animation-delay: 215ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(7),
body.menu-open .nav__mobile a:not(.btn):nth-child(7),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(7) { animation-delay: 250ms; }
.nav.is-open .nav__mobile a:not(.btn):nth-child(8),
body.menu-open .nav__mobile a:not(.btn):nth-child(8),
.nav__links.is-open a:not(.nav__menu-cta):nth-child(8) { animation-delay: 285ms; }

.nav.is-open .nav__mobile .btn,
body.menu-open .nav__mobile .btn,
.nav__links.is-open .nav__menu-cta {
  animation: menu-item-in 480ms var(--ease-out) 320ms both;
}

/* ---------- Section tags ---------- */
.section-tag span:first-child {
  display: inline-block;
  transition: letter-spacing var(--dur-slow) var(--ease-out), color var(--dur-fast) ease;
}

.section-tag.in span:first-child,
.section-tag.reveal.in span:first-child {
  letter-spacing: 0.24em;
}

/* ---------- Form fields ---------- */
.waitlist__input,
.waitlist__combo,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  transition:
    border-color var(--dur-fast) ease,
    background var(--dur-fast) ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  box-shadow: none;
}

.waitlist__input:focus,
.waitlist__combo:focus-within .waitlist__input:focus {
  box-shadow: none;
}

.waitlist__input:focus-visible {
  outline: none;
}

.waitlist__combo:focus-within {
  outline: none;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.theme-toggle:active {
  transform: scale(0.92);
}

/* ---------- Smooth theme switch ---------- */
body,
.nav,
.feature,
.ph-card,
.step,
.calc__panel,
.waitlist,
.foot,
.page-hero,
.legal__inner {
  transition:
    background-color 0.45s ease,
    color 0.35s ease,
    border-color 0.35s ease;
}

/* ---------- Footer links ---------- */
.foot__col a,
.foot__legal a,
.foot__contact a {
  transition: color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .foot__col a:hover,
  .foot__legal a:hover {
    opacity: 0.75;
  }
}

/* ---------- Focus visibility ---------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.28);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

:root[data-theme="light"] a:focus-visible,
:root[data-theme="light"] button:focus-visible {
  outline-color: rgba(14, 12, 10, 0.22);
}

/* ---------- Calculator mode switch ---------- */
.calc__panel {
  contain: layout;
}

.calc__seg {
  position: relative;
}

.calc__seg-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc((100% - 8px - 4px) / 2);
  height: calc(100% - 8px);
  border-radius: 999px;
  background: var(--ink);
  transform: translate3d(0, 0, 0);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 0;
}

.calc--intl .calc__seg-thumb {
  transform: translate3d(calc(100% + 4px), 0, 0);
}

.calc__seg button {
  position: relative;
  z-index: 1;
  background: transparent !important;
  transition: color 0.25s ease;
}

.calc__seg button.is-active {
  color: var(--bg);
}

/* Fixed-width prefix slot — crossfade only, no width animation */
.calc__amount {
  display: grid !important;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: stretch;
}

.calc__amount #calcInr,
.calc__amount #calcCur {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  transition: opacity 0.28s ease;
}

.calc__amount input {
  grid-column: 2;
  grid-row: 1;
}

.calc__amount #calcCur {
  opacity: 0;
  pointer-events: none;
}

.calc--intl .calc__amount #calcInr {
  opacity: 0;
  pointer-events: none;
}

.calc--intl .calc__amount #calcCur {
  opacity: 1;
  pointer-events: auto;
}

#calcMethodField {
  overflow: hidden;
  max-height: 96px;
  opacity: 1;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
}

.calc--intl #calcMethodField {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.calc__intl-note {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin: 0;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
}

.calc--intl .calc__intl-note {
  max-height: 4.5em;
  opacity: 1;
  margin-top: 4px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  body.js-ready {
    animation: none;
  }

  .js-ready .reveal {
    opacity: 1;
    transform: none;
    transition: none !important;
  }

  .nav.is-open .nav__mobile a,
  .nav__links.is-open a {
    animation: none !important;
  }

  .feature:hover,
  .ph-card:hover,
  .step:hover,
  .ctable-mobile__card:hover,
  .calc:hover,
  .btn:hover,
  .logo:hover {
    transform: none;
  }

  body,
  .nav,
  .feature,
  .ph-card,
  .step,
  .calc,
  .waitlist,
  .foot,
  .page-hero,
  .legal__inner {
    transition: none;
  }

  .calc__seg-thumb,
  .calc__seg button,
  #calcMethodField,
  .calc__intl-note,
  .calc__amount #calcCur,
  .calc__amount #calcInr {
    transition: none !important;
    animation: none !important;
  }

  .calc--intl .calc__seg-thumb {
    transform: translate3d(calc(100% + 4px), 0, 0);
  }
}
