/* =========================================
   SunnyDraws 完整樣式表 - 最終佈局與配色整合
   ========================================= */

:root {
  --primary-purple: #6D5D94; 
  --accent-beige: #F9F1DC; 
  --light-purple: #D4CEDD;
  --text-light: #F9F1DC; 
  --text-dark: #4A3F6B;  
  --overlay-gradient: linear-gradient(180deg, rgba(109, 93, 148, 0) 30%, rgba(74, 63, 107, 0.7) 100%);
}

/* --- 1. 基礎佈局與置中 --- */
body {
  font-family: 'SF Pro Display', 'PingFang TC', 'Heiti TC', sans-serif;
  background-color: var(--primary-purple); 
  color: var(--text-light); 
  margin: 0;
  padding: 0;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.home-header{
  text-align: center;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

/* --- 2. Header & Nav --- */
.top-nav {
  text-align: right;
  padding: 20px 0;
  font-size: 14px;
}

.top-nav a {
  text-decoration: none;
  color: var(--light-purple);
  margin: 0 8px;
  transition: 0.3s;
}

.top-nav a:hover { color: white; }

.top-nav span {
  color: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
}

.hero-container {
  text-align: center;
  padding: 60px 0;
  border-bottom: 1px solid rgba(249, 241, 220, 0.15);
}

.logo-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.logo-area h1 {
  font-size: 32px;
  margin: 0;
  letter-spacing: 2px;
  color: var(--accent-beige);
}

.subtitle {
  font-size: 20px;
  margin: 5px 0;
  color: var(--light-purple);
}

.tagline {
  font-size: 16px;
  opacity: 0.8;
}

/* --- 3. Home / Index 排版 --- */
.main-content {
  padding: 50px 0;
  flex: 1;
}

.section-title {
  text-align: center;
  font-size: 28px;
  margin-bottom: 40px;
  font-weight: 600;
  color: var(--accent-beige);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  width: 100%;
}

.category-card {
  display: block;
  text-decoration: none;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: var(--accent-beige);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.category-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.card-title {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  z-index: 2;
  color: white;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* --- 4. Illustration 獨立頁面佈局 --- */
.illustration-detail-page {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.breadcrumb-item {
  background-color: var(--accent-beige);
  color: var(--text-dark);
  padding: 6px 20px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.breadcrumb-item.current {
  background-color: transparent;
  border: 1px solid var(--accent-beige);
  color: var(--accent-beige);
}

.illustration-title {
  font-size: 36px;
  color: var(--accent-beige);
  margin-bottom: 30px;
}

.illustration-image-wrapper {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  margin-bottom: 40px;
  border-radius: 24px;
  border: 6px solid var(--accent-beige);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  overflow: hidden;
  background-color: white;
}

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

.illustration-tags {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.tag-item {
  display: inline-block;
  background-color: rgba(249, 241, 220, 0.1);
  color: var(--accent-beige);
  padding: 2px 16px;
  border-radius: 20px;
  border: 1px solid var(--accent-beige);
  text-decoration: none;
  font-size: 13px;
  transition: 0.3s;
  line-height: 1.8; /* 增加一點行高確保換行時不重疊 */
  margin: 4px 2px;  /* 增加一點外距讓按鈕間有呼吸空間 */
}

/* 👈 選中狀態 (Active)：背景變實心，文字變深色 */
.tag-item.active {
  background-color: var(--accent-beige);
  color: var(--text-dark); /* 使用你變數中的深紫色 */
  font-weight: 700;
}

.tag-item:hover {
  background-color: rgba(249, 241, 220, 0.3);
}

/* --- 5. 按鈕與 License --- */
.download-btn {
  display: inline-block;
  background-color: var(--accent-beige);
  color: var(--text-dark);
  padding: 16px 60px;
  border-radius: 40px;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.license-info-box {
  max-width: 520px;
  width: 100%;
  margin: 60px auto 0;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(249, 241, 220, 0.3);
  border-radius: 24px;
  padding: 35px;
  text-align: left;
}

.license-info-box h3 { color: var(--accent-beige); margin-top: 0; }

.license-agreement {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 25px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- 6. 之前遺失的 Footer 回來了 --- */
.site-footer {
  text-align: center;
  padding: 80px 0;
  border-top: 1px solid rgba(249, 241, 220, 0.1);
}

.support-link {
  color: var(--accent-beige);
  text-decoration: none;
  font-size: 15px;
  border: 1.5px solid var(--accent-beige);
  padding: 12px 30px;
  border-radius: 30px;
  transition: 0.3s;
}

.support-link:hover {
  background-color: var(--accent-beige);
  color: var(--primary-purple);
}

/* 響應式佈局 */
@media (max-width: 900px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .illustration-title { font-size: 28px; }
  .download-btn { width: 100%; padding: 16px 0; text-align: center; }
}



/* --- 插圖總覽頁：一排三格扁平卡片 --- */

.illustration-horizontal-grid {
  display: grid;
  /* 關鍵修改：改為 repeat(3, 1fr) */
  grid-template-columns: repeat(3, 1fr); 
  gap: 15px; /* 間距稍微縮小一點點，留給卡片更多空間 */
  width: 100%;
}

.horizontal-card {
  background-color: var(--accent-beige);
  border-radius: 16px; /* 圓角稍微調小，符合小卡片的比例 */
  overflow: hidden;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-filters {
  display: flex;
  justify-content: center;
  gap: 12px; /* 按鈕之間的間距 */
  margin-bottom: 40px;
  flex-wrap: wrap; /* 允許自動換行 */
  line-height: 2.5; /* 👈 重要：增加行高，確保換行時上下按鈕不重疊 */
}

.card-link {
  display: flex;
  text-decoration: none;
  height: 90px; /* 高度調低一點，讓它看起來更「扁」更精緻 */
}

/* --- 2. 扁平卡片：一排三格，左右 1:1 分布 --- */
.illustration-horizontal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); 
  gap: 20px;
  width: 100%;
}

.horizontal-card {
  background-color: var(--accent-beige);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  height: 110px; /* 👈 稍微增高，配合 1:1 的視覺感 */
}

.card-link {
  display: flex;
  text-decoration: none;
  height: 100%;
}

/* 卡片左側：縮圖區 (佔 50%) */
.thumb-area {
  flex: 0 0 50%; /* 👈 強制佔據一半寬度 */
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
  border-right: 1px solid rgba(0,0,0,0.05);
}

.thumb-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 卡片右側：標題區 (佔 50%) */
.info-area {
  flex: 0 0 50%; /* 👈 強制佔據一半寬度 */
  display: flex;
  align-items: center; /* 垂直置中 */
  padding: 15px;
  box-sizing: border-box;
}

.info-area h3 {
  color: var(--text-dark);
  font-size: 15px; /* 字體稍微加大一點 */
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  /* 標題太長自動換行，最多顯示三行，超過才省略 */
  display: -webkit-box;
  -webkit-line-clamp: 3; 
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word; /* 確保長單字也會換行 */
}

/* 響應式調整 */
@media (max-width: 900px) {
  .illustration-horizontal-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .illustration-horizontal-grid { grid-template-columns: 1fr; }
}