/* ===================================================================
   台東縣義勇消防總隊 全球資訊網 — 共用樣式表
   =================================================================== */

:root {
  /* 台東藍（取自 2026 台東博覽會識別色）為主色，融合消防火焰橙紅與鳳凰金 */
  --navy: #003a94;       /* 台東藍 */
  --navy-dark: #001c49;  /* 深台東藍 */
  --sky: #3f6fb5;        /* 中藍，輔助點綴 */
  --sky-light: #7fa8d9;  /* 淺藍，卡片/標籤點綴 */
  --red: #e2531d;        /* 火鳳凰橙紅（消防火焰意象） */
  --red-dark: #a8330f;   /* 深橙紅 */
  --gold: #eab308;       /* 鳳凰金／艷陽黃 */
  --bg: #eef3fa;         /* 台東藍調淺色背景 */
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #64748b;
  --border: #dbe6f4;
  --shadow: 0 2px 10px rgba(0, 43, 105, 0.1);
  --shadow-lg: 0 8px 28px rgba(0, 43, 105, 0.16);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

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

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

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}
.container-wide {
  max-width: 1400px;
}

/* ---------- Top bar ---------- */
.topbar {
  background: var(--navy-dark);
  color: #cbd5e1;
  font-size: 0.8rem;
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  padding-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- Header / Nav ---------- */
header.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand .emblem {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}
.brand .emblem img { width: 100%; height: 100%; display: block; }
.brand-text h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-text span {
  font-size: 0.72rem;
  color: #bcd0f5;
  letter-spacing: 1px;
}

nav.main-nav ul {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}
nav.main-nav a {
  display: block;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.2s ease;
}
nav.main-nav a:hover,
nav.main-nav a.active {
  background: rgba(255, 255, 255, 0.16);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

/* 導覽有五個項目，寬度不足時改為選單，避免文字擠出畫面 */
@media (max-width: 1080px) {
  .menu-toggle { display: block; }
  nav.main-nav {
    display: none;
    width: 100%;
  }
  nav.main-nav.open { display: block; }
  nav.main-nav ul {
    flex-direction: column;
    padding: 10px 0 18px;
  }
  .nav-wrap { flex-wrap: wrap; }
}

/* ---------- Hazard stripe (warning tape) divider ---------- */
.hazard-strip {
  height: 10px;
  background: repeating-linear-gradient(
    135deg,
    var(--gold) 0 22px,
    var(--navy-dark) 22px 44px
  );
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(30,58,138,0.92), rgba(127,29,29,0.85)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0 12px, transparent 12px 24px);
  color: #fff;
  padding: 68px 0 92px;
  text-align: center;
}
.hero .emblem-watermark {
  position: absolute;
  top: 50%;
  right: -60px;
  transform: translateY(-50%);
  width: 380px;
  height: 380px;
  opacity: 0.08;
  pointer-events: none;
}
.hero .emblem-watermark.left {
  right: auto;
  left: -60px;
  display: none;
}
@media (min-width: 1100px) {
  .hero .emblem-watermark.left { display: block; }
}
.hero-waves {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.hero-waves svg { width: 100%; height: 100%; }

.hero-flame-edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: 46px;
  line-height: 0;
}
.hero-flame-edge svg { width: 100%; height: 100%; display: block; }
.hero > .container { position: relative; z-index: 2; }
.hero h2 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  margin: 0 0 14px;
  font-weight: 800;
}
.hero p {
  max-width: 680px;
  margin: 0 auto;
  color: #e2e8f0;
  font-size: 1.02rem;
}
.hero .hero-badges {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hero .badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
}

