/* ================================================================
   layout.css —— 顶部导航 / Hero / 面板布局 / 右侧固定导航 / 页脚
   ================================================================ */

/* ==================== 顶部导航 ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

/* 非首页 tab 时，导航变为实心底栏 */
body:not([data-tab="home"]) .navbar {
  background: var(--nav-solid);
  border-bottom-color: var(--border);
  backdrop-filter: blur(14px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: var(--nav-h);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
}

.logo svg {
  width: 24px;
  height: 24px;
  color: #8ab4ff;
}

.nav-menu {
  position: relative;
  display: flex;
  gap: 38px;
}

.nav-menu a {
  position: relative;
  padding: 6px 2px;
  font-size: 15px;
  color: var(--text-2);
  transition: color 0.2s;
}

.nav-menu a:hover {
  color: #fff;
}

.nav-menu a.active {
  color: #fff;
}

/* JS 驱动的滑动下划线指示器 */
.nav-indicator {
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--blue);
  transition: left 0.32s var(--ease), width 0.32s var(--ease);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 汉堡按钮 / 移动菜单：桌面端隐藏，≤720px 在响应式区启用 */
.nav-burger {
  display: none;
}

.nav-mobile {
  display: none;
}

/* ==================== 导航搜索（输入框从放大镜左侧展开） ==================== */
.nav-search {
  position: relative;
  z-index: 120;
  display: flex;
  align-items: center;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 0;
  height: 38px;
  padding: 0;
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--card);
  outline: none;
  transition: width 0.32s var(--ease), opacity 0.25s var(--ease),
    padding 0.32s var(--ease), margin 0.32s var(--ease), border-color 0.2s;
}

.nav-search.is-open .search-box input {
  width: 218px;
  margin-right: 8px;
  padding: 0 16px;
  opacity: 1;
  border-color: var(--border);
}

.search-box input::placeholder {
  color: var(--text-3);
}

.search-box input:focus {
  border-color: rgba(127, 160, 255, 0.6);
}

/* 去掉 webkit 搜索框自带的清除按钮默认样式抖动 */
.search-box input::-webkit-search-cancel-button {
  cursor: pointer;
}

/* 搜索结果下拉面板 */
.search-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 120;
  width: 312px;
  max-height: 360px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
  animation: tab-in 0.18s var(--ease) both;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  border-radius: 10px;
  color: var(--text);
  transition: background 0.15s;
}

.search-item:hover {
  background: var(--surface);
}

.search-item-type {
  flex: none;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--blue-light);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.search-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.search-item-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.search-item-text small {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 18px 12px;
  font-size: 12px;
  text-align: center;
  color: var(--text-3);
}

/* ==================== Hero 首屏（首页 tab） ==================== */
.hero {
  position: relative;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg-deep);
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      rgba(8, 13, 26, 0.94) 0%,
      rgba(8, 13, 26, 0.72) 38%,
      rgba(8, 13, 26, 0.25) 68%,
      rgba(8, 13, 26, 0.55) 100%),
    linear-gradient(0deg, rgba(8, 13, 26, 0.92) 0%, rgba(8, 13, 26, 0) 32%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 620px;
  padding: 60px 0 40px;
}

.hero-greeting {
  margin-bottom: 14px;
  font-size: 20px;
  color: var(--text-2);
}

.hero h1 {
  margin-bottom: 20px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.28;
  color: #fff;
}

.hero-desc {
  margin-bottom: 34px;
  font-size: 16px;
  line-height: 1.9;
  color: var(--text-2);
}

.hero-buttons {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
}

.hero-social {
  display: flex;
  gap: 14px;
}

.social-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.social-btn:hover {
  color: #fff;
  border-color: rgba(127, 160, 255, 0.5);
  transform: translateY(-2px);
}

.social-btn svg {
  width: 19px;
  height: 19px;
}

.hero-slogan {
  position: absolute;
  right: 64px;
  bottom: 56px;
  z-index: 2;
  font-family: "Brush Script MT", "Segoe Script", "STKaiti", cursive;
  font-size: 34px;
  font-style: italic;
  line-height: 1.3;
  text-align: right;
  color: #82aaff;
  opacity: 0.9;
  transform: rotate(-7deg);
  text-shadow: 0 0 26px rgba(96, 138, 255, 0.55);
}

/* ==================== Tab 内容面板 ==================== */
main {
  padding: 0;
}

main .tabpage {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 56px) 0 80px;
}

/* ==================== 右侧固定导航 ==================== */
.side-nav {
  position: fixed;
  right: 26px;
  top: 50%;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 999px;
  background: var(--side-bg);
  border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
  transform: translateY(-50%);
}

.side-nav button {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-2);
  transition: color 0.2s, background 0.25s, transform 0.2s;
}

.side-nav button svg {
  width: 19px;
  height: 19px;
}

.side-nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(-2px);
}

.side-nav button.is-active {
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 6px 16px rgba(77, 109, 255, 0.4);
}

