/*
 * Motion for the public website: page transitions, scroll reveals, hover and press feedback.
 * Everything here is decoration — the site works and reads the same without it — and all of it is
 * switched off for visitors who ask their device for less motion.
 */

/* ---------- Always on: colour changes ease instead of jumping ---------- */
[class^="hv"], [class*=" hv"], .nav-link, .mm-link, .chip, .field, .lang-switch a, .cookie-btn {
  transition: color .22s ease, background-color .22s ease, border-color .22s ease, box-shadow .22s ease, opacity .22s ease, transform .22s cubic-bezier(.2,.7,.2,1);
}
.field:focus { background-color: #FBFCFE; }

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

  /* ---------- Page transitions (cross-document View Transitions; ignored by browsers without it) ---------- */
  @view-transition { navigation: auto; }
  header { view-transition-name: site-header; }
  ::view-transition-old(root) { animation: mo-page-out .18s ease both; }
  ::view-transition-new(root) { animation: mo-page-in .38s cubic-bezier(.2,.7,.2,1) backwards; }
  @keyframes mo-page-out { to { opacity: 0; } }
  @keyframes mo-page-in { from { opacity: 0; transform: translateY(10px); } }

  /* ---------- Hero: the opening section's text rises in on load (CSS only, so nothing flashes) ---------- */
  html.motion main > section:first-child > div:not([style*="absolute"]) > * {
    animation: mo-rise .85s cubic-bezier(.2,.7,.2,1) backwards;
  }
  html.motion main > section:first-child > div:not([style*="absolute"]) > :nth-child(2) { animation-delay: .08s; }
  html.motion main > section:first-child > div:not([style*="absolute"]) > :nth-child(3) { animation-delay: .16s; }
  html.motion main > section:first-child > div:not([style*="absolute"]) > :nth-child(4) { animation-delay: .24s; }
  html.motion main > section:first-child > div:not([style*="absolute"]) > :nth-child(5) { animation-delay: .32s; }
  html.motion main > section:first-child > div:not([style*="absolute"]) > :nth-child(n+6) { animation-delay: .4s; }
  @keyframes mo-rise { from { opacity: 0; transform: translateY(22px); } }

  /* ---------- Scroll reveal (classes set by motion.js on blocks that start below the fold) ---------- */
  .mo-rv { opacity: 0; transform: translateY(26px); }
  .mo-rv.mo-in {
    opacity: 1; transform: none;
    transition: opacity .75s ease var(--mo-d, 0s), transform .9s cubic-bezier(.2,.7,.2,1) var(--mo-d, 0s);
  }
  .mo-rv-img { opacity: 0; transform: scale(.97); }
  .mo-rv-img.mo-in { opacity: 1; transform: none; transition: opacity .9s ease var(--mo-d, 0s), transform 1.2s cubic-bezier(.2,.7,.2,1) var(--mo-d, 0s); }

  /* ---------- Header: lifts off the page once you scroll ---------- */
  header { transition: box-shadow .3s ease, background-color .3s ease; }
  header.mo-scrolled { box-shadow: 0 10px 30px -22px rgba(16,35,61,.45); }

  /* ---------- Main menu: underline slides in on hover ---------- */
  .nav-link::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: #3D8FE8;
    transform: scaleX(0); transform-origin: right; transition: transform .35s cubic-bezier(.2,.7,.2,1);
  }
  .nav-link:hover::after { transform: scaleX(1); transform-origin: left; }
  .nav-link[aria-current]::after { display: none; }

  /* ---------- Links and buttons: arrows nudge forward, buttons press ---------- */
  a:not(.wa-float) [aria-hidden="true"]:last-child, a .tx-sky, a .tx-sky-l { display: inline-block; transition: transform .3s cubic-bezier(.2,.7,.2,1); }
  a:not(.wa-float):hover [aria-hidden="true"]:last-child, a:hover .tx-sky, a:hover .tx-sky-l { transform: translateX(4px); }
  a[class^="hv"]:active, a[class*=" hv"]:active, button:active { transform: translateY(1px) scale(.985); }

  /* ---------- Cards: photos zoom slowly inside their frame ---------- */
  a [style*="overflow:hidden"] > img { transition: transform .9s cubic-bezier(.2,.7,.2,1); }
  a:hover [style*="overflow:hidden"] > img, a:focus-visible [style*="overflow:hidden"] > img { transform: scale(1.045); }
  .art-card:hover .art-card-img img, .art-featured:hover .art-featured-img img { transform: scale(1.045); }

  /* ---------- Logos: from muted to full colour on hover ---------- */
  .logo-slot img, .logo-cell img { transition: transform .3s ease, filter .3s ease, opacity .3s ease; }
  .logo-slot:hover img, .logo-cell:hover img { transform: scale(1.06); opacity: 1 !important; }

  /* ---------- FAQ and other open/close blocks ---------- */
  details[open] > :not(summary) { animation: mo-drop .4s cubic-bezier(.2,.7,.2,1) backwards; }
  @keyframes mo-drop { from { opacity: 0; transform: translateY(-6px); } }

  /* ---------- Mobile menu slides down ---------- */
  .mobile-menu:not([hidden]) { animation: mo-menu .32s cubic-bezier(.2,.7,.2,1) backwards; }
  .mobile-menu:not([hidden]) .mm-link { animation: mo-rise .5s cubic-bezier(.2,.7,.2,1) backwards; }
  .mobile-menu:not([hidden]) .mm-link:nth-child(2) { animation-delay: .04s; }
  .mobile-menu:not([hidden]) .mm-link:nth-child(3) { animation-delay: .08s; }
  .mobile-menu:not([hidden]) .mm-link:nth-child(4) { animation-delay: .12s; }
  .mobile-menu:not([hidden]) .mm-link:nth-child(5) { animation-delay: .16s; }
  .mobile-menu:not([hidden]) .mm-link:nth-child(6) { animation-delay: .2s; }
  .mobile-menu:not([hidden]) .mm-link:nth-child(n+7) { animation-delay: .24s; }
  @keyframes mo-menu { from { opacity: 0; transform: translateY(-8px); } }

  /* ---------- Floating WhatsApp button: arrives after the page, lifts on hover ---------- */
  .wa-float { animation: mo-wa .6s cubic-bezier(.2,.7,.2,1) 1.2s backwards; }
  .wa-float:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(16,35,61,.35) !important; }
  .wa-float svg { transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
  .wa-float:hover svg { transform: rotate(-12deg) scale(1.12); }
  @keyframes mo-wa { from { opacity: 0; transform: translateY(24px); } }

  /* ---------- Article pages: reading progress bar ---------- */
  .mo-progress { position: fixed; left: 0; top: 0; z-index: 70; width: 100%; height: 3px; background: #3D8FE8; transform: scaleX(0); transform-origin: left; pointer-events: none; }
}
