/* ============================================================
   馬鳴山鎮安宮官網 — 主樣式表
   整理：月
   ============================================================ */

/* ── 0. 字型設定：全站採用芫荽 Iansui ─────────────────────── */
@font-face {
  font-family: "Iansui";
  src: url("../font/Iansui-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── 1. CSS 變數 ─────────────────────────────────────────── */
:root {
  --red: #c5302c;
  --red-dark: #8b1a18;
  --red-deeper: #5c0e0c;
  --gold: #c8960a;
  --gold-mid: #d4a832;
  --gold-light: #f0d98a;
  --gold-pale: #fdf8ec;
  --cream: #faf7f2;
  --cream-dark: #f0ebe0;
  --white: #ffffff;
  --text: #2a1f1f;
  --text-mid: #4a3535;
  --text-muted: #7a6060;
  --border: #e4d4c0;
  --border-light: #f0e8dc;
  --shadow: rgba(90, 20, 10, 0.1);
  --shadow-md: rgba(90, 20, 10, 0.16);

  --font-serif: "Iansui", "Noto Serif TC", "標楷體", Georgia, serif;
  --font-sans: "Iansui", "Noto Sans TC", "微軟正黑體", Arial, sans-serif;

  --container: 1320px;
  --radius: 6px;
  --radius-lg: 14px;
  --transition: 0.22s ease;
  --header-h: 64px;
}

/* ── 2. 全域重置 ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  font-size: 16px;
}
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--cream);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
ul,
ol {
  list-style: none;
}
button,
input,
textarea,
select {
  font-family: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ── 3. 版型工具 ─────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  background: var(--red);
  color: #fff;
  padding: 10px 20px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 700;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ── 4. Header ───────────────────────────────────────────── */

/* 頂部資訊列 */
.top-bar {
  background: var(--red-deeper);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  padding: 5px 0;
}
.top-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top-bar a {
  color: inherit;
  transition: color var(--transition);
}
.top-bar a:hover {
  color: var(--gold-light);
}
.top-bar-contact {
  display: flex;
  align-items: center;
  gap: 18px;
}
.top-bar-contact i {
  color: var(--gold-mid);
  margin-right: 5px;
}
.top-bar-social {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-bar-social a {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.78rem;
  transition: all var(--transition);
}
.top-bar-social a:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--red-deeper);
}

/* 主 Header */
.main-header {
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 2px 20px var(--shadow);
  border-bottom: 3px solid var(--red);
  /* 確保手機展開選單 absolute 定位以此為基準 */
  isolation: isolate;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 0;
  height: var(--header-h);
}

/* ── Logo ── */
/*
  PNG 尺寸為 1717×916（約 1.87:1）。
  設定 width/height 皆為 74px + object-fit: cover + object-position: left center，
  可從 PNG 左側等比例取出正方形區域（即廟徽圓形圖案），正確裁掉右側白邊。
*/
.site-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: 0 16px 0 0;
  margin-right: 4px;
  /* 分隔線 — 視覺上連結 Logo 與 Nav */
  border-right: 1.5px solid var(--border-light);
  transition: opacity var(--transition);
}
.site-logo:hover {
  opacity: 0.88;
}

.logo-img {
  display: block;
  width: auto;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
}

/* 相容舊 class（不影響頁面顯示） */
.logo-name {
  display: none;
}
.logo-text {
  display: none;
}
.logo-text-zh,
.logo-text-en,
.logo-name-zh,
.logo-name-en {
  display: none;
}

/* ── 5. 主導覽列 ─────────────────────────────────────────── */
.main-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-left: 4px;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 0;
}
.nav-item {
  position: relative;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-mid);
  border-radius: var(--radius);
  transition:
    color var(--transition),
    background var(--transition);
  white-space: nowrap;
  position: relative;
}
.nav-link i {
  font-size: 0.68rem;
  transition: transform var(--transition);
}

/* Hover / focus 狀態 */
.nav-item:hover > .nav-link,
.nav-item:focus-within > .nav-link {
  color: var(--red);
  background: var(--cream);
}

/* 當前頁面底線指示器 */
.nav-item.active > .nav-link {
  color: var(--red);
  font-weight: 800;
}
.nav-item.active > .nav-link::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--red);
  border-radius: 1px;
}

.nav-item:hover > .nav-link i,
.nav-item:focus-within > .nav-link i {
  transform: rotate(180deg);
}
.nav-link:focus {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* 外部連結標記 */
.nav-link-ext {
  font-size: 0.62rem;
  opacity: 0.55;
  margin-left: 1px;
}

/* Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 2px solid var(--red);
  box-shadow: 0 12px 32px var(--shadow-md);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 600;
}
/* 最末項的下拉選單靠右對齊，避免超出視窗右緣 */
.nav-item:last-child .dropdown {
  left: auto;
  right: 0;
}
.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.dropdown-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: all var(--transition);
  position: relative;
}
.dropdown-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--red);
  border-radius: 999px;
  transform: scaleY(0);
  transition: transform var(--transition);
}
.dropdown-link:hover,
.dropdown-link[aria-current="page"] {
  color: var(--red);
  background: var(--cream);
  padding-left: 24px;
}
.dropdown-link:hover::before,
.dropdown-link[aria-current="page"]::before {
  transform: scaleY(1);
}
.dropdown-link:focus {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

/* 漢堡選單 */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.hamburger:hover {
  background: var(--cream);
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--text-mid);
  border-radius: 2px;
  transition: all 0.25s ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* ── 6. 首頁英雄輪播 ─────────────────────────────────────── */
.hero-swiper {
  width: 100%;
  height: 580px;
  background: var(--red-darker, #3a0a08);
}
.hero-swiper .swiper-slide {
  position: relative;
  overflow: hidden;
}
.hero-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-slide-img.object-top {
  object-position: center top;
}

/* 無圖時的漸層佔位 */
.hero-slide-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-ph-1 {
  background: linear-gradient(135deg, #5c0e0c 0%, #8b1a18 50%, #c5302c 100%);
}
.slide-ph-2 {
  background: linear-gradient(135deg, #3a2000 0%, #7a4f00 50%, #c8960a 100%);
}
.slide-ph-3 {
  background: linear-gradient(135deg, #0a2a10 0%, #1a5a30 50%, #2d8a50 100%);
}
.slide-ph-4 {
  background: linear-gradient(135deg, #1a0a2a 0%, #4a1a6a 50%, #7a3aaa 100%);
}
.slide-ph-5 {
  background: linear-gradient(135deg, #0a1a2a 0%, #1a3a5a 50%, #2a5a8a 100%);
}

.hero-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(0, 0, 0, 0.15) 60%,
    transparent 100%
  );
}
.hero-slide-content {
  position: absolute;
  bottom: 60px;
  left: 0;
  right: 0;
}
.hero-slide-content .container {
}
.hero-tag {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.25;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  margin-bottom: 10px;
}
.hero-sub {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}
/* Swiper override */
.hero-swiper .swiper-button-next,
.hero-swiper .swiper-button-prev {
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.35);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transition: background var(--transition);
}
.hero-swiper .swiper-button-next:hover,
.hero-swiper .swiper-button-prev:hover {
  background: var(--red);
}
.hero-swiper .swiper-button-next::after,
.hero-swiper .swiper-button-prev::after {
  font-size: 1rem;
  font-weight: 900;
}
.hero-swiper .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.6);
  opacity: 1;
}
.hero-swiper .swiper-pagination-bullet-active {
  background: var(--gold-mid);
  width: 22px;
  border-radius: 4px;
}

/* ── 7. 首頁各區塊 ───────────────────────────────────────── */

/* 區塊通用 */
.section {
  padding: 64px 0;
}
.section-alt {
  background: var(--white);
}
.section-dark {
  background: linear-gradient(
    135deg,
    var(--red-deeper) 0%,
    var(--red-dark) 100%
  );
  color: #fff;
}

/* 區塊標題 */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--red-dark);
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.section-title::before,
.section-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--gold));
}
.section-title::after {
  background: linear-gradient(to left, transparent, var(--gold));
}
.section-dark .section-title {
  color: var(--gold-light);
}
.section-dark .section-title::before,
.section-dark .section-title::after {
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4));
}
.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.04em;
}
.section-dark .section-subtitle {
  color: rgba(255, 255, 255, 0.7);
}

