/* ====== THEME ====== */
:root {
  --bg: #0b0c10;
  --surface: #121318;
  --elev: #171923;
  --text: #e6e6e6;
  --muted: #a9a9b3;
  --accent: #aaebea;
  --border: #252736;
  --shadow: 0 10px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* FIX: Remove blue outline on sections */
.section {
  outline: none;
}

.section:focus {
  outline: none;
}

[tabindex="-1"]:focus {
  outline: none;
}

/* Sidebar Profile */
.sidebar-profile {
  text-align: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-profile-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 12px;
  overflow: hidden;
  border: 3px solid rgba(102, 252, 241, 0.3);
  box-shadow: 0 0 20px rgba(102, 252, 241, 0.15);
}

.sidebar-profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-name {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-title {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Sidebar Social Links */
.sidebar-social {
  margin-top: auto;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.sidebar-social-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.3s ease;
}

.sidebar-social-btn:hover {
  background: rgba(102, 252, 241, 0.1);
  border-color: rgba(102, 252, 241, 0.4);
  color: var(--accent);
  transform: translateY(-2px);
}

.sidebar-social-btn svg {
  width: 20px;
  height: 20px;
}

/* ====== LOADER ====== */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  z-index: 9999;
  transition: opacity .6s ease, visibility .6s ease;
}

#loader .loader-inner {
  position: relative;
  width: 200px;
  height: 200px;
}

.sphere {
  width: 200px;
  height: 200px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-15deg);
}

.earth {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-image: url('images/earth.jpg');
  background-size: 400% 100%;
  background-position: 0% center;
  animation: rotateEarth 20s linear infinite;
  box-shadow: 
    inset -40px -40px 80px rgba(0, 0, 0, 0.9),
    inset 30px 30px 60px rgba(255, 255, 255, 0.05),
    0 0 60px rgba(102, 252, 241, 0.3),
    0 0 100px rgba(102, 252, 241, 0.15);
  position: relative;
  overflow: hidden;
}

@keyframes rotateEarth {
  from { background-position: 0% center; }
  to { background-position: 100% center; }
}

.earth::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.3), transparent 40%);
  border-radius: 50%;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 19%, rgba(102, 252, 241, 0.1) 19%, rgba(102, 252, 241, 0.1) 20%),
    repeating-linear-gradient(90deg, transparent, transparent 19%, rgba(102, 252, 241, 0.1) 19%, rgba(102, 252, 241, 0.1) 20%);
  opacity: 0.3;
}

.atmosphere {
  position: absolute;
  inset: -25px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 65%, rgba(102, 252, 241, 0.25) 75%, rgba(102, 252, 241, 0.1) 85%, transparent 100%);
  animation: atmosphereGlow 4s ease-in-out infinite;
}

@keyframes atmosphereGlow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.glow-ring {
  position: absolute;
  inset: -35px;
  border-radius: 50%;
  border: 2px solid rgba(102, 252, 241, 0.2);
  animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.3; }
  50% { transform: scale(1); opacity: 0.6; }
}

.loading-text {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  color: #66fcf1;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: pulse 1.5s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(102, 252, 241, 0.5);
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loading-text::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

body.is-loaded #loader {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

.content {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s ease .1s, transform .6s ease .1s;
}

body.is-loaded .content {
  opacity: 1;
  transform: translateY(0);
}

/* ====== ACCESSIBILITY ====== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px; 
  height: 1px;
  overflow: hidden;
}

.visually-hidden { 
  position: absolute; 
  width: 0; 
  height: 0; 
  overflow: hidden; 
}

/* ====== LAYOUT ====== */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  background: linear-gradient(180deg, var(--surface), var(--elev));
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.nav { 
  display: grid; 
  gap: 8px; 
}

.nav-link {
  display: block; 
  padding: 10px 12px; 
  border-radius: 10px;
  color: var(--muted); 
  text-decoration: none; 
  border: 1px solid transparent;
  transition: transform .08s ease, background .2s ease, color .2s ease, border-color .2s ease;
  position: relative;
}

.nav-link:hover { 
  color: var(--text); 
  background: rgba(255,255,255,.03); 
  border-color: var(--border); 
}

.nav-link.active { 
  color: var(--text); 
  background: rgba(102,252,241,.08); 
  border-color: rgba(102,252,241,.35); 
}

.nav-link.active::before {
  content: ''; 
  position: absolute; 
  left: -6px; 
  top: 6px; 
  bottom: 6px;
  width: 3px; 
  background: var(--accent); 
  border-radius: 3px;
}

.content { 
  margin-left: 280px; 
}

/* ====== SECTIONS ====== */
.section {
  min-height: 100vh;
  display: grid; 
  align-items: center;
  background: var(--surface);
}

.section .section-inner { 
  width: min(1100px, 92vw); 
  margin: 0 auto; 
  padding: 70px 0; 
}

.section h2 { 
  margin: 0 0 12px; 
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2rem); 
  letter-spacing: .2px; 
}

