/* ---------------------------------------------
   Raj Khatri — Portfolio
   Palette: charcoal-navy base, marigold accent
   (a nod to Kathmandu's marigold garlands), teal
   secondary, JetBrains Mono for code accents.
---------------------------------------------- */

:root{
  --bg: #0E141C;
  --surface: #161F2B;
  --surface-2: #1D2836;
  --border: rgba(232, 237, 243, 0.08);
  --text: #E8EDF3;
  --muted: #8FA0B3;
  --accent: #F2A63C;
  --accent-2: #3FB7A6;
  --accent-soft: rgba(242, 166, 60, 0.14);

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --container: 1160px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% -10%, rgba(242,166,60,0.08), transparent 40%),
    radial-gradient(circle at 100% 10%, rgba(63,183,166,0.08), transparent 40%);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.container{ max-width: var(--container); margin: 0 auto; padding: 0 24px; }

a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; display: block; }
h1, h2, h3, h4{ font-family: var(--font-display); margin: 0 0 0.5em; line-height: 1.15; }
p{ margin: 0 0 1em; color: var(--muted); }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Loader ---------- */
.loader{
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.loader.hidden{ opacity: 0; visibility: hidden; }
.spinner{
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* ---------- Nav ---------- */
.nav-wrap{
  position: sticky; top: 0; z-index: 100;
  background: rgba(14, 20, 28, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav{
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
}
.logo{
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em;
}
.logo span{ color: var(--accent); }
.nav-links{
  list-style: none; display: flex; gap: 28px; margin: 0; padding: 0;
}
.nav-links a{
  font-size: 0.92rem; color: var(--muted); font-weight: 500;
  padding: 6px 2px; position: relative;
  transition: color 0.2s ease;
}
.nav-links a::after{
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 0; height: 2px; background: var(--accent);
  transition: width 0.2s ease;
}
.nav-links a:hover, .nav-links a.active{ color: var(--text); }
.nav-links a:hover::after, .nav-links a.active::after{ width: 100%; }

.menu-btn{
  display: none; background: none; border: 1px solid var(--border);
  color: var(--text); font-size: 1.1rem; width: 40px; height: 40px;
  border-radius: var(--radius-sm); cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover{ transform: translateY(-2px); }
.btn.primary{ background: var(--accent); color: #17110a; }
.btn.primary:hover{ background: #ffb84f; }
.btn.outline{ border-color: var(--border); color: var(--text); }
.btn.outline:hover{ border-color: var(--accent); }
.btn.ghost{ color: var(--muted); }
.btn.ghost:hover{ color: var(--text); }
.btn.small{ padding: 8px 16px; font-size: 0.85rem; }

/* ---------- Hero ---------- */
.hero{
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px;
  align-items: center;
  padding: 72px 24px 96px;
  min-height: 78vh;
}
.eyebrow-line{
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-2); font-family: var(--font-mono); font-size: 0.82rem;
  margin-bottom: 18px;
}
.eyebrow-line .dot{
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(63,183,166,0.15);
}
h1.glow{
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700; color: var(--text); letter-spacing: -0.02em;
}
h1.glow .name{ color: var(--accent); }
.subtitle{
  font-family: var(--font-mono);
  color: var(--accent-2); font-size: 1rem; margin-bottom: 18px;
}
.intro{ max-width: 46ch; font-size: 1.02rem; }
.hero-cta{ display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 40px; }
.hero-stats{ display: flex; gap: 36px; }
.stat .count{
  display: block; font-family: var(--font-display); font-size: 1.8rem;
  font-weight: 700; color: var(--text);
}
.stat small{ color: var(--muted); font-size: 0.8rem; }

.scene{ position: relative; display: flex; justify-content: center; }
#particles{ position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); z-index: 0; }

.device{
  position: relative; z-index: 1;
  width: min(340px, 80vw);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 14px 14px 22px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.device-notch{
  width: 60px; height: 6px; border-radius: 4px;
  background: rgba(232,237,243,0.15);
  margin: 0 auto 12px;
}
.screen{
  position: relative;
  border-radius: 20px; overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--border);
}
.screen-photo{ width: 100%; height: 100%; object-fit: cover; }
.screen-overlay{
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(14,20,28,0.92) 100%);
}
.code{
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  margin: 0; font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--accent-2);
  background: rgba(14,20,28,0.6);
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: nowrap; overflow: hidden;
}
.code::after{
  content: "▍"; color: var(--accent); animation: blink 1s step-start infinite;
}
@keyframes blink{ 50%{ opacity: 0; } }

/* ---------- Sections ---------- */
.section{ padding: 72px 24px; }
.section-title{
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 32px;
}
.center{ text-align: center; }

.card, .skill-card, .project-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
}
.glass{
  background: linear-gradient(160deg, rgba(29,40,54,0.9), rgba(22,31,43,0.7));
  backdrop-filter: blur(6px);
}

.about-grid{
  display: grid; grid-template-columns: 0.9fr 1fr 1fr; gap: 22px;
}
.profile-card{ text-align: center; }
.avatar{
  width: 92px; height: 92px; border-radius: 50%;
  margin: 0 auto 16px; overflow: hidden;
  border: 2px solid var(--accent);
  padding: 3px;
}
.avatar-img{ width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.list{ list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.list li{ display: flex; align-items: center; gap: 10px; color: var(--text); }
.list i{ color: var(--accent); width: 20px; }

.skills-grid{
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px;
}
.skill-card{ text-align: center; }
.skill-card i{ color: var(--accent-2); margin-bottom: 10px; }
.skill-card h4{ font-size: 0.95rem; margin-bottom: 14px; }
.bar{
  height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden;
}
.progress{
  height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 1.1s ease;
}

.projects-grid{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.project-media{
  height: 120px; border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  font-size: 1.8rem; color: var(--accent);
}
.project-body h3{ font-size: 1.05rem; }
.muted{ color: var(--muted); font-size: 0.92rem; }
.tags{ display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.tags span{
  font-family: var(--font-mono); font-size: 0.72rem;
  background: var(--accent-soft); color: var(--accent);
  padding: 4px 9px; border-radius: 20px;
}
.project-actions{ display: flex; gap: 10px; }

/* ---------- Footer ---------- */
.footer{
  border-top: 1px solid var(--border);
  padding: 40px 24px 24px;
}
.foot-grid{
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px; margin-bottom: 20px;
}
.socials{ display: flex; gap: 16px; font-size: 1.2rem; color: var(--muted); }
.socials a:hover{ color: var(--accent); }
.footer .center{ font-size: 0.85rem; color: var(--muted); }

/* ---------- Scroll to top ---------- */
.scroll-top{
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #17110a; border: none;
  cursor: pointer; opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.scroll-top.visible{ opacity: 1; visibility: visible; }
.scroll-top:hover{ transform: translateY(-3px); }

/* ---------- Responsive ---------- */
@media (max-width: 960px){
  .hero{ grid-template-columns: 1fr; text-align: left; padding-top: 40px; }
  .hero-right{ order: -1; margin-bottom: 12px; }
  .device{ margin: 0 auto; }
  .about-grid, .projects-grid{ grid-template-columns: 1fr; }
  .skills-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px){
  .nav-links{
    position: fixed; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-links.open{ max-height: 400px; }
  .nav-links li{ border-top: 1px solid var(--border); }
  .nav-links a{ display: block; padding: 16px 24px; }
  .menu-btn{ display: block; }
  .hero-stats{ gap: 24px; }
}