/**
 * 全站顶栏（与首页同款：Logo + 搜索 + 主题/登录/头像）与 V5 页尾（.fj-footer）。
 * 顶栏固定在视口上缘，纵向滚动仅发生在 .fj-site-scroll 内，避免滚动条侵入顶栏。
 */
html {
  height: 100%;
}

/* 登录页等未引入 home-exact/post-exact 时仍需生效；与首页 .is-hidden 行为一致 */
.is-hidden {
  display: none !important;
}

body.fj-site-body {
  height: 100%;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 顶栏外壳：登录/注册页只引 chrome 时也要有与首页一致的高度、背景与底边（原仅在 home/post-exact 中定义） */
body.fj-site-body > .fj-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--fj-border-subtle);
}
[data-theme="light"] body.fj-site-body > .fj-header {
  background-color: var(--fj-bg-root);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* 与首页 home-exact 一致：顶栏/主区共用 .fj-container（登录页等未引 home-exact 时依赖此处） */
body.fj-site-body .fj-container {
  max-width: var(--fj-page-max-width, 1200px);
  margin: 0 auto;
  padding: 0 var(--fj-page-padding-x, 32px);
}

/* 前台主内容：与顶栏版心同一 1200px 盒模型，避免「个人中心 vs Hub 子页」感知宽度漂移 */
body.fj-site-body .fj-site-scroll > main.fj-container.fj-site-main {
  width: 100%;
  max-width: var(--fj-page-max-width, 1200px);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* 主内容 + 页尾同区滚动；滚动条不经过顶栏 */
body.fj-site-body > .fj-site-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  /* 顶栏与首屏主区之间留白，避免内容贴齐底边 */
  padding-top: 56px;
}

/* 主区高度跟内容走（勿 flex 拉伸），避免 grid/sticky 在滚动壳内被「假增高」撑乱；与尾栏的 64px 呼吸带用 padding-bottom 实现 */
body.fj-site-body .fj-site-scroll > .fj-site-main:not(.fj-auth-scene) {
  flex: none;
  min-width: 0;
  padding-bottom: var(--fj-footer-isolation-gap, 64px);
}

/* 登录页主区占满滚动壳剩余高度，便于 .fj-auth-scene 垂直居中 */
body.fj-site-body .fj-site-scroll > main.fj-auth-scene {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding-bottom: var(--fj-footer-isolation-gap, 64px);
}

body.fj-site-body .fj-site-scroll > .fj-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* 滚动壳从顶栏下缘开始，侧栏 sticky 的 top 相对滚动视口（不叠加 64px 顶栏） */
body.fj-site-body .fj-site-scroll .fj-nav-menu,
body.fj-site-body .fj-site-scroll .fj-sidebar-right,
body.fj-site-body .fj-site-scroll aside.fj-sidebar,
body.fj-site-body .fj-site-scroll .fj-identity-card,
body.fj-site-body .fj-site-scroll .fj-me-security-card,
body.fj-site-body .fj-site-scroll .fj-layout-dashboard > .fj-sidebar,
body.fj-site-body .fj-site-scroll main.fj-layout > aside:first-of-type,
body.fj-site-body .fj-site-scroll .fj-layout-hub aside.fj-hub-sidebar {
  top: 24px;
}

/* 顶栏内链接：去掉浏览器默认下划线（含 :link / :any-link，与首页游客入口观感一致） */
body.fj-site-body .fj-header a,
body.fj-site-body .fj-header a:link,
body.fj-site-body .fj-header a:any-link,
body.fj-site-body .fj-header a:hover,
body.fj-site-body .fj-header a:visited,
body.fj-site-body .fj-header a:active {
  text-decoration: none;
}

/* 等宽左右列 + 中间搜索：搜索相对视口区居中，不随各页 .fj-logo / 右侧块宽度漂移 */
body.fj-site-body .fj-header .fj-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px) minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  row-gap: 8px;
  min-width: 0;
  height: 100%;
}

body.fj-site-body .fj-header .fj-logo {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: var(--fj-text-primary);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
}

body.fj-site-body .fj-header .fj-logo-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 6px;
  border: none;
  background: url("/luntan/assets/logo-real.png") center / cover no-repeat;
}

