/* ══════════════════════════════════════════════════════════
   css/topbar.css — 全站共用 topbar／手機抽屜／語言選單／
   捲動進度條／回頂按鈕／footer 樣式

   引用頁面：about / join / template / reports / notable /
   changelog / dyfi。只收「這 7 頁逐條完全相同」的規則；
   頁面專屬的（.reveal 動畫、prefers-reduced-motion、目前頁標示
   nav-active、drawer-active、.page-body）仍留在各頁自己的 <style>。
   依賴各頁 :root 的 --glass / --glass-border / --max-width /
   --red / --muted，:root 不要搬進來。
   index.html、policy.html（結構不同）與 typhoon.html（用自己的
   css/site-chrome.css）沒有引用這份檔案，改 topbar 時要另外同步。
══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════
   TOP BAR
   ⚠️ 注意：.more .submenu 必須 position:fixed
   ⚠️ 注意：頁面主體需 padding-top:72px
══════════════════════════════════════════ */
header.topbar {
  position: fixed; left: 0; right: 0; top: 0; height: 72px;
  backdrop-filter: blur(8px) saturate(1.05);
  background: linear-gradient(180deg, rgba(8,9,10,0.6), rgba(8,9,10,0.2));
  border-bottom: 1px solid rgba(255,255,255,0.03);
  z-index: 4000; display: flex; align-items: center;
  transition: background .28s ease, box-shadow .28s ease;
}

.top-inner {
  display: flex; align-items: center; gap: 18px;
  width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 20px;
}

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

.brand img { width: 44px; height: 44px; object-fit: contain; }

.brand .title { font-weight: 700; font-size: 15px; color: #fff; }

.brand .sub   { font-size: 12px; color: var(--muted); }

nav.primary { display: flex; gap: 18px; margin-left: 24px; align-items: center; }

nav.primary a {
  padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,0.88); font-weight: 600; transition: all .25s;
}

nav.primary a:hover { color: #fff; transform: translateY(-3px); }

.more { position: relative; }

.more .submenu {
  position: fixed;
  padding: 8px; border-radius: 10px;
  border: 1px solid var(--glass-border);
  visibility: hidden; opacity: 0; transform: translateY(6px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
  min-width: 220px; z-index: 5000;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  background: linear-gradient(180deg, rgba(8,9,10,0.30), rgba(8,9,10,0.14));
  box-shadow: 0 10px 40px rgba(2,6,23,0.5);
}

.more.open .submenu,
.more:hover .submenu,
.more:focus-within .submenu { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }

.more .submenu a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.95); font-weight: 600; white-space: nowrap;
  transition: background .12s, color .12s;
}

.more .submenu a:hover { background: rgba(255,255,255,0.07); color: #fff; }

.spacer { flex: 1; }

.discord-btn {
  background: linear-gradient(180deg,#78b9ff,#5fa8ff); color: #08131f;
  padding: 10px 14px; border-radius: 11px; font-weight: 700;
  border: 1px solid #5fa8ff; box-shadow: 0 6px 20px rgba(95,168,255,0.06);
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease;
}

.discord-btn:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(95,168,255,0.12); }

.lang-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid var(--glass-border);
  cursor: pointer; overflow: hidden; position: relative;
  z-index: 4100; color: rgba(255,255,255,0.88);
}

.topbar-scrolled {
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  background: linear-gradient(180deg, rgba(7,8,9,0.8), rgba(7,8,9,0.4));
  box-shadow: 0 6px 30px rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════════
   MOBILE TOPBAR
══════════════════════════════════════════ */
.hamburger-btn {
  display: none;
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent; transition: background .18s;
}

.hamburger-btn:active { background: rgba(255,255,255,0.12); }

.mobile-drawer { display: none; position: fixed; inset: 0; z-index: 9000; pointer-events: none; }

.mobile-drawer.open { pointer-events: auto; }

.drawer-shade {
  position: absolute; inset: 0; background: rgba(0,0,0,0.65);
  opacity: 0; transition: opacity .32s ease; -webkit-tap-highlight-color: transparent;
}

.mobile-drawer.open .drawer-shade { opacity: 1; }

.drawer-panel {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: min(320px, 85vw); background: #0d0e10;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .32s cubic-bezier(.2,.9,.2,1);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.mobile-drawer.open .drawer-panel { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); flex-shrink: 0;
}

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

.drawer-brand img { width: 32px; height: 32px; object-fit: contain; }

.drawer-brand-text { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.8); line-height: 1.3; }

.drawer-brand-text small {
  display: block; font-family: 'DM Mono', monospace;
  font-size: 9px; color: rgba(255,255,255,.3); letter-spacing: .06em; font-weight: 400;
}

.drawer-close {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(255,255,255,.55);
  -webkit-tap-highlight-color: transparent; transition: background .15s;
}

.drawer-close:active { background: rgba(255,255,255,.10); }

.drawer-nav { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }

.drawer-link {
  display: flex; align-items: center; gap: 14px; padding: 13px 12px; border-radius: 12px;
  color: rgba(255,255,255,.72); font-weight: 600; font-size: 15px;
  text-decoration: none; border: 1px solid transparent; min-height: 52px;
  transition: background .15s, color .15s; -webkit-tap-highlight-color: transparent;
}

.drawer-link:active { background: rgba(255,255,255,.06); }