/* 快速入口格 */
.quick-links {
  padding: 48px 0;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 12px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-light);
  background: var(--cream);
  transition: all var(--transition);
  text-align: center;
}
.quick-card:hover {
  border-color: var(--red);
  background: #fff5f5;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}
.quick-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  transition: transform var(--transition);
}
.quick-card:hover .quick-icon {
  transform: scale(1.1) rotate(-5deg);
}
.quick-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 0.06em;
}
.quick-card:hover .quick-label {
  color: var(--red);
}

/* 最新消息三欄 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.news-col {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow);
  display: flex;
  flex-direction: column;
}
.news-col-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}
.news-col-head.red {
  background: var(--red);
  color: #fff;
}
.news-col-head.gold {
  background: var(--gold);
  color: #fff;
}
.news-col-head.teal {
  background: #2c7a7b;
  color: #fff;
}
.news-col-head i {
  font-size: 0.85rem;
  opacity: 0.85;
}
.news-list {
  flex: 1;
}
.news-item {
  display: flex;
  min-height: 72px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.news-item:last-child {
  border-bottom: none;
}
.news-item:hover {
  background: var(--cream);
}
.news-date {
  flex: 0 0 70px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-top: 2px;
  white-space: nowrap;
}
.news-text {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-source {
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}
.news-list a {
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  text-decoration: none;
}
.news-col-foot {
  padding: 12px 20px;
  text-align: right;
  border-top: 1px solid var(--border-light);
}
.btn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--red);
  padding: 5px 14px;
  border: 1.5px solid var(--red);
  border-radius: 20px;
  transition: all var(--transition);
}
.btn-more:hover {
  background: var(--red);
  color: #fff;
}
.btn-more i {
  font-size: 0.7rem;
}

/* 慶典行事輪播 */
.events-strip {
  background: linear-gradient(
    135deg,
    var(--red-deeper) 0%,
    var(--red-dark) 100%
  );
  padding: 40px 0;
  position: relative;
  overflow: hidden;
}
.events-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='20' fill='none' stroke='rgba(255,255,255,.04)' stroke-width='1'/%3E%3C/svg%3E")
    repeat;
}
.events-inner {
  position: relative;
}
.events-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--gold-light);
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.events-title i {
  color: var(--gold-mid);
}
.events-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.event-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}
.event-chip:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--gold-mid);
}
.event-chip-date {
  font-size: 0.75rem;
  color: var(--gold-light);
  font-weight: 700;
  white-space: nowrap;
}
.event-chip-name {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;

  display: flex;
  align-items: center;
}

/* 關於本宮 Banner */
.about-banner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 420px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px var(--shadow-md);
}
.about-banner-img {
  position: relative;
  overflow: hidden;
}
.about-banner-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.about-banner:hover .about-banner-img img {
  transform: scale(1.04);
}
.about-banner-content {
  background: var(--red-dark);
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
}
.about-banner-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold-mid);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.about-banner-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.about-banner-text {
  font-size: 0.9rem;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 28px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: var(--red-deeper);
  font-weight: 800;
  font-size: 0.88rem;
  padding: 11px 24px;
  border-radius: 24px;
  letter-spacing: 0.04em;
  transition: all var(--transition);
  align-self: flex-start;
}
.btn-primary:hover {
  background: var(--gold-mid);
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(200, 150, 10, 0.4);
}
.btn-primary i {
  font-size: 0.8rem;
}

/* 服務特色格 */
.service-grid,
.service-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.service-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px var(--shadow-md);
}
.service-card-img {
  height: 160px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 4rem;
  overflow: hidden;
}
.service-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.service-card-body {
  padding: 20px;
  flex: 1;
}
.service-card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 800;
  color: var(--red-dark);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.service-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.service-card-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  text-align: right;
}

/* 服務卡 ── 圖示版（首頁用） */
.service-card-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  margin: 0 auto 16px;
  transition: transform var(--transition);
}
.service-card:hover .service-card-icon {
  transform: scale(1.1) rotate(-6deg);
}
.service-card .service-card-body {
  text-align: center;
  padding: 24px 20px 12px;
}
.service-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--red);
  padding: 8px 20px;
  border: 1.5px solid var(--red);
  border-radius: 20px;
  transition: all var(--transition);
  margin: 0 20px 20px;
}
.service-card-link:hover {
  background: var(--red);
  color: #fff;
}
.service-card-link i {
  font-size: 0.7rem;
}

/* ── 8. 內頁版型 ─────────────────────────────────────────── */
.inner-banner {
  background: linear-gradient(
    135deg,
    var(--red-dark) 0%,
    var(--red-deeper) 100%
  );
  padding: 52px 0 72px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.inner-banner::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--cream);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.inner-banner-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.18;
}
.inner-banner-content {
  position: relative;
  text-align: center;
}
.inner-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 12px;
}
.inner-breadcrumb a {
  transition: color var(--transition);
}
.inner-breadcrumb a:hover {
  color: var(--gold-light);
}
.inner-breadcrumb i {
  font-size: 0.65rem;
  color: var(--gold-mid);
}
.inner-h1 {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.inner-subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.06em;
}

/* 內頁主體 */
.inner-body {
  padding: 0 0 72px;
  background: var(--cream);
}
.inner-surface {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px var(--shadow);
  margin-top: -32px;
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 600px;
  overflow: hidden;
}

