/* LogForge motion — Apple Liquid Glass feel
   Scroll reveal, sticky chrome, hover/press springs.
   Respects prefers-reduced-motion. */

/* ——— Scroll reveal (no filter:blur — that lagged language navigations) ——— */
[data-lf-reveal] {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition:
    opacity .45s var(--ease-out),
    transform .45s var(--ease-out);
}
[data-lf-reveal].is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
html.lf-scrolled [data-lf-reveal],
.lf-section[data-lf-reveal],
.section-heading[data-lf-reveal] {
  opacity: 1;
  transform: none;
}
html.lf-lang-landed [data-lf-reveal] {
  opacity: 1;
  transform: none;
  transition: none;
}
[data-lf-reveal][data-lf-delay="1"] { transition-delay: .04s; }
[data-lf-reveal][data-lf-delay="2"] { transition-delay: .08s; }
[data-lf-reveal][data-lf-delay="3"] { transition-delay: .12s; }
[data-lf-reveal][data-lf-delay="4"] { transition-delay: .16s; }
[data-lf-reveal][data-lf-delay="5"] { transition-delay: .2s; }

/* Stagger children */
.lf-stagger > [data-lf-reveal].is-in:nth-child(1) { transition-delay: .04s; }
.lf-stagger > [data-lf-reveal].is-in:nth-child(2) { transition-delay: .1s; }
.lf-stagger > [data-lf-reveal].is-in:nth-child(3) { transition-delay: .16s; }
.lf-stagger > [data-lf-reveal].is-in:nth-child(4) { transition-delay: .22s; }
.lf-stagger > [data-lf-reveal].is-in:nth-child(5) { transition-delay: .28s; }
.lf-stagger > [data-lf-reveal].is-in:nth-child(6) { transition-delay: .34s; }

/* ——— Sticky chrome densifies on scroll ——— */
.ios-nav.glass,
.topbar.glass,
.shell-top.glass {
  transition:
    background var(--dur-hover) var(--ease-out),
    box-shadow var(--dur-hover) var(--ease-out);
}
html.lf-scrolled .ios-nav.glass,
html.lf-scrolled .topbar.glass {
  background: color-mix(in srgb, var(--glass-bg) 78%, rgb(210 218 232 / 28%));
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  box-shadow:
    0 12px 36px rgb(15 25 45 / 16%),
    inset 0 1px 1px rgb(232 236 244 / 22%);
}
html.lf-scrolled[data-theme="ember"] .ios-nav.glass,
html.lf-scrolled[data-theme="ember"] .topbar.glass {
  background: rgb(0 0 0 / 68%);
  box-shadow:
    0 14px 40px rgb(0 0 0 / 55%),
    inset 0 1px 1px rgb(232 235 242 / 10%);
}

/* ——— Interactive springs: glass / cards / buttons / switches ——— */
.glass.liquid-refract,
.product-card.glass,
.hero-metrics div,
.leader-row,
.overview-card,
.shell-panel {
  transition:
    transform var(--dur-hover) var(--ease-spring),
    box-shadow var(--dur-hover) var(--ease-out),
    border-color var(--dur-hover) var(--ease-out),
    background var(--dur-hover) var(--ease-out);
}

.product-card.glass:hover {
  transform: translateY(-6px) scale(1.018);
}
.product-card.glass:active,
.product-card.glass.lf-pressing {
  transform: translateY(-1px) scale(.97, .985);
  transition-duration: var(--dur-press);
}

.hero-metrics div:hover {
  transform: translateY(-3px) scale(1.025);
}
.hero-metrics div:active {
  transform: scale(.97, .985);
  transition-duration: var(--dur-press);
}

.btn {
  transition:
    transform var(--dur-hover) var(--ease-spring),
    box-shadow var(--dur-hover) var(--ease-out),
    background var(--dur-hover) var(--ease-out),
    opacity .16s ease,
    border-color var(--dur-hover) var(--ease-out);
}
.btn:hover {
  transform: translateY(-2px) scale(1.03);
}
.btn:active,
.btn.lf-pressing {
  /* viscous squash — liquid glass press */
  transform: scale(.96, .93);
  transition-duration: var(--dur-press);
  transition-timing-function: var(--ease-press);
}

