/* ============================================================
   张家界非遗网 — 公共样式 common.css
   所有页面共享：变量、reset、topbar、header、nav、footer、
   mobile-menu、back-to-top、响应式
   ============================================================ */

:root {
  --primary: #8b3a10;
  --primary-light: #b5521a;
  --primary-bg: #fdf6f0;
  --accent: #c9871f;
  --accent-light: #f0c060;
  --text-main: #1a1209;
  --text-sub: #5a4a3a;
  --text-muted: #9a8878;
  --border: rgba(139,58,16,0.12);
  --border-mid: rgba(139,58,16,0.22);
  --white: #ffffff;
  --bg-light: #faf5ef;
  --bg-section: #f5ede3;
  --tag-red: #c1392b;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 4px rgba(80,30,0,0.08);
  --shadow-md: 0 4px 16px rgba(80,30,0,0.10);
  --shadow-lg: 0 8px 32px rgba(80,30,0,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--text-main);
  background: var(--white);
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ======== TOP BAR ======== */
.topbar {
  background: var(--primary);
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  padding: 0 0;
}
.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar a {
  color: rgba(255,255,255,0.75);
  margin-left: 16px;
  font-size: 12px;
  transition: color .2s;
}
.topbar a:hover { color: var(--accent-light); }
.topbar-sites { display: flex; align-items: center; gap: 4px; }
.topbar-sites a {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  padding: 2px 8px;
  margin-left: 0;
  font-size: 11px;
  transition: background .2s;
}
.topbar-sites a:hover { background: rgba(255,255,255,0.22); }

/* ======== HEADER ======== */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.logo-icon {
  width: 40px;
  height: 42px;
  border-radius: var(--radius-md);
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.logo-text { line-height: 1.2; }
.logo-text strong { font-size: 18px; font-weight: 700; color: var(--primary); display: block; }
.logo-text span { font-size: 11px; color: var(--text-muted); }

/* NAV */
.nav { flex: 1; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-item { position: relative; }
.nav-item > a {
  display: block;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav-item > a:hover,
.nav-item.active > a {
  color: var(--primary);
  background: var(--primary-bg);
}
.nav-item.active > a { font-weight: 500; }

/* dropdown */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 120px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 200;
}
.nav-item:hover .nav-dropdown { display: block; }
.nav-dropdown a {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-dropdown a:hover { background: var(--primary-bg); color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-search {
  width: 34px;
  height: 34px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: border-color .2s, color .2s;
  font-size: 16px;
}
.btn-search:hover { border-color: var(--primary); color: var(--primary); }
.btn-clue {
  padding: 7px 16px;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background .2s;
  white-space: nowrap;
}
.btn-clue:hover { background: var(--primary-light); }

/* ======== FOOTER ======== */
.footer {
  background: #2a1005;
  color: rgba(255,255,255,0.65);
  padding: 48px 24px 24px;
}
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
}
.footer-top {
  display: grid;
  grid-template-columns: 220px repeat(4, 1fr);
  gap: 28px;
  padding-bottom: 32px;
  border-bottom: 0.5px solid rgba(255,255,255,0.1);
  margin-bottom: 24px;
}
.footer-brand .logo-text strong { color: var(--accent-light); font-size: 16px; }
.footer-brand .logo-text span { color: rgba(255,255,255,0.4); }
.footer-brand p { font-size: 13px; margin-top: 12px; line-height: 1.8; color: rgba(255,255,255,0.5); }
.footer-col h4 {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-bottom: 14px;
}
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  transition: color .18s;
}
.footer-col ul li a:hover { color: var(--accent-light); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}
.footer-bottom a { color: rgba(255,255,255,0.45); }
.footer-bottom a:hover { color: var(--accent-light); }

/* ======== MOBILE MENU OVERLAY ======== */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 98;
  backdrop-filter: blur(2px);
}
.nav-overlay.active { display: block; }

/* ======== MOBILE MENU BUTTON ======== */
.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  transition: border-color .2s;
}
.mobile-menu-btn:hover { border-color: var(--primary); }
.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-sub);
  border-radius: 1px;
  transition: transform .25s, opacity .25s;
}
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile nav panel */
.nav-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--white);
  z-index: 200;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}
.nav-panel.open { transform: translateX(0); }
.nav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 0.5px solid var(--border);
  background: var(--primary);
  color: var(--white);
}
.nav-panel-title { font-size: 15px; font-weight: 500; }
.nav-panel-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  color: var(--white);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.nav-panel-close:hover { background: rgba(255,255,255,0.25); }
.nav-panel-section {
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
}
.nav-panel-section:last-child { border-bottom: none; }
.nav-panel-section-title {
  padding: 6px 16px 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nav-panel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-sub);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-panel-item:hover { background: var(--primary-bg); color: var(--primary); }
.nav-panel-item.primary { color: var(--primary); font-weight: 500; background: var(--primary-bg); }
.nav-panel-arrow { font-size: 12px; color: var(--text-muted); transition: transform .2s; }
.nav-panel-item.expanded .nav-panel-arrow { transform: rotate(90deg); }

.nav-panel-sub {
  display: none;
  background: var(--bg-light);
  padding: 4px 0;
}
.nav-panel-item.expanded + .nav-panel-sub { display: block; }
.nav-panel-sub-item {
  padding: 10px 16px 10px 28px;
  font-size: 14px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .15s, color .15s;
}
.nav-panel-sub-item:hover { background: var(--primary-bg); color: var(--primary); }
.nav-panel-sub-item::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.nav-panel-footer {
  padding: 16px;
  background: var(--bg-light);
  border-top: 0.5px solid var(--border);
}
.nav-panel-footer-btns { display: flex; gap: 8px; }
.nav-panel-footer-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}
.nav-panel-footer-btn.primary {
  background: var(--primary);
  color: var(--white);
}
.nav-panel-footer-btn.secondary {
  background: var(--accent);
  color: var(--white);
}

/* ======== BACK TO TOP BUTTON ======== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(139, 58, 16, 0.35);
  z-index: 90;
  font-size: 18px;
  transition: opacity .3s, transform .3s, background .2s;
  opacity: 0;
  transform: translateY(12px);
}
.back-to-top.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover { background: var(--primary-light); }
.back-to-top:active { transform: scale(0.92); }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .back-to-top {
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
  }
  .footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .nav-panel { padding-bottom: env(safe-area-inset-bottom); }
}

body.menu-open { overflow: hidden; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .topbar .topbar-info { display: none; }
  .topbar-inner { justify-content: flex-end; }

  .header-inner { gap: 16px; padding: 0 16px; }
  .header-actions .btn-clue { display: none; }
  .nav-list { display: none; }

  .footer-top { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 8px; }

  .mobile-menu-btn { display: flex; }
  .nav-panel { display: block; }
}

@media (max-width: 480px) {
  .topbar { font-size: 11px; }
  .topbar-inner { padding: 5px 12px; }

  .logo-text strong { font-size: 15px; }
  .logo-text span { display: none; }
  .logo-icon { width: 34px; height: 36px; }

  .footer { padding: 32px 14px 16px; }
  .footer-top { grid-template-columns: 1fr; gap: 20px; }
  .footer-col h4 { font-size: 13px; margin-bottom: 10px; }
  .footer-col ul li { margin-bottom: 6px; }
  .footer-col ul li a { font-size: 12px; }
  .footer-bottom { font-size: 11px; }
}
