/* RAAS effects: ideas adapted from Magic UI (MIT, magicui.design) as plain CSS and JS, shared by the website and the
   Portal. Each effect is opt-in by class or data attribute, uses the theme's colours (--brass, --brass-2, --lapis),
   so it fits every theme, and switches off for people who ask for reduced motion.
   spotlight card · border beam · shine border · gradient text · shiny text · number ticker · word rotate ·
   blur fade · grid pattern (animated squares) · dot pattern · particles · meteors · orbiting circles · marquee ·
   ripple rings · scroll progress */

@property --fx-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* ---------- Spotlight card (Magic Card): a soft light follows the pointer across the card and its border ---------- */
.fx-spot { position: relative; isolation: isolate; }
.fx-spot::before, .fx-spot::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s ease; }
.fx-spot::before { z-index: -1; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--brass) 16%, transparent), transparent 70%); }
.fx-spot::after { padding: 1px; background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), var(--brass), color-mix(in srgb, var(--lapis, var(--brass)) 60%, transparent) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.fx-spot:hover::before, .fx-spot:hover::after, .fx-spot:focus-within::before, .fx-spot:focus-within::after { opacity: 1; }

/* ---------- Border beam: a short bright beam travels around the border ---------- */
.fx-beam { position: relative; }
.fx-beam::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--fx-angle), transparent 0 72%, var(--brass) 82%, var(--brass-2, #fff) 88%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: fx-spin var(--fx-beam-s, 7s) linear infinite; }
@keyframes fx-spin { to { --fx-angle: 360deg; } }

/* ---------- Shine border: a slow sheen of colour drifting round the edge ---------- */
.fx-shine { position: relative; }
.fx-shine::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; background-size: 300% 300%;
  background-image: radial-gradient(transparent, transparent, var(--brass), var(--lapis, var(--brass-2)), transparent, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: fx-shine 14s linear infinite; }
@keyframes fx-shine { 0% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } 100% { background-position: 0% 0%; } }

/* ---------- Gradient text and shiny text ---------- */
.fx-gradient { background: linear-gradient(100deg, var(--text) 0%, var(--brass) 35%, var(--lapis, var(--brass-2)) 60%, var(--text) 100%); background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: fx-pan 9s ease-in-out infinite alternate; }
@keyframes fx-pan { to { background-position: 100% center; } }
.fx-shiny { background: linear-gradient(110deg, var(--muted) 40%, var(--text) 50%, var(--muted) 60%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: fx-shimmer 3.2s linear infinite; }
@keyframes fx-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.fx-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface, var(--bg)) 80%, transparent); font-size: .82rem; font-weight: 600; letter-spacing: .02em; backdrop-filter: blur(6px); }
.fx-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 0 var(--brass); animation: fx-ping 2.4s ease-out infinite; }
@keyframes fx-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* ---------- Number ticker (the number is right without scripts; fx.js counts up to it) ---------- */
[data-ticker] { font-variant-numeric: tabular-nums; }

/* ---------- Word rotate ---------- */
.fx-words { display: inline-grid; vertical-align: bottom; }
.fx-words > span { grid-area: 1 / 1; transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1), filter .5s ease; }
.fx-words > span:not(.on) { opacity: 0; transform: translateY(.45em); filter: blur(6px); }

