/*Global styles*/
body {  
  margin: 0;
  font-family: "Noto Serif TC", PMingLiU, "LiSong Pro","Times New Roman", serif;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 70px;
}

main {
  flex: 1;
  max-width: 800px;
  padding: 2rem;
  margin: 0 auto;
}

.layout {
  display: flex;
  min-height: 100vh;
}


/* 超連結 */
a {
  text-decoration:none;
  color: #888888;
  padding: 2px 5px;
  transition-duration: 2000ms;
}

a:hover {
  background: #eeeeee;
  color: #000;
  border-radius: 5px;
}

/* 文章列表 */
aside {
  font-family: system-ui, sans-serif;
  width: 180px;
  flex-shrink: 0;
  flex-direction: row;
  padding-top: 10rem;
  border-right: 1px solid #ddd;
  box-shadow: inset -5px 0px 10px rgba(143, 143, 143, 0.1);
}

aside ul {
  list-style-type: '- ';
  line-height: 1.5;
  padding-left: 1rem;
}

aside li.active a {
  font-weight: bold;
  text-decoration: none;
  background: #888;
  padding: 2px 5px;
  border-radius: 3px;
  color: #FFFFFF;
}

/* 響應式：當視窗寬度小於等於 800px 時隱藏側邊欄 */
@media (max-width: 800px) {
  aside {
    display: none;
  }
}

/*Blog的文章*/
.meta {
  color: #888888;
   font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

article {
  flex: 1;
  max-width: 800px;
  padding: 2rem;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 5rem;
}

.content {
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-ideograph;
}

/*首頁的標題圖片*/
.title-image {
  max-width: 400px;
  width: 100%;
  height: auto;
}

/*作品區的版面調整*/
.work {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.work-header {
  margin-bottom: 2rem;
}

.work-title {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.work-meta {
  font-size: 0.9rem;
  color: #666;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.work-type {
  padding: 0.15rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.75rem;
}

.work-divider {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

.work-content {
  line-height: 1.8;
}

.work-nav {
  font-size: 0.9rem;
}

/* 底部固定導覽列 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 10px rgba(143, 143, 143, 0.1);
  z-index: 100;
}
/* 
position: fixed使導覽列固定在底部，不受頁面滾動影響
z-index: 100確保導覽列始終在最上層
body 添加 70px 底部邊距，避免內容被導覽列遮擋 */

.bottom-nav-content {
  display: flex;
  justify-content: center;
  gap: 2rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

.bottom-nav a {
  color: #888;
  text-decoration: none;
  padding: 0.5rem 1rem;
  transition: all 2000ms;
  font-size: 0.95rem;
}

.bottom-nav a:hover {
  background: #eee;
  color: #000;
  border-radius: 5px;
}

.bottom-nav a.active {
  font-weight: bold;
  color: #000;
  border-bottom:1px #000 solid;
 
}

/* 平板設備 (768px 以下) */
@media (max-width: 768px) {
  main {
    padding: 1.5rem;
  }

  .bottom-nav-content {
    gap: 1rem;
    padding: 1rem;
  }

  .bottom-nav a {
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
  }

  body {
    padding-bottom: 80px;
  }
}

/* 手機設備 (480px 以下) */
@media (max-width: 480px) {
  main {
    padding: 1rem;
  }

  .bottom-nav-content {
    gap: 0.5rem;
    padding: 0.8rem;
  }

  .bottom-nav a {
    font-size: 1.1rem;
    padding: 0.7rem 0.6rem;
    flex: 1;
    text-align: center;
  }

  body {
    padding-bottom: 90px;
  }

  article {
    padding: 1rem;
  }

  .work {
    padding: 2rem 1rem;
  }

  .work-title {
    font-size: 1.5rem;
  }

  .post-nav {
    margin-top: 3rem;
    flex-direction: column;
    gap: 1rem;
  }
}

/* 相片牆網格 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.3rem;
  margin-top: 2rem;
}

.gallery-item {
  overflow: hidden;
  /*border-radius: 8px;*/
  background: #f5f5f5;
  aspect-ratio: 1;
  /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);*/
  transition: transform 200ms ease;
  cursor: pointer;
}
/*
.gallery-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
*/
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #f5f5f5;
}

/* 平板設備相片牆調整 */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    /* gap: 0.8rem; */
  }
}

/* 手機設備相片牆調整 */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    /* gap: 0.6rem; */
  }
}

/* Lightbox Modal 樣式 */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  animation: zoomIn 0.3s ease;
  transition: opacity 0.4s ease;
}

.lightbox-close {
  position: absolute;
  top: -20px;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  z-index: 1001;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
