/* ============================================================
   厚朴之隅 / HopeNook — 样式
   导航栏与页脚是覆盖在画布之上的半透明层；除可交互控件外，
   覆盖层对指针事件透明，鼠标/触摸可穿透到画布上。
   ============================================================ */

:root {
  --bar-bg: rgba(10, 18, 30, 0.30);
  --bar-bg-night: rgba(6, 10, 22, 0.42);
  --bar-blur: 12px;
  --text: #f4f8ff;
  --text-soft: rgba(244, 248, 255, 0.82);
  --accent: #ffd368;
  --nav-h: 60px;
  --footer-h: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a2336;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 画布铺满视口 */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* 让触屏手势交给画布处理，避免页面滚动 */
}

/* 覆盖层：自身不捕获指针，仅其内部控件捕获 */
.overlay-bar {
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none; /* 空白处穿透到画布 */
  z-index: 50;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(var(--bar-blur)) saturate(1.1);
  backdrop-filter: blur(var(--bar-blur)) saturate(1.1);
  transition: background 1.2s ease;
}
.overlay-bar.is-night { background: var(--bar-bg-night); }

#nav {
  top: 0;
  height: var(--nav-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#footer {
  bottom: 0;
  height: var(--footer-h);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(14px, 4vw, 32px);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
#footer a {
  color: var(--text-soft);
  text-decoration: none;
  pointer-events: auto;
  transition: color 0.2s;
}
#footer a:hover { color: var(--accent); }
.footer-right { color: var(--text-soft); }

/* 导航栏内部布局 */
.nav-inner {
  height: 100%;
  padding: 0 clamp(14px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  pointer-events: auto;
  white-space: nowrap;
}
.logo {
  width: 30px;
  height: 30px;
  flex: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}
.site-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #fff, #ffe6a8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 导航菜单 */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
  border-radius: 10px;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover, .nav-link:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}

/* 关注&联系 下拉 */
.dropdown { position: relative; pointer-events: auto; }
.dropdown-menu {
  pointer-events: auto;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: rgba(12, 22, 38, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
/* 透明的悬停“桥”：填补触发器与菜单之间的间隙，保证悬停不断开 */
.dropdown-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}
.dropdown.open .dropdown-menu,
.dropdown-trigger:focus ~ .dropdown-menu,
.dropdown-menu:focus-within {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  pointer-events: auto;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.dropdown-item:hover, .dropdown-item:focus-visible {
  background: rgba(255, 210, 110, 0.14);
  color: #fff;
}
.dropdown-chevron {
  margin-left: 6px;
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.22s;
}
.dropdown.open .dropdown-chevron { transform: rotate(180deg); }

/* 右侧切换按钮 */
.nav-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.26); }
.icon-btn:active { transform: translateY(1px); }
#themeToggle { font-size: 16px; padding: 0 10px; }

/* 汉堡按钮（移动端） */
.nav-toggle {
  display: none;
  pointer-events: auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ====== 弹窗 ====== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  position: relative;
  pointer-events: auto;
  width: min(320px, 86vw);
  background: rgba(16, 26, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal.open .modal-card { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.modal-title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.qr-img {
  width: 220px;
  height: 220px;
  max-width: 100%;
  object-fit: cover;
  border-radius: 14px;
  background: #fff;
  padding: 6px;
}
.email-display {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.email-display a { color: var(--accent); text-decoration: none; }
.copy-btn {
  pointer-events: auto;
  padding: 10px 22px;
  border: 1px solid rgba(255, 210, 110, 0.4);
  border-radius: 12px;
  background: rgba(255, 210, 110, 0.12);
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.copy-btn:hover { background: rgba(255, 210, 110, 0.22); }
.copy-btn:active { transform: translateY(1px); }
.copy-btn.copied { background: rgba(120, 200, 140, 0.2); color: #9fe6b4; border-color: rgba(120, 200, 140, 0.4); }

/* ====== 响应式：移动端 ====== */
@media (max-width: 768px) {
  :root { --nav-h: 54px; --footer-h: 40px; }

  .nav-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px clamp(14px, 4vw, 32px) 16px;
    background: rgba(8, 16, 28, 0.86);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(-130%);
    transition: transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    visibility: hidden;
  }
  #navMenu.open {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
  }
  .nav-link { width: 100%; justify-content: flex-start; }

  /* 移动端下拉：内联展开而非悬浮 */
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.18);
    border: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 8px;
    transition: max-height 0.28s ease, padding 0.28s ease;
  }
  .dropdown.open .dropdown-menu { max-height: 200px; padding: 8px; }
  .dropdown-menu::before { display: none; } /* 移动端无需悬停桥 */

  #footer { font-size: 11px; padding: 0 12px; gap: 8px; }
  .site-name { font-size: 15px; }
}

@media (max-width: 380px) {
  .site-name { display: none; }
}

/* 尊重“减少动画”偏好 */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
