/* RAAS motion: page transitions, link and button animation, scroll reveal and 3D depth.
   Shared by the website and the Portal. Everything here switches off for people who ask for reduced motion. */

/* ---------- page to page: the header stays, the page glides in (browsers with cross-document View Transitions) ---------- */
@view-transition { navigation: auto; }
header.top { view-transition-name: raas-top; }
::view-transition-old(root) { animation: raas-out .22s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: raas-in .38s cubic-bezier(0, 0, .2, 1) both; }
@keyframes raas-out { to { opacity: 0; transform: translateY(-6px) scale(.995); filter: blur(2px); } }
@keyframes raas-in { from { opacity: 0; transform: translateY(14px) scale(.995); } }

/* ---------- links: a line that draws itself, arrows that lean forward ---------- */
.prose a, .app-main p a, .app-main li > a:not(.btn), .meta a, .hint a, .crumbs a, .small a {
  text-decoration: none; background-image: linear-gradient(currentColor, currentColor), linear-gradient(color-mix(in srgb, currentColor 28%, transparent), color-mix(in srgb, currentColor 28%, transparent));
  background-size: 0% 1.5px, 100% 1px; background-position: 0 100%, 0 100%; background-repeat: no-repeat; padding-bottom: 1px;
  transition: background-size .35s cubic-bezier(.2, .7, .2, 1), color .2s;
}
.prose a:hover, .app-main p a:hover, .app-main li > a:not(.btn):hover, .meta a:hover, .hint a:hover, .crumbs a:hover, .small a:hover,
.prose a:focus-visible, .app-main p a:focus-visible { background-size: 100% 1.5px, 100% 1px; }
/* Arrows at the end of a link ("All programmes →") are wrapped by motion.js and lean forward on hover. */
.arrow { display: inline-block; transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
a:hover > .arrow, a:focus-visible > .arrow { transform: translateX(5px); }
a:hover > .arrow-back, a:focus-visible > .arrow-back { transform: translateX(-5px); }
.nav > ul > li > a, .side a { position: relative; }
.nav > ul > li > a::before { content: ''; position: absolute; left: 12%; right: 12%; bottom: 2px; height: 2px; border-radius: 2px; background: var(--brass);
  transform: scaleX(0); transform-origin: left; transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.nav > ul > li > a:hover::before, .nav > ul > li > a[aria-current]::before { transform: scaleX(1); }
.side a { transition: transform .2s ease, background-color .2s ease, color .2s ease; }
.side a:hover { transform: translateX(4px); }
.side a[aria-current]::before { content: ''; position: absolute; left: -2px; top: 20%; bottom: 20%; width: 3px; border-radius: 3px; background: var(--brass); box-shadow: 0 0 10px var(--brass); }

/* ---------- buttons with weight: they lift, press and ripple ---------- */
.btn { position: relative; overflow: hidden; transform: translateZ(0); transition: transform .18s cubic-bezier(.2, .7, .2, 1), box-shadow .25s ease, background-color .2s, color .2s, border-color .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .55), 0 2px 0 -1px rgba(255, 255, 255, .06) inset; }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: 0 3px 8px -6px rgba(0, 0, 0, .6); transition-duration: .06s; }
.btn-primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 -2px 0 rgba(0, 0, 0, .18) inset, 0 6px 16px -10px var(--brass); }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 -2px 0 rgba(0, 0, 0, .18) inset, 0 14px 28px -12px var(--brass); }
.btn .ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%) scale(0); background: currentColor; opacity: .25; animation: raas-ripple .6s ease-out forwards; }
@keyframes raas-ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.btn-primary::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%); transform: translateX(-120%); transition: transform .7s ease; pointer-events: none; }
.btn-primary:hover::before { transform: translateX(120%); }

/* ---------- 3D tilt with a light that follows the pointer ---------- */
.tilt { transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease; will-change: transform; }
.tilt.tilting { transition: transform .08s linear, box-shadow .35s ease; box-shadow: 0 24px 40px -26px rgba(0, 0, 0, .6); }
.tilt-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .16), transparent 45%); mix-blend-mode: soft-light; }
.tilting .tilt-glare { opacity: 1; }

/* ---------- scroll reveal: panels rise into place, slightly rotated, one after another ---------- */
.js-motion .reveal { opacity: 0; transform: perspective(900px) translateY(22px) rotateX(7deg); transform-origin: 50% 100%;
  transition: opacity .6s cubic-bezier(.2, .7, .2, 1) var(--d, 0s), transform .7s cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
.js-motion .reveal.in { opacity: 1; transform: none; }

/* ---------- focus that is easy to see, and glides ---------- */
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; transition: outline-offset .15s ease; }
a:focus-visible, button:focus-visible { outline-offset: 4px; }

/* ---------- a soft progress bar while the next page loads ---------- */
.nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--brass), #ffd27a, var(--brass)); box-shadow: 0 0 10px var(--brass); }
.nav-progress.go { transition: transform 8s cubic-bezier(.1, .8, .2, 1); transform: scaleX(.9); }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .btn, .btn:hover, .btn:active, .tilt, .side a, .side a:hover { transform: none !important; transition: none !important; }
  .btn-primary::before, .btn .ripple, .nav-progress { display: none; }
  .js-motion .reveal { opacity: 1; transform: none; transition: none; }
}
