/* ============================================================
   Raj Bikram Thapa · Portfolio
   Developer-centric, dark/light theme, minimal, micro-interactions
   ============================================================ */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", Menlo, Consolas, monospace;

  --bg: #0a0e14;
  --bg-soft: #10161f;
  --bg-card: #121a25;
  --border: #1e2a38;
  --text: #e6edf3;
  --text-dim: #93a1ad;
  --text-faint: #5c6b78;
  --accent: #4ec9b0;
  --accent-dim: rgba(78, 201, 176, 0.15);
  --accent-2: #569cd6;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --maxw: 1080px;
  --nav-h: 68px;
}

html[data-theme="light"] {
  --bg: #f7f9fb;
  --bg-soft: #eef2f6;
  --bg-card: #ffffff;
  --border: #dde4ea;
  --text: #16212c;
  --text-dim: #46566a;
  --text-faint: #8494a5;
  --accent: #0d7a6a;
  --accent-dim: rgba(13, 122, 106, 0.12);
  --accent-2: #2563a8;
  --shadow: 0 10px 40px rgba(20, 40, 60, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

.mono, .prompt, code {
  font-family: var(--font-mono);
}

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

.narrow { max-width: 820px; }

.accent { color: var(--accent); }
.dim { color: var(--text-faint); }

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }

/* grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.nav.scrolled { border-bottom-color: var(--border); }

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 34px;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-dim);
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle, .menu-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover, .menu-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }

.theme-toggle svg { width: 17px; height: 17px; }

.icon-sun { display: none; }
html[data-theme="light"] .icon-sun { display: block; }
html[data-theme="light"] .icon-moon { display: none; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span {
  width: 16px; height: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 40px) 0 60px;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(78, 201, 176, 0.6);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(78, 201, 176, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(78, 201, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(78, 201, 176, 0); }
}

.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.4vw, 1.22rem);
  color: var(--text-dim);
  margin-bottom: 22px;
}

.terminal-line {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 1rem;
  margin-bottom: 30px;
  letter-spacing: 0.04em;
}

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.2s ease;
}

.btn svg { width: 16px; height: 16px; transition: transform 0.18s ease; }

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

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 6px 22px var(--accent-dim);
}

.btn-primary:hover svg { transform: translateX(3px); }

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

.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost:hover svg { transform: translateY(-2px); }

/* profile photo */
.hero-photo {
  max-width: 320px;
  margin: 0 auto 24px;
}

.hero-photo img {
  width: 100%;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow), 0 0 0 6px var(--accent-dim);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top center;
}

@media (max-width: 960px) {
  .hero-photo { max-width: 260px; }
}

/* terminal card */
.hero-terminal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transform: perspective(900px) rotateY(-6deg);
  transition: transform 0.4s ease;
}

.hero-terminal:hover { transform: perspective(900px) rotateY(0deg) translateY(-4px); }

.term-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.term-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.term-body {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.8;
}

.term-body .prompt { color: var(--accent); font-weight: 600; }
.term-body .out { color: var(--text-dim); margin-bottom: 12px; white-space: normal; }

.cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}

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

.scroll-hint {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.scroll-hint:hover { opacity: 1; }

.mouse {
  width: 24px; height: 38px;
  border: 2px solid var(--text-dim);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.wheel {
  width: 3px; height: 7px;
  border-radius: 3px;
  background: var(--accent);
  animation: wheel 1.6s ease infinite;
}

@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(12px); opacity: 0; }
}

/* ===== PILLARS ===== */
.pillars { padding: 0 24px 90px; }

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.pillar-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}

.pillar-card:hover { transform: translateY(-5px); border-color: var(--accent); }
.pillar-card:hover::before { transform: scaleX(1); }

.pillar-step {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

.pillar-card h3 {
  font-size: 1.15rem;
  margin: 8px 0 6px;
}

.pillar-card p { font-size: 0.88rem; color: var(--text-dim); }

/* ===== SECTIONS ===== */
.section { padding: 96px 0; }
.section.alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-label {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin-bottom: 34px;
}

.lead {
  font-size: clamp(1rem, 2vw, 1.12rem);
  color: var(--text-dim);
  margin-bottom: 16px;
}

.lead:last-child { margin-bottom: 0; }

/* stack */
.stack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stack-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.stack-block:hover { border-color: var(--accent); transform: translateY(-3px); }

.stack-head {
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 12px;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.2s ease;
}

.chip.small { font-size: 0.75rem; padding: 4px 10px; }

.chip:hover { transform: translateY(-2px); background: var(--accent); color: var(--bg); }

.focus-list { list-style: none; display: grid; gap: 12px; }

.focus-list li {
  color: var(--text-dim);
  font-size: 0.95rem;
  padding-left: 4px;
}

.focus-list .accent { margin-right: 8px; }

/* projects */
.project-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: stretch;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.project-card::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.project-card:hover::after { opacity: 1; }

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge.team { background: var(--accent-dim); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.personal { background: rgba(86, 156, 214, 0.14); color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent); }

.project-type { font-size: 0.76rem; color: var(--text-faint); }

.project-title { font-size: 1.28rem; letter-spacing: -0.01em; margin-bottom: 6px; }

.project-title a {
  position: relative;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.25s ease;
}

.project-title a:hover { background-size: 100% 2px; }

.project-category { font-size: 0.78rem; margin-bottom: 16px; }

.project-summary { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 18px; }

.project-tech { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.project-sub {
  font-size: 0.74rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  margin: 4px 0 12px;
  text-transform: uppercase;
}

.project-list-items {
  list-style: none;
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
}

.project-list-items li {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding-left: 20px;
  position: relative;
}

.project-list-items li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

.project-modules { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.module {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  padding: 4px 10px;
  border-radius: 6px;
}

.project-focus {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
}

.project-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.project-link svg { width: 15px; height: 15px; transition: transform 0.2s ease; }
.project-link:hover svg { transform: translate(2px, -2px); }

/* growth */
.growth-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.growth-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.growth-block:hover { border-color: var(--accent); transform: translateY(-3px); }

.growth-block .stack-head { margin-bottom: 14px; }

.growth-role {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.growth-text { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 18px; }

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ===== REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-terminal { max-width: 560px; }
  .pillar-grid { grid-template-columns: repeat(2, 1fr); }
  .growth-grid { grid-template-columns: 1fr; }
  .stack-grid { grid-template-columns: 1fr; }
  .project-list { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav-links {
    position: fixed;
    top: var(--nav-h); right: 0; left: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    z-index: 49;
  }

  .nav-links.open { transform: translateY(0); }

  .nav-links a {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
  }

  .menu-toggle { display: flex; }
  .pillar-grid { grid-template-columns: 1fr; }
  .hero { padding-top: calc(var(--nav-h) + 24px); }
}
