body {
  background-color: #faf7f2;
  font-family: 'Jura', sans-serif;
  color: #2b2b2b;
  margin: 0;
  padding: 0;
  padding-bottom: 250px;
  overflow-x: hidden; /* prevent horizontal scroll */
}

/* Intro section fills full screen */
#intro {
  height: 100vh; /* full viewport height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-left: 12.5%; /* 1/8 of the screen width */
  position: relative;
  box-sizing: border-box;
}

/* Text styles */
#intro h1 {
  font-size: 5rem;
  margin: 0 0 10px 0;
}

#intro h2 {
  font-size: 1.5rem;
  font-weight: normal;
  opacity: 0.8;
  margin: 0;
}

/* Large Chinese character on the right */
.chinese-character {
  position: absolute;
  right: 12.5%;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Liu Jian Mao Cao', cursive;
  font-size: 70rem;
  color: #f0ebe1;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

#intro .intro-text {
  position: relative;
  z-index: 1;
}

/* Scroll indicator arrow */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
  transition: opacity 0.3s ease;
}

.scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

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

/* Navigation bar container - fixed at top */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #faf7f2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Hide nav bar when scrolling down */
.nav-bar.hidden {
  transform: translateY(-100%);
}

/* Show nav bar when scrolling up */
.nav-bar.visible {
  transform: translateY(0);
}

/* Navigation buttons container */
.nav-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 20px;
  gap: 20px;
  background: #faf7f2;
}

/* About button */
#about-btn {
  background: none;
  border: none;
  font-family: 'Jura', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  color: #2b2b2b;
  text-decoration: none;
  padding: 0;
  margin: 0;
  line-height: 1.5;
  vertical-align: baseline;
}

/* Home button */
#home-btn {
  background: none;
  border: none;
  font-family: 'Jura', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  color: #2b2b2b;
  text-decoration: none;
  padding: 0;
  margin: 0;
  line-height: 1.5;
  vertical-align: baseline;
}

/* Hide home button on homepage */
body.homepage #home-btn {
  display: none;
}

/* Projects button */
#projects-btn {
  background: none;
  border: none;
  font-family: 'Jura', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  color: #2b2b2b;
  text-decoration: none;
  padding: 0;
  margin: 0;
  line-height: 1.5;
  vertical-align: baseline;
}

#home-btn:hover,
#projects-btn:hover,
#about-btn:hover {
  text-decoration: underline;
}

/* Projects list */
#projects {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
  padding: 120px 0 100px;
}

/* Project Filter Buttons */
.project-filters {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: 'Jura', sans-serif;
  font-size: 1rem;
  padding: 10px 20px;
  background: transparent;
  border: 2px solid transparent;
  color: #2b2b2b;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: #f5f0e8;
}

.filter-btn.active {
  border: 2px solid #2b2b2b;
  outline: none;
}

/* Hide filtered projects */
.project.hidden {
  display: none;
}

.project {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 1400px;
  width: 95%;
  border-radius: 10px;
  padding: 30px;
  background: #f5f0e8;
}

