@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --background: #ffffff;
  --foreground: #171717;
  --muted: #737373;
  --muted-light: #f5f5f5;
  --border: #e5e5e5;
  --accent: #171717;
  --accent-foreground: #ffffff;
  --grid-color: rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  --nav-bg: rgba(255, 255, 255, 0.85);
  
  --font-serif: 'Instrument Serif', serif;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

.dark {
  --background: #0a0a0a;
  --foreground: #ededed;
  --muted: #a3a3a3;
  --muted-light: #171717;
  --border: #262626;
  --accent: #fafafa;
  --accent-foreground: #000000;
  --grid-color: rgba(255, 255, 255, 0.03);
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(10, 10, 10, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Reduced transition scope to avoid lag */
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
.font-serif { font-family: var(--font-serif); }
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); font-size: 0.85rem; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--muted); }
.text-serif-italic { font-family: var(--font-serif); font-style: italic; }

/* Grid Background System */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

/* Dashed Borders Utility */
.border-dashed { border: 1px dashed var(--border); }
.border-x-dashed { border-left: 1px dashed var(--border); border-right: 1px dashed var(--border); }
.border-t-dashed { border-top: 1px dashed var(--border); }
.border-b-dashed { border-bottom: 1px dashed var(--border); }

/* Top Fixed Navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px dashed var(--border);
}

.nav-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
}

.nav-title {
  font-size: 1.5rem;
  color: var(--foreground);
  text-decoration: none;
}

.nav-links {
  display: none;
  gap: 20px;
  align-items: center;
}

@media (min-width: 600px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--foreground);
}

.nav-link.active {
  color: var(--foreground);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--foreground);
}

/* Nav Actions (theme + hamburger) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.theme-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-btn:hover {
  background-color: var(--muted-light);
  color: var(--foreground);
}

/* Mobile Hamburger */
.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-btn:hover {
  background-color: var(--muted-light);
  color: var(--foreground);
}

@media (min-width: 600px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* Mobile Dropdown */
.mobile-nav {
  display: none;
  width: 100%;
  max-width: 800px;
  flex-direction: column;
  padding: 8px 24px 16px;
  gap: 4px;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background-color: var(--muted-light);
  color: var(--foreground);
}

/* Layout Wrapper */
.layout-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding-top: 60px; /* space for nav */
}

.layout-container {
  width: 100%;
  max-width: 800px;
  background-color: var(--background);
  box-shadow: 0 0 100px 50px var(--background); /* subtle blend into bg */
  position: relative;
}

/* Section Blocks */
.section-block {
  padding: 40px 24px;
}

.section-title {
  font-size: 1.8rem;
  margin-bottom: 24px;
  font-weight: 400;
}

/* Hero Section */
#intro {
  padding-top: 24px;
  padding-bottom: 24px;
}

.banner-wrapper {
  width: 100%;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: -50px; /* pull avatar up */
  position: relative;
  border: 1px dashed var(--border);
}

@media (min-width: 600px) {
  .banner-wrapper {
    height: 180px;
    margin-bottom: -60px;
  }
}

.banner-bg {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
}

.profile-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 12px;
}

@media (min-width: 600px) {
  .profile-header {
    flex-direction: row;
    align-items: flex-end;
    gap: 24px;
  }
}

.avatar-wrapper {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  background-color: var(--background);
  padding: 6px;
  position: relative;
  z-index: 10;
}

@media (min-width: 600px) {
  .avatar-wrapper {
    width: 120px;
    height: 120px;
  }
}

.avatar, .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  background-color: var(--muted-light);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  font-weight: 600;
  font-size: 1.5rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.name-row h1 {
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1;
}

.verified-icon {
  width: 20px;
  height: 20px;
  color: var(--foreground);
}

.title-animation-wrapper {
  overflow: hidden;
}

.animated-title {
  display: inline-block;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.location-text {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-text::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* About Section */
.about-section {
  padding: 32px 24px;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-item {
  display: flex;
  gap: 12px;
  color: var(--foreground);
  font-size: 0.95rem;
}

.about-item .bullet {
  margin-top: 2px;
}

.highlight-text {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--muted);
}

/* Contact Grid */
.contact-section {
  padding: 32px 24px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .contact-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 800px) {
  .contact-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--foreground);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.contact-card:hover {
  background-color: var(--muted-light);
  transform: translateY(-2px);
}

.contact-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--muted-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.contact-card:hover .contact-icon-box {
  background-color: var(--background);
}

.contact-name {
  font-weight: 500;
  font-size: 0.9rem;
  flex: 1;
}

.contact-arrow {
  color: var(--muted);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: all 0.2s ease;
}

.contact-card:hover .contact-arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--foreground);
}

/* Experience Accordion */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.accordion-item {
  border-radius: 12px;
  padding: 16px;
  background-color: transparent;
  transition: background-color 0.2s ease;
}

.accordion-item:hover, .accordion-item.active {
  background-color: var(--muted-light);
}

.accordion-header {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--foreground);
}

@media (min-width: 500px) {
  .accordion-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.accordion-title-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.company-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  overflow: hidden;
}

.company-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

.job-meta {
  display: flex;
  flex-direction: column;
}

.company-name {
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.accordion-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.accordion-item.active .accordion-icon {
  transform: rotate(90deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  padding-left: 64px;
}

.accordion-item.active .accordion-content {
  opacity: 1;
  padding-top: 16px;
}

.experience-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.experience-bullet {
  position: relative;
  padding-left: 14px;
  color: var(--muted);
}

.experience-bullet::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* Projects Section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.view-all-link {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-size: 0.85rem;
}

.view-all-link svg {
  transition: transform 0.2s ease;
}

.view-all-link:hover svg {
  transform: translate(2px, -2px);
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 600px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--background);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.dark .project-card:hover {
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.project-banner-link {
  display: block;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.project-banner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.5s ease;
}

.project-card:hover .project-banner {
  transform: scale(1.05);
}

.bg-gradient-1 {
  background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
}

.bg-gradient-2 {
  background: linear-gradient(135deg, #10b981, #3b82f6);
}

.bg-gradient-3 {
  background: linear-gradient(135deg, #f43f5e, #fb923c);
}

.project-banner-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
}

.banner-tag {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  font-weight: 500;
}

.project-details {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.project-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--muted);
}

.project-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 12px;
  flex: 1;
}

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

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

.tech-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: var(--muted-light);
  color: var(--foreground);
}

.project-links {
  display: flex;
  gap: 8px;
}

.icon-link {
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.icon-link:hover {
  color: var(--foreground);
  background-color: var(--muted-light);
}

/* Writing Section */
.writing-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.writing-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--foreground);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.writing-card:hover {
  background-color: var(--muted-light);
  transform: translateY(-2px);
}

.writing-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: var(--background);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}

.writing-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.writing-title {
  font-size: 1rem;
}

.writing-date {
  font-size: 0.75rem;
}

/* Footer */
footer {
  padding: 32px 24px;
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: space-between;
}

@media (min-width: 600px) {
  .footer-row {
    flex-direction: row;
    align-items: flex-start;
  }
}

.footer-left, .footer-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (min-width: 600px) {
  .footer-right {
    text-align: right;
    align-items: flex-end;
  }
}

.footer-highlight {
  color: var(--foreground);
  font-weight: 500;
}

/* Ask AI Section */
.ask-ai-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.ask-ai-label {
  font-size: 0.8rem;
}

.ask-ai-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: var(--muted-light);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ai-btn:hover {
  background-color: var(--foreground);
  color: var(--background);
  transform: translateY(-3px);
}

.ai-logo {
  width: 16px;
  height: 16px;
}
