/* =========================================================================
   MEDVIZ — MOTION UPGRADE (oryzo-style polish)
   Loaded after styles.css so its rules win on tied specificity.
   Uses transform + opacity only. Respects prefers-reduced-motion.
   ========================================================================= */


/* ───────── #2 · HERO H1 LINE-BY-LINE REVEAL ──────────────────────────── */
.reveal-h1 { display: block; }
.reveal-h1__line {
  display: block;
  overflow: hidden;
  line-height: 1.05;
}
.reveal-h1__inner {
  display: inline-block;
  transform: translate3d(0, 100%, 0);
  filter: blur(8px);
  opacity: 0;
  will-change: transform, filter, opacity;
}
.reveal-h1.is-visible .reveal-h1__inner {
  animation: h1-line-rise .9s cubic-bezier(.22, 1, .36, 1) both;
}
.reveal-h1.is-visible .reveal-h1__line:nth-child(1) .reveal-h1__inner { animation-delay:   0ms; }
.reveal-h1.is-visible .reveal-h1__line:nth-child(2) .reveal-h1__inner { animation-delay: 100ms; }
.reveal-h1.is-visible .reveal-h1__line:nth-child(3) .reveal-h1__inner { animation-delay: 200ms; }

@keyframes h1-line-rise {
  from { transform: translate3d(0, 100%, 0); filter: blur(8px); opacity: 0; }
  to   { transform: translate3d(0, 0, 0);    filter: blur(0);   opacity: 1; }
}


/* ───────── #3 · SCROLL FADE-UPS (uniform) ────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition:
    opacity   .8s cubic-bezier(.22, 1, .36, 1),
    transform .8s cubic-bezier(.22, 1, .36, 1);
  will-change: opacity, transform;
}
.fade-up.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* When applied to a container, stagger its direct children */
.fade-stagger > .fade-up {
  transition-delay: 0ms;
}
.fade-stagger.is-visible > .fade-up:nth-child(1) { transition-delay:  60ms; }
.fade-stagger.is-visible > .fade-up:nth-child(2) { transition-delay: 130ms; }
.fade-stagger.is-visible > .fade-up:nth-child(3) { transition-delay: 200ms; }
.fade-stagger.is-visible > .fade-up:nth-child(4) { transition-delay: 270ms; }
.fade-stagger.is-visible > .fade-up:nth-child(5) { transition-delay: 340ms; }
.fade-stagger.is-visible > .fade-up:nth-child(6) { transition-delay: 410ms; }
.fade-stagger.is-visible > .fade-up:nth-child(7) { transition-delay: 480ms; }
.fade-stagger.is-visible > .fade-up:nth-child(8) { transition-delay: 550ms; }


/* ───────── #5 · MARQUEE TWEAKS (edge masks + 35s loop) ───────────────── */
.logo-marquee, .kinetic-strip {
  mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
  overflow: hidden;
}
.logo-track, .kinetic-strip-track {
  animation-duration: 35s !important;
  animation-timing-function: linear !important;
}
.logo-marquee:hover .logo-track,
.kinetic-strip:hover .kinetic-strip-track {
  animation-play-state: paused;
}


/* ───────── #6 · CARD HOVER (magnetic lift + cursor highlight) ────────── */
.card,
.testimonial,
.feature-list .item,
.b-stat,
.blog-card {
  --mouse-x: 50%;
  --mouse-y: 50%;
  position: relative;
  transition:
    transform   .25s cubic-bezier(.22, 1, .36, 1),
    box-shadow  .25s cubic-bezier(.22, 1, .36, 1),
    border-color .25s cubic-bezier(.22, 1, .36, 1);
}
.card::before,
.testimonial::before,
.feature-list .item::before,
.b-stat::before,
.blog-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mouse-x) var(--mouse-y), rgba(0, 128, 128, 0.10), transparent 70%);
  opacity: 0;
  transition: opacity .2s ease-out;
  pointer-events: none;
  z-index: 0;
}
.card > *,
.testimonial > *,
.feature-list .item > *,
.b-stat > *,
.blog-card > * { position: relative; z-index: 1; }