.hero {
  background-image: linear-gradient(rgba(11, 12, 16, 0.85), rgba(11, 12, 16, 0.2)), url('images/background.jpeg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.hero h1 { 
  font-size: clamp(2rem, 1.6rem + 2vw, 3rem); 
  line-height: 1.2; 
  margin: 0 0 12px; 
}

.accent { 
  color: var(--accent); 
}

/* Wave text effect */
.wave-text {
  display: inline-block;
}

.wave-text span {
  display: inline-block;
  animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { 
    transform: translateY(0); 
  }
  50% { 
    transform: translateY(-8px); 
  }
}

@media (prefers-reduced-motion: reduce) { 
  .wave-text span { 
    animation: none; 
  } 
}

p { 
  color: var(--muted); 
  max-width: 70ch; 
}

.bullets { 
  display: grid; 
  gap: 8px; 
  padding-left: 18px; 
}

/* Buttons */
.btn {
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px;
  padding: 10px 14px; 
  border-radius: 12px; 
  background: var(--accent); 
  color: #0b0c10;
  font-weight: 700; 
  text-decoration: none; 
  border: 1px solid transparent;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
  box-shadow: 0 6px 20px rgba(102,252,241,.25);
}

.btn:hover { 
  transform: translateY(-1px); 
}

.btn.ghost { 
  background: transparent; 
  color: var(--text); 
  border-color: var(--border); 
  box-shadow: none; 
}

.btn.small { 
  padding: 8px 12px; 
  font-weight: 600; 
}

.cta-row { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 12px; 
  margin-top: 14px; 
}

/* ====== MASONRY WORK GRID ====== */
.masonry-grid {
  column-count: 3;
  column-gap: 20px;
}

.project-card {
  break-inside: avoid;
  margin-bottom: 20px;
  background: linear-gradient(180deg, var(--elev), var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(102, 252, 241, 0.2);
  border-color: rgba(102, 252, 241, 0.3);
}

.project-image {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

.project-placeholder {
  width: 100%;
  padding-bottom: 60%;
  background: linear-gradient(135deg, rgba(102, 252, 241, 0.1), rgba(102, 252, 241, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.project-placeholder svg {
  position: absolute;
  width: 60px;
  height: 60px;
  opacity: 0.3;
}

.project-card.tall .project-placeholder {
  padding-bottom: 100%;
}

.project-card.short .project-placeholder {
  padding-bottom: 40%;
}

.project-content {
  padding: 20px;
}

.project-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(102, 252, 241, 0.1);
  border: 1px solid rgba(102, 252, 241, 0.3);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 10px;
  margin-right: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.project-card h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  color: var(--text);
  line-height: 1.3;
}

.project-card p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.project-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tech-pill {
  font-size: 0.75rem;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: var(--muted);
}

/* Skills */
.skills { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 10px; 
  margin-top: 10px; 
}

.pill {
  padding: 8px 10px; 
  border-radius: 999px;
  background: rgba(255,255,255,.04); 
  border: 1px solid var(--border);
  color: var(--text); 
  font-size: .9rem; 
  transition: transform .2s ease, background .2s ease;
}

.pill:hover { 
  transform: translateY(-2px); 
  background: rgba(255,255,255,.06); 
}

/* Footer */
.footer { 
  border-top: 1px solid var(--border); 
  background: var(--surface); 
  padding: 20px 0;
  text-align: center;
}

.tiny { 
  margin: 0; 
  color: var(--muted); 
  font-size: .85rem; 
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
  .masonry-grid { column-count: 2; }
}

@media (max-width: 980px) {
  .sidebar { width: 240px; }
  .content { margin-left: 240px; }
}

@media (max-width: 760px) {
  /* FIX: Mobile sidebar/header */
  .sidebar { 
    position: fixed; 
    width: 100%; 
    height: auto;
    min-height: 80px;
    padding: 12px 16px; 
    flex-direction: row; 
    align-items: center; 
    gap: 12px;
    flex-wrap: wrap;
    overflow: visible;
  }
  
  /* Profile in mobile - smaller and horizontal */
  .sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
  }
  
  .sidebar-profile-image {
    width: 50px;
    height: 50px;
    margin: 0;
  }
  
  .sidebar-name {
    font-size: 0.95rem;
    margin: 0;
  }
  
  .sidebar-title {
    font-size: 0.75rem;
  }
  
  /* Nav scrollable horizontally */
  .nav { 
    display: flex;
    flex-direction: row;
    overflow-x: auto; 
    white-space: nowrap; 
    gap: 6px; 
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding-bottom: 5px;
  }
  
  .nav-link { 
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  /* Hide social on mobile or make smaller */
  .sidebar-social {
    display: flex;
    gap: 8px;
    border: none;
    padding: 0;
    margin: 0;
  }
  
  .sidebar-social-btn {
    width: 36px;
    height: 36px;
  }
  
  /* Adjust content for mobile header */
  .content { 
    margin-left: 0; 
    padding-top: 100px;
  }
  
  .masonry-grid { 
    column-count: 1; 
  }
}