/* ===== Variables ===== */
:root {
  --bg: #0a0a0f;
  --bg-alt: #111118;
  --surface: #1a1a24;
  --border: #2a2a3a;
  --text: #e4e4ed;
  --text-muted: #8888a0;
  --accent: #22d3bb;
  --accent-glow: rgba(34, 211, 187, 0.15);
  --accent-hover: #1ab8a3;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 1100px;
  --radius: 10px;
  --transition: 0.3s ease;
}

[data-theme="light"] {
  --bg: #f8f8fc;
  --bg-alt: #efeff5;
  --surface: #ffffff;
  --border: #dddde8;
  --text: #1a1a2e;
  --text-muted: #6b6b80;
  --accent: #0d9e8a;
  --accent-glow: rgba(13, 158, 138, 0.1);
  --accent-hover: #0b877a;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 50px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 48px;
}

.subsection-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 56px;
  margin-bottom: 20px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

[data-theme="light"] .nav {
  background: rgba(248, 248, 252, 0.85);
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -0.02em;
}

.nav-logo:hover { color: var(--accent) !important; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

.nav-links a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Theme toggle */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.icon-moon { display: block; }
.icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: block; }

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 120px 24px 60px;
  position: relative;
}

.hero-content {
  max-width: var(--max-width);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
}

.hero-text { flex: 1; }

.hero-greeting {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-name {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.accent { color: var(--accent); }
.separator { color: var(--text-muted); margin: 0 4px; }

.hero-title {
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 16px;
  line-height: 1.6;
}

.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-cta {
  display: flex;
  gap: 16px;
}

.hero-photo {
  flex-shrink: 0;
}

.photo-placeholder {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  position: relative;
  overflow: hidden;
}

.photo-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-8px); }
  60% { transform: translateX(-50%) translateY(-4px); }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #0a0a0f;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-glow);
  transform: translateY(-2px);
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 36px;
}

.about-text p {
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 1.02rem;
}

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

.about-interests {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.interest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), transform var(--transition);
}

.interest-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.interest-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.interest-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.interest-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Sports card easter egg */
.sports-card {
  position: relative;
  overflow: hidden;
}

.sports-egg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: var(--radius);
  z-index: 1;
}

.sports-card-content {
  position: relative;
  z-index: 2;
}

.sports-card:hover .sports-egg {
  opacity: 0.25;
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  margin-top: 36px;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 32px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px solid var(--accent);
  z-index: 1;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.timeline-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-institution {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.timeline-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ===== Positions ===== */
.positions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.position-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
}

.position-card:hover { border-color: var(--accent); }

.position-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.position-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 6px 0 4px;
}

.position-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Publications ===== */
.publications-list {
  margin-top: 36px;
}

.pub-item {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:last-child { border-bottom: none; }

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  flex-shrink: 0;
  width: 50px;
  padding-top: 2px;
}

.pub-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  line-height: 1.4;
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.pub-journal {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pub-more {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 32px;
}

.pub-more h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.pub-more p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.pub-links {
  margin-top: 32px;
  text-align: center;
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 36px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

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

.project-icon {
  color: var(--accent);
  margin-bottom: 16px;
}

.project-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

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

.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(34, 211, 187, 0.2);
}

/* ===== Contact ===== */
#contact {
  text-align: center;
}

#contact .section-title {
  display: block;
}

#contact .section-title::after {
  left: 50%;
  transform: translateX(-50%);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color var(--transition), transform var(--transition);
}

.contact-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.contact-card svg { color: var(--accent); flex-shrink: 0; }

/* Bot contact */
.contact-bot {
  margin-top: 32px;
}

.contact-bot-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

/* ===== Photo Gallery ===== */
.photo-strip {
  padding: 56px 24px;
  background: var(--bg-alt);
}

/*
  All 4 photos are portrait (ratio 0.76–0.96).
  3:4 portrait cards (240×320) match perfectly — minimal cropping on all images.
  Cards spread out with gaps rather than flush against each other.
*/
.photo-mosaic {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  max-width: var(--max-width);
  margin: 0 auto;
}

.photo-mosaic > div {
  flex: 0 0 220px;
  height: 293px; /* 3:4 ratio */
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.photo-mosaic > div:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.photo-mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform 0.4s ease;
}

.photo-mosaic > div:hover img { transform: scale(1.03); }

/* Per-photo focal point — minimal adjustment needed since cells match image ratio */
.mosaic-big img          { object-position: center 35%; } /* cardinals: show family group */
.mosaic-top-right img    { object-position: 58% top; }    /* suns: right side, top */
.mosaic-bottom-left img  { object-position: center center; } /* bobblehead: centered */
.mosaic-bottom-right img { object-position: center 10%; } /* dog: keep faces up top */

/* ===== Project Card with Image ===== */
.project-card-has-img {
  display: flex;
  flex-direction: row;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.project-card-img {
  width: 160px;
  flex-shrink: 0;
  object-fit: cover;
}

.project-card-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.project-card-body .project-tags {
  margin-top: auto;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Animations ===== */
.animate-in {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeInUp 0.6s ease forwards;
}

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

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

.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition), opacity var(--transition);
  }

  [data-theme="light"] .nav-links {
    background: var(--bg);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .hero-content {
    flex-direction: column-reverse;
    text-align: center;
    gap: 40px;
  }

  .hero-tagline { margin-left: auto; margin-right: auto; }

  .hero-cta { justify-content: center; }

  .photo-placeholder {
    width: 180px;
    height: 180px;
    font-size: 2.5rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-interests {
    grid-template-columns: 1fr 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .photo-mosaic > div {
    flex: 0 0 calc(50% - 12px);
  }

  .project-card-has-img {
    flex-direction: column;
  }

  .project-card-img {
    width: 100%;
    height: 160px;
  }

  .section { padding: 72px 0; }

  .section-title { font-size: 1.6rem; }
}

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

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .contact-links {
    flex-direction: column;
    align-items: center;
  }

  .positions-grid {
    grid-template-columns: 1fr;
  }
}
