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

:root {
  --bg: #060b13;
  --bg-card: rgba(20, 28, 40, 0.4);
  --bg-card-hover: rgba(30, 40, 60, 0.6);
  --primary: #4f46e5;      /* Indigo */
  --secondary: #06b6d4;    /* Cyan */
  --accent: #8b5cf6;       /* Purple */
  --white: #ffffff;
  --gray: #94a3b8;
  --gray-light: #cbd5e1;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(6, 182, 212, 0.4);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* NOISE TEXTURE AND ANIMATED ORBS */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
  filter: blur(80px);
  animation: floatOrb 15s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, transparent 60%);
  filter: blur(80px);
  animation: floatOrb 20s ease-in-out infinite alternate-reverse;
  z-index: 0;
  pointer-events: none;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0); }
  100% { transform: translate(15%, 15%); }
}

/* NOISE OVERLAY */
.noise-overlay {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

/* MAIN CONTAINER (to keep content above the background effects) */
.content-wrapper {
  position: relative;
  z-index: 2;
}

/* NAVIGATION */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(6, 11, 19, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--white);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-logo span { color: var(--secondary); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--gray);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.3s, text-shadow 0.3s;
}

.nav-links a:hover { 
  color: var(--secondary);
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

/* HERO */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-content { max-width: 720px; }

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1.5rem;
  padding: 0.4rem 1rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 30px;
  backdrop-filter: blur(4px);
}

.hero-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--secondary);
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 8px var(--secondary);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero h1 em {
  font-style: italic;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-light);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hero-subtitle span {
  color: var(--accent);
  font-size: 0.6rem;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--gray-light);
  max-width: 580px;
  margin-bottom: 2.5rem;
  line-height: 1.8;
}

.hero-desc strong { color: var(--white); font-weight: 500; }

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  border: none;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
  position: relative;
  z-index: 1;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--gray-light);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
}

/* SCROLL INDICATOR */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: float 3s ease-in-out infinite;
}

.scroll-hint::after {
  content: '';
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--secondary), transparent);
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* SECTIONS */
section {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6rem 2rem;
}

.section-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--secondary);
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  margin-bottom: 3.5rem;
  color: var(--white);
}

/* GLASSMORPHISM CARDS */
.project-card, .stat-card, .writing-item, .connect-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.project-card:hover, .stat-card:hover, .writing-item:hover, .connect-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-5px);
  box-shadow: 0 10px 40px rgba(6, 182, 212, 0.15);
}

/* OPEN SOURCE / WORK */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.8rem;
}

.project-card {
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.project-card:hover::before { transform: scaleX(1); }

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
}

.project-name {
  font-family: 'DM Mono', monospace;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.project-name:hover { color: var(--secondary); }

.project-badge {
  font-size: 0.6rem;
  padding: 0.3rem 0.6rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  color: #c4b5fd;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--gray-light);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.project-features {
  list-style: none;
  margin-bottom: 1.8rem;
}

.project-features li {
  font-size: 0.8rem;
  color: var(--gray);
  padding: 0.35rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.project-features li::before {
  content: '→';
  color: var(--secondary);
  flex-shrink: 0;
}

.project-code {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  font-size: 0.75rem;
  color: #a5b4fc;
  border-left: 2px solid var(--secondary);
  margin-bottom: 1.5rem;
  font-family: 'DM Mono', monospace;
}

.project-tools {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tool-tag {
  font-size: 0.65rem;
  padding: 0.3rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--gray-light);
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.tool-tag:hover {
  border-color: var(--secondary);
  color: var(--white);
  background: rgba(6, 182, 212, 0.1);
}

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  padding: 2rem;
  text-align: center;
}

.stat-number {
  font-family: 'DM Serif Display', serif;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-light);
}

/* WRITING & SERVICES */
.writing-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.writing-item {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  padding: 1.5rem 2rem;
  text-decoration: none;
}

.writing-item:hover {
  transform: translateY(-5px) translateX(8px);
}

.writing-item-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.writing-item-content { flex: 1; }

.writing-item-title {
  font-size: 1rem;
  color: var(--white);
  font-weight: 500;
  margin-bottom: 0.3rem;
  transition: color 0.2s;
}

.writing-item:hover .writing-item-title {
  color: var(--secondary);
}

.writing-item-meta {
  font-size: 0.8rem;
  color: var(--gray);
  line-height: 1.5;
}

.writing-item-arrow {
  color: var(--secondary);
  font-size: 1.2rem;
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s;
}

.writing-item:hover .writing-item-arrow {
  opacity: 1;
  transform: translateX(0);
}

.writing-cta {
  margin-top: 2rem;
  text-align: center;
}

/* CONNECT */
.connect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}

.connect-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--gray-light);
}

.connect-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s;
}

.connect-card:hover .connect-card-icon {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--secondary);
}

.connect-card-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.2rem;
}

.connect-card > div:nth-child(2) {
  min-width: 0; /* Ensures child elements can truncate properly in flexbox */
}

.connect-card-value {
  font-size: clamp(0.7rem, 4vw, 0.85rem);
  color: var(--white);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* FOOTER */
footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--gray);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.2);
}

footer a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--accent);
}

/* DIVIDER */
.divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 0;
}

/* ANIMATIONS */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.fade-in:nth-child(1) { animation-delay: 0.1s; }
.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.4s; }
.fade-in:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .projects-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 6rem; }
  body::before, body::after { filter: blur(50px); }
}