/* Merqon motion: native animation, readable by default, no layout animation. */
:root {
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
  --motion-fast: 180ms;
  --motion-enter: 640ms;
  --motion-card: 520ms;
}

/* Replace the legacy hidden-until-JS reveal. Content remains available on failure. */
.reveal, .reveal.on { opacity: 1; transform: none; transition: none; }
.hero .hero-title, .hero .hero-foot, .hero .hero-highlights {
  opacity: 1; transform: none; animation: none;
}
.hero .hero-line { display: block; }
.hero .hero-grid { pointer-events: none; }
.hero .hero-glow {
  inset: -10% -16% -12% auto;
  width: min(1000px, 100%); height: auto;
  max-width: none;
  transform: none;
  background:
    radial-gradient(ellipse at 72% 44%, #be39185e 0%, #9b291a32 31%, transparent 69%),
    radial-gradient(ellipse at 88% 70%, #c6491924 0%, transparent 55%);
  opacity: .9;
  pointer-events: none;
  animation: none;
}
.hero > :not(.hero-grid):not(.hero-glow) { position: relative; z-index: 1; }

/* White navigation, black action, original logo and layout. */
nav .nav-cta, nav .merqon-mobile-cta {
  background: #101011 !important;
  color: #fff !important;
  border-color: #101011 !important;
  box-shadow: none;
}
nav .nav-cta:hover, nav .merqon-mobile-cta:hover {
  background: #282829 !important;
  color: #fff !important;
  box-shadow: none;
}
.btn-main, .btn-sec, .nav-cta, .merqon-mobile-cta, .service-next {
  transition: transform var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.btn-main:active, .nav-cta:active, .merqon-mobile-cta:active {
  transform: translateY(0) scale(.985);
}
a:focus-visible, button:focus-visible, .flip-card:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 5px;
}
nav a:focus-visible, nav button:focus-visible { outline-color: #111; }
.motion-arrow { display: inline-block; transition: transform var(--motion-fast) var(--motion-ease); }
@media (hover: hover) and (pointer: fine) {
  .btn-main:hover, .nav-cta:hover, .merqon-mobile-cta:hover { transform: translateY(-2px); }
  .btn-sec:hover .motion-arrow, .service-next:hover .motion-arrow { transform: translateX(3px); }
}

/* Depth uses a wrapper; reveal never overrides the phone's final position. */
.portfolio-motion { position: relative; min-width: 0; align-self: center; }
.portfolio-motion .portfolio-preview { width: 100%; }
#werk .portfolio-case { align-items: center; }
#diensten .flip-card { isolation: isolate; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
#diensten .flip-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(ellipse at 18% 8%, #ef60371a, transparent 66%);
  opacity: 0; pointer-events: none; z-index: 1;
  transition: opacity 260ms ease;
}
#diensten .flip-card-inner { transition: transform var(--motion-card) var(--motion-ease); }
#diensten .flip-card:focus-visible { outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  #diensten .flip-card:hover::after { opacity: 1; }
}
#diensten .flip-card:focus-visible::after { opacity: 1; }

/* Process is decorative progression; the list always stays legible. */
.home-process { position: relative; }
.motion-progress {
  display: block; position: relative; height: 1px; margin: 0 0 12px;
  background: var(--border-mid); overflow: hidden;
}
.motion-progress::after {
  content: ''; position: absolute; inset: 0; background: var(--accent);
  transform-origin: left; transform: scaleX(var(--motion-progress, 0));
  transition: transform 420ms var(--motion-ease);
}
#diensten .home-process li { position: relative; isolation: isolate; }
#diensten .home-process li::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, #ef60370c, transparent); opacity: 0;
  transition: opacity 300ms ease;
}
#diensten .home-process li.is-current::after { opacity: 1; }
#diensten .home-process li.is-complete span { color: var(--white); }

/* Static contact light never moves behind a person filling in the form. */
#scan { position: relative; isolation: isolate; }
#scan > .reveal { position: relative; }
#scan .sec-title { position: relative; isolation: isolate; }
#scan .sec-title::before {
  content: ''; position: absolute; inset: -75% -12%; z-index: -1;
  background: radial-gradient(ellipse at 55% 55%, #ac321b25, transparent 68%);
  pointer-events: none;
}
#merqon-aanvraag-form :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
  border-color: #ef60378c !important;
  box-shadow: 0 0 0 5px #ef60370c;
}
.motion-preference {
  display: inline-flex; align-items: center; background: none;
  color: var(--muted); border: 0; padding: 5px 8px; margin: 0;
  font: inherit; font-size: 12px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.motion-preference:hover { color: var(--white); }

@keyframes merqon-enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Keep the largest text painted immediately; do not make LCP wait for a fade. */
@keyframes merqon-type-enter {
  from { transform: translateY(12px); }
  to { transform: translateY(0); }
}
@keyframes merqon-ambient {
  from { transform: translate3d(-4%, -3%, 0) scale(1); opacity: .72; }
  to { transform: translate3d(5%, 4%, 0) scale(1.09); opacity: 1; }
}
@keyframes merqon-depth {
  from { transform: translateY(10px); }
  to { transform: translateY(-10px); }
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion='paused']) .hero .hero-line {
    animation: merqon-type-enter 640ms var(--motion-ease) backwards;
  }
  html:not([data-motion='paused']) .hero .hero-line + .hero-line { animation-delay: 90ms; }
  html:not([data-motion='paused']) .hero .hero-sub {
    animation: merqon-enter 600ms 130ms var(--motion-ease) backwards;
  }
  html:not([data-motion='paused']) .hero .hero-btns {
    animation: merqon-enter 560ms 200ms var(--motion-ease) backwards;
  }
  html.motion-ambient-ready:not([data-motion='paused']) .hero .hero-glow {
    animation: merqon-ambient 19s ease-in-out infinite alternate;
    animation-play-state: paused;
  }
  html.motion-hero-visible.motion-ambient-ready:not(.motion-page-hidden):not([data-motion='paused']) .hero .hero-glow {
    animation-play-state: running;
  }
  @supports (animation-timeline: view()) {
    @media (min-width: 1000px) and (hover: hover) and (pointer: fine) {
      html:not([data-motion='paused']) .portfolio-motion {
        animation: merqon-depth linear both;
        animation-timeline: view(block);
        animation-range: entry 0% exit 100%;
      }
    }
  }
}
@media (max-width: 768px) {
  .hero .hero-glow { inset: 0 -25% 0 auto; width: 110%; opacity: .85; }
  html.motion-ambient-ready .hero .hero-glow { animation: none !important; }
  .motion-progress::after { transition-duration: 180ms; }
}

/* Runtime pause and the OS preference have the same static, fully usable result. */
html[data-motion='paused'] *, html[data-motion='paused'] *::before, html[data-motion='paused'] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
html[data-motion='paused'] .portfolio-motion { transform: none !important; }
html[data-motion='paused'] .flip-card-inner { transform: none !important; }
html[data-motion='paused'] .flip-back { transform: none; visibility: hidden; }
html[data-motion='paused'] .flip-card.is-flipped .flip-front { visibility: hidden; }
html[data-motion='paused'] .flip-card.is-flipped .flip-back { visibility: visible; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .portfolio-motion, .flip-card-inner { transform: none !important; }
  .flip-back { transform: none; visibility: hidden; }
  .flip-card.is-flipped .flip-front { visibility: hidden; }
  .flip-card.is-flipped .flip-back { visibility: visible; }
}
