:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-2: #8b5cf6;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --max: 1200px;
  --ease-apple: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: "Inter", "SF Pro Display", system-ui, -apple-system, sans-serif;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { scroll-behavior: auto; } /* We handle this in JS for custom offsets */

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.background .shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}

.shape-1 { width: 400px; height: 400px; background: #dbeafe; top: -100px; left: -50px; animation: floaty 15s ease-in-out infinite; }
.shape-2 { width: 350px; height: 350px; background: #ede9fe; bottom: 5%; right: -50px; animation: floaty 18s ease-in-out infinite reverse; }
.shape-3 { width: 250px; height: 250px; background: #f1f5f9; top: 50%; left: 30%; transform: translate(-20%, -10%); animation: floaty 20s ease-in-out infinite; }

.nav {
  position: sticky;
  top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  max-width: calc(var(--max) - 32px);
  margin: 0 auto;
  z-index: 100;
  isolation: isolate;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  transform: translateY(0) scale(1);
  transition: transform 550ms var(--ease-apple), box-shadow 550ms var(--ease-apple), background-color 400ms var(--ease-smooth), border-color 400ms var(--ease-smooth);
}

.nav.scrolled {
  transform: translateY(-2px) scale(0.99);
  box-shadow: var(--shadow-xl);
  background: rgba(255, 255, 255, 0.92);
}

.logo {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-size: 20px;
  text-decoration: none;
}

.accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.nav-links a:hover { color: var(--text); background: rgba(0, 0, 0, 0.03); }

.nav-cta { white-space: nowrap; }

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 20px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 60px;
  align-items: center;
  padding: 40px 0 100px;
}

.avatar-card {
  position: relative;
  width: min(380px, 100%);
  aspect-ratio: 1/1;
  margin: 0 auto;
  will-change: transform;
}

.avatar-ring {
  position: absolute;
  inset: -10px;
  border-radius: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0.15;
  filter: blur(20px);
  animation: pulse 6s ease-in-out infinite;
}

.avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 32px;
  background: var(--card);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-apple);
}

.avatar:hover img { transform: scale(1.05); }

.caption {
  position: absolute;
  bottom: -20px;
  right: -20px;
  background: var(--card);
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
}

