/* =========================================================
  LADLI — Motion, Glass & 3D Enhancement Layer
  Loaded after styles.css. Animation curves follow the
  design-engineering principles documented at
  github.com/emilkowalski/skills (emil-design-eng):
  - custom, "stronger" cubic-bezier curves, never default
  CSS easing
  - ease-out for anything entering/exiting
  - ease-in-out for on-screen movement
  - transitions (not keyframes) for interruptible UI
  - nothing animates from scale(0)
  - only transform + opacity are animated for performance
   ========================================================= */

:root {
  /* Strong ease-out for UI interactions (entering / exiting) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* Strong ease-in-out for on-screen movement */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  /* iOS-style drawer / panel curve */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* Subtle spring for playful, decorative accents only */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --perspective: 1200px;
}

/* Only smooth-scroll for in-page anchor jumps, NOT on page load.
   Global scroll-behavior: smooth causes a visible shake/jolt when
   navigating between pages because the browser tries to smoothly
   scroll from the old scroll position to the top of the new page. */
html:focus-within {
  scroll-behavior: smooth;
}

/* Respect reduced-motion users: keep opacity/color transitions, drop motion */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    transition-property: opacity !important;
    transform: none !important;
  }
}

/* =========================================================
   Lab-themed background texture (very low-opacity pattern)
   ========================================================= */
body {
  background-color: var(--white);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(31, 111, 229, 0.05) 1px, transparent 0);
  background-size: 34px 34px;
  background-attachment: fixed;
}

/* =========================================================
   Scroll-reveal (transitions, not keyframes — interruptible)
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
  will-change: transform, opacity;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.reveal-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Never animate from scale(0) — start visible-but-small */
.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children — kept short (30-70ms) so it never feels slow */
.reveal-stagger {
  transition-delay: calc(var(--d, 0) * 60ms);
}