/* 側邊欄 */
.inner-sidebar {
  background: var(--cream);
  border-right: 1px solid var(--border-light);
  padding: 32px 0;
}
.sidebar-section-title {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0 20px 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: all var(--transition);
  position: relative;
  border-left: 3px solid transparent;
}
.sidebar-link::before {
  content: "—";
  color: var(--border);
  font-size: 0.7rem;
  flex: 0 0 auto;
}
.sidebar-link:hover,
.sidebar-link.active {
  color: var(--red);
  background: #fff5f5;
  border-left-color: var(--red);
}
.sidebar-link.active {
  font-weight: 800;
}
.sidebar-link:hover::before,
.sidebar-link.active::before {
  color: var(--red);
}

/* 內頁內容區 */
.inner-content {
  padding: 40px 48px;
}
.inner-content h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--red-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.inner-content h2 i {
  color: var(--gold);
  font-size: 1.1rem;
}
.inner-content h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--red);
  margin: 28px 0 10px;
}
.inner-content p {
  font-size: 0.95rem;
  line-height: 2;
  color: var(--text-mid);
  margin-bottom: 16px;
  text-align: justify;
}
.inner-content a {
  color: var(--red);
  text-decoration: underline;
}
.inner-content a:hover {
  color: var(--red-dark);
}

/* 內頁 — 無側邊欄版（單頁式服務頁） */
.inner-surface.no-sidebar {
  grid-template-columns: 1fr;
}
.inner-surface.no-sidebar .inner-content {
  padding: 48px 64px;
  max-width: 860px;
  margin: 0 auto;
}

/* ── 9. 元件 ─────────────────────────────────────────────── */

/* 標籤 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.tag-red {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #ffcdd0;
}
.tag-gold {
  background: #fffbec;
  color: #8a6400;
  border: 1px solid #f0d98a;
}
.tag-teal {
  background: #f0fafa;
  color: #2c7a7b;
  border: 1px solid #b0dcdc;
}

/* 文化資產連結卡 */
.heritage-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--cream);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: all var(--transition);
  margin-bottom: 10px;
}
.heritage-link:hover {
  background: var(--gold-pale);
  border-left-color: var(--red);
  color: var(--red);
}
.heritage-link i {
  color: var(--gold);
  flex: 0 0 auto;
}

/* 步驟列表 */
.step-list {
  counter-reset: step;
}
.step-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  align-items: flex-start;
}
.step-num {
  flex: 0 0 36px;
  height: 36px;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
  counter-increment: step;
  margin-top: 2px;
}
.step-text {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text-mid);
  line-height: 1.8;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 20px 0;
}
.data-table th {
  background: var(--red-dark);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  text-align: left;
  letter-spacing: 0.05em;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-mid);
  line-height: 1.6;
}
.data-table tr:nth-child(even) td {
  background: var(--cream);
}
.data-table tr:hover td {
  background: #fff5f5;
}

/* 照片格 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.photo-item {
  aspect-ratio: 3/2;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-dark);
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.photo-item:hover img {
  transform: scale(1.06);
}

/* 神尊卡片 */
.deity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.deity-card {
  background: var(--cream);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: center;
  transition: all var(--transition);
}
.deity-card:hover {
  box-shadow: 0 6px 20px var(--shadow);
  transform: translateY(-3px);
}
.deity-card-img {
  aspect-ratio: 3/4;
  background: var(--cream-dark);
  overflow: hidden;
}
.deity-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.deity-card-body {
  padding: 12px 10px;
}
.deity-card-name {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--red-dark);
  margin-bottom: 3px;
}
.deity-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 協會頁：歷任理事長名單與照片 */
.association-chair-list {
  margin: 0.75rem 0 1.5rem;
  overflow-x: auto;
}
.association-chair-list .deity-table {
  width: 100% !important;
  min-width: 0 !important;
}
.association-members {
  margin-top: 1.75rem;
}
.association-members h2 {
  margin: 1.75rem 0 0.75rem;
}
.association-org-chart {
  margin: 0 auto;
  text-align: center;
}
.association-org-chart img {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 0 auto;
}
.association-chairman-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 720px;
  margin: 0 auto;
}
.association-chairman-grid figure {
  margin: 0;
  text-align: center;
}
.association-chairman-grid img {
  display: block;
  width: 100%;
  height: 360px;
  object-fit: contain;
  object-position: center top;
  border-radius: 8px;
  background: var(--cream-dark);
}
.association-chair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 720px;
  margin: 0.75rem auto 1.5rem;
}
.association-chair-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid #f0dfbd;
  border-radius: var(--radius-lg);
  background: #fffaf0;
}
.association-chair-card img {
  display: block;
  width: 100%;
  height: 360px;
  object-fit: contain;
  object-position: center top;
  background: var(--cream-dark);
}
.association-chair-card figcaption {
  padding: 13px 14px;
  border-top: 1px solid #f0dfbd;
  color: #3f332b;
  line-height: 1.65;
}
.association-chair-name,
.association-chair-term {
  display: block;
}
.association-chair-name {
  margin-bottom: 0.45rem;
  color: var(--red-dark);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 800;
}
.association-chair-term {
  margin-top: 0.35rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid #efd39a;
  border-radius: 999px;
  background: #fff5df;
  color: #604932;
  font-size: 0.82rem;
}
@media (max-width: 640px) {
  .association-chairman-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
  }
  .association-chair-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
  }
}

/* ── 10. 後台文章區（接 articles.js） ───────────────────── */
#article-list-section {
}
#article-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#article-list-container > * {
  width: 100% !important;
}
#article-list-container .card,
#article-list-container article,
#article-list-container > div {
  background: var(--white);
  border: 1px solid var(--border-light) !important;
  border-left: 3px solid var(--red) !important;
  border-radius: var(--radius) !important;
  padding: 14px 18px !important;
  box-shadow: none !important;
  transition: all var(--transition);
}
#article-list-container .card:hover,
#article-list-container article:hover,
#article-list-container > div:hover {
  border-left-color: var(--gold) !important;
  background: var(--cream) !important;
  box-shadow: 0 4px 12px var(--shadow) !important;
}
#article-list-container h3,
#article-list-container h4,
#article-list-container .title,
#article-list-container .article-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: var(--red-dark) !important;
  margin-bottom: 6px !important;
  line-height: 1.5 !important;
}
#article-list-container .date,
#article-list-container time,
#article-list-container .text-muted,
#article-list-container small {
  font-size: 0.82rem !important;
  color: var(--text-muted) !important;
}
#article-pagination {
  margin-top: 20px;
}
#article-pagination .pagination {
  gap: 6px;
  justify-content: center;
  display: flex;
  flex-wrap: wrap;
}
#article-pagination .page-link {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-weight: 700;
  font-size: 0.88rem;
  transition: all var(--transition);
  text-decoration: none;
  padding: 4px 10px;
}
#article-pagination .page-item.active .page-link,
#article-pagination .page-link:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
#article-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
#article-error {
  background: #fff0f0;
  border: 1px solid #ffcdd0;
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--red);
}
#article-detail-view {
}
#back-to-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 20px;
  transition: all var(--transition);
}
#back-to-list-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── 11. Footer ──────────────────────────────────────────── */
.site-footer {
  background: linear-gradient(180deg, var(--red-deeper) 0%, #3a0808 100%);
  color: rgba(255, 255, 255, 0.82);
}
.footer-inner {
  padding: 56px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-col {
}
.footer-col-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--gold-mid);
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* Footer Logo（col-about） */
.footer-logo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  margin-bottom: 14px;
}
.footer-logo-zh,
.footer-logo-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: 0.12em;
}
.footer-logo-en {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.08em;
}
.footer-intro,
.footer-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.85;
  margin-bottom: 16px;
}

