/* =========================================================
   EFFECTS.CSS  -  premium animations layer
   (loaded AFTER styles.css, nothing in styles.css is changed)
   Sections:
   1. Preloader            6. Cursor glow + glass spotlight
   2. Scroll progress      7. 3D tilt
   3. Floating blobs       8. Magnetic buttons
   4. Navbar on scroll     9. Skill bars + rings
   5. Scroll reveal       10. Theme toggle, modal slide, page transition
========================================================= */

/* ---------- 1. PRELOADER ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #6b4bd8, #2a2a86 55%, #17195a 100%);
  transition: transform .9s cubic-bezier(.77, 0, .18, 1);
}
.preloader.done { transform: translateY(-100%); }
html.no-pl .preloader { display: none; }
.preloader { animation: plFail .01s 6s forwards; } /* failsafe if JS breaks */
@keyframes plFail { to { visibility: hidden; opacity: 0; } }
html.preloading body { overflow: hidden; }

.pl-inner { text-align: center; }

.pl-logo {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pl-logo b {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 40px;
  font-weight: 700;
  background: linear-gradient(135deg, #5b3df5, #2f7bff 40%, #0aa5c9 70%, #d6358f);
  box-shadow: 0 0 60px rgba(150, 110, 255, .7), inset 0 2px 0 rgba(255,255,255,.6);
  animation: plPop .9s cubic-bezier(.2, 1.3, .3, 1) both;
}
.pl-logo i {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 30%, #ff5fa8 65%, #48eaff 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: plSpin 1.1s linear infinite;
}
.pl-name {
  display: flex;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  letter-spacing: 6px;
  text-transform: uppercase;
}
.pl-name span {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  animation: plLetter .5s ease forwards;
}
.pl-bar {
  width: 170px;
  height: 3px;
  margin: 20px auto 0;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, .12);
}
.pl-bar em {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, #22c7ee, #7c5cff, #ff5fa8, #ffb547);
  animation: plBar 1.5s cubic-bezier(.6, 0, .2, 1) .2s forwards;
}
@keyframes plPop {
  from { transform: scale(.3) rotate(-90deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes plSpin { to { transform: rotate(360deg); } }
@keyframes plLetter { to { opacity: 1; transform: none; } }
@keyframes plBar { to { transform: scaleX(1); } }

/* ---------- 2. SCROLL PROGRESS ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1100;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, #0ac9e8, #0875e8, #8b5cf6, #ec4899);
  box-shadow: 0 0 12px rgba(10, 201, 232, .6);
}

/* ---------- 3. FLOATING BLOBS ---------- */
.blobs {
  position: fixed;
  inset: 0;
  z-index: -9;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .42;
  will-change: transform;
}
.blob-1 {
  width: 480px; height: 480px; left: -120px; top: 4%;
  background: radial-gradient(circle at 30% 30%, #2fd4f0, #0875e8);
  animation: blobA 22s ease-in-out infinite alternate;
}
.blob-2 {
  width: 420px; height: 420px; right: -110px; top: 32%;
  background: radial-gradient(circle at 40% 40%, #b58bff, #5b6cff);
  animation: blobB 27s ease-in-out infinite alternate;
}
.blob-3 {
  width: 380px; height: 380px; left: 32%; bottom: -150px;
  background: radial-gradient(circle at 50% 50%, #2ee6b0, #08a8d8);
  animation: blobC 31s ease-in-out infinite alternate;
}
html.dark .blob { opacity: .26; }
@keyframes blobA {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(140px, 90px) scale(1.18); }
  100% { transform: translate(50px, -70px) scale(.92); }
}
@keyframes blobB {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-120px, 70px) scale(.9); }
  100% { transform: translate(-30px, -90px) scale(1.15); }
}
@keyframes blobC {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(160px, -60px) scale(1.12); }
  100% { transform: translate(-100px, -30px) scale(.95); }
}

/* ---------- 4. NAVBAR ON SCROLL ---------- */
.navbar-wrapper { transition: padding-top .35s ease; }
.navbar-box {
  transition: min-height .35s ease, padding .35s ease, box-shadow .35s ease,
              background .35s ease, transform .35s ease;
}
.navbar-wrapper.scrolled { padding-top: 10px; }
.navbar-wrapper.scrolled .navbar-box {
  min-height: 56px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(34px) saturate(1.6);
          backdrop-filter: blur(34px) saturate(1.6);
  box-shadow: 0 12px 34px var(--shadow);
}
html:not(.dark) .navbar-wrapper.scrolled .navbar-box { background: rgba(255, 255, 255, .72); }
.navbar-wrapper.scrolled .logo-icon { width: 34px; height: 34px; font-size: 17px; }
.logo-icon { transition: width .35s ease, height .35s ease, font-size .35s ease, transform .4s ease; }
.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.08); }

/* ---------- 5. SCROLL REVEAL ---------- */
/* uses the individual `translate` property so it never fights
   with the transform used by hover / tilt / pulse effects */
.reveal {
  opacity: 0;
  translate: 0 38px;
  transition:
    opacity .8s ease var(--rd, 0s),
    translate .85s cubic-bezier(.2, .8, .2, 1) var(--rd, 0s),
    transform .3s ease, border-color .3s ease, box-shadow .3s ease, background .3s ease;
}
.reveal.in { opacity: 1; translate: 0 0; }

/* ---------- 6. CURSOR GLOW + GLASS SPOTLIGHT ---------- */
.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  border-radius: 50%;
  z-index: -8;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
  will-change: transform;
  background: radial-gradient(circle, rgba(20, 200, 240, .30), rgba(8, 117, 232, .12) 42%, transparent 70%);
}
.cursor-glow.on { opacity: 1; }
html.dark .cursor-glow {
  background: radial-gradient(circle, rgba(60, 225, 255, .22), rgba(120, 90, 255, .10) 42%, transparent 70%);
}

