/* Variables & Reset */
:root { --bg: rgba(15, 25, 45, 0.6); --bd: rgba(100, 150, 255, 0.1); --hl: rgba(100, 150, 255, 0.3); }
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
html { background: #050c1a; height: 100%; overflow-y: scroll; }

/* Core Layout & Page Transition */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif; color: #e1eaf5;
  display: flex; justify-content: center; min-height: 100dvh; padding: 60px;
  position: relative; opacity: 1; 
  /* Slower, smoother easing curve for transitions */
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(160deg, #001a3a, #02060c 60%, #050c1a);
}
body.fade-out { opacity: 0; }
body.contact-page { padding: 100px 24px 40px; align-items: flex-start; }

.grid-wrap { width: 100%; max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.wrap { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 0 10px; }

/* Navigation */
.top-nav { position: fixed; inset: 0 0 auto 0; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; z-index: 1000; pointer-events: none; }
.nav-menu-wrap { position: relative; pointer-events: auto; z-index: 2000; display: flex; justify-content: flex-end; }

/* Glass Components */
.nav-btn, .card, .social-btn {
  position: relative; overflow: hidden; background: var(--bg);
  backdrop-filter: blur(40px) saturate(120%); -webkit-backdrop-filter: blur(40px) saturate(120%);
  border: 1px solid var(--bd); border-top: 1px solid var(--hl);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), border-color .3s ease;
  transform: translateZ(0); user-select: none; -webkit-user-select: none;
}
:is(.nav-btn, .card, .social-btn)::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%), rgba(50,100,255,0.1), transparent 70%);
}
@media (hover: hover) {
  :is(.nav-btn, .card, .social-btn):hover { transform: translateY(-2px); border-top-color: rgba(130,180,255,0.6); }
  :is(.nav-btn, .card, .social-btn):hover::before { opacity: 1; }
}
.glass-active { transform: translateY(-2px) !important; border-top-color: rgba(130,180,255,0.8) !important; }
.glass-active::before { opacity: 1 !important; background: radial-gradient(500px circle at var(--x,50%) var(--y,50%), rgba(70,120,255,0.15), transparent 60%); }