/* ---------- Page header (non-home pages) ---------- */
.page-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--navy), var(--red-dark));
  color: #fff;
  padding: 46px 0 60px;
  text-align: center;
}
.page-header h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 3.4vw, 2rem); }
.page-header p { margin: 0; color: #dbe4fb; }
.page-header .emblem-watermark {
  position: absolute;
  top: 50%;
  right: -40px;
  transform: translateY(-50%);
  width: 220px;
  height: 220px;
  opacity: 0.1;
  pointer-events: none;
}
.page-header > .container { position: relative; z-index: 2; }

/* ---------- Section shell ---------- */
section.block { padding: 56px 0; }
section.block.alt { background: #eef1f8; }
.section-head {
  text-align: center;
  margin-bottom: 36px;
}
.section-head .kicker {
  color: var(--red);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 0.8rem;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.section-head .kicker::before,
.section-head .kicker::after {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--gold);
  display: inline-block;
}
.section-head h3 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin: 6px 0 10px;
  color: var(--navy-dark);
}
.section-head p { color: var(--text-muted); max-width: 640px; margin: 0 auto; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin-top: -46px;
  position: relative;
  z-index: 2;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px 14px;
  text-align: center;
}
.stat-card .num { font-size: 1.7rem; font-weight: 800; color: var(--navy); }
.stat-card .lbl { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Cards / grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  border: 1px solid var(--border);
}
.card h4 {
  margin-top: 0;
  color: var(--navy-dark);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Timeline (沿革) ---------- */
.timeline {
  border-left: 3px solid var(--navy);
  margin-left: 10px;
  padding-left: 26px;
}
.timeline .t-item { position: relative; padding-bottom: 26px; }
.timeline .t-item:last-child { padding-bottom: 0; }
.timeline .t-item::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--navy);
}
.timeline .t-year { font-weight: 800; color: var(--red); font-size: 0.95rem; }
.timeline .t-desc { color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Org chart ---------- */
.org-chart { text-align: center; }
.org-level { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.org-box {
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.org-box.top { background: var(--red-dark); font-size: 1rem; }
.org-box.sub { background: #dbe4fb; color: var(--navy-dark); font-weight: 600; }
.org-connector { color: var(--border); font-size: 1.2rem; }

/* ---------- Unit grid (組織架構 分隊清單) ---------- */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 40px;
}
.unit-grid .card h4 { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.unit-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--navy-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Table ---------- */
table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.simple th, table.simple td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
table.simple th { background: #eef1f8; color: var(--navy-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline { background: transparent; border: 2px solid #fff; color: #fff; }
.btn-ghost { background: var(--navy); color: #fff; }
.btn-ghost:hover { background: var(--navy-dark); }

/* ---------- Tags / status ---------- */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.tag.upcoming { background: #fef3c7; color: #92400e; }
.tag.done { background: #dcfce7; color: #166534; }
.tag.ongoing { background: #dbeafe; color: #1e40af; }

/* ---------- Plan / activity list items ---------- */
.plan-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 5px solid var(--navy);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.plan-item .plan-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.plan-item h4 { margin: 0; color: var(--navy-dark); font-size: 1.02rem; }
.plan-item .plan-date { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.plan-item p { margin: 6px 0 0; color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Gallery (activity albums) ---------- */
.album {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  overflow: hidden;
}
.album-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  cursor: pointer;
  gap: 12px;
  flex-wrap: wrap;
}
.album-head:hover { background: #f4f6fb; }
.album-title { display: flex; flex-direction: column; gap: 4px; }
.album-title h4 { margin: 0; color: var(--navy-dark); font-size: 1.05rem; }
.album-title .album-date { font-size: 0.8rem; color: var(--text-muted); }
.album-toggle {
  font-size: 1.3rem;
  color: var(--navy);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.album.open .album-toggle { transform: rotate(180deg); }
.album-desc {
  padding: 0 22px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.album-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  border-top: 1px solid var(--border);
}
.album.open .album-body { max-height: 900px; }
.album-frame-wrap { padding: 16px 22px 22px; }
.album-frame-wrap iframe {
  width: 100%;
  height: 800px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
@media (max-width: 760px) {
  .album.open .album-body { max-height: 700px; }
  .album-frame-wrap iframe { height: 600px; }
}
.album-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--navy);
  font-weight: 700;
}
.album-placeholder {
  padding: 30px 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  background: #f9fafb;
  border-radius: 8px;
  margin: 16px 22px 22px;
}

/* ---------- Footer ---------- */
footer.site-footer {
  background: var(--navy-dark);
  color: #cbd5e1;
  padding: 40px 0 22px;
  margin-top: 40px;
}
footer.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 24px;
}
footer.site-footer h5 {
  color: #fff;
  margin: 0 0 12px;
  font-size: 0.95rem;
}
footer.site-footer p, footer.site-footer li { font-size: 0.85rem; color: #94a3b8; }
footer.site-footer ul { list-style: none; padding: 0; margin: 0; }
footer.site-footer li { margin-bottom: 6px; }
footer.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
}
@media (max-width: 760px) {
  footer.site-footer .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Empty state ---------- */
.empty-note {
  background: #fff7ed;
  border: 1px dashed #fbbf24;
  color: #92400e;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* ---------- Calendar (重要活動行事曆) ---------- */
.calendar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin: -6px 0 18px;
}
.calendar-feed-link {
  color: var(--navy);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.calendar-feed-link:hover { color: var(--red); }
.calendar-footnote {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.calendar-frame-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calendar-frame-wrap iframe {
  width: 100%;
  height: 760px;
  border: 0;
  display: block;
  background: #fff;
}
#brigade-calendar-upcoming:not([src]) { display: none; height: 0; }
.calendar-frame-wrap.is-agenda iframe,
.calendar-frame-wrap-agenda iframe {
  height: 640px;
}
.calendar-upcoming {
  margin-bottom: 42px;
}
.calendar-upcoming .section-head { margin-bottom: 22px; }
@media (max-width: 900px) {
  .calendar-frame-wrap iframe,
  .calendar-frame-wrap.is-agenda iframe {
    height: min(78vh, 720px);
    min-height: 560px;
  }
  .calendar-frame-wrap-agenda iframe {
    height: 640px;
    min-height: 0;
  }
}
@media (max-width: 560px) {
  .calendar-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .calendar-actions .btn { text-align: center; }
}