/* Footer social icons（col-about） */
.footer-social {
  display: flex;
  gap: 10px;
}
.footer-social a {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.82rem;
  color: rgba(255, 255, 255, 0.7);
  transition: all var(--transition);
}
.footer-social a:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--red-deeper);
}

/* Footer 連結列表 */
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.footer-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: rgba(255, 255, 255, 0.65);
  padding: 5px 0;
  transition: color var(--transition);
}
.footer-links a::before {
  content: "—";
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.25);
}
.footer-links a:hover {
  color: var(--gold-light);
}
.footer-links a:hover::before {
  color: var(--gold-mid);
}

/* Footer 聯絡資訊 */
.footer-contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}
.footer-contact-list i {
  color: var(--gold-mid);
  flex: 0 0 16px;
  margin-top: 3px;
}
.footer-contact-list a {
  color: rgba(255, 255, 255, 0.7);
  transition: color var(--transition);
}
.footer-contact-list a:hover {
  color: var(--gold-light);
}
.footer-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  transition: all var(--transition);
}
.footer-ext-link:hover {
  color: var(--gold-light);
  border-color: var(--gold-mid);
  background: rgba(255, 255, 255, 0.07);
}

/* Content-area source links must not inherit the light-on-dark footer treatment. */
.content-card .content-source-link,
.content-card .footer-ext-link {
  color: #7a1110;
  background: #fff8ed;
  border-color: #d7b06a;
  text-decoration: none;
}
.content-card .content-source-link:hover,
.content-card .footer-ext-link:hover {
  color: #fff;
  background: #8b1a18;
  border-color: #8b1a18;
}

/* 舊版類名相容 */
.footer-logo-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-info-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--gold-mid);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.footer-info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.83rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
  line-height: 1.6;
}
.footer-info-item i {
  color: var(--gold-mid);
  flex: 0 0 16px;
  margin-top: 3px;
}
.footer-social-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--gold-mid);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.footer-social-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
  color: rgba(255, 255, 255, 0.7);
  transition: color var(--transition);
}
.footer-social-link:hover {
  color: var(--gold-light);
}
.footer-social-link i {
  width: 16px;
  color: var(--gold-mid);
}

/* Footer Bottom Bar */
.footer-bottom {
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.footer-bottom .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-copy {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.38);
}
.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.38);
}
.footer-bottom-links a {
  color: rgba(255, 255, 255, 0.45);
  transition: color var(--transition);
}
.footer-bottom-links a:hover {
  color: var(--gold-light);
}
.footer-bottom-links span {
  opacity: 0.4;
}

/* ── 12. RWD ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .news-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .service-grid,
  .service-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-grid > *:last-child {
    grid-column: span 2;
  }
  .about-banner {
    grid-template-columns: 1fr;
  }
  .about-banner-img {
    height: 280px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 68px;
  }
  .logo-img {
    width: 56px;
    height: 56px;
  }
  .site-logo {
    padding-right: 16px;
  }
  .top-bar-contact span {
    display: none;
  }
  .main-nav {
    display: none;
  }
  .hamburger {
    display: flex;
  }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 16px 32px var(--shadow-md);
    padding: 12px 0;
    z-index: 1000;
  }
  .main-nav.open .nav-list {
    flex-direction: column;
    width: 100%;
  }
  .main-nav.open .nav-item {
    width: 100%;
  }
  .main-nav.open .nav-link {
    padding: 14px 24px;
    border-radius: 0;
    justify-content: space-between;
  }
  .main-nav.open .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--border-light);
    border-radius: 0;
    background: var(--cream);
    padding: 4px 0;
    display: none;
  }
  .main-nav.open .nav-item.open .dropdown {
    display: block;
  }
  .main-nav.open .dropdown-link {
    padding-left: 40px;
  }
  .inner-surface {
    grid-template-columns: 1fr;
  }
  .inner-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 16px 0;
  }
  .hero-swiper {
    height: 420px;
  }
  .hero-title {
    font-size: 1.8rem;
  }
  .inner-h1 {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  .quick-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .quick-card {
    padding: 16px 8px;
  }
  .quick-icon {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
  .quick-label {
    font-size: 0.72rem;
  }
  .service-grid,
  .service-cards {
    grid-template-columns: 1fr;
  }
  .hero-swiper {
    height: 300px;
  }
  .hero-title {
    font-size: 1.4rem;
  }
  .hero-sub {
    font-size: 0.85rem;
  }
  .hero-slide-content {
    bottom: 36px;
  }
  .inner-content {
    padding: 24px 20px;
  }
  .inner-surface.no-sidebar .inner-content {
    padding: 24px 20px;
  }
  .section {
    padding: 44px 0;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer-grid > *:last-child {
    grid-column: auto;
  }
  .section-title {
    font-size: 1.4rem;
  }
  .logo-img {
    width: 48px;
    height: 48px;
  }
  .site-logo {
    padding-right: 14px;
  }
}

/* ── 13. About 內頁通用樣式 ─────────────────────────────────────────── */

/* 頁面 Hero */
.page-hero {
  background: linear-gradient(135deg, #7a1110 0%, #a51f1b 45%, #d1a84f 100%);
  color: #fff;
  padding: 72px 0 54px;
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 255, 255, 0.18),
      transparent 28%
    ),
    linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.28));
  pointer-events: none;
}
.page-hero .container {
  position: relative;
  z-index: 1;
}
.breadcrumb {
  font-size: 0.95rem;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.85);
}
.breadcrumb a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  margin-bottom: 18px;
}
.page-title {
  font-family: "Noto Serif TC", serif;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1.18;
  margin: 0 0 16px;
}
.page-desc {
  max-width: 760px;
  font-size: 1.12rem;
  line-height: 1.9;
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
}

