/* 强制显示滚动条，避免加载后突兀出现 */
html {
  overflow-y: scroll; /* 始终显示垂直滚动条槽位 */
}

body {
  overflow-x: hidden; /* 隐藏水平滚动条 */
}

/* 进度条  */
.progress-bar {
  position: fixed;
  bottom: 5px;
  left: 0;
  width: 100%;
  height: 8px;
  background: transparent;
  z-index: 9999;
  overflow: visible !important;
  border-radius: 999px;
  /* box-shadow: inset 0 1px 2px rgba(0,0,0,0.12); */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.progress-bar.loaded {
  opacity: 1;
  visibility: visible;
}

.progress-bar span {
  display: block;
  height: 100%;
  /* red fill with subtle gradient + moving sheen stripes */
  background-color: #c4e380;
  background-size: 40px 100%, 100% 100%;
  background-position: 0 0, 0 0;
  width: 0%;
  position: relative; /* 设置相对定位 */
  border-radius: 999px;
  animation: progressStripes 3s linear infinite;
}



.progress-bar span::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -26px;
  transform: translateY(-90%);
  width: 60px;
  height: 70px;
  /* background: url(https://static.igem.wiki/teams/6029/common/process-bar.webp) no-repeat center center; */
  background-size: cover;
  transition: transform 0.2s ease-out;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
  animation: iconBob 2.4s ease-in-out infinite;
}

@keyframes progressStripes {
0% { background-position: 0 0, 0 0; }
100% { background-position: 40px 0, 0 0; }
}

@keyframes iconBob {
0%, 100% { transform: translateY(-84%); }
50% { transform: translateY(-90%); }
}

/* Reduced motion support for progress bar */
@media (prefers-reduced-motion: reduce) {
.progress-bar span { animation: none; }
.progress-bar span::after { animation: none; transition: none; }
}



/* 进度条 */
.diy-totop {
  position: fixed;
  right: 40px;
  bottom: 40px;
  transition: transform 0.25s ease, filter 0.25s ease;
  transform: translateY(0) rotate(0deg);
  width: 80px;
  z-index: 999999;
}
.diy-totop:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.18));
}
#totopLink {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* 页面未加载完成时，强制隐藏 */
body:not(.page-loaded) #totopLink {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* 页面加载完成后，根据滚动位置显示/隐藏 */
body.page-loaded #totopLink.diy-show {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1);
}

/* Gentle float animation when visible */
#totopLink.diy-show .diy-totop {
  /* animation: totopFloat 3s ease-in-out infinite, totopShadow 3s ease-in-out infinite; */
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.14));
}

@keyframes totopFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes totopShadow {
  0%, 100% { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.14)); }
  50% { filter: drop-shadow(0 5px 8px rgba(0,0,0,0.22)); }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #totopLink.diy-show .diy-totop { animation: none; }
  .diy-totop { transition: none; }
}