/* =========================================================
   Glassmorphism header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  isolation: isolate;
  background:
    radial-gradient(120% 200% at 12% -60%, rgba(103, 197, 248, 0.14), transparent 60%),
    radial-gradient(120% 200% at 88% -80%, rgba(233, 90, 165, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.26));
  backdrop-filter: blur(48px) saturate(240%);
  -webkit-backdrop-filter: blur(48px) saturate(240%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.78) inset,
    0 1px 0 rgba(31, 111, 229, 0.03),
    0 14px 32px rgba(31, 111, 229, 0.04);
  transition: background 240ms var(--ease-out), box-shadow 240ms var(--ease-out), border-color 240ms var(--ease-out);
  will-change: background, box-shadow;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.12) 44%, rgba(255, 255, 255, 0) 72%);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(31, 111, 229, 0), rgba(31, 111, 229, 0.18), rgba(31, 111, 229, 0));
}

.site-header.is-scrolled {
  background:
    radial-gradient(120% 200% at 12% -60%, rgba(103, 197, 248, 0.1), transparent 60%),
    radial-gradient(120% 200% at 88% -80%, rgba(233, 90, 165, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.42));
  border-bottom-color: rgba(255, 255, 255, 0.4);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.82) inset,
    0 1px 0 rgba(31, 111, 229, 0.04),
    0 16px 38px rgba(31, 111, 229, 0.06);
}

.site-header.is-scrolled::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08) 44%, rgba(255, 255, 255, 0) 72%);
}

.nav-wrap {
  position: relative;
  z-index: 1;
  transition: transform 240ms var(--ease-out), padding 240ms var(--ease-out);
}

.site-header.is-scrolled .nav-wrap {
  transform: translateY(0);
}

.brand img {
  transition: transform 240ms var(--ease-out);
}

/* Fallback for browsers without backdrop-filter support */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header {
    background: rgba(255, 255, 255, 0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .nav-wrap,
  .brand img {
    transition: none;
  }
}

/* =========================================================
   Animated gradient text / ribbon
   ========================================================= */
.gradient-text {
  background-size: 200% auto;
  animation: shimmer 7s linear infinite;
}

@keyframes shimmer {
  0% {
    background-position: 0% center;
  }

  100% {
    background-position: 200% center;
  }
}

.top-ribbon {
  background-size: 300% 100%;
  animation: ribbonFlow 10s ease infinite;
}

@keyframes ribbonFlow {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

/* =========================================================
   Hero decoration
   ========================================================= */
.hero::before {
  animation: floatBlob 9s var(--ease-in-out) infinite;
}

.hero::after {
  animation: floatBlob 11s var(--ease-in-out) infinite reverse;
}

@keyframes floatBlob {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(18px, -22px) scale(1.06);
  }
}

.float-card {
  animation: floatCard 4.5s var(--ease-in-out) infinite;
}

@keyframes floatCard {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* =========================================================
   3D tilt for cards (mouse-tracked, decorative only)
   ========================================================= */
.card,
.test-card,
.industry-card,
.article-card,
.download-item,
.value-item,
.contact-card,
.gas {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 300ms var(--ease-out), box-shadow 300ms var(--ease-out), border-color 250ms var(--ease-out);
}

.card:hover,
.industry-card:hover,
.article-card:hover,
.download-item:hover {
  box-shadow: 0 24px 54px rgba(31, 111, 229, 0.18);
}

/* JS sets --rx / --ry per element on mousemove for real 3D tilt */
@media (hover: hover) and (pointer: fine) {
  .tilt-3d {
    transform: perspective(var(--perspective)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(var(--tz, 0px));
  }
}

.icon-bubble,
.industry-icon,
.tiny-icon,
.contact-icon,
.step-icon,
.download-icon,
.vicon {
  transition: transform 350ms var(--ease-spring), background 250ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {

  .card:hover .icon-bubble,
  .industry-card:hover .industry-icon,
  .test-card:hover .tiny-icon,
  .contact-card:hover .contact-icon,
  .download-item:hover .download-icon {
    transform: rotateY(180deg) scale(1.06);
  }
}

/* =========================================================
   Process track
   ========================================================= */
.process-step .step-icon {
  transition: transform 300ms var(--ease-spring), box-shadow 300ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .process-step:hover .step-icon {
    transform: translateY(-6px) scale(1.06) rotateZ(-3deg);
    box-shadow: 0 18px 36px rgba(31, 111, 229, 0.2);
  }
}

.process-track::before {
  background-size: 200% 100%;
  animation: ribbonFlow 6s linear infinite;
}

/* =========================================================
   Micro-interactions: arrows, links
   ========================================================= */
.test-card .arrow-mini {
  transition: transform 220ms var(--ease-out);
}

.test-card:hover .arrow-mini {
  transform: translateX(5px);
}

.link-arrow .icon {
  transition: transform 220ms var(--ease-out);
}

.link-arrow:hover .icon {
  transform: translateX(4px);
}

/* =========================================================
   Buttons — shine sweep + press feedback
   ========================================================= */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 160ms var(--ease-out);
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  transition: left 450ms var(--ease-out);
}

.btn:hover::before {
  left: 130%;
}

.btn:active {
  transform: scale(0.97);
}

/* =========================================================
   Photo frame
   ========================================================= */
.photo-frame img {
  transition: box-shadow 300ms var(--ease-out);
}

/* =========================================================
   FAQ
   ========================================================= */
.faq-list details summary::after {
  transition: transform 220ms var(--ease-out), background 220ms var(--ease-out);
}

.faq-list details[open] summary::after {
  transform: rotate(180deg);
}

.faq-answer {
  animation: faqIn 250ms var(--ease-out);
}

@keyframes faqIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   Hero 3D canvas mount
   ========================================================= */
.hero-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

.hero-3d canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.hero-visual {
  position: relative;
}

/* =========================================================
   Back to top
   ========================================================= */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 150;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--royal);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 30px rgba(31, 111, 229, 0.35);
  border: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  pointer-events: none;
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out), background 200ms var(--ease-out);
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--pink);
}

.back-to-top:active {
  transform: scale(0.94);
}