/* 兩欄版型（側欄 + 內容） */
.about-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.about-content {
  min-width: 0;
}
.about-side {
  position: sticky;
  top: 110px;
  background: #fff;
  border: 1px solid var(--border-light, #eadfcb);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(60, 20, 10, 0.08);
  overflow: hidden;
}
.about-side-title {
  background: #7a1110;
  color: #fff;
  padding: 18px 22px;
  font-weight: 800;
}
.about-side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 22px;
  color: #3b2315;
  border-bottom: 1px solid #f0e7d8;
  font-weight: 700;
}
.about-side a:last-child {
  border-bottom: 0;
}
.about-side a[aria-current="page"],
.about-side a:hover {
  background: #fff6e2;
  color: #9d1d18;
}

/* 內容卡片 */
.content-card {
  background: #fff;
  border: 1px solid var(--border-light, #eadfcb);
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(60, 20, 10, 0.08);
  padding: 34px;
}
.content-card + .content-card {
  margin-top: 24px;
}
.content-card h2 {
  font-family: "Noto Serif TC", serif;
  font-size: 1.75rem;
  color: #7a1110;
  margin: 0 0 16px;
}
.content-card h3 {
  font-size: 1.22rem;
  color: #8b1a18;
  margin: 24px 0 10px;
}
.content-card p,
.content-card li {
  line-height: 2;
  color: #3f332b;
}
.adopted-steps,
.fortune-steps {
  counter-reset: adopted-step;
  margin: 0;
  padding: 0;
}
.adopted-steps > li,
.fortune-steps > li {
  position: relative;
  counter-increment: adopted-step;
  padding-left: 2.25em;
}
.adopted-steps > li::before,
.fortune-steps > li::before {
  content: counter(adopted-step, cjk-ideographic) "、";
  position: absolute;
  left: 0;
  color: #8b1a18;
  font-weight: 700;
}
.adopted-document img {
  margin-left: auto;
  margin-right: auto;
}
.contact-layout .transport-section p {
  text-align: justify;
}
.contact-route-map {
  max-width: 520px;
  margin: 1rem auto;
  text-align: center;
}
.contact-route-map img {
  width: 100%;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.contact-route-map figcaption {
  margin-top: 0.5rem;
  color: #888;
  font-size: 0.85rem;
}
.division-incense-seat img {
  margin-left: auto;
  margin-right: auto;
}
.lead {
  font-size: 1.12rem;
  color: #2f2924;
}

/* 資訊格 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.info-box {
  background: #fff9ed;
  border: 1px solid #f0dfbd;
  border-radius: 16px;
  padding: 20px;
}
.info-box i {
  color: #b52320;
  margin-right: 8px;
}

/* 時間軸 */
.timeline {
  position: relative;
  margin: 24px 0 0;
  padding-left: 28px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #d7b46a;
}
.timeline-item {
  position: relative;
  margin-bottom: 22px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 0.55em;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #b52320;
  border: 3px solid #f6df9a;
}

/* 特色三欄格 */
.feature-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.feature-card {
  background: #fff9ed;
  border: 1px solid #f0dfbd;
  border-radius: 18px;
  padding: 22px;
}
.feature-card i {
  font-size: 1.7rem;
  color: #b52320;
  margin-bottom: 12px;
}

/* 慶典行事表 */
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 14px;
}
.calendar-table th,
.calendar-table td {
  border: 1px solid #eadfcb;
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}
.calendar-table th {
  background: #7a1110;
  color: #fff;
}
.calendar-table tr:nth-child(even) td {
  background: #fff9ed;
}

/* 注意事項框 */
.note-box {
  background: #f7f2e8;
  border-left: 5px solid #b52320;
  padding: 18px 20px;
  border-radius: 12px;
  margin-top: 20px;
  color: #4b3a30;
}

/* 圖片格 */
.history-article p {
  font-size: 1.06rem;
  line-height: 2.15;
  text-align: justify;
  margin: 0 0 28px;
  color: #3f332b;
}
.history-photo-grid {
  display: grid;
  gap: 18px;
  margin: 10px 0 34px;
}
.history-photo-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.history-photo-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.history-photo-item {
  margin: 0;
  background: #fff9ed;
  border: 1px solid #f0dfbd;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(60, 20, 10, 0.08);
}
.history-photo-item img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: #f7efe0;
  cursor: zoom-in;
  transition:
    transform 0.25s ease,
    filter 0.25s ease;
}
.history-photo-item img:hover {
  transform: scale(1.015);
  filter: brightness(0.96);
}
.history-photo-item figcaption {
  padding: 12px 14px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #5a4538;
  background: #fffaf0;
  border-top: 1px solid #f0dfbd;
}

/* 燈箱 */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 6, 0.86);
  padding: 28px;
}
.lightbox-modal.open {
  display: flex;
}
.lightbox-panel {
  position: relative;
  max-width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  background: #fff;
}
.lightbox-caption {
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: center;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  border: 0;
  background: rgba(122, 17, 16, 0.92);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  background: #b52320;
  transform: scale(1.04);
  outline: 3px solid #f6df9a;
  outline-offset: 2px;
}
.lightbox-close {
  top: -14px;
  right: -14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
}
.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.2rem;
}
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  transform: translateY(-50%) scale(1.04);
}
.lightbox-prev {
  left: -64px;
}
.lightbox-next {
  right: -64px;
}

@media (max-width: 900px) {
  .about-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .about-side {
    position: static;
  }
  .feature-list,
  .info-grid {
    grid-template-columns: 1fr;
  }
  .content-card {
    padding: 24px;
  }
  .page-hero {
    padding: 54px 0 42px;
  }
  .calendar-table {
    font-size: 0.95rem;
  }
  .history-photo-grid-2,
  .history-photo-grid-3 {
    grid-template-columns: 1fr;
  }
  .history-photo-item img {
    height: auto;
    min-height: 220px;
  }
  .history-article p {
    font-size: 1rem;
    line-height: 2;
  }
  .lightbox-modal {
    padding: 18px;
  }
  .lightbox-image {
    max-height: 72vh;
  }
  .lightbox-prev {
    left: 8px;
  }
  .lightbox-next {
    right: 8px;
  }
  .lightbox-close {
    top: 8px;
    right: 8px;
  }
  .lightbox-caption {
    border-radius: 12px;
    max-width: 92vw;
  }
}