.glass:not(.navbar-box):not(.pm-dialog) { position: relative; }
.glass:not(.navbar-box):not(.pm-dialog)::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 65%);
}
.glass:not(.navbar-box):not(.pm-dialog):hover::before { opacity: 1; }

/* ---------- 7. 3D TILT ---------- */
.tilt-wrap { transform-style: preserve-3d; will-change: transform; }
.tilt-wrap > .profile-card { height: 100%; }

/* ---------- 8. MAGNETIC BUTTONS ---------- */
[data-magnetic] {
  transition: translate .35s cubic-bezier(.2, .8, .2, 1), transform .25s ease,
              color .25s ease, background .25s ease, border-color .25s ease;
}

/* ---------- 9. SKILL BARS + RINGS ---------- */
.skill-bars { display: grid; gap: 20px; margin-top: 26px; }
.sbar-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--heading);
  font-size: 13px;
  font-weight: 600;
}
.sbar-head em { color: var(--primary); font-style: normal; }
.sbar-track {
  height: 9px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(100, 130, 150, .18);
}
.sbar-fill {
  position: relative;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, #0ac9e8, #0875e8, #8b5cf6);
  transition: transform 1.5s cubic-bezier(.2, .8, .2, 1) var(--bd, 0s);
}
.sbar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}
.sbar.go .sbar-fill { transform: scaleX(var(--lv, .8)); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.rings-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}
.ring-card {
  padding: 22px 10px 18px;
  border-radius: 22px;
  text-align: center;
}
.ring-card:hover { transform: translateY(-6px); }
.ring-box { position: relative; width: 100px; height: 100px; margin: 0 auto 12px; }
.ring-box svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(100, 130, 150, .20); stroke-width: 9; }
.ring-fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.7s cubic-bezier(.2, .8, .2, 1) var(--bd, 0s);
  filter: drop-shadow(0 0 5px rgba(10, 201, 232, .5));
}
.ring-card.go .ring-fg { stroke-dashoffset: calc(327 - 327 * var(--lv, .8)); }
.ring-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--heading);
  font-size: 20px;
  font-weight: 700;
}
.ring-val small { font-size: 11px; margin-left: 1px; color: var(--muted); }
.ring-card h3 { color: var(--heading); font-size: 13px; font-weight: 600; }

