/* OSANIME Modern Sticky Header + Back To Top v172
   Shared by guest/member headers. Keeps existing navigation/dropdowns intact. */

:root{
  --osanime-header-glass:rgba(5,10,23,.78);
  --osanime-header-glass-strong:rgba(5,10,23,.92);
  --osanime-header-line:rgba(255,255,255,.075);
  --osanime-header-pink:#ff4f93;
  --osanime-header-violet:#8b5cf6;
  --osanime-header-blue:#60a5fa;
  --osanime-header-shadow:0 18px 54px rgba(0,0,0,.38);
  --osanime-scroll-progress:0;
  --osanime-backtop-bottom:22px;
}

/* overflow:hidden on the shared .page used to trap position:sticky.
   overflow:clip keeps the visual clipping without creating a scroll container. */
body.index-php-page main.page{
  overflow:clip!important;
}

body.index-php-page .topbar.osanime-header{
  position:sticky!important;
  top:0!important;
  z-index:10020!important;
  overflow:visible!important;
  isolation:isolate;
  border-bottom:1px solid var(--osanime-header-line)!important;
  background:
    radial-gradient(circle at 15% -120%,rgba(255,79,147,.18),transparent 42%),
    radial-gradient(circle at 85% -140%,rgba(96,165,250,.14),transparent 40%),
    linear-gradient(180deg,rgba(5,10,23,.94),var(--osanime-header-glass))!important;
  -webkit-backdrop-filter:blur(18px) saturate(145%);
  backdrop-filter:blur(18px) saturate(145%);
  box-shadow:0 1px 0 rgba(255,255,255,.02) inset;
  transition:
    height .28s cubic-bezier(.2,.75,.25,1),
    padding .28s cubic-bezier(.2,.75,.25,1),
    background .28s ease,
    border-color .28s ease,
    box-shadow .28s ease!important;
  will-change:height,background,box-shadow;
}