/* 四欄圖片格 */
.history-photo-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .history-photo-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .history-photo-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ── YouTube JSON 影音列表模組 ─────────────────────────────── */
.youtube-json-section {
  margin: 34px 0 0;
  padding: 22px 24px;
  background: #fff9ed;
  border: 1px solid #f0dfbd;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(60, 20, 10, 0.05);
}
.youtube-json-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: #7a1110;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.youtube-json-desc {
  margin: 0 0 18px !important;
  color: #5a4538 !important;
  line-height: 1.8 !important;
  font-size: 0.98rem !important;
}
.youtube-json-status {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px dashed #d7b46a;
  color: #5a4538;
}
.youtube-video-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.youtube-video-card {
  background: #fff;
  border: 1px solid #f0dfbd;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(60, 20, 10, 0.05);
}
.youtube-video-title {
  font-size: 1.08rem;
  color: #7a1110;
  margin: 0 0 8px;
  font-weight: 800;
  line-height: 1.55;
}
.youtube-video-title i {
  margin-right: 8px;
  color: #a31310;
}
.youtube-video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 8px;
  color: #7a6060;
  font-size: 0.9rem;
  line-height: 1.6;
}
.youtube-video-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.youtube-video-desc {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #3f332b;
  margin: 0 0 12px !important;
}
.desc-toggle {
  border: 0;
  background: transparent;
  color: #b52320;
  font-weight: 800;
  cursor: pointer;
  margin-left: 6px;
  padding: 0;
  font-family: inherit;
  font-size: 0.95rem;
}
.desc-toggle:hover,
.desc-toggle:focus {
  text-decoration: underline;
  outline: 2px solid #f6df9a;
  outline-offset: 2px;
}
.youtube-video-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b52320;
  font-weight: 800;
  border: 1.5px solid #b52320;
  border-radius: 999px;
  padding: 7px 16px;
  transition: all 0.2s ease;
}
.youtube-video-link:hover,
.youtube-video-link:focus {
  background: #b52320;
  color: #fff;
}
@media (max-width: 900px) {
  .youtube-json-section {
    padding: 20px 18px;
  }
  .youtube-video-card {
    padding: 15px 16px;
  }
  .youtube-video-title {
    font-size: 1.02rem;
  }
  .youtube-video-meta {
    font-size: 0.86rem;
  }
  .youtube-video-desc {
    font-size: 0.92rem;
  }
}
@media (max-width: 600px) {
  .youtube-json-section {
    margin: 28px 0 0;
    padding: 18px 14px;
  }
  .youtube-json-title {
    font-size: 1.2rem;
  }
  .youtube-json-desc {
    font-size: 0.92rem !important;
  }
  .youtube-video-list {
    gap: 12px;
  }
  .youtube-video-card {
    padding: 14px;
    border-radius: 14px;
  }
  .youtube-video-title {
    font-size: 1rem;
  }
  .youtube-video-meta {
    font-size: 0.82rem;
    gap: 4px 10px;
  }
  .youtube-video-desc {
    font-size: 0.9rem;
  }
  .youtube-video-link {
    padding: 6px 14px;
    font-size: 0.9rem;
  }
  .desc-toggle {
    font-size: 0.9rem;
  }
}

/* ── 慶典行事（calendar.html）專用 ────────────────────────── */

/* 農曆日期注意事項 */
.calendar-lunar-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff9ed;
  border: 1px solid #f0dfbd;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 8px 0 20px;
  color: #5a4538;
  font-weight: 800;
  line-height: 1.7;
}
.calendar-lunar-note i {
  color: #b52320;
  flex-shrink: 0;
}

/* 月份快速跳轉 */
.month-jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 30px;
  padding: 14px;
  background: #fffaf0;
  border: 1px solid #f0dfbd;
  border-radius: 16px;
}
.month-jump-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #efd8a8;
  color: #7a1110;
  font-weight: 900;
  line-height: 1.4;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.month-jump-nav a:hover,
.month-jump-nav a:focus {
  background: #7a1110;
  color: #fff;
  border-color: #7a1110;
  outline: 3px solid #f6df9a;
  outline-offset: 2px;
}

/* 月份區塊 */
.festival-month {
  margin: 0 0 30px;
  scroll-margin-top: 110px;
}
.festival-month:last-child {
  margin-bottom: 0;
}

/* 月份標題：左側紅金漸層 pill + 底線 */
.festival-month-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: #7a1110;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0dfbd;
}
.festival-month-title::before {
  content: "";
  display: block;
  flex-shrink: 0;
  width: 10px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b52320, #d7b46a);
}

/* 慶典卡片格線 */
.festival-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* 慶典卡片：日期欄（左）＋ 事項欄（右）水平 grid */
.festival-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 0;
  background: #fff;
  border: 1px solid #f0dfbd;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(60, 20, 10, 0.06);
}

.festival-date {
  background: #fff3dc;
  border-right: 1px solid #f0dfbd;
  padding: 18px 14px;
  color: #7a1110;
  font-weight: 900;
  line-height: 1.65;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.festival-body {
  padding: 17px 20px;
}

.festival-event {
  padding: 0 0 14px;
  margin: 0 0 14px;
  border-bottom: 1px dashed #e6d2ad;
}
.festival-event:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.festival-name {
  font-size: 1.08rem;
  font-weight: 900;
  color: #7a1110;
  line-height: 1.65;
  margin: 0 0 6px;
}

.festival-desc {
  font-size: 0.96rem;
  line-height: 1.85;
  color: #3f332b;
  margin: 0 !important;
  text-align: left !important;
}

/* 附加標籤（備用） */
.festival-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff6e2;
  border: 1px solid #efd8a8;
  border-radius: 999px;
  padding: 4px 10px;
  color: #7a1110;
  font-size: 0.82rem;
  font-weight: 800;
  margin: 4px 8px 8px 0;
}
.festival-note {
  font-size: 0.92rem;
  color: #7a6060;
  margin-top: 8px;
  line-height: 1.7;
}

