@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

:root {
  --bg: #0a0a0f;
  --surface: #111118;
  --surface-hover: #14141d;
  --border: #1e1e2e;
  --border-hover: #3b3b5c;
  --accent: #7C3AED;
  --accent-glow: rgba(124,58,237,0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6,182,212,0.2);
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --radius: 10px;
  --radius-sm: 6px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.7;
  /* subtle grid texture */
  background-image:
    linear-gradient(rgba(124,58,237,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

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

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 80px);
  height: 60px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.15s;
  cursor: pointer;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}

/* ── Hero ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(80px, 15vw, 140px) clamp(20px, 5vw, 80px) clamp(60px, 10vw, 100px);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-eyebrow::before, .hero-eyebrow::after {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
}

h1 {
  font-size: clamp(32px, 6vw, 64px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

h1 .gradient {
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.typewriter-wrap {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(14px, 2.5vw, 20px);
  color: var(--text-muted);
  margin-bottom: 40px;
  min-height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.typewriter-prompt { color: var(--accent); }
.typewriter-text { color: var(--cyan); }
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--cyan);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

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

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, box-shadow 0.15s;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: #6d28d9;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

/* ── Stats strip ── */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 5vw, 64px);
  padding: 32px clamp(20px, 5vw, 80px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.stat { text-align: center; }

.stat-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ── Projects section ── */
#projects {
  padding: clamp(48px, 8vw, 80px) clamp(20px, 5vw, 80px);
  max-width: 1280px;
  margin: 0 auto;
}

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 600;
  margin-bottom: 32px;
  letter-spacing: -0.01em;
}

/* ── Filter pills ── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.filter-pill {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.filter-pill:hover { border-color: var(--border-hover); color: var(--text); }
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

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

@media (max-width: 900px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .projects-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  will-change: transform;
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 1px var(--accent-glow);
}

.card-thumb-wrap {
  position: relative;
  overflow: hidden;
}

.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.card-cat-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 65ch;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.card-tag {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.card-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: gap 0.15s;
}
.card-link:hover { gap: 8px; }

.featured-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 20px;
}

.card-wrap {
  transition: opacity 0.2s, transform 0.2s;
}

/* ── Empty / Loading states ── */
.projects-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.projects-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px clamp(20px, 5vw, 80px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Focus visible (keyboard nav) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── Skip to content ── */
.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transition: top 0.15s;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ── Skeleton loading ── */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--border);
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.skeleton-body { padding: 18px 20px; }

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: var(--border);
  animation: skeleton-pulse 1.6s ease-in-out infinite;
  margin-bottom: 10px;
}
.skeleton-line.short { width: 40%; animation-delay: 0.1s; }
.skeleton-line.medium { width: 70%; animation-delay: 0.2s; }
.skeleton-line.full { width: 100%; animation-delay: 0.15s; }
.skeleton-line.title { height: 16px; width: 85%; margin-bottom: 12px; animation-delay: 0.05s; }

/* ── Stat loading pulse ── */
.stat-number.loading {
  animation: skeleton-pulse 1.4s ease-in-out infinite;
  color: var(--text-muted);
}

/* ── About section ── */
#about {
  padding: clamp(48px, 8vw, 80px) clamp(20px, 5vw, 80px);
  max-width: 1280px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }

.about-left { display: flex; flex-direction: column; gap: 20px; }

.about-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.about-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.about-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.about-github-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s;
  text-decoration: none;
}
.about-github-link:hover { color: var(--accent); }

.about-bio {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.8;
  max-width: 55ch;
}

.about-bio strong { color: var(--text); font-weight: 600; }

.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s;
}
.tool-item:hover { border-color: var(--border-hover); }

.tool-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Contact section ── */
#contact {
  padding: clamp(48px, 8vw, 80px) clamp(20px, 5vw, 80px);
  border-top: 1px solid var(--border);
  text-align: center;
}

.contact-inner {
  max-width: 560px;
  margin: 0 auto;
}

.contact-inner p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 16px;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Card hover overlay (click hint) ── */
.card-thumb-wrap { position: relative; overflow: hidden; }

.card-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.card-wrap:hover .card-hover-overlay,
.card-wrap:focus-visible .card-hover-overlay { opacity: 1; }

/* ── Project Detail Modal ── */
.project-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.project-detail-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.project-detail-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.22s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.project-detail-overlay.open .project-detail-modal {
  transform: translateY(0) scale(1);
}

.detail-close {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px 0 0;
  z-index: 10;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.detail-close:hover { color: var(--text); border-color: var(--border-hover); }

.detail-thumb-wrap {
  width: 100%;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  line-height: 0;
}

.detail-thumb-wrap img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.detail-content {
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-body {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.8;
}

.detail-body p { margin-bottom: 12px; }
.detail-body p:last-child { margin-bottom: 0; }
.detail-body strong { color: var(--text); font-weight: 600; }
.detail-body ul, .detail-body ol { padding-left: 20px; margin-bottom: 12px; }
.detail-body li { margin-bottom: 4px; }

.detail-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.detail-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-size: 14px;
  padding: 10px 20px;
}

@media (max-width: 520px) {
  .detail-content { padding: 20px; }
  .project-detail-overlay { padding: 12px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .typewriter-cursor { animation: none; opacity: 1; }
}
