/* HELIS depth and motion layer. Loads after the interface styles and only adds
   paint (light, shadow) and compositor work (transform, opacity) — nothing here
   animates layout. Scroll-linked effects use CSS scroll timelines where the
   browser has them; js/motion.js covers the rest. With "reduce motion" the
   depth stays and every movement is dropped. */

@property --spot-a { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --mx { syntax: '<length-percentage>'; inherits: false; initial-value: 50%; }
@property --my { syntax: '<length-percentage>'; inherits: false; initial-value: 0%; }
@property --mo-i { syntax: '<number>'; inherits: false; initial-value: 0; }

body.helis-shell {
  --ease-out: cubic-bezier(.22,.8,.24,1);
  --edge-light: inset 0 1px 0 rgba(255,255,255,.05);
  --float-shadow: 0 18px 32px -26px rgba(0,0,0,.95);
  --lift-glow: 0 24px 46px -24px rgba(131,112,237,.62);
  --top-light: linear-gradient(180deg, rgba(255,255,255,.032), rgba(255,255,255,0) 44%);
  --spot-light: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), rgb(168 150 255 / calc(var(--spot-a, 0) * .2)), transparent 64%);
}

/* Ambient light behind the content: one fixed layer, never repainted on scroll. */
body.helis-shell::before {
  content: ""; display: block; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 1;
  background:
    radial-gradient(880px 520px at 92% -6%, rgba(131,112,237,.15), transparent 64%),
    radial-gradient(760px 520px at 18% 112%, rgba(88,120,255,.07), transparent 62%);
  -webkit-mask-image: none; mask-image: none;
}

/* Reading progress. */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 70; pointer-events: none;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, #6a55d8, #9a87fa 60%, #cfc6ff);
  box-shadow: 0 0 8px rgba(150,132,255,.55);
}
@keyframes mo-progress { to { transform: scaleX(1); } }
@supports (animation-timeline: scroll()) {
  .scroll-progress { animation: mo-progress linear both; animation-timeline: scroll(root block); }
}