@media (max-width: 1000px) {
  .festival-card-grid {
    grid-template-columns: 1fr;
  }
  .festival-card {
    grid-template-columns: 118px minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .calendar-lunar-note {
    padding: 12px 14px;
    font-size: 0.92rem;
  }
  .month-jump-nav {
    padding: 12px;
    gap: 6px;
    margin-bottom: 24px;
  }
  .month-jump-nav a {
    min-height: 34px;
    padding: 5px 11px;
    font-size: 0.9rem;
  }
  .festival-month-title {
    font-size: 1.25rem;
  }
  /* 手機版卡片：日期改置頂橫條 */
  .festival-card {
    grid-template-columns: 1fr;
  }
  .festival-date {
    border-right: 0;
    border-bottom: 1px solid #f0dfbd;
    justify-content: flex-start;
    text-align: left;
    padding: 12px 16px;
  }
  .festival-body {
    padding: 15px 16px;
  }
  .festival-name {
    font-size: 1rem;
  }
  .festival-desc {
    font-size: 0.92rem;
  }
}

/* ── 手機版：關於本宮側欄隱藏（使用漢堡選單導覽即可）── */
@media (max-width: 900px) {
  .about-side {
    display: none;
  }
  .about-layout {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
}

/* ── 回到頂端按鈕 ──────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: #7a1110;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(60, 20, 10, 0.24);
  cursor: pointer;
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.22s ease,
    background 0.22s ease;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover,
.back-to-top:focus-visible {
  background: #b52320;
  outline: 3px solid #f6df9a;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }
}

/* ============================================================
   Header / Logo / Navigation 最終修正版
   重點：
   1. Logo 保留原圖 1717×916 比例，不裁切、不壓成正方形。
   2. 首頁 active 狀態由 index.html 的完整路徑 JS 控制，避免千歲協會誤亮。
   3. 桌機導覽保持一列，手機改漢堡選單。
   ============================================================ */

:root {
  --header-h: 148px;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: linear-gradient(180deg, #fffdf8 0%, #fff8ed 100%);
  border-bottom: 3px solid var(--red);
  box-shadow: 0 8px 26px rgba(90, 20, 10, 0.1);
  isolation: isolate;
}

.main-header .container {
  max-width: 1480px;
  padding-left: 28px;
  padding-right: 28px;
}

.header-inner {
  height: auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-logo {
  flex: 0 0 clamp(320px, 28vw, 440px);
  width: clamp(320px, 28vw, 440px);
  aspect-ratio: 1717 / 916;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 24px 10px 0;
  margin-right: 0;
  border-right: 1px solid rgba(200, 150, 10, 0.26);
  text-decoration: none;
  transition:
    opacity var(--transition),
    transform var(--transition);
}

.site-logo:hover,
.site-logo:focus-visible {
  opacity: 0.9;
  transform: translateY(-1px);
}

.logo-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1717 / 916;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
}

.main-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-left: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}

.nav-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 999px;
  color: #2f2420;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.35;
  white-space: nowrap;
  transition:
    color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.nav-link i {
  font-size: 0.78rem;
}

.nav-item:hover > .nav-link,
.nav-item:focus-within > .nav-link {
  color: var(--red);
  background: #fff1dd;
  transform: translateY(-1px);
}

.nav-item.active > .nav-link,
.nav-link[aria-current="page"] {
  color: var(--red);
  background: #fff1dd;
  font-weight: 900;
}

.nav-item.active > .nav-link::after,
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 5px;
  height: 2px;
  background: var(--red);
  border-radius: 999px;
}

.nav-link:focus-visible,
.dropdown-link:focus-visible,
.hamburger:focus-visible {
  outline: 3px solid #f6df9a;
  outline-offset: 3px;
}

.dropdown {
  top: calc(100% + 10px);
  min-width: 208px;
  border-radius: 16px;
  border: 1px solid rgba(200, 150, 10, 0.32);
  border-top: 3px solid var(--red);
  box-shadow: 0 18px 42px rgba(60, 20, 10, 0.18);
  overflow: hidden;
}

.dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.dropdown-link {
  padding: 11px 18px;
  font-size: 1rem;
  font-weight: 700;
}

.hamburger {
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(122, 17, 16, 0.24);
  background: #fff6e7;
}

.hamburger span {
  background: var(--red-dark);
}

/* 中型桌機：保留橫式 Logo，但縮小導覽與 Logo */
@media (max-width: 1320px) {
  :root {
    --header-h: 128px;
  }

  .main-header .container {
    padding-left: 22px;
    padding-right: 22px;
  }

  .site-logo {
    flex-basis: clamp(260px, 24vw, 340px);
    width: clamp(260px, 24vw, 340px);
    padding-right: 18px;
  }

  .nav-link {
    padding-left: 9px;
    padding-right: 9px;
    font-size: 0.98rem;
  }
}

/* 平板以下：改為漢堡選單 */
@media (max-width: 1100px) {
  :root {
    --header-h: 104px;
  }

  .top-bar-contact span:nth-child(3) {
    display: none;
  }

  .header-inner {
    min-height: var(--header-h);
  }

  .site-logo {
    flex: 0 0 240px;
    width: 240px;
    padding: 8px 0;
    border-right: 0;
  }

  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .main-nav {
    display: none;
  }

  .main-nav.open {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: block;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 10px 18px 22px;
    background: #fffdf8;
    border-top: 1px solid rgba(200, 150, 10, 0.28);
    box-shadow: 0 18px 38px rgba(60, 20, 10, 0.18);
    z-index: 1000;
  }

  .main-nav.open .nav-list {
    display: block;
    width: 100%;
  }

  .main-nav.open .nav-item {
    width: 100%;
    border-bottom: 1px solid #f0e4d6;
  }

  .main-nav.open .nav-link {
    width: 100%;
    min-height: 50px;
    justify-content: space-between;
    padding: 13px 4px;
    border-radius: 0;
    font-size: 1.08rem;
    transform: none;
  }

  .main-nav.open .nav-item.active > .nav-link,
  .main-nav.open .nav-link[aria-current="page"] {
    background: transparent;
  }

  .main-nav.open .nav-item.active > .nav-link::after,
  .main-nav.open .nav-link[aria-current="page"]::after {
    left: 0;
    right: auto;
    bottom: 8px;
    width: 48px;
  }

  .main-nav.open .dropdown {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    min-width: 0;
    margin: 0 0 12px;
    padding: 6px;
    border: 1px solid #f0dfbd;
    border-radius: 14px;
    box-shadow: none;
    background: #fff7e8;
  }

  .main-nav.open .dropdown::before {
    display: none;
  }

  .main-nav.open .nav-item.open .dropdown {
    display: block;
  }

  .main-nav.open .dropdown-link {
    padding: 12px 14px;
    border-radius: 10px;
  }
}

@media (max-width: 600px) {
  :root {
    --header-h: 78px;
  }

  .top-bar {
    display: none;
  }

  .main-header .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-logo {
    flex-basis: 168px;
    width: 168px;
  }

  .hamburger {
    width: 44px;
    height: 44px;
  }

  .main-nav.open {
    max-height: calc(100vh - var(--header-h));
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ============================================================
   Header / Logo / Navigation 最終緊湊修正版 2026-05-04
   目的：
   1. Logo 保留 1717×916 橫式比例，不裁切。
   2. 移除過大的 Logo 容器與導覽空白。
   3. 桌機維持一列導覽；平板、手機改漢堡選單。
   4. 首頁只 highlight 首頁，不誤亮 association/index.html。
   ============================================================ */

:root {
  --header-h: 92px;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: #fffaf2;
  border-bottom: 3px solid var(--red);
  box-shadow: 0 4px 18px rgba(90, 20, 10, 0.1);
  isolation: isolate;
}

.main-header .container {
  max-width: 1360px;
  padding-left: 24px;
  padding-right: 24px;
}

.header-inner {
  height: var(--header-h);
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* Logo：用高度控制，不再用大面積 aspect-ratio 容器撐版面 */
.site-logo {
  flex: 0 0 15%;
  width: 15%;
  min-width: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 6px 0 0;
  margin: 0;
  border-right: 0px solid rgba(200, 150, 10, 0.24);
  text-decoration: none;
  transition:
    opacity var(--transition),
    transform var(--transition);
}

.site-logo:hover,
.site-logo:focus-visible {
  opacity: 0.92;
  transform: translateY(-1px);
}

.logo-img {
  display: block;
  width: auto;
  height: 100px;
  margin: 0px 0px 0px 15px;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}

/* 導覽列：降低高度與水平間距，讓資訊集中 */
.main-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-left: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #2f2420;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.35;
  white-space: nowrap;
  position: relative;
  transition:
    color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.nav-link i {
  font-size: 0.76rem;
}

.nav-item:hover > .nav-link,
.nav-item:focus-within > .nav-link {
  color: var(--red);
  background: #fff1dd;
  transform: translateY(-1px);
}

.nav-item.active > .nav-link,
.nav-link[aria-current="page"] {
  color: var(--red);
  background: #fff1dd;
  font-weight: 900;
}

.nav-item.active > .nav-link::after,
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  background: var(--red);
  border-radius: 999px;
}

.nav-link:focus-visible,
.dropdown-link:focus-visible,
.hamburger:focus-visible {
  outline: 3px solid #f6df9a;
  outline-offset: 3px;
}

/* Dropdown：保留滑鼠移動緩衝，不再掉選單 */
.dropdown {
  top: calc(100% + 8px);
  min-width: 200px;
  border-radius: 14px;
  border: 1px solid rgba(200, 150, 10, 0.32);
  border-top: 3px solid var(--red);
  box-shadow: 0 16px 38px rgba(60, 20, 10, 0.16);
  overflow: visible;
}

.dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}

.dropdown-link {
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 700;
}

.hamburger {
  display: none;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid rgba(122, 17, 16, 0.24);
  background: #fff6e7;
}

.hamburger span {
  display: block;
  width: 23px;
  height: 2.5px;
  background: var(--red-dark);
  border-radius: 2px;
  transition: all 0.25s ease;
}

/* 中型桌機：再壓縮 Logo 與字距，避免換行 */
@media (max-width: 1280px) {
  :root {
    --header-h: 80px;
  }

  .main-header .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .site-logo {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    padding-right: 12px;
  }

  .logo-img {
    height: 68px;
    margin-left: 0;
  }

  .header-inner {
    gap: 16px;
  }

  .nav-link {
    min-height: 34px;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
  }
}

/* 平板以下：改漢堡選單 */
@media (max-width: 1100px) {
  :root {
    --header-h: 72px;
  }

  .top-bar-contact span:nth-child(3) {
    display: none;
  }

  .header-inner {
    height: var(--header-h);
  }

  .site-logo {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: var(--header-h);
    padding: 0;
    border-right: 0;
  }

  .logo-img {
    height: 64px;
  }

  .hamburger {
    display: flex;
  }

  .main-nav {
    display: none;
  }

  .main-nav.open {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: block;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 10px 18px 22px;
    background: #fffdf8;
    border-top: 1px solid rgba(200, 150, 10, 0.28);
    box-shadow: 0 18px 38px rgba(60, 20, 10, 0.18);
    z-index: 1000;
  }

  .main-nav.open .nav-list {
    display: block;
    width: 100%;
  }

  .main-nav.open .nav-item {
    width: 100%;
    border-bottom: 1px solid #f0e4d6;
  }

  .main-nav.open .nav-link {
    width: 100%;
    min-height: 50px;
    justify-content: space-between;
    padding: 13px 4px;
    border-radius: 0;
    font-size: 1.08rem;
    transform: none;
  }

  .main-nav.open .nav-item.active > .nav-link,
  .main-nav.open .nav-link[aria-current="page"] {
    background: transparent;
  }

  .main-nav.open .nav-item.active > .nav-link::after,
  .main-nav.open .nav-link[aria-current="page"]::after {
    left: 0;
    right: auto;
    bottom: 8px;
    width: 48px;
  }

  .main-nav.open .dropdown {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    min-width: 0;
    margin: 0 0 12px;
    padding: 6px;
    border: 1px solid #f0dfbd;
    border-radius: 14px;
    box-shadow: none;
    background: #fff7e8;
  }

  .main-nav.open .dropdown::before {
    display: none;
  }

  .main-nav.open .nav-item.open .dropdown {
    display: block;
  }

  .main-nav.open .dropdown-link {
    padding: 12px 14px;
    border-radius: 10px;
  }
}

@media (max-width: 600px) {
  :root {
    --header-h: 82px;
  }

  .top-bar {
    display: none;
  }

  .main-header .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-logo {
    width: auto;
    min-width: 0;
  }

  .logo-img {
    height: 76px;
    margin: 0px;
  }

  .hamburger {
    width: 38px;
    height: 38px;
  }

  .main-nav.open {
    max-height: calc(100vh - var(--header-h));
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ─── Global Lightbox ──────────────────────────────────────── */
main figure {
  cursor: zoom-in;
}
main figure img {
  transition: opacity 0.15s;
}
main figure:hover img {
  opacity: 0.88;
}
.page-hero figure,
.about-side figure {
  cursor: default;
}
.page-hero figure:hover img,
.about-side figure:hover img {
  opacity: 1;
}

#lb-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#lb-modal.open {
  display: flex;
}
.lb-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 92vw;
  max-height: 92vh;
  cursor: default;
}
#lb-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
}
#lb-cap {
  color: #ccc;
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
  text-align: center;
}
#lb-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#lb-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
#lb-prev,
#lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  width: 3rem;
  height: 5rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lb-prev:hover,
