/* =========================================
   1. CSS 變數系統
   ========================================= */
:root {
  --bg-color: #f4f1ea;
  --text-main: #2d3436;
  --text-sub: #636e72;
  --accent-color: #c0a062;
  --accent-hover: #a3864d;
  --card-bg: #ffffff;

  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 15px 35px rgba(45, 52, 54, 0.15);
  --radius: 8px;

  --font-heading: "Cinzel", serif;
  --font-body: "Lato", "Noto Sans TC", sans-serif;
}

/* =========================================
   2. 全域基礎設定
   ========================================= */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* 稍微縮小這裡 */
}

body {
  font-family: var(--font-body);
  color: var(--text-main);
  line-height: 1.6; /* 行高稍微縮小一點點，讓結構緊湊 */
  background-color: var(--bg-color);
  background-image: radial-gradient(
    rgba(192, 160, 98, 0.2) 1px,
    transparent 1px
  );
  background-size: 24px 24px;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.05em;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

/* =========================================
   3. 導航列 (Navbar)
   ========================================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 5%; /* 上下 Padding 縮小，更精實 */
  background: rgba(244, 241, 234, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(192, 160, 98, 0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 1.2rem; /* 字體稍微縮小 */
  font-weight: 700;
  gap: 10px;
  color: var(--text-main);
}

.logo-img {
  height: 35px; /* Logo 稍微縮小 */
  width: auto;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.logo-zh {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 0.85rem;
  color: var(--accent-color);
  margin-left: 5px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 25px; /* 間距縮小 */
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: var(--accent-color);
  transition: width 0.3s ease;
}

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

.nav-links a:hover::after {
  width: 100%;
}

.btn-contact {
  border: 1px solid var(--text-main);
  padding: 5px 15px;
  border-radius: 50px;
  font-size: 0.85rem;
}

.btn-contact:hover {
  background-color: var(--text-main);
  color: #fff;
  border-color: var(--text-main);
  transform: translateY(-2px);
}

/* =========================================
   4. Hero Section - 【修正：減少留白】
   ========================================= */
.hero {
  min-height: 60vh; /* 從 75vh 改為 60vh，減少首頁高度 */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px; /* Padding 縮小 */
  position: relative;
  overflow: hidden;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(244, 241, 234, 0) 70%
  );
}

.hero-content {
  z-index: 2;
  max-width: 800px;
  animation: fadeInUp 1s ease-out;
}

.hero h1 {
  font-size: 3rem; /* 字體稍微調小 */
  margin-bottom: 15px; /* 間距縮小 */
  color: var(--text-main);
  text-shadow: 2px 2px 0px rgba(192, 160, 98, 0.2);
}

.hero-sub {
  font-size: 1.2rem;
  color: var(--text-sub);
  margin-bottom: 30px; /* 間距縮小 */
  font-weight: 300;
}

.en-sub {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--accent-color);
  letter-spacing: 0.05em;
  margin-top: 5px;
  display: block;
  opacity: 0.8;
}

.btn-main {
  display: inline-block;
  background-color: var(--text-main);
  color: #fff;
  padding: 12px 35px; /* 按鈕稍微改小 */
  border-radius: 4px;
  font-family: var(--font-heading);
  letter-spacing: 2px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
}

.btn-main:hover {
  background-color: transparent;
  color: var(--text-main);
  border-color: var(--text-main);
  transform: translateY(-3px);
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
}

/* =========================================
   5. 區塊通用 - 【修正：減少留白、引號收尾】
   ========================================= */
.section {
  padding: 60px 20px; /* 從 100px 改為 60px，讓節奏更緊湊 */
}

.bg-light {
  background-color: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 40px;
  text-align: center;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  display: block;
  width: 50px;
  height: 3px;
  background: var(--accent-color);
  margin: 10px auto 0;
}

.story-box {
  max-width: 750px;
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--text-main);
  padding: 30px 40px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent-color);
  line-height: 1.8;
  position: relative;
}

/* 左引號 */
.story-box::before {
  content: "“";
  font-family: var(--font-heading);
  font-size: 4rem; /* 稍微縮小引號 */
  color: rgba(192, 160, 98, 0.3);
  position: absolute;
  top: 10px; /* 調整位置 */
  left: 10px;
  line-height: 1;
}

/* ★ 右引號 - 這裡補上了！ */
.story-box::after {
  content: "”";
  font-family: var(--font-heading);
  font-size: 4rem;
  color: rgba(192, 160, 98, 0.3);
  position: absolute;
  bottom: -20px; /* 放在右下角 */
  right: 20px;
  line-height: 1;
}

.signature {
  margin-top: 20px;
  font-family: var(--font-heading);
  color: var(--accent-color);
  font-weight: 700;
  text-align: right;
  font-size: 0.9rem;
}