/* Header: lifts off the page once it is scrolled. */
@media (min-width: 1001px) {
  body.helis-shell > .topbar { transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease; }
  body.helis-shell.is-scrolled > .topbar {
    background: rgba(16,18,28,.82); border-bottom-color: rgba(131,112,237,.3);
    box-shadow: 0 14px 34px -18px rgba(0,0,0,.85);
    -webkit-backdrop-filter: blur(14px) saturate(1.35); backdrop-filter: blur(14px) saturate(1.35);
  }
  html.motion-lite body.helis-shell.is-scrolled > .topbar { background: var(--bg-2); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
body.helis-shell .brand-logo { transition: transform .45s var(--ease-out); }
body.helis-shell .brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }

/* Sidebar: the current section is a lit pill; icons lean towards the pointer. */
body.helis-shell :is(.sidebar-links, .sidebar-bottom) a { position: relative; isolation: isolate; transition: color .18s ease, background-color .18s ease; }
body.helis-shell .sidebar-links a > :is(.ico, .nav-ico) { transition: transform .28s var(--ease-out); }
body.helis-shell .sidebar-links a:hover > :is(.ico, .nav-ico) { transform: translateX(2px) scale(1.08); }
body.helis-shell .sidebar-links a:is(.active, [aria-current="page"]) { background: none; color: #cfc6ff; }
body.helis-shell .sidebar-links a:is(.active, [aria-current="page"])::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: linear-gradient(90deg, rgba(131,112,237,.27), rgba(131,112,237,.07));
  box-shadow: inset 3px 0 0 #a996ff, inset 0 0 0 1px rgba(131,112,237,.18);
}

/* Surfaces: light from above and a soft drop, so panels read as raised. */
body.helis-shell :is(.card, .guild-card, .calm-card, .table-wrap, .profile-mini-card, .server-profile-panel, .sync-panel,
    .ab-hl, .ab-card, .ab-cta, .tm-pod, .tm-row, .club-me, .club-tier, .club-row, .gw-card, .gw-history-row, .cg-card,
    .sec-card, .sec-info, .rd-card, .unlock-card, .me-loyalty-card, .me-referral-stat, .mt-card, .an-trend) {
  background-image: var(--top-light);
  box-shadow: var(--edge-light), var(--float-shadow);
}
/* Compact cards also catch a light that follows the pointer (--mx/--my come from motion.js). */
body.helis-shell :is(.card-link, .guild-card, .shop-card, .ab-card, .ab-hl, .gw-card, .cg-card, .tm-pod, .club-tier) {
  background-image: var(--spot-light), var(--top-light);
  transition: transform .3s var(--ease-out), border-color .2s ease, box-shadow .3s ease, --spot-a .4s ease;
}
body.helis-shell :is(.card-link, .guild-card, .shop-card, .ab-card, .ab-hl, .gw-card, .cg-card, .tm-pod, .club-tier):hover {
  --spot-a: 1; transform: none; border-color: rgba(160,142,255,.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--float-shadow);
}
body.helis-shell .shop-card:hover { box-shadow: inset 0 0 0 1px rgba(160,142,255,.5), inset 0 1px 0 rgba(255,255,255,.08); }
/* Only what can be clicked lifts. */
body.helis-shell :is(.card-link, a.guild-card):hover {
  transform: translate3d(0, -4px, 0); border-color: rgba(160,142,255,.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), var(--lift-glow), 0 16px 30px -22px #000;
}
body.helis-shell :is(.card-link, a.guild-card):active { transform: translate3d(0, -1px, 0); transition-duration: .08s; }
body.helis-shell .guild-cover { transition: transform .7s var(--ease-out); }
body.helis-shell a.guild-card:hover .guild-cover { transform: scale(1.05); }
body.helis-shell .tile .tile-ico { align-self: flex-start; display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--border); border-radius: 12px; font-size: 22px; transition: transform .35s var(--ease-out); }
body.helis-shell .tile:hover .tile-ico { transform: translate3d(0, -2px, 0) scale(1.06); }
body.helis-shell .stat .num.accent {
  align-self: flex-start; color: transparent; -webkit-text-fill-color: transparent;
  background: linear-gradient(100deg, #d6ceff, #8f7cf3 62%); -webkit-background-clip: text; background-clip: text;
}

/* Buttons press like physical keys. */
body.helis-shell .btn { transition: transform .18s var(--ease-out), background-color .18s ease, border-color .18s ease, box-shadow .22s ease; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
body.helis-shell .btn:not(:disabled):hover { transform: translate3d(0, -1px, 0); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 10px 18px -12px rgba(0,0,0,.9); }
body.helis-shell .btn:not(:disabled):active { transform: scale(.98); transition-duration: .06s; }
body.helis-shell .btn-primary { background-image: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0)); box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 10px 22px -12px rgba(131,112,237,.9); }
body.helis-shell .btn-primary:not(:disabled):hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 14px 28px -12px rgba(131,112,237,1); }
body.helis-shell tbody td { transition: background-color .12s ease; }
body.helis-shell tbody tr:hover > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* Hero banners: drifting light, the banner's dot grid and a floating emblem. */
body.helis-shell :is(.helis-welcome, .ab-hero, .tm-hero, .club-hero) {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(118deg, #2c2552 0%, #201c3a 48%, #17162a 100%);
  border-color: #453a73;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 34px 60px -44px rgba(131,112,237,.7);
}
body.helis-shell :is(.helis-welcome, .ab-hero, .tm-hero, .club-hero)::before {
  content: ""; position: absolute; z-index: -1; inset: -60% -8% -60% 34%; pointer-events: none;
  background:
    radial-gradient(closest-side at 34% 52%, rgba(152,124,255,.42), transparent),
    radial-gradient(closest-side at 76% 40%, rgba(84,134,255,.24), transparent);
}
body.helis-shell :is(.helis-welcome, .ab-hero, .tm-hero, .club-hero)::after {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(rgba(200,188,255,.26) 1px, transparent 1.5px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(100deg, transparent 42%, #000 100%); mask-image: linear-gradient(100deg, transparent 42%, #000 100%);
}
body.helis-shell .welcome-emblem {
  color: transparent; -webkit-text-fill-color: transparent; opacity: .92;
  background: linear-gradient(165deg, #e2dcff 0%, #9b88f7 38%, #54469c 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 16px 26px rgba(98,78,214,.55));
}
body.helis-shell .welcome-emblem small { color: #b3a6ea; -webkit-text-fill-color: #b3a6ea; }

@keyframes mo-rise { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
@keyframes mo-reveal { from { opacity: 0; transform: translate3d(0, 28px, 0) scale(.985); } }
@keyframes mo-drop { from { opacity: 0; transform: translate3d(0, -12px, 0); } }
@keyframes mo-fade { from { opacity: 0; } }
@keyframes mo-pop { from { opacity: 0; transform: translate3d(0, -6px, 0) scale(.98); } }
@keyframes mo-dialog { from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.97); } }
@keyframes mo-card { from { opacity: 0; transform: translate3d(26px, 0, 0); } }
@keyframes mo-aurora { from { transform: translate3d(-6%, 4%, 0) rotate(-4deg); } to { transform: translate3d(6%, -5%, 0) rotate(5deg) scale(1.12); } }
@keyframes mo-emblem { from { transform: translate3d(0, 46px, 0) rotate(-11deg); } to { transform: translate3d(0, -46px, 0) rotate(-4deg); } }
@keyframes mo-char-scroll { to { transform: translate3d(0, 60px, 0); } }
@keyframes mo-vt-out { to { opacity: 0; } }
@keyframes mo-vt-in { from { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  /* Page load: blocks rise one after another. Only "from" is keyed and nothing
     is held afterwards, so hover transforms keep working once it has played. */
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > :nth-child(-n+10):not(.flashes, .registration-page, .ab-wrap, .tm-wrap, .club-wrap, .profile-page, .grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers, dialog, script, style),
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(-n+12) {
    animation: mo-rise .62s var(--ease-out) backwards;
    animation-delay: calc(var(--mo-d, 0ms) + var(--mo-i, 0) * 45ms);
  }
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > * { --mo-d: 0ms; }
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > :nth-child(2) { --mo-d: 55ms; }
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > :nth-child(3) { --mo-d: 110ms; }
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > :nth-child(4) { --mo-d: 165ms; }
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > :nth-child(5) { --mo-d: 220ms; }
  body.helis-shell :is(.container, .ab-wrap, .tm-wrap, .club-wrap, .profile-page) > :nth-child(n+6) { --mo-d: 275ms; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(1) { --mo-i: 1; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(2) { --mo-i: 2; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(3) { --mo-i: 3; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(4) { --mo-i: 4; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(5) { --mo-i: 5; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(6) { --mo-i: 6; }
  body.helis-shell :is(.grid, .guild-grid, .ab-grid, .ab-highlights, .gw-grid, .cg-grid, .tm-list, .club-tiers) > :nth-child(n+7) { --mo-i: 7; }

  /* Scroll reveal. motion.js marks blocks that start below the fold (.rv) and
     releases them as they come into view (.rv-in). Outside this media query the
     classes do nothing, so content can never stay hidden. */
  body.helis-shell .rv:not(.rv-in) { opacity: 0 !important; animation: none !important; }
  body.helis-shell .rv.rv-in { animation: mo-reveal .72s var(--ease-out) var(--rv-d, 0ms) backwards !important; }

  body.helis-shell :is(.helis-welcome, .ab-hero, .tm-hero, .club-hero)::before { animation: mo-aurora 18s ease-in-out infinite alternate; }
  body.helis-shell :is(.helis-welcome, .ab-hero, .tm-hero, .club-hero).mo-paused::before,
  html.motion-lite body.helis-shell :is(.helis-welcome, .ab-hero, .tm-hero, .club-hero)::before { animation-play-state: paused; }
  /* The emblem follows the banner's own passage through the window. A plain
     view() would latch onto the banner itself (overflow: hidden makes it a
     scroll container that never scrolls), so the banner names the timeline. */
  @supports (animation-timeline: view()) {
    body.helis-shell .helis-welcome { view-timeline: --helis-banner block; }
    body.helis-shell .welcome-emblem { animation: mo-emblem linear both; animation-timeline: --helis-banner; animation-range: cover 0% cover 100%; }
  }

  /* A transition name must be unique on the page, and the admin pages light a
     link in two menus at once — so only the first menu's pill travels. */
  body.helis-shell .sidebar-content > nav:first-of-type a:is(.active, [aria-current="page"])::before { view-transition-name: helis-nav-pill; }
  body.helis-shell dialog[open] { animation: mo-dialog .24s var(--ease-out); }
  body.helis-shell dialog[open]::backdrop { animation: mo-fade .2s ease; }
  body.helis-shell .rs-panel:not([hidden]) { animation: mo-pop .16s var(--ease-out); }

  /* Page-to-page: the content cross-fades while the header and the sidebar stay
     put and the current-section pill slides to its new place. Browsers without
     cross-document view transitions simply navigate as before. The opt-in
     (@view-transition) is inline in base.html: it is read while <body> is being
     parsed, before this file is guaranteed to have arrived. */
  body.helis-shell > .topbar { view-transition-name: helis-topbar; }
  body.helis-shell > .app-sidebar { view-transition-name: helis-sidebar; }
  ::view-transition-old(root) { animation: mo-vt-out .16s ease both; }
  ::view-transition-new(root) { animation: mo-vt-in .26s ease both; }
  ::view-transition-group(helis-topbar) { z-index: 3; }
  ::view-transition-group(helis-nav-pill) { z-index: 2; animation-duration: .34s; animation-timing-function: cubic-bezier(.3,.9,.3,1); }
  ::view-transition-old(helis-topbar), ::view-transition-new(helis-topbar),
  ::view-transition-old(helis-sidebar), ::view-transition-new(helis-sidebar) { animation-duration: .16s; }

  /* Sign-in screen: one staged entrance, then the scene answers the pointer. */
  .registration-page .registration-header { animation: mo-drop .6s var(--ease-out) backwards; }
  .registration-page .registration-intro > * { animation: mo-rise .7s var(--ease-out) backwards; }
  .registration-page .registration-intro > :nth-child(1) { animation-delay: .08s; }
  .registration-page .registration-intro > :nth-child(2) { animation-delay: .16s; }
  .registration-page .registration-intro > :nth-child(3) { animation-delay: .27s; }
  .registration-page .registration-intro > :nth-child(4) { animation-delay: .36s; }
  .registration-page .registration-intro > :nth-child(5) { animation-delay: .46s; }
  .registration-page .registration-card { animation: mo-card .8s var(--ease-out) .18s backwards; }
  .registration-page .registration-steps li { animation: mo-rise .55s var(--ease-out) backwards; }
  .registration-page .registration-steps li:nth-child(1) { animation-delay: .5s; }
  .registration-page .registration-steps li:nth-child(2) { animation-delay: .58s; }
  .registration-page .registration-steps li:nth-child(3) { animation-delay: .66s; }
  .registration-page .registration-character { animation: mo-fade 1.4s ease .1s backwards; translate: calc(var(--px, 0) * -18px) calc(var(--py, 0) * -10px); transition: translate .7s var(--ease-out); }
  .registration-page .registration-background { scale: 1.05; translate: calc(var(--px, 0) * 10px) calc(var(--py, 0) * 8px); transition: translate .9s var(--ease-out); }
  @supports (animation-timeline: scroll()) {
    .registration-page .registration-character { animation: mo-fade 1.4s ease .1s backwards, mo-char-scroll linear both; animation-timeline: auto, scroll(root block); }
  }
}
.registration-page .registration-card {
  background-image: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgb(168 150 255 / calc(var(--spot-a, 0) * .13)), transparent 62%), linear-gradient(145deg, #201e32ed, #13141ff5 60%);
  transition: --spot-a .5s ease;
}
.registration-page .registration-card:hover { --spot-a: 1; }
.registration-page .registration-button-arrow { transition: transform .25s var(--ease-out, ease); }
.registration-page .registration-discord:hover .registration-button-arrow { transform: translateX(5px); }

@media print {
  .scroll-progress { display: none; }
  body.helis-shell .rv { opacity: 1 !important; animation: none !important; }
}
