/* ================================================
   宮廟網站主樣式 v2 — 亮底傳統清爽風
   參考風格：台灣知名宮廟官網（米白底、紅色系）
   ================================================ */

   @import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;500;600;700;900&display=swap');

   :root {
     --red:        #C0392B;
     --red-dark:   #96261F;
     --red-light:  #E74C3C;
     --red-bg:     #FDF0EE;
     --gold:       #B8860B;
     --gold-light: #DAA520;
     --gold-bg:    #FFF8E7;
     --cream:      #FAF7F2;
     --warm-white: #FFFFFF;
     --border:     #E8DDD5;
     --border-red: rgba(192,57,43,0.2);
     --text-dark:  #22120c;
     --text-mid:   #5C3D2E;
     --text-light: #8C6A5A;
     --nav-h:      72px;
     --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
     --shadow-md:  0 4px 20px rgba(0,0,0,0.12);
   }
   
   /* ── Reset ── */
   *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
   html { scroll-behavior: smooth; }
   body {
     font-family: 'Noto Serif TC', 'Noto Serif', serif;
     background: var(--cream);
     color: var(--text-dark);
     line-height: 1.8;
     overflow-x: hidden;
   }
   img { max-width: 100%; display: block; }
   a  { color: inherit; text-decoration: none; }
   
   /* ══════════ TOP BAR ══════════ */
   #topbar {
     background: var(--red-dark);
     color: rgba(255,255,255,0.85);
     font-size: 1rem; letter-spacing: 0.08em;
     padding: 6px 40px;
     display: flex; justify-content: space-between; align-items: center;
   }
   #topbar a { color: rgba(255,255,255,0.75); transition: color 0.2s; }
   #topbar a:hover { color: #fff; }
   
   /* ══════════ NAV ══════════ */
   #navbar {
     position: sticky; top: 0; z-index: 999;
     background: var(--warm-white);
     border-bottom: 3px solid var(--red);
     box-shadow: var(--shadow-sm);
     display: flex; align-items: stretch;
     height: var(--nav-h);
   }
   .nav-logo-block {
     display: flex; align-items: center; gap: 14px;
     padding: 0 28px;
     background: var(--red);
     color: white; flex-shrink: 0;
     min-width: 200px;
   }
   .nav-logo-icon { font-size: 2rem; }
   .nav-logo-main { font-size: 1.35rem; font-weight: 900; letter-spacing: 0.15em; line-height: 1.2; }
   .nav-logo-sub  { font-size: 0.8rem; letter-spacing: 0.18em; opacity: 0.82; }
   
   #navbar > ul {
     list-style: none;
     display: flex; align-items: stretch;
     margin-left: 4px;
   }
   #navbar > ul > li > a {
     display: flex; align-items: center;
     height: 100%; padding: 0 18px;
     font-size: 1rem; font-weight: 600; letter-spacing: 0.1em;
     color: var(--text-dark);
     border-bottom: 3px solid transparent;
     margin-bottom: -3px;
     white-space: nowrap;
     transition: color 0.2s, border-color 0.2s;
   }
   #navbar > ul > li > a:hover { color: var(--red); border-color: var(--red); background: var(--red-bg); }
   
   /* ── 下拉選單（線上服務） ── */
   li.dropdown {
     position: relative;
   }
   li.dropdown > .dropdown-toggle {
     cursor: pointer;
   }
   ul.dropdown-menu {
     display: none !important;
     position: absolute;
     top: 100%; right: 0;
     background: var(--warm-white);
     border: 1px solid var(--border);
     border-top: 3px solid var(--red);
     box-shadow: var(--shadow-md);
     min-width: 120px;
     z-index: 1000;
     list-style: none;
     padding: 0;
     margin: 0;
     flex-direction: column;
   }
   li.dropdown:hover > ul.dropdown-menu,
   li.dropdown.open > ul.dropdown-menu {
     display: flex !important;
   }
   ul.dropdown-menu > li > a {
     display: block;
     padding: 10px 16px;
     height: auto;
     font-size: 0.9rem;
     font-weight: 600;
     letter-spacing: 0.08em;
     color: var(--text-dark);
     border-bottom: 1px solid var(--border);
     margin-bottom: 0;
     white-space: nowrap;
     transition: background 0.2s, color 0.2s;
   }
   ul.dropdown-menu > li:last-child > a {
     border-bottom: none;
   }
   ul.dropdown-menu > li > a:hover {
     background: var(--red-bg);
     color: var(--red);
   }
   
   /* hamburger */
   #menu-toggle {
     display: none; margin-left: auto; margin-right: 16px;
     background: none; border: none; cursor: pointer; padding: 8px;
     align-self: center;
   }
   #menu-toggle span {
     display: block; width: 26px; height: 2px;
     background: var(--red); margin: 6px 0;
   }
   #mobile-menu {
     display: none; position: fixed;
     top: var(--nav-h); left: 0; right: 0; z-index: 998;
     background: white; border-bottom: 3px solid var(--red);
     box-shadow: var(--shadow-md); flex-direction: column;
   }
   #mobile-menu.open { display: flex; }
   #mobile-menu a {
     padding: 14px 24px; font-size: 1rem; font-weight: 600;
     color: var(--text-dark); letter-spacing: 0.1em;
     border-bottom: 1px solid var(--border);
   }
   #mobile-menu a:hover { background: var(--red-bg); color: var(--red); }
   
   /* ══════════ HERO (更新版：支援背景圖) ══════════ */
   #hero {
     position: relative; 
     height: 600px; /* 稍微增加高度，展現廟宇氣勢 */
     /* 替換下方 url 中的圖片路徑，例如 'images/temple-main.jpg' */
     background: url('包公廟.png') no-repeat center center;
     background-size: cover;
     background-attachment: fixed; /* 滾動時有視差效果，若不喜歡可刪除 */
     display: flex; 
     align-items: center; 
     justify-content: center;
     text-align: center; 
     overflow: hidden;
   }
   
   /* 新增黑色半透明遮罩，防止背景照片太亮導致文字看不清楚 */
   #hero::before {
     content: '';
     position: absolute;
     top: 0; left: 0; right: 0; bottom: 0;
     background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
     z-index: 0;
   }
   
   /* 確保內容在遮罩之上 */
   .hero-inner { 
     position: relative; 
     z-index: 1; 
     padding: 0 24px; 
   }
   
   /* 微調標題陰影，增加閱讀性 */
   .hero-title-cn {
     font-size: clamp(3rem, 9.5vw, 5.5rem); /* 稍微調小一點點，避免遮住太多照片 */
     text-shadow: 0 4px 15px rgba(255, 255, 255, 0.6);
   }
   
   .hero-tagline {
     font-size: clamp(1.4rem, 2vw, 1.2rem);
     color:#000000;
     text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
     font-weight: 500;
   }
   
   .hero-btns {
     margin-top: 15px;
     display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
     font-size: clamp(1.4rem, 2vw, 1.2rem);
     color:#4b1cf4;
     text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
     font-weight: 500;
   }
   
   /* ══════════ 跑馬燈 ══════════ */
   #marquee-bar {
     background: var(--gold-bg);
     border-top: 1px solid rgba(184,134,11,0.22);
     border-bottom: 1px solid rgba(184,134,11,0.22);
     padding: 10px 0; display: flex; align-items: center; overflow: hidden;
   }
   .marquee-label {
     flex-shrink: 0; padding: 0 18px;
     font-size: 1rem; font-weight: 700; letter-spacing: 0.2em;
     color: var(--red); border-right: 2px solid var(--border-red);
     white-space: nowrap;
   }
   .marquee-track { flex: 1; overflow: hidden; }
   .marquee-inner {
     display: flex; gap: 56px; white-space: nowrap;
     animation: marquee 28s linear infinite;
   }
   .marquee-inner span { font-size: 1rem; color: solid var(--text-mid); }
   .marquee-inner span::before { content: '◆ '; color: var(--red); font-size: 0.6em; vertical-align: middle; }
   @keyframes marquee {
     0%   { transform: translateX(0); }
     100% { transform: translateX(-50%); }
   }
   
   /* ══════════ 快速連結 ══════════ */
   #quick-links { background: var(--warm-white); padding: 0; }
   .quick-grid {
     display: grid; grid-template-columns: repeat(4, 1fr);
     border-left: 1px solid var(--border); border-top: 1px solid var(--border);
   }
   .quick-item {
     display: flex; flex-direction: column; align-items: center;
     justify-content: center; padding: 28px 16px; gap: 10px;
     border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
     text-align: center; cursor: pointer;
     position: relative; overflow: hidden;
     
   }
   .quick-item::after {
     content: ''; position: absolute; bottom: 0; left: 0; right: 0;
     height: 3px; background: var(--red);
     transform: scaleX(0); transition: transform 0.25s;
   }
   .quick-item:hover { background: var(--red-bg); }
   .quick-item:hover::after { transform: scaleX(1); }
   .quick-item:hover .qi-icon { background: var(--red); color: white; }
   .qi-icon {
     width: 52px; height: 52px; border-radius: 50%;
     background: var(--red-bg); color: var(--red);
     display: flex; align-items: center; justify-content: center;
     font-size: 1.6rem; transition:  color 0.2s;
   }
   .qi-label { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.1em; color: var(--text-dark); }
   .qi-sub   { font-size: 0.9rem; color: var(--text-light); letter-spacing: 0.05em; }
   
   /* ══════════ SECTION BASE ══════════ */
   .section { padding: 72px 40px; }
   .section-gray  { background: #F5EEE8; }
   .section-white { background: var(--warm-white); }
   .section-red   { background: var(--red); color: white; }
   
   .section-header { text-align: center; margin-bottom: 48px; }
   .section-tag {
     display: inline-block; font-size: 0.9rem; letter-spacing: 0.45em;
     color: var(--red); padding: 3px 14px;
     border: 1px solid var(--border-red); margin-bottom: 10px;
   }
   .section-title {
     font-size: clamp(1.7rem, 3.5vw, 2.2rem);
     font-weight: 900; letter-spacing: 0.1em; color: var(--text-dark);
   }
   .section-title em { font-style: normal; color: var(--red); }
   .section-rule { width: 44px; height: 3px; background: var(--red); margin: 12px auto 0; }
   .container { max-width: 1100px; margin: 0 auto; }
   
   /* ══════════ 最新消息 ══════════ */
   .news-layout {
     display: grid; grid-template-columns: 1fr 320px;
     gap: 40px; max-width: 1100px; margin: 0 auto;
   }
   #news-list { display: flex; flex-direction: column; }
   .news-card {
     display: flex; align-items: flex-start; gap: 18px;
     padding: 20px 0; border-bottom: 1px solid var(--border);
     cursor: pointer;
   }
   .news-card:first-child { border-top: 1px solid var(--border); }
   .news-card:hover .news-title-text { color: var(--red); }
   .news-date-badge {
     flex-shrink: 0; width: 56px; text-align: center;
     padding: 8px 4px; background: var(--red); color: white;
   }
   .nb-day   { font-size: 1.6rem; font-weight: 900; line-height: 1; }
   .nb-month { font-size: 0.65rem; letter-spacing: 0.08em; opacity: 0.88; margin-top: 2px; }
   .news-body { flex: 1; }
   .news-cat-tag {
     display: inline-block; font-size: 0.8rem; letter-spacing: 0.15em;
     color: var(--red); border: 1px solid var(--border-red);
     padding: 1px 8px; margin-bottom: 6px;
   }
   .news-title-text {
     font-size: 1.2rem; font-weight: 700; color: var(--text-dark);
     line-height: 1.5; letter-spacing: 0.04em; transition: color 0.2s;
   }
   .news-excerpt {
     font-size: 1rem; color: var(--text-light); line-height: 1.75; margin-top: 4px;
     display: -webkit-box; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
   }
   .news-more-btn {
     display: inline-block; margin-top: 20px; padding: 9px 28px;
     font-size: 1rem; font-family: inherit; letter-spacing: 0.18em;
     border: 1px solid var(--red); color: var(--red); background: transparent;
     cursor: pointer; transition:  color 0.25s;
   }
   .news-more-btn:hover { background: var(--red); color: white; }
   
   /* sidebar */
   .sidebar-box {
     background: var(--warm-white); border: 1px solid var(--border);
     border-top: 3px solid var(--red); margin-bottom: 22px; overflow: hidden;
   }
   .sidebar-title {
     padding: 12px 16px; font-size: 1rem; font-weight: 700;
     letter-spacing: 0.15em; color: var(--red);
     background: var(--red-bg); border-bottom: 1px solid var(--border-red);
   }
   .sidebar-content { padding: 12px 16px; }
   .sidebar-link {
     display: flex; align-items: center; gap: 8px;
     padding: 9px 0; border-bottom: 1px dashed var(--border);
     font-size: 1rem; color: var(--text-mid); cursor: pointer;
     transition: color 0.2s;
     text-decoration: none;
   }
   .sidebar-link:last-child { border-bottom: none; }
   .sidebar-link:hover { color: var(--red); }
   .sidebar-link::before { content: '›'; color: var(--red); font-size: 1.1rem; line-height: 1; }
   .s-info-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 0.82rem; }
   .s-info-row:last-child { border-bottom: none; }
   .s-info-label { color: var(--text-light); white-space: nowrap; flex-shrink: 0; font-size: 1rem;}
   .s-info-val   { color: var(--text-dark);font-size: 1rem; }
   
   /* ══════════ 神明介紹 ══════════ */
   .deity-grid {
     display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
     gap: 22px; max-width: 1000px; margin: 0 auto;
   }
   .deity-card {
     background: var(--warm-white); border: 1px solid var(--border);
     border-top: 4px solid var(--red); padding: 30px 18px; text-align: center;
     box-shadow: var(--shadow-sm); transition: transform 0.3s, box-shadow 0.3s;
   }
   .deity-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
   .deity-icon  { font-size: 2.8rem; margin-bottom: 12px; }
   .deity-name  { font-size: 1.5rem; font-weight: 900; color: var(--red); letter-spacing: 0.12em; margin-bottom: 4px; }
   .deity-epithet { font-size: 1rem; color: var(--text-light); letter-spacing: 0.14em; margin-bottom: 10px; }
   .deity-desc  { font-size: 1.1rem; color: var(--text-mid); line-height: 1.85; }
   
   /* ══════════ 統計 ══════════ */
   .stats-grid {
     display: grid; grid-template-columns: repeat(4, 1fr);
     gap: 1px; background: rgba(255,255,255,0.12);
     max-width: 860px; margin: 0 auto;
   }
   .stat-item { text-align: center; padding: 32px 20px; background: rgba(255,255,255,0.07); }
   .stat-num  { font-size: 2.6rem; font-weight: 900; color: #FFD700; line-height: 1; }
   .stat-unit { font-size: 1rem; font-weight: 700; color: rgba(255,255,255,0.85); }
   .stat-label { font-size: 0.78rem; letter-spacing: 0.2em; color: rgba(255,255,255,0.65); margin-top: 7px; }
   
   /* ══════════ 廟史 ══════════ */
   .history-layout {
     display: grid; grid-template-columns: 1fr 1fr;
     gap: 56px; align-items: center;
     max-width: 1000px; margin: 0 auto;
   }
   .history-year-big {
     font-size: 5rem; font-weight: 900;
     color: rgba(192,57,43,0.07); line-height: 1;
     margin-bottom: -14px; letter-spacing: 0.05em;
   }
   .history-heading { font-size: 2rem; font-weight: 900; color: var(--text-dark); letter-spacing: 0.08em; margin-bottom: 18px; }
   .history-heading span { color: var(--red); }
   .history-text p { font-size: 1rem; line-height: 2.2; color: var(--text-mid); margin-bottom: 14px; }
   .tl-item { display: flex; gap: 18px; }
   .tl-line-col { display: flex; flex-direction: column; align-items: center; }
   .tl-dot {
     width: 11px; height: 11px; border-radius: 50%;
     background: var(--red); flex-shrink: 0; margin-top: 5px;
     border: 2px solid white; box-shadow: 0 0 0 2px var(--red);
   }
   .tl-stem { flex: 1; width: 2px; background: var(--border-red); margin: 3px 0; }
   .tl-item:last-child .tl-stem { display: none; }
   .tl-body { padding-bottom: 26px; }
   .tl-year  { font-size: 1rem; font-weight: 700; letter-spacing: 0.2em; color: var(--red); margin-bottom: 3px; }
   .tl-event { font-size: 1.1rem; color: var(--text-mid); line-height: 1.7; }
   
   /* ══════════ 交通資訊 ══════════ */
   .info-grid {
     display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
     gap: 24px; max-width: 1000px; margin: 0 auto;
   }
   .info-block {
     background: var(--warm-white); border: 1px solid var(--border);
     padding: 26px 22px; box-shadow: var(--shadow-sm);
   }
   .info-block-title {
     font-size: 1rem; font-weight: 700; letter-spacing: 0.2em; color: var(--red);
     margin-bottom: 16px; padding-bottom: 10px;
     border-bottom: 2px solid var(--red-bg);
     display: flex; align-items: center; gap: 8px;
   }
   .info-row { display: flex; gap: 12px; margin-bottom: 11px; font-size: 1rem; }
   .info-label { color: var(--text-light); width: 52px; flex-shrink: 0; font-size: 1rem; }
   .info-val   { color: var(--text-dark); line-height: 1.7; }
   
   /* ══════════ FOOTER ══════════ */
   footer { background: #1E0E08; color: rgba(255,255,255,0.6); }
   .footer-main {
     display: grid; grid-template-columns: 1.5fr 1fr 1fr;
     gap: 44px; max-width: 1100px; margin: 0 auto;
     padding: 52px 40px 36px;
   }
   .footer-brand .brand-name { font-size: 1.8rem; font-weight: 900; color: white; letter-spacing: 0.15em; margin-bottom: 10px; }
   .footer-brand p { font-size: 1rem; line-height: 1.9; }
   .footer-col h4 {
     font-size: 0.84rem; font-weight: 700; letter-spacing: 0.2em; color: white;
     margin-bottom: 14px; padding-bottom: 8px;
     border-bottom: 1px solid rgba(255,255,255,0.12);
   }
   .footer-col a {
     display: block; font-size: 1rem; padding: 4px 0;
     color: rgba(255,255,255,0.52); transition: color 0.2s;
   }
   .footer-col a:hover { color: white; }
   .footer-bottom {
     border-top: 1px solid rgba(255,255,255,0.08); padding: 16px 40px;
     display: flex; justify-content: space-between; align-items: center;
     font-size: 1rem; color: rgba(255,255,255,0.3);
   }
   
   /* ══════════ Scroll Reveal ══════════ */
   .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
   .reveal.visible { opacity: 1; transform: none; }
   
   /* ══════════ Animations ══════════ */
   @keyframes fadeDown {
     from { opacity: 0; transform: translateY(-18px); }
     to   { opacity: 1; transform: translateY(0); }
   }
   
   /* ══════════ Responsive ══════════ */
   @media (max-width: 1200px), (max-width: 1366px) and (pointer: coarse) {
    #navbar > ul {
      display: none;
    }
  
    #menu-toggle {
      display: flex;
    }
  
    .nav-logo-block {
      min-width: 0;
      padding: 0 20px;
    }
  
    .nav-logo-main {
      font-size: 1.2rem;
    }
  
    #topbar {
      padding: 6px 24px;
      font-size: 0.9rem;
    }
  
    #hero {
      height: 520px;
    }
  
    .section {
      padding: 64px 28px;
    }
  
    .quick-item {
      padding: 24px 12px;
    }
  }
  
  @media (max-width: 900px) {
    .news-layout { grid-template-columns: 1fr; }
    .history-layout { grid-template-columns: 1fr; gap: 32px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-main { grid-template-columns: 1fr; padding: 36px 24px 24px; gap: 28px; }
  }
  
  @media (max-width: 768px) {
    .section { padding: 48px 20px; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    #topbar { display: none; }
  
    #hero {
      background-attachment: scroll;
      background-position: center 30%;
    }
  }
  
  @media (max-width: 480px) {
    .hero-title-cn { font-size: 2.8rem; }
    .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
  }
   
   .committee-img-wrapper {
     display: flex;
     justify-content: center;
     margin-top: 20px;
   }
   
   .committee-img-wrapper img {
     max-width: 80%;
     height: auto;
     border-radius: 8px;
   }

   