.project-link {
  display: flex;
  align-items: center;
  gap: 40px;
  width: 100%;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.project-link:hover {
  opacity: 0.8;
}

.project img {
  max-height: 250px;   /* max vertical size */
  width: auto;         /* width adjusts automatically */
  max-width: 60%;      /* but don't get wider than this */
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: block;      /* removes inline space */
  margin: 0 auto;      /* center horizontally */
}


.project-title {
  font-size: 1.5rem;
  color: #2b2b2b;
  text-decoration: none;
}

.project .tech-stack {
  width: 100%;
  justify-content: center;
  margin-top: 0;
}

/* ========== PROJECT PAGE STYLES ========== */

/* Main content container for project pages */
main {
  max-width: 800px;
  margin: auto;
  padding: 80px 20px 100px;
}

/* Project page title */
main h1 {
  font-size: 2.5rem;
  margin-bottom: 40px;
  line-height: 1.3;
}

/* Content sections */
.section {
  margin-bottom: 50px;
}

.section h2 {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.section h3 {
  font-size: 1.2rem;
  margin-top: 25px;
  margin-bottom: 10px;
}

.code-block {
  background: #504435;
  color: #f8f4ee;
  font-family: 'Jura', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 20px 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.highlight-box {
  background: #f0ebe1;
  border-left: 4px solid #b28a5c;
  padding: 20px 25px;
  border-radius: 10px;
  margin: 20px 0;
}

.highlight-box ul {
  margin: 15px 0 0 20px;
  padding: 0;
}

/* Text formatting */
main p,
main li {
  line-height: 1.8;
  font-size: 1rem;
}

main ul,
main ol {
  margin-left: 20px;
}

main strong {
  font-weight: bold;
}

/* Media placeholders */
.media-placeholder {
  background: #f5f2ed;
  border: 2px dashed #ccc;
  border-radius: 10px;
  padding: 60px 20px;
  text-align: center;
  margin: 30px 0;
  color: #999;
  font-style: italic;
}

/* Tech stack tags */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.tech-tag {
  background: #e8e4dc;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Section divider */
.divider {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid #ddd;
}

/* Video container for YouTube embeds */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 30px 0;
  border-radius: 10px;
  background: #000;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

/* ========== MOBILE RESPONSIVE STYLES ========== */

@media (max-width: 768px) {
  /* Intro section mobile adjustments */
  #intro {
    padding-left: 5%;
    padding-right: 5%;
    padding-top: 80px; /* Space for navigation buttons */
  }

  #intro h1 {
    font-size: 2.5rem;
  }

  #intro h2 {
    font-size: 1.2rem;
  }

  /* Chinese character mobile */
  .chinese-character {
    font-size: 15rem;
    right: 5%;
  }

  /* Navigation bar mobile */
  .nav-buttons {
    padding: 15px 10px;
    gap: 15px;
  }

  /* Navigation buttons - larger touch targets */
  #about-btn,
  #home-btn,
  #projects-btn {
    font-size: 1rem;
    padding: 10px 15px;
    min-height: 44px; /* Minimum touch target size */
    min-width: 60px;
  }

  /* Projects section mobile */
  #projects {
    padding: 80px 5% 60px;
    gap: 60px;
  }

  .project {
    width: 100%;
    gap: 15px;
    padding: 20px;
  }

  .project-link {
    flex-direction: column;
    gap: 20px;
  }

  .project img {
    max-height: 400px;   /* max vertical size */
    width: auto;         /* width adjusts automatically */
    max-width: 60%;      /* but don't get wider than this */;
  }

  .project-title {
    font-size: 1.2rem;
    text-align: center;
  }

  .project .tech-stack {
    padding: 0 10px;
  }

  /* Main content mobile */
  main {
    padding: 80px 5% 60px;
  }

  main h1 {
    font-size: 1.8rem;
    margin-bottom: 30px;
  }

  .section {
    margin-bottom: 40px;
  }

  .section h2 {
    font-size: 1.3rem;
  }

  .section h3 {
    font-size: 1.1rem;
  }

  main p,
  main li {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  /* Scroll indicator mobile */
  .scroll-indicator {
    bottom: 30px;
  }

  /* Tech stack tags mobile */
  .tech-stack {
    gap: 8px;
  }

  .tech-tag {
    font-size: 0.85rem;
    padding: 5px 12px;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  #intro {
    padding-left: 5%;
    padding-right: 5%;
  }

  #intro h1 {
    font-size: 2rem;
  }

  #intro h2 {
    font-size: 1rem;
  }

  /* Chinese character extra small screens */
  .chinese-character {
    font-size: 10rem;
    right: 2%;
  }

  .nav-buttons {
    padding: 12px 5px;
    gap: 10px;
  }

  #about-btn,
  #home-btn,
  #projects-btn {
    font-size: 0.9rem;
    padding: 8px 12px;
    min-height: 44px;
    min-width: 50px;
  }

  main h1 {
    font-size: 1.5rem;
  }

  .section h2 {
    font-size: 1.2rem;
  }

  .project-title {
    font-size: 1.1rem;
  }

  /* Ensure images don't overflow */
  img {
    max-width: 100%;
    height: auto;
  }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
  /* For touch devices */
  #about-btn:hover,
  #home-btn:hover,
  #projects-btn:hover {
    text-decoration: none;
  }

  #about-btn:active,
  #home-btn:active,
  #projects-btn:active {
    opacity: 0.7;
  }

  .project:active {
    opacity: 0.7;
  }
}

/* Prevent text size adjustment on iOS */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Ensure images are responsive */
img {
  max-width: 100%;
  height: auto;
}

/* ========== PROJECT NAVIGATION ========== */

.project-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #ddd;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
  color: #2b2b2b;
  padding: 15px 20px;
  border-radius: 8px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  flex: 1;
  max-width: 48%;
}

.nav-link:hover {
  background-color: #f5f0e8;
  opacity: 0.9;
}

.nav-link-prev {
  justify-content: flex-start;
  text-align: left;
}

.nav-link-next {
  justify-content: flex-end;
  text-align: right;
}

.nav-link-empty {
  visibility: hidden;
}

.nav-arrow {
  font-size: 1.5rem;
  font-weight: normal;
  flex-shrink: 0;
}

.nav-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0; /* Allow text to truncate */
}

.nav-label {
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-title {
  font-size: 1rem;
  font-weight: normal;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Mobile responsive styles for project navigation */
@media (max-width: 768px) {
  .project-navigation {
    flex-direction: column;
    gap: 15px;
    margin-top: 50px;
    padding-top: 30px;
  }

  .nav-link {
    max-width: 100%;
    width: 100%;
    padding: 12px 15px;
  }

  .nav-link-next {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }

  .nav-link-next .nav-arrow {
    order: 2;
    margin-left: auto;
  }

  .nav-title {
    font-size: 0.95rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}