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

:root {
  --color-bg: #0f1117;
  --color-bg-alt: #161821;
  --color-surface: #1e2029;
  --color-border: #2a2d3a;
  --color-text: #e0e0e6;
  --color-text-muted: #8b8ea3;
  --color-accent: #6c8cff;
  --color-accent-hover: #8aa4ff;
  --color-accent-subtle: rgba(108, 140, 255, 0.1);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --container-width: 1100px;
  --transition: 0.3s ease;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

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

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

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

.section {
  padding: 100px 0;
}

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

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

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

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-family);
}

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

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.btn-outline {
  border-color: var(--color-border);
  color: var(--color-text);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 0.8rem;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}

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

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.5px;
}

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

.nav-menu {
  display: flex;
  list-style: none;
  gap: 32px;
}

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

.nav-link:hover,
.nav-link.active {
  color: var(--color-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(--color-text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 0 0;
  overflow: hidden;
}

.hero-mosaic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: auto auto auto auto;
  gap: 6px;
  width: 100%;
  max-width: 1200px;
  padding: 24px;
}

.mosaic-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: var(--color-surface);
  border-radius: 8px;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.mosaic-img:hover {
  opacity: 1;
}

.hero-center {
  grid-column: 2 / 6;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: rgba(15, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  z-index: 1;
}

.hero-greeting {
  font-size: 1.1rem;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: 12px;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -1px;
}

.hero-tagline {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 36px;
}

.hero-contacts {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 32px;
}

.hero-contacts a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  transition: color var(--transition);
}

.hero-contacts a:hover {
  color: var(--color-accent);
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

.about-image img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

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

.about-skills {
  margin-top: 32px;
}

.about-skills h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

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

.tag {
  display: inline-block;
  padding: 6px 14px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.tag-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
  cursor: pointer;
}

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

a.project-card {
  color: inherit;
  text-decoration: none;
}

a.project-card:hover {
  color: inherit;
}

.project-thumb {
  position: relative;
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  display: block;
  background: var(--color-surface);
}

.project-thumb .image-placeholder {
  border-radius: 0;
  border: none;
  aspect-ratio: 16/9;
}

.project-card-info {
  padding: 20px;
}

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

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

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 24px;
}

.modal-overlay.active {
  opacity: 1 !important;
  pointer-events: all !important;
}

.modal {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 16px 0 0;
  z-index: 10;
  transition: border-color var(--transition);
}

.modal-close:hover {
  border-color: var(--color-accent);
}

.modal-body {
  padding: 0 32px 32px;
}

.modal-gallery {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.modal-gallery.single {
  grid-template-columns: 1fr;
}

.modal-gallery.multi {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.modal-gallery img,
.modal-gallery video {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.modal-gallery video {
  max-height: 400px;
  object-fit: contain;
  background: #000;
}

.modal-gallery .gallery-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.modal-details h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-details .project-tags {
  margin-bottom: 16px;
}

.modal-details p {
  color: var(--color-text-muted);
  line-height: 1.7;
}

@media (max-width: 768px) {
  .modal {
    max-height: 90vh;
  }

  .modal-body {
    padding: 0 20px 20px;
  }

  .modal-gallery.multi {
    grid-template-columns: 1fr;
  }
}

/* ===== Publications ===== */
.publications-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pub-item {
  display: flex;
  gap: 24px;
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: border-color var(--transition);
}

.pub-item:hover {
  border-color: var(--color-accent);
}

.pub-year {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
  min-width: 50px;
  padding-top: 2px;
}

.pub-details h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

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

.pub-venue {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 12px;
}

.pub-links {
  display: flex;
  gap: 16px;
}

.pub-links a {
  font-size: 0.8rem;
  font-weight: 500;
}

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

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

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

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

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

.timeline-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 4px;
}

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

.timeline-org {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.timeline-content p:last-child {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

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

.contact-text {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: 36px;
}

.contact-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  transition: border-color var(--transition), transform var(--transition);
}

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

.contact-icon {
  font-size: 1.2rem;
}

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

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

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

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

  .hero-mosaic {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-center {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .mosaic-img {
    height: 100px;
  }

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

  .about-image {
    max-width: 200px;
    margin: 0 auto;
  }

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

  .pub-item {
    flex-direction: column;
    gap: 8px;
  }

  .section {
    padding: 64px 0;
  }
}
