@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700;800;900&display=swap');

html {
  scroll-behavior: smooth;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  caret-color: #2563eb;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: #f8fafc;
  color: #0f172a;
  overflow-x: hidden;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Explicit typographic hierarchy with fluid scaling and line balance tuned for Lexend */
h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.28;
  letter-spacing: -0.015em;
  font-weight: 700;
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.38;
  letter-spacing: -0.01em;
  font-weight: 500;
  text-wrap: balance;
}

h4 {
  font-size: 0.95rem;
  line-height: 1.42;
  letter-spacing: normal;
  font-weight: 500;
  text-wrap: balance;
}

p {
  font-size: 0.95rem;
  line-height: 1.65;
  letter-spacing: normal;
  text-wrap: pretty;
}

/* Craft floor: browser surfaces theming */
::selection {
  background-color: #bfdbfe;
  color: #1e3a8a;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
  border: 2px solid #f1f5f9;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Smooth section anchor offset for sticky headers on desktop */
section {
  scroll-margin-top: 3rem;
}

/* On mobile/tablet where top header is sticky, increase scroll margin */
@media (max-width: 1023px) {
  section {
    scroll-margin-top: 5rem;
  }
}

/* Focus styles for keyboard accessibility */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Touch targets: min 44px on touch screens */
@media (hover: none) and (pointer: coarse) {
  .nav-link, button {
    min-height: 44px;
  }
}

/* Sidebar navigation links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.95rem;
  border-radius: 0.75rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: #475569;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

.nav-link.active {
  color: #2563eb;
  background-color: #eff6ff;
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3.5px;
  height: 20px;
  background-color: #2563eb;
  border-radius: 0 4px 4px 0;
}

.nav-link svg {
  transition: transform 0.2s ease, stroke 0.2s ease;
}

.nav-link:hover svg {
  transform: translateX(1px);
}

.nav-link.active svg {
  stroke: #2563eb;
}

/* Project Card Hover Animation */
.project-card {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.28s ease;
  will-change: transform, box-shadow;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -12px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  border-color: #94a3b8;
}

.project-card:hover .project-img {
  transform: scale(1.025);
}

.project-img {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Skills pill hover */
.skill-pill {
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
}

.skill-pill:hover {
  background-color: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
  transform: translateY(-1.5px);
  box-shadow: 0 2px 6px -1px rgba(37, 99, 235, 0.12);
}

/* Fade in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
