/* =========================================================
   Bidur Khanal — Portfolio
   Custom stylesheet (Tailwind handles utility classes;
   this file holds things Tailwind can't: keyframes,
   glass surfaces, the terminal signature element, etc.)
   ========================================================= */

:root {
  --bg: #0F172A;
  --bg-elevated: #131c33;
  --accent: #3B82F6;      /* electric blue */
  --accent-2: #8B5CF6;    /* purple */
  --accent-cyan: #22D3EE; /* signature glow, used sparingly */
  --text-primary: #E7ECF6;
  --text-muted: #94A3B8;
  --border-soft: rgba(148, 163, 184, 0.14);
  --glass-bg: rgba(19, 28, 51, 0.55);
  --glass-border: rgba(148, 163, 184, 0.18);
}

html.light {
  --bg: #F5F7FB;
  --bg-elevated: #FFFFFF;
  --text-primary: #0F172A;
  --text-muted: #4B5875;
  --border-soft: rgba(15, 23, 42, 0.09);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(15, 23, 42, 0.08);
}

* { scroll-behavior: smooth; }

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

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  transition: background-color 0.35s ease, color 0.35s ease;
}

.font-display { font-family: 'Space Grotesk', 'Inter', sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- Glass surfaces ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.glass-nav {
  background: rgba(15, 23, 42, 0.55);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
html.light .glass-nav {
  background: rgba(245, 247, 251, 0.7);
}

/* ---------- Gradient text / accents ---------- */
.grad-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.grad-border {
  position: relative;
}
.grad-border::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-cyan));
  z-index: 60;
  transition: width 0.1s ease-out;
}

/* ---------- Loading screen ---------- */
#loading-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-caret {
  display: inline-block; width: 10px; height: 1.4rem;
  background: var(--accent-cyan);
  margin-left: 4px;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.16,.84,.44,1), transform 0.7s cubic-bezier(.16,.84,.44,1);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }
.reveal-scale { opacity: 0; transform: scale(0.94); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal-scale.in-view { opacity: 1; transform: scale(1); }

/* stagger children via inline --delay custom property */
.reveal, .reveal-scale { transition-delay: var(--delay, 0ms); }

/* ---------- Nav active link indicator ---------- */
.nav-link { position: relative; }
.nav-link::after {
  content: "";
  position: absolute; left: 0; bottom: -4px;
  width: 0%; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}
.nav-link.active::after, .nav-link:hover::after { width: 100%; }
.nav-link.active { color: var(--text-primary); }

/* ---------- Typing cursor ---------- */
.type-cursor {
  display: inline-block; width: 3px; height: 1em;
  background: var(--accent-cyan);
  margin-left: 2px; vertical-align: -0.1em;
  animation: blink 0.9s steps(1) infinite;
}

/* ---------- Terminal signature element ---------- */
.terminal {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(19,28,51,0.9), rgba(15,23,42,0.95));
  box-shadow: 0 30px 80px -20px rgba(59, 130, 246, 0.25), 0 0 0 1px rgba(148,163,184,0.05);
}
html.light .terminal {
  background: linear-gradient(180deg, #ffffff, #f3f5fa);
  box-shadow: 0 30px 80px -30px rgba(59,130,246,0.25);
}
.terminal-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: rgba(148,163,184,0.06);
  border-bottom: 1px solid var(--border-soft);
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }

/* ---------- Skill progress bars ---------- */
.skill-bar-track {
  height: 8px; border-radius: 999px;
  background: rgba(148,163,184,0.15);
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%; border-radius: 999px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1.2s cubic-bezier(.16,.84,.44,1);
}

/* ---------- Cards ---------- */
.card-hover {
  transition: transform 0.35s cubic-bezier(.16,.84,.44,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px -20px rgba(59,130,246,0.35);
  border-color: rgba(59,130,246,0.4);
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -8px rgba(59,130,246,0.55); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  border: 1px solid var(--glass-border);
  transition: border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
}
.btn-outline:hover { border-color: var(--accent); transform: translateY(-2px); background: rgba(59,130,246,0.08); }

.social-icon {
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), border-color 0.3s ease, color 0.3s ease;
}
.social-icon:hover { transform: translateY(-4px) rotate(-6deg); border-color: var(--accent); color: var(--accent); }

/* ---------- Back to top ---------- */
#back-to-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.3s ease;
}
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- Timeline ---------- */
.timeline-line {
  position: absolute; left: 15px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.35;
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
}

/* ---------- Particles canvas ---------- */
#particles-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}

/* ---------- Custom scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.25); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59,130,246,0.5); }

/* ---------- Focus visibility for accessibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Contribution graph placeholder ---------- */
.contrib-cell {
  width: 11px; height: 11px; border-radius: 2px;
  background: rgba(148,163,184,0.12);
}

/* ---------- Lazy image fade-in ---------- */
img.lazy-img { opacity: 0; transition: opacity 0.5s ease; }
img.lazy-img.loaded { opacity: 1; }

/* ---------- Form field error state ---------- */
.field-error { border-color: #F87171 !important; }
.field-error-msg { color: #F87171; font-size: 0.8rem; margin-top: 4px; min-height: 1rem; }

/* ---------- Section eyebrow ---------- */
.eyebrow::before { content: "// "; color: var(--accent-cyan); opacity: 0.8; }
