/* ============================================
   楊佳叡醫師個人網站 — 全站樣式
   ============================================ */

/* --- CSS 變數 --- */
:root {
  --color-bg: #F8F6F1;
  --color-primary: #26215C;
  --color-accent: #B8A050;
  --color-primary-light: #3C3489;
  --color-primary-pale: #EEEDFE;
  --color-text-primary: #1A1A1A;
  --color-text-secondary: #666666;
  --color-text-tertiary: #999999;
  --color-border: rgba(184, 160, 80, 0.2);

  --font-serif-en: 'Playfair Display', serif;
  --font-serif-zh: 'Noto Serif TC', serif;
  --font-sans-en: 'Inter', sans-serif;
  --font-sans-zh: 'Noto Sans TC', sans-serif;
  --font-serif: var(--font-serif-en), var(--font-serif-zh), serif;
  --font-sans: var(--font-sans-en), var(--font-sans-zh), sans-serif;

  --max-width: 1100px;
  --section-gap: 100px;
  --section-gap-mobile: 56px;
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- 圖片 Placeholder --- */
.img-placeholder {
  background-color: #D5D3CE;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
  font-family: var(--font-sans);
  overflow: hidden;
}

/* --- 字型層級 --- */
h1, .h1 {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--color-primary);
}

h2, .h2 {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--color-primary);
}

h3, .h3 {
  font-family: var(--font-sans);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text-primary);
}

p {
  line-height: 1.8;
  color: var(--color-text-primary);
}

.text-small {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.text-accent {
  color: var(--color-accent);
}

/* --- 容器 --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- 區塊標題 --- */
.section-title {
  text-align: center;
  margin-bottom: 48px;
}

.section-title h2 {
  margin-bottom: 4px;
}

.section-title .subtitle {
  font-family: var(--font-serif-en);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text-tertiary);
  letter-spacing: 0.05em;
}

/* --- 金色分隔線 --- */
.divider {
  width: 60px;
  height: 1px;
  background-color: var(--color-accent);
  margin: 24px auto;
}

/* --- 按鈕 --- */
.btn-primary {
  display: inline-block;
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 12px 32px;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  border-radius: 0;
  cursor: pointer;
  text-align: center;
}

.btn-primary:hover {
  background: var(--color-primary-pale);
  border-color: var(--color-primary-light);
}

/* ============================================
   導覽列
   ============================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(248, 246, 241, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 44px;
}

/* 導覽項目（含 dropdown 容器） */
.nav-item {
  position: relative;
}

.navbar-menu > a,
.nav-item > a {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  transition: color 0.3s ease;
  position: relative;
  display: inline-block;
  padding: 8px 0;
}

.navbar-menu > a::after,
.nav-item > a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.navbar-menu > a:hover::after,
.navbar-menu > a.active::after,
.nav-item > a:hover::after,
.nav-item > a.active::after {
  width: 100%;
}

/* Dropdown 下拉選單 */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  transform: none;
  min-width: 200px;
  background: #F8F6F1;
  border: 1px solid var(--color-border);
  padding: 12px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1001;
}

.nav-item:hover > .dropdown {
  opacity: 1;
  visibility: visible;
}

.dropdown a {
  display: block;
  padding: 8px 24px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: #26215C;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
  white-space: nowrap;
}

.dropdown a:hover {
  color: #B8A050;
}

/* 漢堡選單按鈕 */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--color-primary);
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* 手機全螢幕選單 */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: var(--color-bg);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu.active {
  display: flex;
  opacity: 1;
}

.mobile-menu > a,
.mobile-nav-item > a {
  font-family: var(--font-sans);
  font-size: 20px;
  color: var(--color-primary);
  letter-spacing: 0.05em;
}

/* 手機版下拉子選單 */
.mobile-nav-item {
  text-align: center;
}

.mobile-nav-item > a {
  cursor: pointer;
}

.mobile-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.mobile-nav-item.open > .mobile-dropdown {
  max-height: 400px;
}

.mobile-dropdown a {
  display: block;
  font-family: var(--font-sans);
  font-size: 15px;
  color: #26215C;
  padding: 8px 0;
  transition: color 0.3s ease;
}

.mobile-dropdown a:hover {
  color: #B8A050;
}

.mobile-dropdown-toggle {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  color: var(--color-primary);
  font-size: 14px;
  vertical-align: middle;
  margin-left: 2px;
}

.mobile-dropdown-toggle::after {
  content: '▾';
}

.mobile-nav-item.open > .mobile-dropdown-toggle::after {
  content: '▴';
}

