/* ============================================================
   motion.css — scroll reveals, page transitions, hover polish.
   Everything is switched on by <html class="mo"> (set in each
   page's <head>) and is skipped entirely for visitors who have
   "reduce motion" turned on. Safe to delete: just remove the
   <link> and <script> tags for motion.css / motion.js.
   ============================================================ */

@media (prefers-reduced-motion: no-preference) {

  html.mo { scroll-behavior: smooth; }

  /* ---- Page transitions: fade in on arrival, fade out on leave ---- */
  html.mo body { animation: mo-page 0.4s ease backwards; }
  html.mo.mo-leaving body { opacity: 0; transition: opacity 0.26s ease; }

  /* ---- Scroll reveals: hidden until they scroll into view ---- */
  html.mo :is(
    .hero-left > *, .hero-right,
    .work-header, .work-grid, .section-h2, .about-h2, .about-body, .about-photo,
    .stat, .testimonial-card, .footer-cell, .footer-bottom,
    .work-page-hero > *, .project-item, .ys-site-card, .footer-grid > *,
    .cs-hero > *,
    .page-header > *, .cell, .page-footer
  ):not(.fade-in):not(.fi):not(.lightbox *):not(.mobile-menu *):not(.nav *):not(.fade-in *):not(.fi *):not(.mo-in) {
    opacity: 0;
  }

  html.mo .mo-in {
    animation: mo-up 0.9s cubic-bezier(0.2, 0.65, 0.2, 1) backwards;
    animation-delay: var(--mo-d, 0s);
  }
  html.mo .mo-in.mo-zoom { animation-name: mo-zoom; animation-duration: 1.1s; }

  @keyframes mo-page { from { opacity: 0; } to { opacity: 1; } }
  @keyframes mo-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes mo-up   { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
  @keyframes mo-zoom { from { opacity: 0; transform: scale(1.045); }   to { opacity: 1; transform: none; } }

  /* ---- Project pop-ups (Work page) ease in ---- */
  html.mo .lightbox.open { animation: mo-fade 0.35s ease backwards; }
  html.mo .lightbox.open .lightbox-inner { animation: mo-up 0.55s cubic-bezier(0.2, 0.65, 0.2, 1) 0.06s backwards; }

  /* ---- Hover polish ---- */
  .nav-links a:not(.nav-cta) { position: relative; }
  .nav-links a:not(.nav-cta)::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
    background: currentColor; transform: scaleX(0); transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.2, 0.65, 0.2, 1);
  }
  .nav-links a:not(.nav-cta):hover::after { transform: scaleX(1); }

  .btn-arrow::after { display: inline-block; transition: transform 0.3s cubic-bezier(0.2, 0.65, 0.2, 1); }
  .btn-arrow:hover::after { transform: translateX(6px); }

  .cell-img-wrap img, .cell-img-wrap svg { transition: transform 0.6s cubic-bezier(0.2, 0.65, 0.2, 1); }
  .cell:hover .cell-img-wrap img, .cell:hover .cell-img-wrap svg { transform: scale(1.03); }
}

@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  @keyframes mo-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
}

/* mobile overflow guard */
html,body{overflow-x:clip;max-width:100%}
@media(max-width:700px){
  table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .cs-stats{grid-template-columns:minmax(0,1fr)!important}
}
