/* ==========================================================
   Norvi Infotech – scroll animation & UI polish
   Load AFTER your main stylesheet. No markup changes needed:
   scroll-effects.js tags the elements automatically.
   ========================================================== */

:root {
  --fx-ease: cubic-bezier(.22, .8, .24, 1);
  --fx-dur: .7s;
}

/* ---------- Scroll progress bar ---------- */
.fx-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: var(--color-blue, #2563eb);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 9999;
  pointer-events: none;
}

/* ---------- Reveal on scroll (only when JS is on) ---------- */
.js .fx-reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity var(--fx-dur) var(--fx-ease),
              transform var(--fx-dur) var(--fx-ease);
  transition-delay: var(--fx-delay, 0ms);
  will-change: opacity, transform;
}
.js .fx-reveal.fx-left  { transform: translate3d(-36px, 0, 0); }
.js .fx-reveal.fx-right { transform: translate3d(36px, 0, 0); }
.js .fx-reveal.fx-zoom  { transform: scale(.94); }

.js .fx-reveal.is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* ---------- Hero entrance (plays once on load) ---------- */
.js .hero-content > * {
  opacity: 0;
  transform: translateY(22px);
  animation: fx-rise .8s var(--fx-ease) forwards;
}
.js .hero-content > :nth-child(1) { animation-delay: .05s; }
.js .hero-content > :nth-child(2) { animation-delay: .18s; }
.js .hero-content > :nth-child(3) { animation-delay: .32s; }
.js .hero-content > :nth-child(4) { animation-delay: .46s; }

.js .hero-visual-frame {
  opacity: 0;
  animation: fx-zoom-in 1s var(--fx-ease) .25s forwards;
}
.hero-visual-img { animation: fx-float 7s ease-in-out 1.4s infinite; }

@keyframes fx-rise    { to { opacity: 1; transform: none; } }
@keyframes fx-zoom-in { from { transform: scale(.95) translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fx-float   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- Cards: lift + accent line on hover ---------- */
.norvi-card,
.portfolio-card,
.process-step-card,
.tech-category-block {
  position: relative;
  transition: transform .35s var(--fx-ease),
              box-shadow .35s var(--fx-ease),
              border-color .35s var(--fx-ease);
}
.norvi-card::after,
.process-step-card::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--color-blue, #2563eb);
  border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s var(--fx-ease);
}
.norvi-card:hover,
.portfolio-card:hover,
.process-step-card:hover,
.tech-category-block:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px -16px rgba(15, 30, 70, .22);
  border-color: rgba(37, 99, 235, .35);
}
.norvi-card:hover::after,
.process-step-card:hover::after { transform: scaleX(1); }

/* Icon boxes react when the card is hovered */
.card-icon-box { transition: transform .4s var(--fx-ease), background .3s, color .3s; }
.norvi-card:hover .card-icon-box {
  transform: rotate(-6deg) scale(1.08);
  background: var(--color-blue, #2563eb);
  color: #fff;
}

/* Portfolio image zoom */
.portfolio-thumb-frame { overflow: hidden; }
.portfolio-thumb-img { transition: transform .8s var(--fx-ease); }
.portfolio-card:hover .portfolio-thumb-img { transform: scale(1.06); }

/* ---------- Links & buttons ---------- */
.btn-primary-norvi,
.btn-secondary-norvi,
.btn-accent-norvi,
.btn-outline-white {
  transition: transform .25s var(--fx-ease), box-shadow .25s var(--fx-ease),
              background-color .25s, color .25s, border-color .25s;
}
.btn-primary-norvi:hover,
.btn-accent-norvi:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, .55);
}
.btn-secondary-norvi:hover,
.btn-outline-white:hover { transform: translateY(-2px); }
.btn-primary-norvi:active,
.btn-secondary-norvi:active,
.btn-accent-norvi:active,
.btn-outline-white:active { transform: translateY(0) scale(.98); }

.card-action-link { display: inline-block; transition: transform .25s var(--fx-ease), color .25s; }
.card-action-link:hover { transform: translateX(5px); }

/* Keyboard focus */
a:focus-visible, button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .55);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Sticky header polish (works with <header> in header.php) ---------- */
header, .site-header, .navbar {
  transition: box-shadow .3s ease, background-color .3s ease, backdrop-filter .3s ease;
}
.fx-scrolled {
  box-shadow: 0 6px 24px -12px rgba(15, 30, 70, .25);
  background-color: rgba(255, 255, 255, .88) !important;
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
}

/* ---------- Metrics ---------- */
.portfolio-metric-val { font-variant-numeric: tabular-nums; }

/* ---------- FAQ smoothness ---------- */
.faq-item { transition: box-shadow .3s ease, border-color .3s ease; }
.faq-item:hover { box-shadow: 0 8px 24px -14px rgba(15, 30, 70, .25); }
.faq-chevron { transition: transform .35s var(--fx-ease); }
.faq-item.active .faq-chevron { transform: rotate(180deg); }

/* ---------- CTA banner shimmer ---------- */
.cta-banner { position: relative; overflow: hidden; }
.cta-banner::before {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.12), transparent);
  transform: skewX(-18deg);
  animation: fx-shimmer 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes fx-shimmer { 0%, 55% { left: -60%; } 100% { left: 140%; } }

/* ---------- Back to top ---------- */
.fx-top {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: var(--color-navy, #0f1e46);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  opacity: 0; transform: translateY(12px);
  pointer-events: none;
  transition: opacity .3s, transform .3s var(--fx-ease), background .25s;
  z-index: 999;
}
.fx-top.show { opacity: 1; transform: none; pointer-events: auto; }
.fx-top:hover { background: var(--color-blue, #2563eb); }

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .fx-reveal,
  .js .hero-content > *,
  .js .hero-visual-frame {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .hero-visual-img,
  .cta-banner::before { animation: none !important; }
  .norvi-card:hover, .portfolio-card:hover,
  .process-step-card:hover, .tech-category-block:hover { transform: none; }
}
