/* Lightswind Ripple Button and Border Beam. Original registry sources are
   credited in support-motion-notices.txt. Both effects run locally in CSS. */
:is(button.btn.blue, button.button.primary):not(.slide-arrow, .hold-button) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  /* Five circles use the original Ripple Button offsets. One paint layer
     keeps existing button icons, labels and accessible names intact. */
  :is(button.btn.blue, button.button.primary):not(.slide-arrow, .hold-button)::after {
    --circle: radial-gradient(closest-side, #125fad 96%, transparent);
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background-image: var(--circle), var(--circle), var(--circle), var(--circle), var(--circle);
    background-repeat: no-repeat;
    background-size: 30px 30px;
    background-position:
      calc(50% - 3.3em) calc(50% - 4em), calc(50% - 6em) calc(50% + 1.3em),
      calc(50% - .2em) calc(50% + 1.8em), calc(50% + 3.5em) calc(50% + 1.4em),
      calc(50% + 3.5em) calc(50% - 3.8em);
    opacity: 0;
    transition: background-size .6s ease, background-position .6s ease, opacity .28s ease;
  }

  :is(button.btn.blue, button.button.primary):not(.slide-arrow, .hold-button, :disabled, [aria-disabled="true"]):is(:focus-visible, :active)::after {
    background-size: max(120px, 120%) 420%;
    background-position: center;
    opacity: 1;
  }
  @media (hover: hover) {
    :is(button.btn.blue, button.button.primary):not(.slide-arrow, .hold-button, :disabled, [aria-disabled="true"]):hover::after {
      background-size: max(120px, 120%) 420%;
      background-position: center;
      opacity: 1;
    }
  }
  .support-portal button.button.primary:not(.slide-arrow)::before { content: none; }
}

.lw-search { position: relative; }
.lw-search.table-search { border-radius: 12px; }
.lw-beam { display: none; }

@supports (offset-path: inset(0 round 12px)) and (mask-composite: exclude) {
  @media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
    .lw-search:focus-within > .lw-beam {
      display: block;
      position: absolute;
      inset: 0;
      z-index: 1;
      padding: 2px;
      border-radius: inherit;
      pointer-events: none;
      mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
      mask-composite: exclude;
    }
    .lw-search:focus-within > .lw-beam::after {
      content: "";
      position: absolute;
      width: clamp(70px, 20%, 150px);
      aspect-ratio: 1;
      background: linear-gradient(to left, #1574d4, #64b7ff, transparent);
      offset-path: inset(0 round 12px);
      animation: lw-border-beam 3s linear infinite;
    }
  }
}
@keyframes lw-border-beam { from { offset-distance: 0%; } to { offset-distance: 100%; } }

/* Gradient Bars: bottom-origin wave with a V-shaped envelope, behind login. */
.web-entry { position: relative; isolation: isolate; }
.lw-bars {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  display: flex; align-items: flex-end; gap: clamp(2px, .35vw, 6px);
  pointer-events: none;
}
.lw-bars i {
  flex: 1; border-radius: 12px 12px 0 0; transform-origin: bottom;
  background: linear-gradient(0deg, #76b2ed55, #a5e2d855 68%, #cee9ff36);
}
@media (prefers-reduced-motion: no-preference) {
  .lw-bars i { animation: lw-bars-wave 3.4s ease-in-out infinite alternate; }
  @keyframes lw-bars-wave {
    0% { transform: scaleY(.85); opacity: .8; }
    50% { transform: scaleY(1.12); opacity: 1; }
    100% { transform: scaleY(.9); opacity: .85; }
  }
}

/* Glass Folder: three document planes and a hinged translucent front. */
.lw-folder {
  position: relative; flex: 0 0 29px; width: 29px; height: 21px;
  margin-block: 4px; background: #3685bf; border-radius: 3px 4px 4px 4px;
  perspective: 80px; transform-style: preserve-3d;
}
.document-type-group > summary > span.lw-folder { flex: 0 0 29px; }
.document-type-group > summary > .lw-folder + span { flex: 1; min-width: 0; }
.lw-folder::before {
  content: ''; position: absolute; bottom: 96%; left: 0;
  width: 45%; height: 3px; border-radius: 3px 3px 0 0; background: inherit;
}
.lw-folder i, .lw-folder b {
  position: absolute; inset: 2px 2px 0; transform-origin: bottom;
  border: 1px solid #aacedf; border-radius: 3px; background: #f0f8ff;
}
.lw-folder i:nth-child(2) { inset-block-start: 4px; }
.lw-folder i:nth-child(3) { inset-block-start: 6px; }
.lw-folder b { inset: 3px -1px 0; background: linear-gradient(145deg,#79c9eac9,#3f97cec9); border-color: #589fc8; }
.document-type-group[open] > summary .lw-folder i:nth-child(1) { transform: rotateX(-20deg); }
.document-type-group[open] > summary .lw-folder i:nth-child(2) { transform: rotateX(-30deg); }
.document-type-group[open] > summary .lw-folder i:nth-child(3) { transform: rotateX(-38deg); }
.document-type-group[open] > summary .lw-folder b { transform: rotateX(-46deg) translateY(1px); }
@media (prefers-reduced-motion: no-preference) {
  .lw-folder > * { transition: transform .36s cubic-bezier(.22,1,.36,1); }
}

/* Animated Copy Button: copy/check spring and the post-success pulse. */
.lw-copy {
  display: inline-grid; place-items: center; position: relative; flex: none;
  width: 32px; height: 32px; padding: 0; border: 1px solid #abc8d4;
  border-radius: 9px; color: #486679; background: #ffffffbd; cursor: pointer;
}
.lw-copy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lw-copy svg > * { transform-box: fill-box; transform-origin: center; }
.lw-copy-check { opacity: 0; transform: scale(.5) rotate(-45deg); }
.lw-copy.is-copied { color: #147657; border-color: #83c9af; }
.lw-copy.is-copied .lw-copy-sheets { opacity: 0; transform: scale(.5); }
.lw-copy.is-copied .lw-copy-check { opacity: 1; transform: none; }
.lw-copy-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (prefers-reduced-motion: no-preference) {
  .lw-copy svg > * { transition: transform .32s cubic-bezier(.22,1.35,.35,1), opacity .18s ease; }
  .lw-copy.is-copied::after {
    content: ''; position: absolute; inset: 2px; border-radius: inherit;
    pointer-events: none; background: #35bd8e42; animation: lw-copy-pulse .5s ease-out both;
  }
  @keyframes lw-copy-pulse { from { opacity: .5; transform: scale(1); } to { opacity: 0; transform: scale(1.8); } }

  /* Animated Notification: new discussion entries settle after persistence. */
  .support-portal .task-chat-message.message-arrived {
    animation: lw-notification-arrival .48s cubic-bezier(.22,1,.36,1) both;
  }
  @keyframes lw-notification-arrival {
    from { opacity: 0; transform: translateY(20px) scale(.94); filter: blur(4px); }
    to { opacity: 1; transform: none; filter: none; }
  }
}