/* Page reading progress line integrated into the sticky header. */
body.index-php-page .topbar.osanime-header::before{
  content:"";
  position:absolute;
  z-index:10025;
  left:0;
  right:0;
  bottom:-1px;
  height:2px;
  pointer-events:none;
  background:linear-gradient(90deg,var(--osanime-header-pink),#f472b6,var(--osanime-header-violet),var(--osanime-header-blue));
  box-shadow:0 0 14px rgba(255,79,147,.46);
  transform:scaleX(var(--osanime-scroll-progress));
  transform-origin:left center;
  transition:transform .08s linear;
}

body.index-php-page.osanime-header-scrolled .topbar.osanime-header{
  height:68px!important;
  border-bottom-color:rgba(255,79,147,.16)!important;
  background:
    radial-gradient(circle at 20% -160%,rgba(255,79,147,.22),transparent 45%),
    radial-gradient(circle at 84% -170%,rgba(99,102,241,.18),transparent 42%),
    linear-gradient(180deg,rgba(7,12,26,.94),rgba(5,10,23,.82))!important;
  -webkit-backdrop-filter:blur(24px) saturate(165%);
  backdrop-filter:blur(24px) saturate(165%);
  box-shadow:var(--osanime-header-shadow),0 1px 0 rgba(255,255,255,.04) inset!important;
}

/* Make existing header controls feel like one modern system. */
body.index-php-page .topbar.osanime-header .site-brand,
body.index-php-page .topbar.osanime-header>.logo{
  transition:transform .28s cubic-bezier(.2,.75,.25,1),opacity .2s ease!important;
  transform-origin:left center;
}
body.index-php-page.osanime-header-scrolled .topbar.osanime-header .site-brand,
body.index-php-page.osanime-header-scrolled .topbar.osanime-header>.logo{
  transform:scale(.94);
}

body.index-php-page .topbar.osanime-header .site-nav>a,
body.index-php-page .topbar.osanime-header .site-nav-dropdown>button,
body.index-php-page .topbar.osanime-header .nav>a,
body.index-php-page .topbar.osanime-header .nav-dropdown>button{
  position:relative;
  border-radius:10px!important;
  transition:background .18s ease,color .18s ease,transform .18s ease,border-color .18s ease!important;
}
body.index-php-page .topbar.osanime-header .site-nav>a:hover,
body.index-php-page .topbar.osanime-header .site-nav-dropdown>button:hover,
body.index-php-page .topbar.osanime-header .nav>a:hover,
body.index-php-page .topbar.osanime-header .nav-dropdown>button:hover{
  background:rgba(255,255,255,.055)!important;
  color:#fff!important;
  transform:translateY(-1px);
}
body.index-php-page .topbar.osanime-header .site-nav>a.active,
body.index-php-page .topbar.osanime-header .nav>a.active{
  background:linear-gradient(135deg,rgba(255,79,147,.14),rgba(139,92,246,.10))!important;
  box-shadow:0 0 0 1px rgba(255,79,147,.12) inset;
}

body.index-php-page .topbar.osanime-header .site-search,
body.index-php-page .topbar.osanime-header>.search{
  border-color:rgba(255,255,255,.12)!important;
  background:rgba(7,16,32,.55)!important;
  box-shadow:0 8px 24px rgba(0,0,0,.12) inset,0 1px 0 rgba(255,255,255,.025)!important;
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
  transition:border-color .2s ease,background .2s ease,box-shadow .2s ease!important;
}
body.index-php-page .topbar.osanime-header .site-search:focus-within,
body.index-php-page .topbar.osanime-header>.search:focus-within{
  border-color:rgba(255,79,147,.5)!important;
  background:rgba(10,20,39,.86)!important;
  box-shadow:0 0 0 3px rgba(255,79,147,.08),0 12px 34px rgba(0,0,0,.20)!important;
}

body.index-php-page .topbar.osanime-header .hamb,
body.index-php-page .topbar.osanime-header .mobile-search,
body.index-php-page .topbar.osanime-header .mobile-notification-toggle,
body.index-php-page .topbar.osanime-header .mobile-user-avatar{
  border:1px solid rgba(255,255,255,.09)!important;
  background:rgba(255,255,255,.045)!important;
  box-shadow:0 8px 24px rgba(0,0,0,.16),0 1px 0 rgba(255,255,255,.04) inset!important;
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
  transition:transform .18s ease,background .18s ease,border-color .18s ease,box-shadow .18s ease!important;
}
body.index-php-page .topbar.osanime-header .hamb:hover,
body.index-php-page .topbar.osanime-header .mobile-search:hover,
body.index-php-page .topbar.osanime-header .mobile-notification-toggle:hover,
body.index-php-page .topbar.osanime-header .mobile-user-avatar:hover{
  transform:translateY(-1px);
  background:rgba(255,79,147,.10)!important;
  border-color:rgba(255,79,147,.30)!important;
  box-shadow:0 10px 28px rgba(0,0,0,.22),0 0 0 3px rgba(255,79,147,.05)!important;
}

body.index-php-page .topbar.osanime-header .site-auth-actions .btn,
body.index-php-page .topbar.osanime-header .guest-auth-actions .btn,
body.index-php-page .topbar.osanime-header .user-menu-toggle,
body.index-php-page .topbar.osanime-header .pm-header-message-button{
  transition:transform .18s ease,border-color .18s ease,background .18s ease,box-shadow .18s ease!important;
}
body.index-php-page .topbar.osanime-header .site-auth-actions .btn:hover,
body.index-php-page .topbar.osanime-header .guest-auth-actions .btn:hover,
body.index-php-page .topbar.osanime-header .user-menu-toggle:hover,
body.index-php-page .topbar.osanime-header .pm-header-message-button:hover{
  transform:translateY(-1px);
}

/* Dropdowns stay attached to the compact sticky header instead of using a stale pixel offset. */
body.index-php-page .topbar.osanime-header.search-open .site-search,
body.index-php-page .topbar.osanime-header.search-open>.search{
  top:calc(100% + 8px)!important;
}

/* Back to top ------------------------------------------------------------ */
.osanime-back-to-top{
  position:fixed;
  z-index:9990;
  right:clamp(14px,2.2vw,30px);
  bottom:calc(var(--osanime-backtop-bottom) + env(safe-area-inset-bottom,0px));
  width:56px;
  height:56px;
  display:grid;
  place-items:center;
  padding:0;
  border:0;
  border-radius:18px;
  color:#fff;
  background:
    radial-gradient(circle at 30% 20%,rgba(255,255,255,.16),transparent 32%),
    linear-gradient(145deg,rgba(16,28,49,.94),rgba(7,14,28,.94));
  box-shadow:0 18px 48px rgba(0,0,0,.42),0 0 0 1px rgba(255,255,255,.09) inset,0 0 24px rgba(255,79,147,.10);
  -webkit-backdrop-filter:blur(16px) saturate(145%);
  backdrop-filter:blur(16px) saturate(145%);
  cursor:pointer;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(18px) scale(.82) rotate(6deg);
  transition:opacity .22s ease,visibility .22s ease,transform .34s cubic-bezier(.18,.9,.25,1.15),bottom .24s ease,box-shadow .2s ease!important;
}
.osanime-back-to-top::before{
  content:"";
  position:absolute;
  inset:7px;
  border-radius:13px;
  background:linear-gradient(145deg,rgba(255,79,147,.13),rgba(139,92,246,.07));
  opacity:.88;
  pointer-events:none;
}
.osanime-back-to-top::after{
  content:"";
  position:absolute;
  width:24px;
  height:70px;
  top:-12px;
  left:-18px;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.24),transparent);
  transform:rotate(28deg);
  opacity:0;
  pointer-events:none;
}
.osanime-back-to-top.is-visible{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0) scale(1) rotate(0);
}
.osanime-back-to-top.is-visible:hover{
  transform:translateY(-4px) scale(1.035);
  box-shadow:0 22px 58px rgba(0,0,0,.48),0 0 0 1px rgba(255,79,147,.26) inset,0 0 34px rgba(255,79,147,.16);
}
.osanime-back-to-top.is-visible:hover::after{
  opacity:1;
  animation:osanimeBackTopShine .8s ease forwards;
}
.osanime-back-to-top:focus-visible{
  outline:3px solid rgba(255,79,147,.36);
  outline-offset:4px;
}
.osanime-back-to-top .osbt-progress{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  transform:rotate(-90deg);
  overflow:visible;
  pointer-events:none;
}
.osanime-back-to-top .osbt-progress-track,
.osanime-back-to-top .osbt-progress-value{
  fill:none;
  stroke-width:2.2;
}
.osanime-back-to-top .osbt-progress-track{stroke:rgba(255,255,255,.10)}
.osanime-back-to-top .osbt-progress-value{
  stroke:url(#osbtGradient);
  stroke-linecap:round;
  stroke-dasharray:100;
  stroke-dashoffset:100;
  filter:drop-shadow(0 0 3px rgba(255,79,147,.55));
  transition:stroke-dashoffset .08s linear;
}
.osanime-back-to-top .osbt-arrow{
  position:relative;
  z-index:2;
  width:22px;
  height:22px;
  filter:drop-shadow(0 3px 8px rgba(0,0,0,.35));
  transition:transform .2s ease;
}
.osanime-back-to-top:hover .osbt-arrow{transform:translateY(-2px)}
.osanime-back-to-top .osbt-tooltip{
  position:absolute;
  right:calc(100% + 10px);
  top:50%;
  transform:translate(6px,-50%);
  padding:7px 10px;
  border:1px solid rgba(255,255,255,.09);
  border-radius:9px;
  background:rgba(7,14,28,.92);
  color:#e9eef8;
  box-shadow:0 12px 30px rgba(0,0,0,.32);
  font-size:10px;
  font-weight:800;
  letter-spacing:.15px;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
}
.osanime-back-to-top:hover .osbt-tooltip,
.osanime-back-to-top:focus-visible .osbt-tooltip{
  opacity:1;
  transform:translate(0,-50%);
}

body.sidebar-is-open .osanime-back-to-top,
body.profile-menu-is-open .osanime-back-to-top{
  opacity:0!important;
  pointer-events:none!important;
  transform:translateY(14px) scale(.88)!important;
}

@keyframes osanimeBackTopShine{
  from{transform:translateX(0) rotate(28deg)}
  to{transform:translateX(96px) rotate(28deg)}
}

@media(max-width:960px){
  body.index-php-page.osanime-header-scrolled .topbar.osanime-header{
    height:64px!important;
    padding-top:0!important;
    padding-bottom:0!important;
  }
  body.index-php-page .topbar.osanime-header{
    -webkit-backdrop-filter:blur(20px) saturate(155%);
    backdrop-filter:blur(20px) saturate(155%);
  }
  .osanime-back-to-top{
    right:12px;
    width:52px;
    height:52px;
    border-radius:17px;
  }
  .osanime-back-to-top::before{border-radius:12px}
  .osanime-back-to-top .osbt-tooltip{display:none}
}

@media(max-width:520px){
  body.index-php-page.osanime-header-scrolled .topbar.osanime-header{
    height:62px!important;
  }
  .osanime-back-to-top{
    right:10px;
    width:50px;
    height:50px;
    border-radius:16px;
  }
  .osanime-back-to-top .osbt-arrow{width:20px;height:20px}
}

@media(prefers-reduced-motion:reduce){
  body.index-php-page .topbar.osanime-header,
  body.index-php-page .topbar.osanime-header *,
  .osanime-back-to-top,
  .osanime-back-to-top *{
    scroll-behavior:auto!important;
    animation:none!important;
    transition-duration:.01ms!important;
  }
}
