/* =========================================================
   竹南保民宮 官方網站樣式
   風格：自然簡約、溫暖木質色調，融合傳統廟宇的沉穩感
   ========================================================= */

:root {
  --color-bg: #faf7f0;
  --color-bg-alt: #f2ede1;
  --color-surface: #ffffff;
  --color-text: #3a332a;
  --color-text-soft: #6b6055;
  --color-border: #e6ddcc;
  --color-primary: #8c2f26;      /* 廟宇紅 */
  --color-primary-dark: #6f241d;
  --color-gold: #b8892b;         /* 金色點綴 */
  --color-gold-soft: #e8d7ac;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(60, 45, 20, 0.08);
  --max-width: 1120px;
  --font-serif: "Noto Serif TC", "PMingLiU", serif;
  --font-sans: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--color-primary-dark);
  margin: 0 0 0.6em;
  letter-spacing: 0.03em;
}

p { margin: 0 0 1.1em; color: var(--color-text); }

/* ---------- 頂部導覽列 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 240, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-gold-soft);
}

.brand-text .name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--color-primary-dark);
  font-weight: 700;
  line-height: 1.3;
}

.brand-text .desc {
  font-size: 0.78rem;
  color: var(--color-text-soft);
  letter-spacing: 0.05em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav a {
  padding: 10px 14px;
  font-size: 0.95rem;
  border-radius: 999px;
  color: var(--color-text);
  transition: background 0.2s, color 0.2s;
  position: relative;
}

.nav a:hover,
.nav a.active {
  background: var(--color-primary);
  color: #fff;
}

.nav .has-dropdown { position: relative; }

.dropdown {
  display: none;
  position: absolute;
  top: 110%;
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 160px;
  padding: 6px;
}

.nav .has-dropdown:hover .dropdown { display: block; }

.dropdown a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.dropdown a:hover { background: var(--color-bg-alt); color: var(--color-primary-dark); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--color-primary-dark);
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 62vh;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(180deg, rgba(30,20,10,0.15), rgba(30,20,10,0.55)),
              var(--color-bg-alt) center/cover no-repeat;
  color: #fff;
}

.hero.has-image {
  background-image: linear-gradient(180deg, rgba(30,20,10,0.1), rgba(20,14,8,0.65)),
                     url('../../wp-content/uploads/2024/11/bm01.png');
}

.hero-content {
  padding: 60px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--color-gold-soft);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4vw, 3rem);
  margin-bottom: 0.3em;
}

.hero p {
  color: rgba(255,255,255,0.9);
  max-width: 560px;
  font-size: 1.05rem;
}

/* ---------- Section ---------- */
.section {
  padding: 72px 0;
}

.section.alt { background: var(--color-bg-alt); }

.section-head {
  text-align: center;
  margin-bottom: 44px;
}

.section-head .eyebrow {
  display: block;
  color: var(--color-gold);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 1.9rem;
  margin-bottom: 10px;
}

.section-head .sub {
  color: var(--color-text-soft);
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.grid {
  display: grid;
  gap: 28px;
}

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

/* 首頁公告清單 */
.announce-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.announce-item {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 20px 26px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.2s;
}

.announce-item:last-child { border-bottom: none; }
.announce-item:hover { background: var(--color-bg-alt); }

.announce-date {
  flex: 0 0 auto;
  width: 84px;
  text-align: center;
  color: var(--color-primary);
  font-family: var(--font-serif);
}

.announce-date .day { font-size: 1.5rem; font-weight: 700; display: block; }
.announce-date .ym { font-size: 0.78rem; color: var(--color-text-soft); }

.announce-body { flex: 1; min-width: 0; }

.announce-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px;
}

.pin-badge {
  display: inline-block;
  font-size: 0.72rem;
  background: var(--color-primary);
  color: #fff;
  padding: 2px 9px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
}

.announce-excerpt {
  color: var(--color-text-soft);
  font-size: 0.9rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--color-text-soft);
}

/* 神明宮殿巡禮 卡片 */
.deity-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.deity-card .img-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--color-bg-alt);
}

.deity-card img { width: 100%; height: 100%; object-fit: cover; }

.deity-card .content { padding: 18px 20px 22px; flex: 1; display: flex; flex-direction: column; }

.deity-card h3 { font-size: 1.1rem; margin-bottom: 8px; }

.deity-card .excerpt {
  color: var(--color-text-soft);
  font-size: 0.9rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-link {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--color-primary);
  font-weight: 700;
}