/* hover 时左侧浮出文字标签 */
.side-nav button::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text);
  background: var(--tooltip-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(6px);
  transition: opacity 0.2s, transform 0.2s;
}

.side-nav button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ==================== 返回盒子（详情页滚动后显示，位于侧边导航下方） ==================== */
.back-nav {
  position: fixed;
  right: 26px;
  /* 侧边导航（6 个按钮）半高 ≈ 134px，再加 24px 间距 */
  top: calc(50% + 158px);
  z-index: 90;
  display: flex;
  padding: 8px;
  border-radius: 999px;
  background: var(--side-bg);
  border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
  /* 默认隐藏 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.back-nav.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 按钮 —— 与 .side-nav button 同款 */
.back-nav button {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s, background 0.25s, transform 0.2s;
}

.back-nav button svg {
  width: 19px;
  height: 19px;
}

.back-nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(-2px);
}

/* hover 时左侧浮出文字标签（与侧边导航一致） */
.back-nav button::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text);
  background: var(--tooltip-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(6px);
  transition: opacity 0.2s, transform 0.2s;
}

.back-nav button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ==================== 页脚 ==================== */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0;
  font-size: 13px;
  color: var(--text-3);
}

.footer .logo {
  font-size: 16px;
}

.footer-tag {
  margin-left: 18px;
}

.footer-left {
  display: flex;
  align-items: center;
}

.footer-nav {
  display: flex;
  gap: 26px;
}

.footer-nav a {
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: #fff;
}

/* ==================== 响应式 ==================== */

/* ---- 平板（竖屏 iPad 等） ---- */
@media (max-width: 1024px) {
  .nav-inner {
    gap: 20px;
  }

  .nav-menu {
    gap: 24px;
  }

  .side-nav {
    right: 14px;
  }

  .back-nav {
    right: 14px;
  }

  /* Hero 在平板宽度下适度缩放，避免标题/标语拥挤 */
  .hero-inner {
    max-width: 560px;
    padding: 48px 0 36px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero-slogan {
    right: 36px;
    bottom: 40px;
    font-size: 28px;
  }
}

/* ---- 手机 ---- */
@media (max-width: 720px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .nav-inner {
    gap: 12px;
  }

  .section-head {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
  }

  /* 手机端"查看全部"按钮加大触控区域 */
  .section-more {
    padding: 6px 0;
    font-size: 14px;
  }

  .nav-menu {
    display: none;
  }

  .nav-actions {
    gap: 10px;
  }

  /* 汉堡按钮出现 */
  .nav-burger {
    display: grid;
    place-items: center;
  }

  /* 汉堡打开时：三条线变 X */
  .nav-burger.is-open svg path:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
  }

  .nav-burger.is-open svg path:nth-child(2) {
    opacity: 0;
  }

  .nav-burger.is-open svg path:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
  }

  .nav-burger svg path {
    transition: transform 0.25s var(--ease), opacity 0.2s;
    transform-origin: center;
  }

  /* 移动端下拉菜单面板 */
  .nav-mobile {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    background: var(--nav-solid);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }

  .nav-mobile.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav-mobile a {
    padding: 13px 14px;
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-2);
  }

  .nav-mobile a.active,
  .nav-mobile a:hover {
    color: #fff;
    background: var(--surface);
  }

  /* 搜索在手机上：放大镜点开后变成置顶整行搜索条 */
  .nav-search.is-open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: var(--nav-solid);
    backdrop-filter: blur(14px);
  }

  .nav-search.is-open .search-box {
    flex: 1;
    min-width: 0;
  }

  .nav-search.is-open .search-box input {
    width: 100%;
    margin-right: 0;
  }

  /* 移动端不展示搜索结果下拉（历史记录），输入后回车直达首个结果 */
  .search-panel {
    display: none !important;
  }

  /* Hero */
  .hero-inner {
    padding: 36px 0 28px;
  }

  .hero-greeting {
    font-size: 17px;
  }

  .hero h1 {
    font-size: 31px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .hero-buttons {
    flex-wrap: wrap;
  }

  .hero-slogan {
    display: none;
  }

  /* 内容面板上下留白收紧 */
  main .tabpage {
    padding: calc(var(--nav-h) + 28px) 0 56px;
  }

  /* 手机端隐藏右侧悬浮导航，由汉堡菜单替代，释放屏幕空间 */
  .side-nav {
    display: none;
  }

  .back-nav {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-left {
    flex-direction: column;
    gap: 8px;
  }

  .footer-tag {
    margin-left: 0;
  }
}

/* ---- 小屏手机（≤480px） ---- */
@media (max-width: 480px) {
  .nav-actions {
    gap: 8px;
  }

  .nav-actions .btn-sm {
    padding: 8px 14px;
    font-size: 13px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .hero-desc {
    font-size: 14px;
  }

  /* 两个主按钮整行堆叠，不再挤压 */
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .social-btn {
    width: 40px;
    height: 40px;
  }
}