/* =========================================
   6. 工具庫 - 【修正：遮擋問題、重疊問題】
   ========================================= */
.category-header {
  text-align: center;
  margin-bottom: 40px; /* 間距縮小 */
}

.category-header h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.category-header h2 i {
  color: var(--accent-color);
  font-size: 1.4rem;
}

.category-desc {
  color: var(--text-sub);
  font-family: "Noto Sans TC", sans-serif;
  letter-spacing: 0.05em;
  font-size: 1rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px; /* 卡片間距稍微拉近 */
}

.product-card {
  background: var(--card-bg);
  padding: 30px 25px 35px 25px; /* ★ 底部 padding 加大，避免按鈕被切掉 */
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid rgba(192, 160, 98, 0.2);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative; /* 這是 z-index 生效的關鍵 */
  overflow: visible; /* ★ 改為 visible，避免陰影或凸出物被切掉 */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

/* ★ 卡片 Hover 修正：加上 z-index: 10 */
.product-card:hover {
  transform: translateY(-8px) scale(1.02); /* 稍微放大一點點 */
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-color);
  z-index: 10; /* ★ 關鍵！讓選中的卡片浮在所有卡片之上 */
}

.product-card .card-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  transition: transform 0.3s;
}

.product-card:hover .card-icon {
  transform: scale(1.1) rotate(5deg);
}

.product-card h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.product-desc {
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 20px;
  flex-grow: 1;
  line-height: 1.5;
}

.btn-tool {
  display: inline-block;
  padding: 8px 20px;
  color: var(--accent-color);
  font-family: var(--font-heading);
  font-weight: 700;
  border: 1px solid var(--accent-color);
  border-radius: 4px;
  transition: all 0.3s;
  background: #fff; /* 確保按鈕有背景色，不會透過去 */
}

.btn-tool:hover {
  background-color: var(--accent-color);
  color: #fff;
}

.tag {
  display: inline-block;
  background: #f1f2f6;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #7f8c8d;
  font-weight: 500;
  letter-spacing: 1px;
}

.tag-debug {
  background: #fff0f0;
  color: #e17055;
  border: 1px solid #fab1a0;
}

.mystery-box {
  background: linear-gradient(135deg, #fff 0%, #fefcf5 100%);
  border-style: dashed;
}

/* =========================================
   7. 頁尾 (Footer) - 優化版
   ========================================= */
footer {
  /* 背景改成跟文字主色一樣的深岩灰，視覺上會更像「墨水沈澱」的感覺 */
  background-color: var(--text-main);
  color: #b2bec3; /* 文字改用柔和的灰白色 */
  text-align: center;
  padding: 50px 20px; /* 稍微縮減高度 */
  margin-top: 60px;
  position: relative; /* 為了放偽元素 */
}

/* 頂部漸層金線 - 取代原本的實線邊框 */
footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px; /* 細緻一點 */
  /* 讓線條從中間往兩邊淡出，像光暈一樣 */
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent-color),
    transparent
  );
}

footer h3 {
  font-family: var(--font-heading); /* 標題用 Cinzel */
  color: #fff;
  margin-bottom: 20px;
  font-size: 1.5rem;
  letter-spacing: 2px; /* 字距拉開，增加儀式感 */
}

/* Email 連結優化 */
.email-link {
  color: var(--accent-color);
  font-family: "Lato", sans-serif;
  border-bottom: 1px dotted rgba(192, 160, 98, 0.5);
  padding-bottom: 2px;
  transition: all 0.3s;
}

.email-link:hover {
  color: #fff;
  border-bottom-color: #fff;
  text-shadow: 0 0 10px rgba(192, 160, 98, 0.5); /* 發光效果 */
}

/* 分隔線優化 */
.footer-line {
  border: 0;
  height: 1px;
  /* 也是用漸層，讓分隔線若隱若現 */
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  margin: 30px auto;
  max-width: 250px;
}

.power-by {
  font-size: 0.9rem;
  margin-bottom: 10px;
  font-weight: 300;
  opacity: 0.8;
}

.coffee-link {
  color: #fdcb6e; /* 比較溫暖的拿鐵色 */
  font-weight: 700;
  position: relative;
  display: inline-block;
}

/* 咖啡杯的小動畫 */
.coffee-link:hover {
  transform: rotate(-10deg) scale(1.1);
}

.copyright {
  font-size: 0.75rem;
  opacity: 0.5; /* 讓版權宣告稍微隱形一點，不搶戲 */
  margin-top: 15px;
  font-family: "Lato", sans-serif;
  letter-spacing: 1px;
}

/* =========================================
   8. 手機版響應式微調
   ========================================= */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .navbar {
    flex-direction: column;
    padding: 10px 15px;
  }

  .nav-links {
    margin-top: 10px;
    gap: 15px;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 50px 20px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