/* 按鈕 */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
}

.btn:hover { background: var(--color-primary-dark); transform: translateY(-1px); }

.btn.outline {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary) !important;
}

.btn.outline:hover { background: var(--color-primary); color: #fff !important; }

.btn.small { padding: 8px 18px; font-size: 0.85rem; }

/* 內容頁 */
.page-hero {
  padding: 56px 0 20px;
  text-align: center;
}

.page-hero .eyebrow {
  color: var(--color-gold);
  letter-spacing: 0.25em;
  font-size: 0.85rem;
}

.page-hero h1 { font-size: 2rem; }

.breadcrumb {
  font-size: 0.85rem;
  color: var(--color-text-soft);
}

.breadcrumb a { color: var(--color-primary); }

.content-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

.content-wrap.wide { max-width: 960px; }

.content-wrap p { color: var(--color-text); }

.content-wrap img {
  border-radius: var(--radius);
  margin: 24px 0;
}

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 26px;
}

.info-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.info-row:last-child { margin-bottom: 0; }

.info-row .label {
  flex: 0 0 84px;
  color: var(--color-gold);
  font-weight: 700;
  font-family: var(--font-serif);
}

.map-frame {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.map-frame iframe { width: 100%; height: 420px; border: 0; display: block; }

/* 神明清單（宮殿巡禮索引） */
.deity-index-item {
  display: flex;
  gap: 22px;
  padding: 26px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: flex-start;
}

.deity-index-item:first-child { padding-top: 0; }
.deity-index-item:last-child { border-bottom: none; }

.deity-index-item .thumb {
  flex: 0 0 140px;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1/1;
  background: var(--color-bg-alt);
}

.deity-index-item .thumb img { width: 100%; height: 100%; object-fit: cover; }

.deity-index-item .text h3 { margin-bottom: 8px; }

.deity-index-item .text .excerpt {
  color: var(--color-text-soft);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

/* Footer */
.site-footer {
  background: #2b2119;
  color: #d9cfbe;
  padding: 52px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 34px;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-grid h4 { color: #f2e8d5; font-size: 1rem; margin-bottom: 14px; }

.footer-grid p, .footer-grid a { color: #bfb29c; font-size: 0.9rem; }

.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a:hover { color: #f2e8d5; }

.footer-bottom {
  text-align: center;
  padding-top: 22px;
  font-size: 0.82rem;
  color: #8c8171;
}

.footer-bottom a {
  color: #bfb29c;
  text-decoration: underline;
}

.footer-bottom a:hover { color: #f2e8d5; }

/* 分頁 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 34px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.9rem;
}

.pagination a:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* 表單（聯絡我們／後台通用） */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--color-text);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  background: #fff;
  color: var(--color-text);
}

textarea.form-control { min-height: 140px; resize: vertical; }

.form-control:focus { outline: none; border-color: var(--color-primary); }

.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.92rem;
}

.alert.success { background: #eaf6ec; color: #2f6b3a; border: 1px solid #bfe3c5; }
.alert.error { background: #fbeceb; color: #a3372c; border: 1px solid #f2c3bd; }

/* 佔位圖片提示（尚未上傳照片時） */
.placeholder-note {
  padding: 14px 18px;
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--color-text-soft);
}

/* 圖片彈出視窗（點擊縮圖時整個視窗置中彈出，不開新視窗） */
.lightbox-trigger {
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  display: block;
  line-height: 0;
  font-size: 0;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  transition: transform 0.25s;
  transform: translateZ(0) scale(1);
  backface-visibility: hidden;
}

.lightbox-trigger:hover { transform: translateZ(0) scale(1.03); }
.lightbox-trigger:focus { outline: none; }
.lightbox-trigger::-moz-focus-inner { border: 0; }

.lightbox-trigger img { display: block; }

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 6, 0.8);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-overlay.open { display: flex; }

.lightbox-modal {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  max-width: min(90vw, 900px);
  max-height: 88vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-modal img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  border-radius: 6px;
  display: block;
}

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* 響應式 */
@media (max-width: 880px) {
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .menu-toggle { display: block; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 16px; }
  .dropdown { position: static; box-shadow: none; border: none; display: none; padding-left: 14px; }
  .nav .has-dropdown.open .dropdown { display: block; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .deity-index-item { flex-direction: column; }
  .deity-index-item .thumb { width: 100%; flex-basis: auto; }
  .announce-item { padding: 16px; }
}