/* Specific Components */
.nav-btn { pointer-events: auto; display: flex; justify-content: center; align-items: center; text-decoration: none; color: #9ab6d3; cursor: pointer; }
.nav-btn.circle { width: 40px; height: 40px; border-radius: 50%; }
.nav-btn.oval { height: 40px; width: 110px; border-radius: 40px; font-weight: 500; font-size: 14px; letter-spacing: .2px; }

/* Dropdown */
.nav-menu-wrap.open .contact-trigger { opacity: 0; pointer-events: none; transform: scale(0.9); }
.nav-dropdown.ios-menu {
  position: absolute; top: 0; right: 0; width: 110px; height: 40px; border-radius: 40px;
  background: rgba(30,35,55,0.95); border: 1px solid var(--bd); box-shadow: 0 25px 60px -10px rgba(0,0,0,0.6);
  opacity: 0; visibility: hidden; transform-origin: top right; backdrop-filter: blur(40px);
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.nav-menu-wrap.open .nav-dropdown.ios-menu { opacity: 1; visibility: visible; width: 240px; height: 115px; border-radius: 22px; z-index: 10; }
.menu-inner-content { opacity: 0; width: 100%; transition: opacity .2s ease; }
.nav-menu-wrap.open .menu-inner-content { opacity: 1; transition-delay: .15s; }

.menu-header { padding: 14px 16px 6px; display: flex; justify-content: space-between; }
.menu-label { font-size: 12px; font-weight: 600; color: #8b9bb4; text-transform: uppercase; }
.menu-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 2px 12px 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; text-decoration: none; color: #e1eaf5; transition: background .2s; }
.menu-item:hover { background: rgba(255,255,255,0.12); }
.icon-box { width: 32px; height: 32px; background: #007AFF; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; }
.menu-text { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }

/* Splash */
.intro-splash { position: fixed; inset: 0; background: #000; z-index: 9999; display: flex; align-items: center; justify-content: center; transition: opacity 1s, visibility 1s; }
.intro-splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-logo { width: 140px; animation: fade 2.2s ease-in-out forwards; }
@keyframes fade { 0% { opacity: 0; transform: scale(.88); } 40%, 100% { opacity: 1; transform: scale(1); } }

/* Cards */
.card > *, .social-btn > * { position: relative; z-index: 1; }
.card:not(.small-card) { padding: 36px 34px; border-radius: 32px; width: 100%; flex-direction: column; display: flex; }
.card.small-card { width: 100%; min-height: 200px; padding: 30px; border-radius: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 24px; }
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 22px; color: #f0f6ff; letter-spacing: -0.2px; }

.avatar { width: 84px; height: 84px; background: rgba(20,30,50,0.4); border-radius: 50%; overflow: hidden; border: 1px solid var(--bd); font-size: 28px; color: #d5e3ee; display: flex; align-items: center; justify-content: center; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; }
.avatar:not(.fallback) .avatar-initials, .avatar.fallback .avatar-img { display: none; }

.name { margin-bottom: 18px; font-size: 32px; font-weight: 600; color: #f0f6ff; letter-spacing: -0.5px; }
.bio, .skill-content { user-select: text; -webkit-user-select: text; cursor: text; }
.bio { font-size: 18px; line-height: 1.62; color: #9ab6d3; white-space: pre-line; }

/* Social */
.social-row { display: flex; gap: 22px; }
.social-btn { width: 70px; height: 70px; border-radius: 24px; display: flex; justify-content: center; align-items: center; text-decoration: none; }
.icon { font-size: 28px; color: #9ab6d3; opacity: 0.8; transition: .3s; }
.social-btn:hover .icon { color: #fff; opacity: 1; transform: scale(1.1); text-shadow: 0 0 15px rgba(100,150,255,0.5); }
.social-btn[aria-label="LinkedIn"] .icon { font-size: 30px; font-weight: 600; letter-spacing: -1px; }

.github-icon, .chess-icon { width: 32px; height: 32px; background: center/contain no-repeat; }
.github-icon { background-color: #9ab6d3; mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 .3a12 12 0 00-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4a3.2 3.2 0 00-1.3-1.8c-1-.7.1-.7.1-.7a2.5 2.5 0 011.8 1.2 2.6 2.6 0 003.5 1 2.6 2.6 0 01.8-1.6c-2.7-.3-5.5-1.4-5.5-6a4.7 4.7 0 011.3-3.3 4.4 4.4 0 01.1-3.2s1-.3 3.3 1.2a11.4 11.4 0 016 0c2.3-1.5 3.3-1.2 3.3-1.2a4.4 4.4 0 01.1 3.2 4.7 4.7 0 011.3 3.3c0 4.7-2.8 5.7-5.5 6a2.9 2.9 0 01.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0012 .3z"/></svg>'); -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 .3a12 12 0 00-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4a3.2 3.2 0 00-1.3-1.8c-1-.7.1-.7.1-.7a2.5 2.5 0 011.8 1.2 2.6 2.6 0 003.5 1 2.6 2.6 0 01.8-1.6c-2.7-.3-5.5-1.4-5.5-6a4.7 4.7 0 011.3-3.3 4.4 4.4 0 01.1-3.2s1-.3 3.3 1.2a11.4 11.4 0 016 0c2.3-1.5 3.3-1.2 3.3-1.2a4.4 4.4 0 01.1 3.2 4.7 4.7 0 011.3 3.3c0 4.7-2.8 5.7-5.5 6a2.9 2.9 0 01.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0012 .3z"/></svg>'); }
.chess-icon { background-image: url('assets/chess-pawn.png'); filter: brightness(0) saturate(100%) invert(75%) sepia(14%) saturate(437%) hue-rotate(180deg) brightness(92%) contrast(89%); }
.social-btn:hover .chess-icon { filter: brightness(0) invert(1); }
.social-btn:hover .github-icon { background-color: #fff; }

.skill-section { margin: 12px 0 20px; width: 100%; }
.skill-list { list-style: none; padding: 0; }
.skill-list li { position: relative; padding-left: 18px; margin-bottom: 28px; font-size: 14px; color: #cbd7e3; display: flex; flex-direction: column; gap: 12px; line-height: 1.55; }
.skill-list li:last-child { margin-bottom: 0; }
.skill-list li::before { content: "▹"; position: absolute; left: 0; color: #64ffda; top: 1px; font-size: 14px; }
.skill-list li strong { color: #fff; font-weight: 600; }
.nav-btn.view-btn { width: auto; min-width: 80px; padding: 0 20px; height: 32px; font-size: 12px; margin-left: 0; border-radius: 40px; align-self: flex-start; }

@media (max-width: 520px) {
  body:not(.contact-page) { padding: 30px 20px 100px; align-items: flex-start; }
  .card:not(.small-card) { padding: 24px; border-radius: 24px; }
  .name { font-size: 26px; } .bio { font-size: 16px; }
  .social-btn { width: 60px; height: 60px; }
  .top-nav { padding: 15px; }
  .skill-list li { margin-bottom: 36px; }
}