/* ===== Variables ===== */
:root {
  --bg: #0a0a0b;
  --bg-alt: #111113;
  --surface: #1a1a1d;
  --border: #2a2a2d;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --radius: 12px;
  --max-width: 1400px;
  --transition: 0.3s ease;
}

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

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

body {
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

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

/* ===== 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: 48px;
  position: relative;
  display: inline-block;
}

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

.subsection-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 64px;
  margin-bottom: 24px;
  color: var(--text);
}

/* ===== Navigation ===== */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.nav-container {
  max-width: var(--max-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: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

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

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

.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: var(--transition);
}

/* ===== Hero ===== */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('assets/img/OwnBuilt4axisCNC.jpg') center/cover no-repeat;
  opacity: 0.07;
  z-index: 0;
}

#hero .hero-content {
  position: relative;
  z-index: 1;
}

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

.hero-name {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 32px;
}

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

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
}

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

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

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

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

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

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

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

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

.highlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: border-color var(--transition);
}

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

.highlight-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.highlight-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== Projects Grid (Home) ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--accent-glow);
  color: var(--text);
}

.project-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.project-info {
  padding: 24px;
  flex: 1;
}

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

.project-tags span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 20px;
}

.project-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.project-info p {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== Project Detail Pages ===== */
.project-hero {
  padding: 120px 0 48px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--accent);
}

.project-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.project-detail {
  max-width: 900px;
}

.project-detail-image img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 48px;
}

.project-detail-gallery {
  display: flex;
  gap: 16px;
  margin-bottom: 48px;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  user-select: none;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding-left: 24px;
  padding-right: 24px;
}

.project-detail-gallery::-webkit-scrollbar {
  display: none;
}

.project-detail-gallery.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.project-detail-gallery img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  height: 450px;
  width: auto;
  flex-shrink: 0;
  object-fit: cover;
  pointer-events: none;
}

.project-detail-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
  margin-top: 40px;
}

.project-detail-body h2:first-child {
  margin-top: 0;
}

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

.project-detail-body ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.project-detail-body li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.project-detail-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.project-detail-body li strong {
  color: var(--text);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.disclaimer {
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.5;
}

/* ===== PDF Viewer ===== */
.pdf-viewer {
  margin-top: 24px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pdf-viewer iframe {
  width: 100%;
  height: 75vh;
  min-height: 500px;
  border: none;
  background: var(--surface);
}

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

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

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

.pub-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.pub-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

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

/* ===== Awards ===== */
.awards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.award-item {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: border-color var(--transition);
}

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

.award-item strong {
  color: var(--text);
}

.award-place {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 10px;
  border-radius: 20px;
  margin-right: 12px;
}

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

.skill-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.skill-category h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

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

.skill-tags span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  transition: all var(--transition);
}

.skill-tags span:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Contact ===== */
.contact-text {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 500px;
}

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

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 11, 0.95);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

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

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

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

  .project-meta {
    flex-direction: column;
    gap: 8px;
  }

  .project-detail-gallery img {
    height: 280px;
  }

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

  .hero-name {
    font-size: 2.5rem;
  }

  .section {
    padding: 64px 0;
  }
}