.hero-text h1 {
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.lede {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 600px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: transform 320ms var(--ease-apple), box-shadow 320ms var(--ease-apple), border-color 250ms var(--ease-smooth), background-color 250ms var(--ease-smooth), color 250ms var(--ease-smooth);
  will-change: transform;
}

.button:hover { transform: translateY(-2px) scale(1.01); box-shadow: var(--shadow-lg); border-color: #cbd5e1; }
.button:active { transform: translateY(0); }

.button.copied {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #059669 !important;
}

.button.primary {
  background: var(--text);
  color: #fff;
  border: none;
}
.button.primary:hover { background: #1e293b; }

.button.ghost {
  background: transparent;
  border: 2px solid var(--border);
}
.button.ghost:hover { background: #f1f5f9; border-color: #cbd5e1; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.meta-pill {
  padding: 8px 16px;
  border-radius: 99px;
  background: #fff;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

.section { padding: 100px 0; border-top: 1px solid var(--border); }
.section-heading { margin-bottom: 48px; }
.section-heading h2 { font-size: clamp(32px, 4vw, 48px); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 16px; }

.card {
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--border);
  padding: 32px;
  box-shadow: var(--shadow);
  transition: transform 420ms var(--ease-apple), box-shadow 420ms var(--ease-apple), border-color 300ms var(--ease-smooth);
  will-change: transform;
}

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); border-color: var(--accent); }

.project { display: grid; gap: 24px; }
.tag { padding: 6px 12px; border-radius: 8px; background: #eff6ff; color: var(--accent); font-weight: 700; font-size: 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.card h3 { font-size: 22px; margin-bottom: 12px; letter-spacing: -0.01em; }

.pill-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.pill { padding: 10px 20px; background: #fff; border: 1px solid var(--border); border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--text); }

.experience { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 40px; }
.experience-item { padding: 24px; background: #fff; border-radius: 20px; border: 1px solid var(--border); }

.contact-card { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--border);
}

.contact-info .button { width: 100%; }

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 60px 20px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* Animations */
[data-animate] {
  opacity: 0;
  transform: translateY(34px) scale(0.985);
  filter: blur(6px);
  transition: opacity 900ms var(--ease-apple), transform 900ms var(--ease-apple), filter 700ms var(--ease-smooth);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

body.motion-ready .nav {
  animation: introSlide 900ms var(--ease-apple) both;
}

body.motion-ready .hero .avatar-card {
  animation: introRise 1100ms var(--ease-apple) 70ms both;
}

body.motion-ready .hero .hero-text {
  animation: introRise 1100ms var(--ease-apple) 170ms both;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.05); }
}

@keyframes introSlide {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes introRise {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.985);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@media (max-width: 1024px) {
  .page { padding: 80px 18px; }
  .hero { grid-template-columns: 1fr; text-align: center; gap: 40px; }
  .hero-text { order: 2; }
  .avatar-card { order: 1; width: min(320px, 100%); }
  .hero-actions, .meta-row { justify-content: center; }
  .lede { margin-left: auto; margin-right: auto; }
}

@media (max-width: 900px) {
  .nav-cta { display: inline-flex; }
}

@media (max-width: 768px) {
  .nav {
    max-width: none;
    width: calc(100% - 16px);
    padding: 10px 14px;
    gap: 8px;
    top: 10px;
  }

  .nav-links { display: none; }
  .nav-cta {
    display: inline-flex;
    min-height: 44px;
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 14px;
    width: auto;
  }

  .page { padding: 62px 16px 80px; }
  .hero { padding: 10px 0 44px; gap: 22px; }
  .avatar-card { width: min(248px, 100%); }
  .caption { font-size: 12px; padding: 10px 14px; bottom: -14px; right: -14px; }
  .hero-text .eyebrow { margin-bottom: 8px; }
  .hero-text h1 { margin-bottom: 14px; }
  .hero-text .lede { margin-bottom: 18px; font-size: 16px; line-height: 1.5; }
  .hero-actions { margin-bottom: 14px; gap: 10px; }
  .meta-row { margin-bottom: 10px; }
  .section { padding: 44px 0; }
  .section-heading { margin-bottom: 28px; }
  .card { padding: 22px; }
  .card-grid { gap: 12px; }
  .experience { gap: 12px; margin-top: 24px; }
  .contact-card { gap: 12px; }
  .project-actions { display: grid; gap: 10px; }
  .project-actions .button { width: 100%; }
  .footer { flex-direction: column; gap: 24px; text-align: center; }

  .button,
  .nav-links a,
  .pill,
  .meta-pill {
    min-height: 44px;
    min-width: 44px;
  }

  [data-animate] {
    transform: translateY(18px) scale(0.99);
    filter: blur(4px);
    transition: opacity 600ms var(--ease-apple), transform 600ms var(--ease-apple), filter 450ms var(--ease-smooth);
  }
}

@media (max-width: 540px) {
  .nav { width: calc(100% - 12px); border-radius: 16px; }
  .logo { font-size: 18px; }
  .hero-text h1 { font-size: clamp(32px, 9vw, 44px); }
  .lede { font-size: 16px; }
  .button { width: 100%; justify-content: center; }
  .nav .nav-cta {
    width: auto;
    min-height: 44px;
    padding: 11px 10px;
    font-size: 14px;
    justify-content: center;
  }
  .hero-actions { width: 100%; }
  .meta-row { gap: 8px; }
  .meta-pill { font-size: 12px; padding: 8px 12px; }
  .card { padding: 22px; }
  .pill { font-size: 13px; padding: 8px 14px; }
  .contact-card { grid-template-columns: 1fr; }
}

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

  .shape-1,
  .shape-2,
  .shape-3,
  .avatar-card {
    transform: none !important;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