/* ============================================
   頁尾
   ============================================ */
.footer {
  background: var(--color-primary);
  color: var(--color-bg);
  padding: 64px 0 0;
  margin-top: var(--section-gap);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 48px;
}

.footer-brand .name-zh {
  font-family: var(--font-serif-zh);
  font-size: 20px;
  margin-bottom: 4px;
}

.footer-brand .name-en {
  font-family: var(--font-serif-en);
  font-size: 13px;
  color: rgba(248, 246, 241, 0.7);
  margin-bottom: 12px;
}

.footer-brand .tagline {
  font-size: 14px;
  color: rgba(248, 246, 241, 0.7);
  line-height: 1.6;
}

.footer h4 {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: var(--color-accent);
}

.footer-links a {
  display: block;
  font-size: 14px;
  color: rgba(248, 246, 241, 0.8);
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #fff;
}

.footer-contact p {
  font-size: 14px;
  color: rgba(248, 246, 241, 0.8);
  margin-bottom: 8px;
}

.footer-contact a {
  color: rgba(248, 246, 241, 0.8);
  transition: color 0.3s ease;
}

.footer-contact a:hover {
  color: #fff;
}

.footer-bottom {
  text-align: center;
  padding: 24px 0;
  margin-top: 48px;
  border-top: 1px solid rgba(248, 246, 241, 0.15);
  font-size: 13px;
  color: rgba(248, 246, 241, 0.5);
}

/* ============================================
   頁面 Hero（內頁通用）
   ============================================ */
.page-hero {
  text-align: center;
  padding: 80px 0 60px;
}

.page-hero h1 {
  margin-bottom: 8px;
}

.page-hero .subtitle {
  font-family: var(--font-serif-en);
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* ============================================
   卡片通用
   ============================================ */
.card {
  transition: transform 0.3s ease;
}

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

.card .card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
}

.card .card-date {
  font-size: 13px;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
}

.card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.card .card-tag {
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 500;
}

.card .card-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--color-primary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.card .card-excerpt {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .card-link {
  font-size: 13px;
  color: var(--color-primary);
  letter-spacing: 0.03em;
  transition: color 0.3s ease;
}

.card .card-link:hover {
  color: var(--color-primary-light);
}

/* ============================================
   Hashtag 篩選列
   ============================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 48px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  padding: 6px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 0;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-pale);
}

/* ============================================
   Grid 排列
   ============================================ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

/* ============================================
   RWD — 平板 (768–1023px)
   ============================================ */
@media (max-width: 1023px) {
  h1, .h1 { font-size: 36px; }
  h2, .h2 { font-size: 26px; }
  h3, .h3 { font-size: 19px; }

  :root {
    --section-gap: 72px;
  }

  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

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

/* ============================================
   RWD — 手機 (≤767px)
   ============================================ */
@media (max-width: 767px) {
  h1, .h1 { font-size: 32px; }
  h2, .h2 { font-size: 24px; }
  h3, .h3 { font-size: 18px; }

  .page-hero h1,
  .section-title,
  .section-heading,
  h1, h2, h3 {
    font-family: 'Noto Serif TC', 'Playfair Display', serif !important;
  }
  body { font-size: 15px; }
  .text-small { font-size: 12px; }

  :root {
    --section-gap: 56px;
  }

  .container {
    padding: 0 24px;
  }

  .navbar-menu {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .grid-3,
  .grid-4,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .page-hero {
    padding: 56px 0 40px;
  }

  .section-title {
    margin-bottom: 32px;
  }
}

/* ===== 頁尾迷你聯絡表單 ===== */
.footer-contact-form h4 {
  color: #c9a84c;
  font-size: 13px;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.footer-form-group {
  margin-bottom: 10px;
}
.footer-form-group input,
.footer-form-group textarea {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 8px 12px;
  color: #e8e4dc;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.footer-form-group input::placeholder,
.footer-form-group textarea::placeholder {
  color: rgba(255,255,255,0.35);
}
.footer-form-submit {
  background: transparent;
  border: 1px solid #c9a84c;
  color: #c9a84c;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.footer-form-submit:hover {
  background: #c9a84c;
  color: #1a1a2e;
}
.footer-form-success {
  color: #c9a84c;
  font-size: 14px;
  line-height: 1.8;
  padding: 16px 0;
}
.contact-form-success {
  color: var(--color-primary);
  font-size: 16px;
  line-height: 1.8;
  padding: 24px 0;
  border-left: 2px solid var(--color-accent);
  padding-left: 20px;
}