/* ---------- Blur fade (scroll reveal with focus) ---------- */
.js-fx .fx-blur { opacity: 0; filter: blur(10px); transform: translateY(14px); transition: opacity .7s ease var(--d, 0s), filter .7s ease var(--d, 0s), transform .7s cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
.js-fx .fx-blur.in { opacity: 1; filter: none; transform: none; }

/* ---------- Backgrounds: grid with lighting squares, dots, particles, meteors ---------- */
.fx-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.fx-grid { background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%); }
.fx-grid i { position: absolute; width: 43px; height: 43px; background: color-mix(in srgb, var(--brass) 22%, transparent); opacity: 0; transition: opacity 1.6s ease; }
.fx-grid i.on { opacity: 1; }
.fx-dots { background-image: radial-gradient(color-mix(in srgb, var(--text) 22%, transparent) 1px, transparent 1.2px); background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); }
canvas.fx-particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-meteors span { position: absolute; top: -10%; width: 2px; height: 2px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brass) 20%, transparent); transform: rotate(215deg); animation: fx-meteor linear infinite; }
.fx-meteors span::after { content: ''; position: absolute; top: 50%; width: 70px; height: 1px; transform: translateY(-50%); background: linear-gradient(90deg, var(--brass), transparent); }
@keyframes fx-meteor { 0% { transform: rotate(215deg) translateX(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: rotate(215deg) translateX(-700px); opacity: 0; } }

/* ---------- Orbiting circles ---------- */
.fx-orbit { position: relative; display: grid; place-items: center; aspect-ratio: 1; }
.fx-orbit .ring { position: absolute; inset: calc(50% - var(--r)); border-radius: 50%; border: 1px solid var(--line); }
.fx-orbit .sat { position: absolute; top: 50%; left: 50%; width: var(--s, 40px); height: var(--s, 40px); margin: calc(var(--s, 40px) / -2); display: grid; place-items: center; border-radius: 50%;
  background: var(--surface, var(--bg)); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .8rem; font-weight: 700; color: var(--text);
  transform: rotate(calc(var(--a) * 1deg)) translateY(calc(var(--r) * -1)) rotate(calc(var(--a) * -1deg));
  animation: fx-orbit var(--t, 24s) linear infinite; animation-delay: calc(var(--t, 24s) * var(--a) / -360); }
.fx-orbit .sat.rev { animation-direction: reverse; }
@keyframes fx-orbit { from { transform: rotate(0deg) translateY(calc(var(--r) * -1)) rotate(0deg); } to { transform: rotate(360deg) translateY(calc(var(--r) * -1)) rotate(-360deg); } }

/* ---------- Marquee ---------- */
.fx-marquee { --gap: 14px; display: flex; gap: var(--gap); overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.fx-marquee > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-shrink: 0; gap: var(--gap); min-width: 100%; justify-content: space-around; animation: fx-marquee var(--t, 40s) linear infinite; }
.fx-marquee:hover > ul { animation-play-state: paused; }
@keyframes fx-marquee { to { transform: translateX(calc(-100% - var(--gap))); } }

/* ---------- Ripple rings (behind a mark) ---------- */
.fx-ripple { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.fx-ripple i { position: absolute; width: var(--w); aspect-ratio: 1; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent); background: color-mix(in srgb, var(--brass) 4%, transparent); animation: fx-breathe 4s ease-in-out infinite; animation-delay: var(--dl); }
@keyframes fx-breathe { 50% { transform: scale(.94); } }

/* ---------- Scroll progress ---------- */
.fx-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 999; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--brass), var(--lapis, var(--brass-2))); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .fx-beam::after, .fx-shine::before, .fx-gradient, .fx-shiny, .fx-pill .dot, .fx-meteors span, .fx-orbit .sat, .fx-marquee > ul, .fx-ripple i { animation: none !important; }
  .fx-meteors { display: none; }
  .fx-shiny { color: var(--text); background: none; }
  .js-fx .fx-blur { opacity: 1; filter: none; transform: none; transition: none; }
  .fx-words > span:not(.on) { display: none; }
  .fx-progress { display: none; }
}
@media (forced-colors: active) { .fx-gradient, .fx-shiny { color: CanvasText; background: none; } .fx-spot::before, .fx-spot::after, .fx-beam::after, .fx-shine::before { display: none; } }
/* High-contrast themes are for legibility: no decorative backgrounds, beams or glows. */
:root[data-palette^="contrast"] .fx-bg, :root[data-palette^="contrast"] canvas.fx-particles, :root[data-palette^="contrast"] .fx-ripple, :root[data-palette^="contrast"] .fx-spot::before, :root[data-palette^="contrast"] .fx-spot::after, :root[data-palette^="contrast"] .fx-beam::after, :root[data-palette^="contrast"] .fx-shine::before, :root[data-palette^="contrast"] .side a[aria-current]::after { display: none; }
:root[data-palette^="contrast"] .fx-gradient { color: var(--brass); background: none; animation: none; }