.back-to-top svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 820px) {
  .back-to-top {
    bottom: 96px;
    right: 16px;
  }
}

/* =========================================================
   Form feedback toast
   ========================================================= */
.form-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 280ms var(--ease-out), max-height 280ms var(--ease-out), margin 280ms var(--ease-out);
}

.form-toast.is-visible {
  opacity: 1;
  max-height: 120px;
  margin-top: 14px;
}

.form-toast.success {
  background: var(--sky-22);
  color: var(--royal);
  border: 1.5px solid var(--royal-18);
}

.form-toast.error {
  background: var(--pink-10);
  color: #a11a5b;
  border: 1.5px solid var(--pink);
}

.form-toast.sending {
  background: var(--orange-12);
  color: #8a5a05;
  border: 1.5px solid var(--orange);
}

/* =========================================================
   Loading state for submit buttons
   ========================================================= */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn.is-loading .btn-label {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  left: 50%;
  top: 50%;
  margin: -9px 0 0 -9px;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   Cursor glow (desktop, page-wide)
   ========================================================= */
.cursor-glow {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(103, 197, 248, 0.18), transparent 70%);
  transform: translate(-50%, -50%);
  transition: opacity 250ms var(--ease-out);
  opacity: 0;
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  .cursor-glow.is-active {
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .cursor-glow {
    display: none;
  }
}

/* =========================================================
   Admin-portal link badge (shown only on-site, subtle)
   ========================================================= */
.admin-portal-link {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 140;
  font-size: 12px;
  font-weight: 700;
  color: var(--royal);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--royal-18);
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.admin-portal-link:hover {
  opacity: 1;
  transform: translateY(-2px);
}
/* =========================================================
   Ambient particle background (tsParticles, behind hero copy)
   ========================================================= */
.hero-particles-mount {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.hero > .container {
  position: relative;
  z-index: 1;
}

/* =========================================================
   Scroll progress bar
   ========================================================= */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 10001;
  background: linear-gradient(90deg, var(--royal), var(--pink), var(--orange));
  transition: width 120ms linear;
  pointer-events: none;
}

/* =========================================================
   Hero heading word-in stagger (anime.js sets the from/to,
   this just keeps layout stable before JS runs)
   ========================================================= */
.hero h1 .word-in {
  display: inline-block;
  will-change: transform, opacity;
}

/* =========================================================
   Subtle scroll parallax on hero visuals (JS sets --parallax-shift)
   ========================================================= */
.hero .photo-frame {
  transform: translateY(var(--parallax-shift, 0px));
}
.hero .hero-3d {
  transform: translateY(calc(var(--parallax-shift, 0px) * -0.5));
}

/* =========================================================
   3D mount — bigger stage on interior pages so the new
   scenes (core / vials / equipment / pin) have room to read
   ========================================================= */
.hero-compact .hero-3d {
  opacity: 0.95;
}

/* =========================================================
   Responsive fix: a couple of pages set an inline
   grid-template-columns on .process-track for a specific
   step count. Inline styles beat external stylesheets, so we
   need !important here to still collapse to one column on
   small screens.
   ========================================================= */
@media (max-width: 620px) {
  .process-track[style] {
    grid-template-columns: 1fr !important;
  }
}
@media (min-width: 621px) and (max-width: 900px) {
  .process-track[style] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* =========================================================
   Accessible focus ring (keyboard navigation only)
   Nothing here changes appearance for mouse/touch users —
   :focus-visible only engages for keyboard/assistive nav.
   ========================================================= */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--royal);
  outline-offset: 3px;
  border-radius: 6px;
}

.form-control:focus-visible {
  outline: none;
}
/* =========================================================
   Performance: pause decorative infinite animations while the
   browser tab is in the background. Nothing visible changes —
   a backgrounded tab has no frame to animate — but this stops
   the browser from doing continuous style/paint work for a
   page nobody is looking at. Toggled by assets/enhance.js.
   ========================================================= */
.motion-paused *,
.motion-paused *::before,
.motion-paused *::after {
  animation-play-state: paused !important;
}