.card:hover,
.testimonial:hover,
.feature-list .item:hover,
.b-stat:hover,
.blog-card:hover {
  transform: translate3d(0, -4px, 0);
  box-shadow: 0 22px 48px rgba(20, 50, 70, 0.12), 0 4px 10px rgba(20, 50, 70, 0.05);
  border-color: var(--teal-200);
}
.card:hover::before,
.testimonial:hover::before,
.feature-list .item:hover::before,
.b-stat:hover::before,
.blog-card:hover::before { opacity: 1; }


/* ───────── #7 · SCROLL PROGRESS BAR ──────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  z-index: 1000;
  pointer-events: none;
}
.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-700));
  transform-origin: left center;
  transition: width .12s linear;
}


/* ───────── #8 · NAV STATE TRANSITIONS ────────────────────────────────── */
.site-header {
  transition:
    background-color  .4s cubic-bezier(.22, 1, .36, 1),
    backdrop-filter   .4s cubic-bezier(.22, 1, .36, 1),
    -webkit-backdrop-filter .4s cubic-bezier(.22, 1, .36, 1),
    box-shadow        .4s cubic-bezier(.22, 1, .36, 1),
    border-color      .4s cubic-bezier(.22, 1, .36, 1);
}
.site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 2px 12px rgba(20, 50, 70, 0.06);
  border-bottom: 1px solid rgba(20, 50, 70, 0.06);
}
/* When a dark section sits behind the nav, switch text colors */
.site-header.nav--on-dark {
  background-color: rgba(0, 63, 64, 0.55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.site-header.nav--on-dark .main-nav > li > a,
.site-header.nav--on-dark .main-nav > li > button {
  color: white;
}
.site-header.nav--on-dark .nav-cta {
  background: white;
  color: var(--teal-700);
}
.site-header.nav--on-dark .brand-logo img {
  filter: brightness(0) invert(1);
}


/* ───────── #10 · BUTTON MICRO-INTERACTIONS ───────────────────────────── */
.btn,
.btn-primary,
.btn-secondary {
  transition:
    transform        .2s cubic-bezier(.22, 1, .36, 1),
    box-shadow       .2s cubic-bezier(.22, 1, .36, 1),
    background-color .2s cubic-bezier(.22, 1, .36, 1),
    color            .2s cubic-bezier(.22, 1, .36, 1);
}
.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 14px 30px rgba(0, 128, 128, 0.28);
}
.btn-secondary:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 22px rgba(20, 50, 70, 0.10);
}
/* Any inline SVG/icon inside a button slides 4px right on parent hover */
.btn svg,
.btn-primary svg,
.btn-secondary svg,
.btn .arrow,
.btn-primary .arrow,
.btn-secondary .arrow {
  display: inline-block;
  vertical-align: middle;
  transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}
.btn:hover svg,
.btn-primary:hover svg,
.btn-secondary:hover svg,
.btn:hover .arrow,
.btn-primary:hover .arrow,
.btn-secondary:hover .arrow {
  transform: translate3d(4px, 0, 0);
}


/* ───────── #11 · GRAIN OVERLAY ───────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
  mix-blend-mode: multiply;
  opacity: 0.04;
  z-index: 9999;
}


/* ───────── REDUCED-MOTION OVERRIDES ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal-h1__inner,
  .fade-up,
  .fade-stagger > .fade-up {
    animation-duration: 60ms !important;
    transition-duration: 60ms !important;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
  }
  .scroll-progress__bar { transition: none !important; }
  .site-header { transition: none !important; }
  .btn:hover svg,
  .btn-primary:hover svg,
  .btn-secondary:hover svg,
  .btn:hover .arrow,
  .btn-primary:hover .arrow,
  .btn-secondary:hover .arrow,
  .card:hover,
  .testimonial:hover,
  .feature-list .item:hover,
  .b-stat:hover,
  .blog-card:hover { transform: none !important; }
  body::after { display: none; }
  .logo-track, .kinetic-strip-track { animation-play-state: paused !important; }
}


/* ───────── MOBILE ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Backdrop-filter is expensive on mid-range Android — fall back to flat */
  .site-header.scrolled {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: rgba(255, 255, 255, 0.94);
  }
  .site-header.nav--on-dark {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: rgba(0, 63, 64, 0.92);
  }
  /* Cursor-tracking highlight is a no-op on touch devices anyway */
}