/* ---------- 10a. THEME TOGGLE ---------- */
.theme-circle i { display: inline-block; }
.theme-circle.spin i { animation: iconSpin .65s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes iconSpin {
  from { transform: rotate(-220deg) scale(.2); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: none !important;
}
::view-transition-old(root), ::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
.theme-ripple {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

/* ---------- 10b. PAGE TRANSITION ---------- */
@keyframes pageIn {
  from { opacity: 0; translate: 0 22px; filter: blur(6px); }
  to   { opacity: 1; translate: 0 0; filter: blur(0); }
}
body.page-ready main,
body.page-ready .breadcrumb-wrap { animation: pageIn .7s cubic-bezier(.2, .8, .2, 1) both; }
main, .breadcrumb-wrap {
  transition: opacity .38s ease, translate .38s ease, filter .38s ease;
}
html.leaving main,
html.leaving .breadcrumb-wrap {
  opacity: 0;
  translate: 0 -22px;
  filter: blur(6px);
}
.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  transform: translateY(100%);
  background: linear-gradient(135deg, #0875e8, #8b5cf6 60%, #ec4899);
  transition: transform .45s cubic-bezier(.77, 0, .18, 1);
}
html.leaving .page-curtain { transform: translateY(0); }

/* ---------- 10c. MODAL SLIDE ---------- */
.pm-body { overflow: hidden; }
.pm-features li { animation: liUp .5s ease both; }
.pm-features li:nth-child(2) { animation-delay: .05s; }
.pm-features li:nth-child(3) { animation-delay: .10s; }
.pm-features li:nth-child(4) { animation-delay: .15s; }
.pm-features li:nth-child(5) { animation-delay: .20s; }
.pm-features li:nth-child(6) { animation-delay: .25s; }
@keyframes liUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #0ac9e8, #0875e8);
  box-shadow: 0 12px 30px rgba(0, 130, 230, .35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(.8);
  transition: opacity .35s ease, transform .35s ease, visibility .35s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { transform: translateY(-4px); }

/* ---------- Profile photo ---------- */
.avatar-wrap {
  position: relative;
  flex-shrink: 0;
  padding: 4px;
  border-radius: 50%;
}
.avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(#0ac9e8, #8b5cf6, #ec4899, #22c55e, #0ac9e8);
  animation: plSpin 6s linear infinite;
}
.avatar-wrap .avatar {
  position: relative;
  overflow: hidden;
  border-width: 3px;
  border-color: rgba(255, 255, 255, .85);
}
.avatar img, .photo-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-frame {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 8px;
  border-radius: 38px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 46px;
  font-weight: 700;
  background: linear-gradient(135deg, #0969cf, #12cfe9);
  box-shadow: 0 18px 40px rgba(8, 117, 232, .35);
  animation: floaty 5s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-9px) rotate(1.5deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 991px) { .rings-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 575px) {
  .rings-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .to-top { right: 14px; bottom: 14px; }
  .blob { filter: blur(55px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; translate: none; transition: none; }
  .blob, .photo-frame, .avatar-wrap::before, .sbar-fill::after { animation: none; }
  body.page-ready main, body.page-ready .breadcrumb-wrap { animation: none; }
  .preloader { display: none; }
  .cursor-glow { display: none; }
}

/* page opened through a transition: cover the screen instantly (no flash) */
html.arriving::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: linear-gradient(135deg, #0875e8, #8b5cf6 60%, #ec4899);
}

/* keep the initials big (styles.css shrinks every span inside .profile-info) */
.profile-info .avatar span { font-size: 27px; font-weight: 700; color: #fff; }
@media (max-width: 450px) { .profile-info .avatar span { font-size: 23px; } }
.photo-frame span { font-size: 46px; }
