:root {
  --font-body: "Raleway", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-content: "Raleway", sans-serif;
  --color-bg: #0a0b0d;
  --color-text: #e0e0e0;
  --color-accent: #ffffff;
  --rail-width: 300px;
  --nav-width: 280px;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 300;
  height: 100vh;
  overflow: hidden;
}

/* Visibility Helpers */
.mobile-only { display: none !important; }
.desktop-only { display: flex !important; }
@media (max-width: 768px) {
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }
}

#background-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }
#bg-image { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.6s ease; }
#pixel-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: overlay; }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); }

/* Desktop Sidebar (Inside Grid) */
.sidebar {
  padding: 4rem 60px 4rem 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  text-align: right;
  z-index: 100;
}
.nav-center { display: flex; flex-direction: column; gap: 0.8rem; }
.nav-link { 
  color: var(--color-text); 
  text-decoration: none; 
  font-family: var(--font-body);
  font-size: 0.95rem; 
  text-transform: uppercase; 
  letter-spacing: 0.05em; 
  transition: all 0.3s ease; 
  opacity: 0.5;
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  right: -25px;
  top: 50%;
  width: 4px;
  height: 4px;
  background: #99f3ff;
  opacity: 0;
  transform: translateY(-50%) rotate(45deg) scale(0);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 0 10px rgba(153, 243, 255, 0.8);
}
.nav-link:hover, .nav-link.active { 
  opacity: 1; 
  color: #fff;
  transform: translateX(-5px);
}
.nav-link.active::after { 
  opacity: 1;
  right: -15px;
  transform: translateY(-50%) rotate(225deg) scale(1);
  animation: pulseSquare 2s infinite alternate;
}

@keyframes pulseSquare {
  0% { box-shadow: 0 0 5px rgba(153, 243, 255, 0.5); transform: translateY(-50%) rotate(225deg) scale(1); }
  100% { box-shadow: 0 0 15px rgba(153, 243, 255, 1); transform: translateY(-50%) rotate(315deg) scale(1.2); }
}

.logo-area, .copyright { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; opacity: 0.5; }

/* Desktop Grid Layout */
.grid-layout {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr var(--rail-width);
  height: 100vh;
  width: 100%;
  position: relative;
  z-index: 10;
  padding: 0 3vw;
}
.content-scroll { overflow-y: auto; padding: 15vh 10% 40vh 6%; scrollbar-width: none; scroll-behavior: smooth; }
.content-scroll::-webkit-scrollbar { display: none; }

.page-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  display: none;
}
.page-section.hidden {
  display: none !important;
}
.page-section.active {
  display: block;
}
.page-section.visible {
  opacity: 1;
  transform: none;
}
.page-section.fading-out {
  opacity: 0;
  transform: translateY(-10px);
}

