
@import url('https://fonts.googleapis.com/earlyaccess/cwtexfangsong.css');

body {
  background-color: #2f3740;
  color: #eeeeee;
  font-family: 'source-han-serif-hk-subset', sans-serif;
  margin: 0;
  padding: 0;
  position: relative;
  overflow-x: hidden;
  line-height: 1.8;
}
.fog-bg::before {
  content: "";
  position: fixed;
  top: -25%; left: -25%;
  width: 150%; height: 150%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.04), transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(240, 240, 255, 0.035), transparent 60%),
    radial-gradient(circle at 50% 50%, rgba(220, 230, 255, 0.03), transparent 20%);
  backdrop-filter: blur(60px);
  animation: fogMove 10s ease-in-out infinite alternate;
  z-index: -1;
  pointer-events: none;
}

@keyframes fogMove {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  50% {
    transform: translate(-50px, -40px) scale(1.05);
  }
  100% {
    transform: translate(-100px, -80px) scale(1.1);
  }
}




a {
  color: #dddddd;
  text-decoration: none;
}
a:hover {
  color: #ffffff;
}

header.site-header {
  text-align: center;
  padding: 2rem 1rem;
}
header h1 {
  font-size: clamp(1rem, 5vw, 2rem); /* 動態字體大小 */
  font-family: 'source-han-serif-hk-subset', sans-serif;
  font-weight: bold;
  font-size: 2rem;
  color: #fff0f5;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  letter-spacing: 2px;
  position: relative;
}
header h1::after {
  content: "";
  display: block;
  width: 200px;
  margin: 0.5rem auto 0;
  border-bottom: 2px solid #5f6770;
  opacity: 0.5;
}
header .tagline {
  font-family: 'source-han-serif-hk-subset', sans-serif;
  font-size: 1rem;
  color: #dddddd;
  margin-top: 0.5rem;
  letter-spacing: 2px;
  opacity: 0.8;
}

main {
  display: flex;
  flex-wrap: wrap; /* ⭐ 加這行 → 小螢幕時 aside 自動下排 */
  padding: .5rem;
  box-sizing: border-box;
}

aside {
  justify-content: center; /* 置中 */
  width: 100%;
  padding-right: 0.1rem;
}
.category-link {
  justify-content: center; /* 置中 */
  display: inline-block;
  margin: 0.1rem 0.1rem;
  padding: 0.1rem 0.1rem;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 0.8rem;
}
.category-link:hover {
  transform: translateY(-2px);
}
.category-link.active {
  font-weight: bold;
  border-color: #3f4750;
}


.poem-section { 
  flex: 1;
  min-width: 0; /* ⭐ 改成 0 → 保證在窄畫面時不強迫 600px 導致整排擠爆 */
  left: 50%;
}
#poem-list {
  justify-content: center; /* 置中 */
  text-align: center;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* 自動 2~3 篇排版 */
  gap: 16px;
  padding: 1rem 0;
  left: 50%;
}
.poem-link {
  width: 250px;
  display: inline-block;
  margin: 0 auto;
  justify-content: center; /* 置中 */
  text-align: center;
  font-size: 1.1rem;
  padding: 0.8rem;
  margin-bottom: .8rem;
  border-left: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
.poem-link:hover {
  transform: translateX(-3px);
}
.poem-link strong {
  justify-content: center; /* 置中 */
  text-align: center;
  display: inline-block;
  position: relative;
  transition: all 0.3s ease;
}
.poem-link strong::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #ffffff;
  transition: width 0.3s ease;
}
.poem-link:hover strong::after {
  width: 100%;
}

#poem-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
}
#poem-link, #poem-list {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}
#poem-title, #poem-meta, #poem-body {
  opacity: 1;
}
@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

.fade-in-fast {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

#poem-title {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: #ffffff;
  font-weight: bold;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 0.5rem;
}
#poem-body {
  white-space: pre-wrap;
  font-size: 1rem;
  color: #ffffff;
  font-family: 'source-han-serif-hk-subset', sans-serif;
  line-height: 1.5;
  letter-spacing: 1px;
  margin-bottom: 2rem;
}
.open-cusdis-button,
.page-numbers-button,
.page-button,
.back-button,
.next-prev-buttons button {
  font-size: .8rem;
  font-family: 'source-han-serif-hk-subset', sans-serif;
  padding: 0.1rem 0.6rem;
  background: #3f4750;
  color: #aaa;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
   box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.open-cusdis-button:hover,
.page-numbers-button:hover,
.page-button:hover,
.back-button:hover,
.next-prev-buttons button:hover {

  transform: translateY(-1px);
}


.pagination {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto; /* 最重要 */
  white-space: nowrap;
}

.pagination > button.page-button {
  flex: 0 0 auto; /* 不會被擠壓 */
}

.pagination > #page-numbers {
  display: flex;
  flex: 1 1 auto; /* 可以收縮 / 撐開 */
  min-width: 0; /* ⭐⭐⭐ 最重要！允許 shrink，不然 flex 算法不會縮 */
  max-width: 100%;
  overflow-x: auto; /* ⭐⭐⭐ 這句才是保證不會換行！ */
  white-space: nowrap;
}

#cusdis_thread {
  font-size: .8rem;
  max-width: 450px;
  margin: 0 auto;
  padding: 0.1rem;

  border-radius: 1px;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
  max-height: 400px;   /* 建議加 → 不會撐爆頁面 */
  overflow-y: auto;

}
#cusdis_thread iframe {
  background-color: transparent !important;
  color-scheme: light !important; /* 強制用 light mode，不要變全黑 */
}


#cusdis-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  display: flex; /* <== 永遠保留 flex，但由 visible 控制能不能互動 */
}

#cusdis-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

#cusdis-modal .modal-inner {
  background: #2f3740;
  padding: 1rem;
  border-radius: 8px;
  max-width: 680px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  position: relative;

  transform: scale(0.96);
  transition: transform 0.25s ease;
}
#cusdis-modal.visible .modal-inner {
  transform: scale(1);
}

#cusdis-modal .close-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.2em;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  transition: all 0.3s ease;
}

#cusdis-modal iframe {
  width: 100%;
  height: 500px;
  border: none;
}



footer.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #bbbbbb;
  font-size: .8rem;
}

/* 手機版 RWD → 分類欄改換行 */
@media (max-width: 768px {
  main {
    flex-direction: column;
    padding: 1rem;
  }
  aside#category-list {
    display: flex;
    flex-wrap: wrap; /* 換行 */
    justify-content: center; /* 置中 */
    overflow-x: auto;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
  }
  aside#category-list a.category-link {
    font-size: clamp(0.8rem, 2.5vw, 1rem); /* 動態分類字體大小 */
    flex: 0 1 auto;
    margin: 0.5rem;
    padding: 0.6rem 1.2rem;
  }
}
