@import 'variables.css';

/* =========================================
   1. Reset & Base (基礎設定)
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background-color: var(--c-bg);
  color: var(--c-ink-soft);
  line-height: 1.75; /* 增加行高，讓閱讀更舒適 */
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; display: block; border-radius: 4px; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--c-ink);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* =========================================
   2. Layout (通用佈局)
   ========================================= */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
  position: relative; /* 確保圖層順序正確 */
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.section-desc {
  color: var(--c-ink-soft);
  opacity: 0.8;
  max-width: 600px;
  margin: 0 auto;
}

/* =========================================
   3. Components (元件：按鈕、卡片、空狀態)
   ========================================= */

/* 按鈕 */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  text-align: center;
  font-size: 0.95rem;
}

.btn--primary {
  background-color: var(--c-accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(217, 164, 65, 0.2);
}

.btn--primary:hover {
  background-color: var(--c-accent-hover);
  transform: translateY(-2px);
}

.btn--outline {
  border: 1px solid var(--c-ink);
  color: var(--c-ink);
  background: transparent;
}

.btn--outline:hover {
  background-color: var(--c-ink);
  color: #fff;
}

/* 卡片 (通用) */
.card {
  background: var(--c-surface);
  padding: 24px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%; /* 確保卡片高度一致 */
}

.card:hover {
  transform: translateY(-5px);
}

.card__img {
  height: 220px;
  background-color: #eee;
  margin-bottom: 20px;
  border-radius: 8px;
  object-fit: cover;
}

.card__tag {
  font-size: 0.8rem;
  color: var(--c-accent);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.card__title {
  font-size: 1.3rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.card__excerpt {
  font-size: 0.95rem;
  color: #666;
  flex-grow: 1; /* 把按鈕推到底部 */
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* 限制顯示三行 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-ink);
  display: inline-flex;
  align-items: center;
  margin-top: auto; /* 強制對齊底部 */
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}

/* --- [修正] 空狀態 (Empty State) --- */
/* 讓「尚無文章」的區塊變透明、優雅 */
.empty-state {
  grid-column: 1 / -1; /* 跨滿整欄 */
  text-align: center;
  padding: 60px 20px;
  background-color: transparent; /* 透明背景，解決白色大方塊問題 */
  border: 2px dashed #ccc;      /* 虛線框增加設計感 */
  border-radius: 12px;
  color: #888;
  margin-top: 20px;
}

.empty-hint {
  font-size: 0.9rem;
  margin-top: 8px;
  opacity: 0.7;
}

/* =========================================
   4. Header & Nav (導覽列)
   ========================================= */
.header {
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: rgba(247, 243, 236, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000; /* 確保在最上層 */
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: 0.05em;
}

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

.nav-links a {
  font-size: 0.95rem;
  color: var(--c-ink);
  font-weight: 500;
  position: relative;
}

.nav-links a:hover {
  color: var(--c-accent);
}

/* =========================================
   5. Hero Section (首頁主視覺 - 修正重疊問題)
   ========================================= */
.hero {
  padding: 100px 0 80px; /* 增加下方 padding */
  text-align: center;
  background: linear-gradient(180deg, var(--c-bg) 0%, #FFF 100%);
  overflow: hidden; /* 防止內容溢出 */
}

.hero__content {
  position: relative;
  z-index: 10;
  max-width: 800px;
  margin: 0 auto;
}

.hero__title {
  font-size: 3rem;
  line-height: 1.3;
  margin-bottom: 24px;
}

.hero__text {
  font-size: 1.125rem;
  margin-bottom: 50px; /* 增加文字與圖片的距離 */
  color: var(--c-ink-soft);
}

/* [修正] 圖片容器 */
.hero__visual {
  margin-top: 0; 
  width: 100%;
  max-height: 500px; /* 限制最大高度 */
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  overflow: hidden; /* 切掉多餘部分 */
  position: relative;
}

.hero__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* =========================================
   6. Monthly List (每月書單)
   ========================================= */
.section-monthly {
  padding: 100px 0;
  background-color: var(--c-bg); 
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

@media (max-width: 768px) {
  .monthly-grid {
    grid-template-columns: 1fr;
  }
}

.month-card {
  background: var(--c-ink);
  color: #fff;
  padding: 32px;
  border-radius: var(--radius-card);
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px; /* 確保卡片高度一致 */
}

.month-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 6px;
  background: var(--c-accent);
}

.month-card h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.month-card span {
  display: block;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 20px;
  font-weight: 500;
  letter-spacing: 1px;
}

.month-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 24px;
  opacity: 0.9;
  flex-grow: 1;
}

/* =========================================
   7. Doll Theater (公仔劇場 - 左右排版)
   ========================================= */
.section-dolls {
  padding: 100px 0;
  background-color: var(--c-bg);
}

.doll-showcase {
  display: flex;
  align-items: center;
  gap: 60px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .doll-showcase {
    flex-direction: column;
    gap: 40px;
  }
}

.doll-text {
  flex: 1;
  text-align: left;
}

.doll-image {
  flex: 1;
  height: 450px;
  background-color: #f0f0f0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.doll-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doll-text ul {
  padding-left: 0;
  margin-bottom: 30px;
}

.doll-text li {
  margin-bottom: 12px;
  font-size: 1.05rem;
  color: var(--c-ink-soft);
}

/* =========================================
   8. Footer & Quote
   ========================================= */
.footer {
  background-color: var(--c-ink);
  color: #fff;
  padding: 60px 0 30px;
  text-align: center;
  margin-top: 0;
}

.quote-section {
  padding: 100px 0;
  text-align: center;
  background-color: var(--c-bg);
}

.quote-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--c-ink);
  line-height: 1.8;
}

/* =========================================
   單篇文章樣式 (Single Post)
   ========================================= */
.post-container {
  max-width: 800px; /* 閱讀最佳寬度 */
  margin: 40px auto;
  padding: 0 24px;
  background: #fff;
  border-radius: 16px;
  /* 如果想要像圖五那樣乾淨，可以把背景拿掉，或是加上陰影 */
}

.post-header {
  text-align: center;
  margin-bottom: 40px;
}

.post-tag {
  display: inline-block;
  background: var(--c-bg); /* 米色底 */
  color: var(--c-accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 16px;
}

.post-title {
  font-size: 2.4rem;
  line-height: 1.3;
  color: var(--c-ink);
  margin-bottom: 16px;
}

.post-meta {
  color: #888;
  font-size: 0.95rem;
}

.post-cover {
  margin-bottom: 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.post-cover img {
  width: 100%;
  height: auto;
  display: block;
}

/* 內文排版優化 */
.post-content {
  font-size: 1.1rem;
  line-height: 1.9;
  color: #333;
}

.post-content p {
  margin-bottom: 1.5em; /* 段落間距 */
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 30px 0; /* 圖片上下留白 */
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.post-content h2 {
  font-size: 1.8rem;
  margin-top: 50px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--c-bg);
}

.post-content blockquote {
  border-left: 4px solid var(--c-accent);
  padding-left: 20px;
  margin: 30px 0;
  color: #666;
  font-style: italic;
}

/* 底部 */
.post-footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  color: #999;
}

/* =========================================
   每月書單內頁樣式 (Monthly Detail)
   ========================================= */
.book-section {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 60px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.book-section-title {
  font-size: 1.8rem;
  color: var(--c-accent);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--c-bg);
  padding-bottom: 10px;
}

.book-section-intro {
  margin-bottom: 40px;
  color: #666;
  font-size: 1.1rem;
}

.book-item {
  display: flex;
  gap: 30px;
  margin-bottom: 50px;
  padding-bottom: 50px;
  border-bottom: 1px dashed #eee;
}

.book-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* 手機版改成上下堆疊 */
@media (max-width: 768px) {
  .book-item {
    flex-direction: column;
  }
}

.book-cover {
  flex: 0 0 160px; /* 固定寬度 */
}

.book-cover img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.book-info {
  flex: 1;
}

.book-info h3 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  color: var(--c-ink);
}

.book-review {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-ink-soft);
}