.drawer-link .dl-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
}

.drawer-link.highlight { background: rgba(192,57,43,0.10); border-color: rgba(192,57,43,0.22); color: #e87060; }

.drawer-link.highlight:active { background: rgba(192,57,43,0.20); }

.drawer-sep { height: 1px; background: rgba(255,255,255,0.05); margin: 6px 12px; }

.drawer-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
}

.drawer-lang-btn {
  padding: 8px 14px; border-radius: 100px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  font-family: 'DM Mono', monospace; font-size: 12px; color: rgba(255,255,255,.48);
  cursor: pointer; transition: background .15s, color .15s; -webkit-tap-highlight-color: transparent;
}

.drawer-lang-btn.active-lang {
  background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,.9);
}

/* ══════════════════════════════════════════
   LANGUAGE MENU（由 i18n.js 動態建立）
══════════════════════════════════════════ */
.lang-menu {
  position: fixed;
  background: linear-gradient(180deg, rgba(8,9,10,0.30), rgba(8,9,10,0.14));
  border: 1px solid var(--glass-border); border-radius: 10px; padding: 6px;
  display: flex; flex-direction: column; gap: 6px; min-width: 120px;
  box-shadow: 0 10px 40px rgba(2,6,23,0.5); z-index: 5000;
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
}

.lang-menu button {
  background: transparent; border: 0; padding: 8px 10px; text-align: left;
  color: rgba(255,255,255,0.92); font-weight: 600; border-radius: 8px; cursor: pointer;
}

.lang-menu button:hover { background: rgba(255,255,255,0.03); color: #fff; }

/* ══════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════ */
#progressBar {
  position: fixed; bottom: 0; left: 0; height: 3px; background: var(--red);
  width: 0%; z-index: 4500; transition: width .05s linear;
}

/* ══════════════════════════════════════════
   TO-TOP 按鈕
══════════════════════════════════════════ */
.to-top {
  position: fixed; left: 20px; bottom: 20px; width: 52px; height: 52px;
  border-radius: 12px; background: var(--glass); display: grid; place-items: center;
  border: 1px solid var(--glass-border);
  transform: translateY(12px); opacity: 0;
  transition: transform .3s, opacity .3s, background .35s ease, color .35s ease,
              border-color .35s ease, box-shadow .35s ease;
  cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 3500; color: #fff;
}

.to-top.show { transform: translateY(0); opacity: 1; }

.to-top.alt-contrast {
  background: rgba(255,255,255,0.94); color: #08131f;
  border-color: rgba(0,0,0,0.06); box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
footer {
  background: #08090a;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 0 20px;
}

.footer-inner { max-width: var(--max-width); margin: 0 auto; }

.footer-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 32px 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05); flex-wrap: wrap;
}

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

.footer-brand img { width: 36px; height: 36px; object-fit: contain; opacity: .85; }

.footer-brand-text { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.75); line-height: 1.3; }

.footer-brand-text small {
  display: block; font-family: 'DM Mono', monospace;
  font-size: 10px; font-weight: 400; color: rgba(255,255,255,.28); letter-spacing: .08em;
}

.footer-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.footer-pill {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03);
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .04em;
  color: rgba(255,255,255,.45); text-decoration: none; white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s;
}

.footer-pill:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); color: rgba(255,255,255,.85); }

.footer-pill.primary { background: rgba(192,57,43,.12); border-color: rgba(192,57,43,.3); color: #e87060; }

.footer-pill.primary:hover { background: rgba(192,57,43,.22); border-color: rgba(192,57,43,.5); color: #ff8a7a; }

.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 0; flex-wrap: wrap;
}

.footer-copy   { font-family: 'DM Mono', monospace; font-size: 11px; color: rgba(255,255,255,.50); letter-spacing: .04em; }

.footer-credit { font-family: 'DM Mono', monospace; font-size: 11px; color: rgba(255,255,255,.38); letter-spacing: .04em; }

/* ══════════════════════════════════════════
   MOBILE
══════════════════════════════════════════ */
/* 平板（≤1100px）改用漢堡選單：桌面選單英文版約需 1086px 才排得下（2026-09 實測），
   更窄時「首頁」「地震報告」等會被擠成兩行。topbar 高度維持 72px，各頁 .page-body 不用改。
   index.html、policy.html、css/site-chrome.css 有同樣一段，改數值要四處同步。 */
@media (max-width: 1100px) {
  .hamburger-btn { display: flex; }
  nav.primary    { display: none !important; }
  .discord-btn   { display: none !important; }
  .lang-btn      { display: none !important; }
  .mobile-drawer { display: block; }
}
@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  nav.primary    { display: none !important; }
  .discord-btn   { display: none !important; }
  .lang-btn      { display: none !important; }
  .mobile-drawer { display: block; }
  header.topbar  { height: 60px; }
  .top-inner     { padding: 0 14px; gap: 12px; }
  .brand img     { width: 36px; height: 36px; }
  .brand .title  { font-size: 14px; }
  .brand > div > div:last-child { display: none; }
  #progressBar { height: 2px; }
  .to-top { width: 44px; height: 44px; left: 12px; bottom: 12px; }
  nav.primary a:hover { transform: none; }
}

@media (max-width: 700px) {
  .footer-nav    { flex-direction: column; align-items: flex-start; gap: 20px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}