#lb-next:hover {
  background: rgba(255, 255, 255, 0.25);
}
#lb-prev {
  left: 0.6rem;
}
#lb-next {
  right: 0.6rem;
}

/* 2026-07-19: 五年大科海報與協會公告列表 */
.ceremony-2026-poster {
  margin-top: 2rem;
  text-align: center;
}
.ceremony-2026-poster figure {
  margin: 1rem auto;
  max-width: 400px;
}
.ceremony-2026-poster img {
  display: block;
  width: 100%;
  height: 560px;
  object-fit: contain;
  background: #f9f5ee;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
  margin: 0 auto;
}
.ceremony-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 1.5rem 0;
}
.ceremony-photo-grid figure {
  margin: 0;
  text-align: center;
}
.ceremony-photo-grid figcaption {
  margin-top: 0.5rem;
  color: #6f5d50;
  font-size: 0.9rem;
}
.ceremony-poster-grid {
  grid-template-columns: minmax(0, 400px);
  justify-content: center;
}
.ceremony-poster-grid img {
  width: 100%;
  height: 560px;
  object-fit: contain;
  background: #f9f5ee;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}
.association-news-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.association-news-item {
  border: 1px solid #eadfce;
  border-radius: 8px;
  background: #fff;
}
.association-news-item a {
  display: block;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
}
.association-news-item a:hover {
  background: #fff8e9;
}
.association-news-item strong {
  display: block;
  color: #8b2325;
}
.association-news-item span {
  display: block;
  margin-top: 0.35rem;
  color: #777;
  font-size: 0.875rem;
}
