/* ==========================================================================
   layout.css — 全站骨架
   导航（毛玻璃吸附 + 阅读进度）/ 页脚 / 回到顶部 / Toast / 模态框
   ========================================================================== */

/* ---------- 导航：Apple 式极窄毛玻璃条 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled { border-bottom-color: var(--line-soft); }
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.nav__brand:hover { opacity: 1; }
.nav__mark {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--grad-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.nav__link {
  position: relative;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.2s var(--ease);
}
.nav__link:hover { color: var(--text); opacity: 1; }
.nav__link.is-active { color: var(--text); }
.nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--text);
}
.nav__tools { display: flex; align-items: center; gap: 2px; margin-left: 8px; }

/* 账号入口：未登录显示"注册"，已登录显示用户名（点击退出） */
.nav__account {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav__account:hover { color: var(--text); background: var(--fill-hover); opacity: 1; }
.nav__account-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.18);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
    transform 0.3s var(--ease-out);
}
.icon-btn:hover { background: var(--fill-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.88); }
.icon-btn svg { width: 17px; height: 17px; }
.nav__burger { display: none; }

/* 顶部阅读进度：细到几乎看不见，但滚动时一直在动 */
.nav__progress {
  position: absolute;
  left: 0; bottom: -1px;
  height: 1.5px;
  width: 0;
  background: var(--text);
  opacity: 0.55;
  transition: width 0.08s linear;
}

/* ---------- 页脚 ---------- */
.footer {
  padding: 60px 0 44px;
  background: var(--bg-alt);
  font-size: 12.5px;
  color: var(--text-secondary);
  border-top: 1px solid var(--line-soft);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 30px;
}
.footer h4 {
  margin: 0 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 10px; }
.footer a { color: var(--text-secondary); transition: color 0.2s var(--ease); }
.footer a:hover { color: var(--text); opacity: 1; }
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 90;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: var(--glass);
  color: var(--text);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.94);
  transition: all 0.4s var(--ease-out);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--text); color: var(--bg); }
.to-top svg { width: 16px; height: 16px; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(90vw, 440px);
  padding: 11px 18px;
  border-radius: var(--r-pill);
  background: rgba(29, 29, 31, 0.9);
  color: #f5f5f7;
  font-size: 13px;
  box-shadow: var(--sh-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  animation: toast-in 0.45s var(--ease-out);
}
.toast--ok::before { content: "✓"; color: var(--green); }
.toast--warn::before { content: "!"; color: var(--orange); }
.toast--info::before { content: "i"; color: var(--blue-light); }
.toast.is-leaving { animation: toast-out 0.3s var(--ease) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- 模态框 ---------- */
.modal {
  width: min(720px, 92vw);
  max-height: 86vh;
  padding: 0;
  border: none;
  border-radius: var(--r-xl);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--sh-3);
  overflow: hidden;
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.modal[open] { animation: modal-in 0.45s var(--ease-out); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal__hero {
  height: 190px;
  display: grid;
  place-items: center;
  font-size: 64px;
}
.modal__body { padding: 28px 32px 32px; overflow-y: auto; max-height: 58vh; }
.modal__body h3 { font-size: 26px; margin-bottom: 10px; }
.modal__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.modal__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background-color 0.2s var(--ease), transform 0.3s var(--ease-out);
}
.modal__close:hover { background: rgba(0, 0, 0, 0.58); transform: rotate(90deg); }
.modal__list { margin: 0; padding-left: 20px; color: var(--text-secondary); }
.modal__list li { margin-bottom: 9px; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .nav__burger { display: grid; }
  .nav__brand span:last-child { display: none; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 20px 24px;
    margin-left: 0;
    background: var(--glass);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--line-soft);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.32s var(--ease-out);
  }
  .nav__links.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav__link { padding: 14px 6px; font-size: 17px; }
  .nav__link.is-active::after { display: none; }
  .nav__tools { margin-left: 0; padding-top: 8px; }
  .footer__grid { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 520px) {
  .to-top { right: 14px; bottom: 14px; }
}