/* Desktop Switcher Area */
.switcher-rail {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.progress-container {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 140px; background: rgba(255, 255, 255, 0.1); z-index: 20;
}
.progress-bar-fill { width: 100%; height: 0%; background: #fff; transition: height 0.1s linear; }

.rail-container {
  width: 100%; height: 100vh; position: relative; perspective: 1000px;
  display: flex; align-items: center; justify-content: center;
}
.carousel-track { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.5s ease; }
.carousel-item {
  position: absolute; top: 50%; left: 60px; width: 180px; height: 135px; background: #000;
  transform: translateY(-50%); transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; opacity: 0; z-index: 0; cursor: pointer;
}
.carousel-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.5; transition: opacity 0.3s; }
.carousel-item.active { opacity: 1; z-index: 10; transform: translateY(-50%) scale(1.3); border-color: #ffffff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.carousel-item.active img { opacity: 1; }
.carousel-item.prev { opacity: 0.8; z-index: 5; transform: translateY(-170%) scale(1.1); filter: blur(1px) brightness(0.7); }
.carousel-item.next { opacity: 0.8; z-index: 5; transform: translateY(70%) scale(1.1); filter: blur(1px) brightness(0.7); }

/* Desktop Lock Toggle */
.lock-toggle-container {
  position: fixed; top: 4rem; right: 3vw; width: var(--rail-width); display: flex; justify-content: center; z-index: 1000;
}
.lock-button {
  width: 60px; height: 30px; background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; display: flex; align-items: center; padding: 0 4px; cursor: pointer; position: relative; transition: all 0.3s ease;
}
.lock-knob {
  width: 22px; height: 22px; background: rgba(255, 255, 255, 0.4); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); color: #000;
}
.lock-button.locked .lock-knob { transform: translateX(30px); background: #99f3ff; }
.lock-button svg { width: 12px; height: 12px; }
.lock-button .icon-locked { opacity: 0; position: absolute; }
.lock-button.locked .icon-unlocked { opacity: 0; position: absolute; }
.lock-button.locked .icon-locked { opacity: 1; position: static; }

/* Page Content Styles */
.hero-title { font-family: var(--font-mono); font-size: 2rem; font-weight: 400; line-height: 1.1; margin-bottom: 2rem; color: var(--color-accent); letter-spacing: -0.03em; }
.intro-text { font-family: var(--font-content); font-size: 1.15rem; line-height: 1.6; color: #eee; max-width: 650px; }
.inline-link {
  color: #99f3ff;
  text-decoration: none;
  position: relative;
  cursor: pointer;
  transition: color 0.3s ease;
  background-image: linear-gradient(#99f3ff, #99f3ff);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.inline-link:hover {
  background-size: 100% 1px;
}
.section-title { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; margin-bottom: 3rem; color: #888; letter-spacing: 0.1em; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 1rem; width: 100px; }
.item-card { position: relative; margin-bottom: 5rem; }
.item-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.2rem; }
.item-logo { width: 50px; height: 50px; object-fit: contain; background: rgba(255, 255, 255, 0.05); padding: 5px; border-radius: 8px; }
.item-info { flex: 1; }
.item-card .meta { font-family: var(--font-mono); font-size: 0.65rem; color: #888; margin-bottom: 0.2rem; text-transform: uppercase; letter-spacing: 0.05em; }
.item-card .item-title { font-family: var(--font-content); font-size: 1.4rem; font-weight: 300; margin-bottom: 0.2rem; color: #fff; }
.item-subtitle { font-family: var(--font-content); font-size: 1rem; color: #99f3ff; font-weight: 300; }
.item-list { list-style: none; padding-left: 40px; }
.item-list li { font-family: var(--font-content); font-size: 1rem; color: #ccc; line-height: 1.6; margin-bottom: 0.6rem; padding-left: 0.5rem; }

/* Desktop Socials */
.social-links-fixed {
  position: fixed; bottom: 4rem; right: 3vw; width: var(--rail-width); display: flex; justify-content: center; gap: 1.5rem; z-index: 100;
}
.social-links-fixed a { color: var(--color-text); opacity: 0.8; transition: all 0.3s ease; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.social-links-fixed a:hover { opacity: 1; transform: translateY(-5px); }

/* Global Skill Highlights */
.item-tags {
  position: fixed; top: 0; left: 0; width: auto; max-width: 350px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.8rem; padding: 1.2rem 1.8rem;
  background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(15px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); opacity: 0; display: none; transition: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1); pointer-events: none; z-index: 1000; transform: translate(-50%, -50%);
}

/* Personal Section Styles */
.personal-content-spacer { height: 4rem; }
.personal-container { display: block; width: 100%; }
.personal-item {
  position: relative; margin-bottom: 2rem; padding: 1.5rem;
  border-radius: 12px; background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05); transition: all 0.3s ease;
}
.personal-title-mono {
  font-family: var(--font-mono); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: #fff;
}
.personal-meta {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: #666; margin-top: 0.3rem; text-transform: uppercase;
}
.personal-card-header { display: flex; justify-content: space-between; align-items: center; }
.clickable-card { cursor: pointer; }
.clickable-card:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(153, 243, 255, 0.2); }
.personal-indicator { width: 18px; height: 18px; flex-shrink: 0; color: #444; transition: all 0.3s ease; }
.personal-indicator svg { width: 100%; height: 100%; display: block; }
.clickable-card:hover .personal-indicator { color: #99f3ff; }
.clickable-card.expanded .personal-indicator { transform: rotate(45deg); color: #99f3ff; }
.personal-expand-content {
  display: none;
  margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.clickable-card.expanded .personal-expand-content {
  display: block;
}
.personal-description { font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.6; color: #aaa; }
#personal .intro-text { font-family: var(--font-mono); font-size: 0.85rem; }
#personal .section-title { font-size: 0.7rem; margin-bottom: 2rem; padding-bottom: 0.5rem; width: 80px; }

.personal-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-top: 2rem; }
.gallery-item { aspect-ratio: 1/1; overflow: hidden; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: all 0.4s ease; }
.gallery-item:hover img { opacity: 1; transform: scale(1.05); }

.item-tags.has-image { width: 320px; flex-direction: row; flex-wrap: nowrap; gap: 1.2rem; padding: 1.2rem; }
.hover-card-img { width: 80px; height: 80px; object-fit: contain; border-radius: 6px; background: rgba(255, 255, 255, 0.03); padding: 5px; flex-shrink: 0; }
.hover-card-divider { width: 1px; height: 60px; background: rgba(255, 255, 255, 0.1); flex-shrink: 0; }
/* .item-card:hover .item-tags { opacity: 1; } is removed as it's now JS-controlled */
.skill-tag { font-family: var(--font-body); font-size: 0.75rem; font-weight: 400; color: #fff; display: flex; align-items: center; position: relative; white-space: nowrap; }
.item-tags.has-image .skill-tag { display: block; margin: 0.2rem 0; }
.item-tags:not(.has-image) .skill-tag:not(:last-child)::after { content: ""; width: 3px; height: 3px; background: rgba(255, 255, 255, 0.3); border-radius: 50%; margin-left: 0.8rem; display: inline-block; }
.item-tags-inner { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.item-tags:not(.has-image) .item-tags-inner { display: contents; }

/* Featured Project & Highlights */
.featured-project { background: rgba(153, 243, 255, 0.03); border-left: 2px solid #99f3ff; padding: 2rem; margin-left: -2rem; border-radius: 0 12px 12px 0; }
.highlight-label { font-family: var(--font-mono); font-size: 0.65rem; color: #99f3ff; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
#personal { overflow: visible !important; }
.group-header { display: block !important; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; color: #666; margin: 4rem 0 2rem 0; letter-spacing: 0.15em; border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 0.4rem; }

/* ------------------------------------------------ */
/* MOBILE STYLES */
/* ------------------------------------------------ */
@media (max-width: 768px) {
  body { overflow-y: auto; overflow-x: hidden; }
  .grid-layout { display: flex; flex-direction: column; height: auto; min-height: 100vh; padding: 0; overflow-x: hidden; }
  
  .mobile-header {
    display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1.2rem;
    position: fixed; top: 1rem; left: 5%; width: 90%; z-index: 2000;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
  }
  .mobile-header .logo { font-family: var(--font-mono); font-size: 0.8rem; color: #fff; text-transform: uppercase; }
  #menu-toggle { background: rgba(255, 255, 255, 0.1); border: none; color: #fff; font-family: var(--font-mono); font-size: 0.65rem; padding: 0.4rem 0.8rem; border-radius: 8px; }

  .sidebar {
    position: fixed; top: 5.5rem; left: 5%; width: 90%; height: auto; max-height: 60vh;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
    padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; text-align: center;
    z-index: 1500; opacity: 0; pointer-events: none; transform: translateY(-20px); transition: all 0.4s ease;
  }
  .sidebar.open { opacity: 1 !important; pointer-events: all !important; transform: translateY(0) !important; }
  .nav-center { width: 100%; gap: 1rem; display: flex; flex-direction: column; align-items: center; }
  .nav-link { font-size: 1rem; opacity: 0.6; position: relative; transition: all 0.3s ease; transform: none !important; }
  .nav-link.active { opacity: 1; color: #fff; }
  .nav-link::after { right: -12px !important; }
  .nav-link.active::after { right: -8px !important; }

  .content-scroll { padding: 6rem 1.5rem 12rem; height: auto; overflow-x: hidden; }

  .featured-project {
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
    border-radius: 0 12px 12px 0;
    padding: 1.5rem;
    background: rgba(153, 243, 255, 0.05) !important;
    border-left: 3px solid #99f3ff !important;
  }

  .switcher-rail {
    position: fixed; bottom: 4rem; left: 5%; width: 90%; height: 60px; z-index: 2000;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
    display: flex; align-items: center; padding: 0;
  }
  .rail-container { width: 100%; height: 100%; display: flex; flex-direction: row; align-items: center; position: relative; overflow: hidden; border-radius: 16px; }
  
  /* Horizontal progress bar for mobile */
  .mobile-progress-container {
    position: absolute; top: -10px; left: 0; width: 100%; height: 2px;
    background: rgba(255, 255, 255, 0.1); transform: none; z-index: 2100;
  }
  .mobile-progress-container .progress-bar-fill { background: #fff; height: 100%; }

  .carousel-track {
    display: flex; flex-direction: row; align-items: center; gap: 0.8rem; height: 100%;
    padding: 0 50%; transform: none; transition: transform 0.5s ease; top: auto; left: auto;
  }
  .carousel-item {
    position: relative; top: auto !important; left: auto !important; width: 34px !important; height: 34px !important; transform: none !important;
    opacity: 0.3; display: block !important; flex-shrink: 0;
  }
  .carousel-item img { opacity: 1; }
  .carousel-item.active { opacity: 1; border: 1.5px solid #fff; width: 40px !important; height: 40px !important; }

  .mobile-lock-area {
    display: flex; align-items: center; height: 100%; padding: 0 0.6rem;
    background: rgba(255, 255, 255, 0.03); border-left: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; z-index: 5;
  }
  .mobile-lock-area .lock-button { background: transparent; border: none; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; box-shadow: none; }
  .lock-knob { width: 20px; height: 20px; color: #fff; background: transparent; }
  .lock-button.locked .lock-knob { transform: none; background: transparent; }

  .social-links-fixed {
    position: fixed; bottom: 1.5rem; left: 0; width: 100%; justify-content: center; gap: 1.5rem; z-index: 2000; align-items: center;
  }
  .copyright-mobile { display: block; font-family: var(--font-mono); font-size: 0.65rem; color: #fff; opacity: 0.4; }
  
  .item-tags.has-image, .item-tags:not(.has-image) {
    width: 260px; background: rgba(10, 11, 13, 0.9); position: absolute; top: 0; left: 50%; transform: translate(-50%, -105%); pointer-events: none;
  }
}