/* Magic UI Progressive Blur — viewport bottom fade while scrolling */

.progressive-blur-scroll {
  position: relative;
  overflow: hidden;
}

/* Fixed to bottom of screen — page scroll until footer */
.progressive-blur-viewport {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--pb-height, 160px);
  pointer-events: none;
  z-index: 35;
  opacity: var(--pb-opacity, 0);
  visibility: visible;
  will-change: opacity;
}

.progressive-blur-viewport.is-hidden {
  opacity: 0 !important;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.5s ease;
}

.progressive-blur {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
}

.progressive-blur-viewport > .progressive-blur,
.progressive-blur-scroll > .progressive-blur {
  inset: 0;
  bottom: auto;
  height: 100%;
  /* Master fade — blur dissolves in from the top edge */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 12%,
    rgba(0, 0, 0, 0.35) 38%,
    #000 72%,
    #000 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 12%,
    rgba(0, 0, 0, 0.35) 38%,
    #000 72%,
    #000 100%
  );
}

.progressive-blur--bottom {
  bottom: 0;
  height: var(--pb-height, 40%);
}

.progressive-blur--top {
  top: 0;
  height: var(--pb-height, 28%);
}

.progressive-blur__layer {
  position: absolute;
  inset: 0;
}

.progressive-blur--bottom .progressive-blur__layer:nth-child(1) {
  backdrop-filter: blur(0.5px);
  -webkit-backdrop-filter: blur(0.5px);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 28%, #000 62%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 28%, #000 62%);
}

.progressive-blur--bottom .progressive-blur__layer:nth-child(2) {
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 22%, #000 58%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 22%, #000 58%);
}

.progressive-blur--bottom .progressive-blur__layer:nth-child(3) {
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 18%, #000 54%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 18%, #000 54%);
}

.progressive-blur--bottom .progressive-blur__layer:nth-child(4) {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 14%, #000 50%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 14%, #000 50%);
}

.progressive-blur--bottom .progressive-blur__layer:nth-child(5) {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 10%, #000 46%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 10%, #000 46%);
}

.progressive-blur--bottom .progressive-blur__layer:nth-child(6) {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 6%, #000 42%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 6%, #000 42%);
}

.progressive-blur-scroll__viewport {
  max-height: var(--pbs-max-height, 420px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.progressive-blur-scroll__viewport::-webkit-scrollbar {
  width: 8px;
}

.progressive-blur-scroll__viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

html[data-theme="light"] .progressive-blur-scroll__viewport {
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

html[data-theme="light"] .progressive-blur-scroll__viewport::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  .progressive-blur-viewport {
    display: none;
  }
}