body.fj-site-body .fj-header .fj-search-bar {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 400px;
  min-width: 0;
}
.fj-search-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  line-height: 1.25;
  padding: 8px 14px;
  padding-right: 76px;
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--fj-text-primary);
  font-size: 0.9rem;
  transition: all var(--fj-duration-normal) var(--fj-ease-out);
}
.fj-search-input:focus {
  border-color: var(--fj-orange-500);
  background-color: var(--fj-bg-surface);
  box-shadow: 0 0 0 2px var(--fj-orange-glow);
  outline: none;
}
.fj-search-input::placeholder {
  color: var(--fj-text-tertiary);
}
.fj-search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 6px;
  line-height: 1;
  font-size: 0.6875rem;
  font-family: var(--fj-font-tabular);
  color: var(--fj-text-tertiary);
  background: var(--fj-bg-root);
  border-radius: 4px;
  border: 1px solid var(--fj-border-subtle);
  pointer-events: none;
}
[data-theme="light"] .fj-search-shortcut {
  background: var(--fj-bg-surface);
  border-color: var(--fj-border-base);
}
[data-theme="light"] .fj-search-input {
  background-color: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

body.fj-site-body .fj-header .fj-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  flex-shrink: 0;
  justify-self: end;
  min-width: 0;
}
/* 提高优先级，避免 auth-gate 等页面 CSS 影响顶栏游客区；与首页观感一致 */
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: fit-content;
  white-space: nowrap;
  flex-wrap: nowrap;
}
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions .fj-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--fj-border-base);
  background: transparent;
  color: var(--fj-text-secondary);
  text-decoration: none !important;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  box-sizing: border-box;
  transition:
    color var(--fj-duration-fast) var(--fj-ease-out),
    background-color var(--fj-duration-fast) var(--fj-ease-out),
    border-color var(--fj-duration-fast) var(--fj-ease-out),
    transform var(--fj-duration-fast) var(--fj-ease-out);
}
[data-theme="light"] body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions .fj-nav-link {
  background: var(--fj-bg-surface);
  border-color: var(--fj-border-strong);
}
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions .fj-nav-link:hover {
  color: var(--fj-text-primary);
  background: var(--fj-bg-hover);
  border-color: var(--fj-border-hover);
}
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions .fj-nav-link:active {
  transform: scale(0.96);
}
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions a.fj-btn.fj-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin-bottom: 0;
  min-height: 36px;
  padding: 6px 16px;
  border-radius: 8px;
  text-decoration: none !important;
  line-height: 1.2;
  box-sizing: border-box;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--fj-orange-500);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px var(--fj-orange-glow);
  transition:
    transform var(--fj-duration-fast) var(--fj-ease-out),
    background var(--fj-duration-fast) var(--fj-ease-out);
}
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions a.fj-btn.fj-btn-primary:hover {
  background: var(--fj-orange-400);
}
body.fj-site-body .fj-header .fj-header-actions #guestHeaderActions a.fj-btn.fj-btn-primary:active {
  transform: scale(0.96);
}

.fj-nav-link {
  color: var(--fj-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--fj-duration-fast);
}
.fj-nav-link:hover {
  color: var(--fj-text-primary);
}
.fj-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform var(--fj-duration-fast) var(--fj-ease-out), background var(--fj-duration-fast) var(--fj-ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.fj-btn:active {
  transform: scale(0.96);
}
.fj-btn-primary {
  background: var(--fj-orange-500);
  color: #fff;
}
.fj-btn-primary:hover {
  background: var(--fj-orange-400);
}

.fj-theme-toggle {
  color: var(--fj-text-secondary);
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}
.fj-theme-toggle:hover {
  color: var(--fj-text-primary);
  background: var(--fj-bg-hover);
}

.fj-creator-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--fj-orange-500);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fj-text-primary);
  flex-shrink: 0;
}
#topAvatarLink {
  text-decoration: none;
  color: inherit;
}

/* =========================================
   V5.0 全局页尾（与 --fj-page-max-width / --fj-page-padding-x 对齐顶栏）
   节奏：正文结束 → 隔离 64px → 细线 → 内边距 32px → 尾栏内容 → 32px → 视口底
   ========================================= */
.fj-footer {
  border-top: 1px solid var(--fj-border-subtle);
  background: transparent;
  padding: var(--fj-footer-padding-y, 32px) 0;
  box-sizing: border-box;
}

.fj-footer-inner {
  box-sizing: border-box;
  max-width: var(--fj-page-max-width);
  margin: 0 auto;
  /* 与 body.fj-site-body .fj-header .fj-container 左右内边距同一令牌 */
  padding: 0 var(--fj-page-padding-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}

.fj-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fj-footer-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fj-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  line-height: 1.25;
}

.fj-footer-logo .fj-logo-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.fj-footer-slogan {
  font-size: 0.72rem;
  color: var(--fj-text-tertiary);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.fj-footer-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.fj-footer-link {
  font-size: 0.8rem;
  color: var(--fj-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--fj-duration-normal) var(--fj-ease-out);
}

.fj-footer-link:hover {
  color: var(--fj-text-primary);
}

.fj-footer-link:focus-visible {
  outline: 2px solid var(--fj-orange-500);
  outline-offset: 3px;
  border-radius: 4px;
}

.fj-footer-link.highlight {
  color: var(--fj-orange-500);
}

.fj-footer-link.highlight:hover {
  color: var(--fj-orange-400);
  text-shadow: 0 0 12px var(--fj-orange-glow);
}

.fj-footer-copy {
  font-size: 0.7rem;
  color: var(--fj-text-tertiary);
  font-family: var(--fj-font-tabular);
  line-height: 1.35;
  white-space: nowrap;
}

.fj-footer-copy-mono {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  .fj-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .fj-footer-nav {
    gap: 10px 20px;
  }

  .fj-footer-copy {
    white-space: normal;
  }
}

/* 顶栏语言切换（site-i18n.js 注入） */
.fj-global-locale-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}
.fj-global-locale-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid var(--fj-border-base);
  background: var(--fj-bg-surface);
  color: var(--fj-text-secondary);
  cursor: pointer;
  line-height: 1;
}
.fj-global-locale-btn:hover {
  border-color: var(--fj-orange-500);
  color: var(--fj-text-primary);
}
.fj-global-locale-btn[aria-pressed="true"] {
  color: var(--fj-orange-500);
  border-color: var(--fj-orange-500);
}

@media (max-width: 720px) {
  body.fj-site-body .fj-header .fj-header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
  }

  body.fj-site-body .fj-header .fj-search-bar {
    flex: 1 1 160px;
    min-width: 0;
    max-width: none;
    width: auto;
  }

  .fj-search-shortcut {
    display: none;
  }
}