.lf-switch,
.theme-switch {
  transition:
    transform var(--dur-hover) var(--ease-spring),
    background var(--dur-switch) var(--ease-out),
    border-color var(--dur-switch) var(--ease-out),
    box-shadow var(--dur-hover) var(--ease-out);
}
.lf-switch:hover,
.theme-switch:hover {
  transform: scale(1.07);
}
.lf-switch:active,
.theme-switch:active,
.lf-switch.lf-pressing,
.theme-switch.lf-pressing {
  transform: scale(.93, .9);
  transition-duration: var(--dur-press);
}

.lf-switch-thumb,
.theme-switch-thumb {
  transition:
    transform var(--dur-switch) var(--ease-spring),
    width var(--dur-switch) var(--ease-spring),
    background var(--dur-switch) var(--ease-out),
    border-color var(--dur-switch) var(--ease-out),
    box-shadow var(--dur-switch) var(--ease-out);
}

/* Apple-style thumb squash on press / stretch on travel */
.lf-switch:active .lf-switch-thumb,
.theme-switch:active .lf-switch-thumb,
.lf-switch.lf-pressing .lf-switch-thumb,
.theme-switch.lf-pressing .lf-switch-thumb {
  width: calc(var(--sw-thumb) + 8px);
  border-radius: 999px;
}

.btn.lf-pressing,
.product-card.lf-pressing,
.shell-tab.lf-pressing,
.shell-dock-tab.lf-pressing,
.locale-pill.lf-pressing {
  transform: scale(.96);
  transition-duration: var(--dur-press);
}

.lf-seg-thumb {
  transition:
    transform var(--dur-switch) var(--ease-spring),
    width var(--dur-switch) var(--ease-spring),
    height .28s var(--ease-out),
    opacity .2s ease,
    background var(--dur-hover) var(--ease-out),
    box-shadow var(--dur-hover) var(--ease-out);
}

.shell-tab,
.shell-dock-tab,
.shell-nav-item,
.locale-pill {
  transition:
    transform var(--dur-hover) var(--ease-spring),
    color .22s ease,
    background .22s ease,
    box-shadow .22s ease;
}
/* Shell chrome: no scale on hover — scale caused horizontal scroll + flicker in the sidebar. */
.shell-tab:hover,
.shell-dock-tab:hover {
  transform: translateY(-1px);
}
.shell-nav-item:hover {
  transform: none;
}
.shell-tab:active,
.shell-dock-tab:active,
.shell-nav-item:active {
  transform: scale(.98);
  transition-duration: var(--dur-press);
}

.leader-row {
  border-radius: 14px;
  margin: 0 -6px;
  padding-inline: 6px;
}
.leader-row:hover {
  background: rgb(255 255 255 / 12%);
  transform: translateX(2px);
}
html[data-theme="ember"] .leader-row:hover {
  background: rgb(255 255 255 / 06%);
}

/* Wallpaper parallax hooks (set by JS) */
.ios-wallpaper,
.ambient {
  transition: transform .08s linear;
}

/* Login card entrance */
.login-card[data-lf-reveal] {
  transform: translate3d(0, 28px, 0) scale(.96);
}
.login-card[data-lf-reveal].is-in {
  transform: translate3d(0, 0, 0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  [data-lf-reveal],
  [data-lf-reveal].is-in {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
  .product-card.glass:hover,
  .product-card.glass:active,
  .btn:hover,
  .btn:active,
  .btn.lf-pressing,
  .lf-switch:hover,
  .lf-switch:active,
  .lf-switch.lf-pressing,
  .theme-switch:hover,
  .theme-switch:active,
  .theme-switch.lf-pressing,
  .hero-metrics div:hover,
  .shell-tab:hover,
  .shell-dock-tab:hover {
    transform: none !important;
  }
  .lf-switch:active .lf-switch-thumb,
  .theme-switch:active .lf-switch-thumb,
  .lf-switch.lf-pressing .lf-switch-thumb,
  .theme-switch.lf-pressing .lf-switch-thumb {
    width: var(--sw-thumb) !important;
  }
  .ios-wallpaper,
  .ambient {
    transition: none !important;
  }
}
