/* ─────────────────────────────────────────────
   AplusX — Shared Interactions (minimal)
   Quiet entry animations + clean hover micro-states.
   No parallax, no breathing, no progress bar.
   ───────────────────────────────────────────── */

:root {
  --fx-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ───── Reveal primitives ─────
   We use CSS @keyframes (not transitions) so the entry animation
   plays reliably regardless of the timing between the data-fx
   attribute being added and .is-visible being applied. With a
   transition, if both happen in the same paint frame the browser
   collapses the change and the animation is silently skipped.
*/
[data-fx] { will-change: opacity, transform; }

@keyframes fxReveal {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fxFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

[data-fx="reveal"] {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
}
[data-fx="reveal"].is-visible {
  animation: fxReveal 700ms var(--fx-ease) both;
}

[data-fx="fade"] {
  opacity: 0;
}
[data-fx="fade"].is-visible {
  animation: fxFade 800ms var(--fx-ease) both;
}

/* ───── Header scroll state ───── */
.header { transition: background 280ms var(--fx-ease), box-shadow 280ms var(--fx-ease); }
.header.is-scrolled {
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

/* ───── Image hover zoom (subtle) ───── */
.brand-image,
.career-image,
.about-image,
.video-card,
.detail-hero {
  overflow: hidden;
}
.brand-image img,
.career-image img,
.about-image img,
.detail-hero img {
  transition: transform 800ms var(--fx-ease);
}
.brand-image:hover img,
.career-image:hover img,
.about-image:hover img,
.detail-hero:hover img {
  transform: scale(1.025);
}

/* ───── Buttons — clean micro-lift ───── */
.login-btn,
.contact-btn {
  transition:
    background 220ms var(--fx-ease),
    transform 240ms var(--fx-ease);
}
.login-btn:hover,
.contact-btn:hover { transform: translateY(-1px); }
.login-btn:active,
.contact-btn:active { transform: translateY(0); }

/* ───── Nav links — quiet color hover ───── */
.nav a { transition: opacity 220ms var(--fx-ease); }

/* ───── Brand socials hover ───── */
.brand-socials a { transition: opacity 220ms var(--fx-ease); }
.brand-socials a:hover { opacity: 0.55; }

/* ───── Custom scrollbar — slim, minimal ───── */
@supports (scrollbar-width: thin) {
  html { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.22) transparent; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
  background-clip: padding-box;
}

/* ───── P0-4: Touch devices — kill sticky :hover ─────
   Without this, tapping an element on iOS/Android keeps :hover
   "stuck" until the next tap, leaving images zoomed and buttons
   lifted. We reset transforms/opacity on `(hover:none)` only — desktop
   mouse users still get the full hover treatment. */
@media (hover: none) {
  .video-card:hover .video-thumb,
  .brand-image:hover img,
  .career-image:hover img,
  .about-image:hover img,
  .detail-hero:hover img {
    transform: none;
  }
  .video-card:hover .video-bg { transform: none; }
  .video-card:hover .play-modern {
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.92);
  }
  .login-btn:hover,
  .contact-btn:hover,
  .send-btn:hover,
  .apply-fixed:hover,
  .learn-btn:hover {
    transform: none;
  }
  .nav a:hover { opacity: 1; }
  .brand-socials a:hover { opacity: 1; transform: none; }
  a.brand-url:hover { opacity: 1; }
  .job-row:hover { background: transparent; }
  .job-row.featured:hover { background: #f5f5f5; }
}

/* ───── Back-to-top floating button ─────
   Auto-injected via interactions.js on every page. Hidden until the user
   has scrolled past 600px. Sits above the mobile sticky-apply bar
   (bottom: 16px on desktop, 88px on small mobile). */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 240ms var(--fx-ease), transform 240ms var(--fx-ease), background 200ms ease;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover { background: #333; }
.back-to-top svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 768px) {
  .back-to-top { right: 12px; bottom: 12px; }
  /* On career-detail (.apply-sticky present) lift it so it doesn't sit
     on top of the sticky Apply bar */
  body:has(.apply-sticky) .back-to-top { bottom: 80px; }
}

/* ───── Reduced motion ───── */
@media (prefers-reduced-motion: reduce) {
  [data-fx] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .header,
  .login-btn,
  .contact-btn,
  .nav a,
  .brand-image img,
  .career-image img,
  .about-image img,
  .detail-hero img,
  .brand-socials a {
    transition: none !important;
  }
}
