/*
 * Liquid Glass visual layer — 顶栏浮岛 + 搜索框（v1, 2026-10-25）
 * 参考图：星夜湖畔玻璃时钟主页（顶栏深玻璃 / 搜索框浅玻璃的双色体系）
 * 仅覆盖视觉，不改动 HTML 结构与业务逻辑；材质层全部用元素自身
 * 多层背景 + border/inset-shadow 实现（engine-dropdown 等会重建 innerHTML
 * 的容器不注入子元素）。
 * 加载顺序：在所有 home-*.css 之后。
 */

/* ────────────────────────────────────────────────────────────
   0) 滚动进度条：贴页面最顶端（原挂在顶栏底边）
   ──────────────────────────────────────────────────────────── */
html { scroll-padding-top: 0 !important; } /* 旧版为 44px 实心顶栏留的锚点补偿，浮岛模式下导致跳转差 44px */

.scroll-progress {
  position: fixed !important;
  top: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  width: 100% !important;
  height: 3px !important;
  z-index: 100 !important;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, #0071e3, #64d2ff) !important;
}

/* ────────────────────────────────────────────────────────────
   1) 顶栏容器：整条玻璃带 → 透明，三个子项各自成浮岛
   ──────────────────────────────────────────────────────────── */
.top-bar {
  height: 56px !important;
  gap: 18px !important;
  padding: 10px 22px 0 !important;
  background: transparent !important;
  border-bottom: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
[data-theme="dark"] .top-bar { background: transparent !important; }

/* 滚动态：旧样式会把整条顶栏换成近实心背景（被用户视为"遮罩"），
   改为保持透明，三个浮岛以自身玻璃悬浮 */
.page-scrolled .top-bar,
[data-theme="dark"].page-scrolled .top-bar {
  background: transparent !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

/* 浮岛通用材质：深色调玻璃 + 斜向受光 + 顶缘高光 */
.site-brand,
.site-links,
.top-actions {
  position: relative;
  border-radius: 999px !important;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, .04) 34%, transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 42%),
    rgba(16, 22, 38, .34) !important;
  border: 1px solid rgba(255, 255, 255, .16) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .34),
    inset 0 -1px 0 rgba(255, 255, 255, .05),
    0 2px 6px rgba(6, 10, 24, .22),
    0 14px 34px rgba(6, 10, 24, .28) !important;
  backdrop-filter: blur(22px) saturate(168%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(168%) !important;
}
[data-theme="light"] .site-brand,
[data-theme="light"] .site-links,
[data-theme="light"] .top-actions {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .18) 36%, transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0) 46%),
    rgba(255, 255, 255, .52) !important;
  border-color: rgba(255, 255, 255, .65) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .80),
    inset 0 -1px 0 rgba(16, 22, 38, .04),
    0 2px 6px rgba(30, 41, 66, .10),
    0 14px 34px rgba(30, 41, 66, .16) !important;
}

.site-brand { padding: 5px 16px 5px 8px !important; }
.top-actions {
  gap: 4px !important;
  padding: 4px 6px !important;
  /* grid 第三列是 1fr 整宽——收紧为贴合内容的胶囊，靠右悬浮（参考图形态） */
  width: fit-content !important;
  justify-self: end !important;
}

/* ────────────────────────────────────────────────────────────
   2) 分段导航：选中 = 亮玻璃底 + 蓝色下划线；未选中 = 透明
   ──────────────────────────────────────────────────────────── */
.site-links {
  gap: 6px !important;
  padding: 5px 8px !important;
}
.site-links a {
  position: relative;
  padding: 7px 16px !important;
  border-radius: 999px !important;
  opacity: .82;
  transition: opacity 180ms ease, background-color 220ms ease, color 220ms ease;
}
.site-links a:hover { opacity: 1; }
.site-links a::after {
  content: none; /* 原文件的链接下划线动画让位给选中指示 */
}
.site-links a.active {
  opacity: 1;
  color: #fff !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .10)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .30);
}
.site-links a.active::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #64d2ff, #0a84ff);
  box-shadow: 0 1px 4px rgba(100, 210, 255, .55);
}
[data-theme="light"] .site-links a.active {
  color: #0a84ff !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .62)) !important;
  box-shadow: inset 0 1px 0 #fff, 0 1px 4px rgba(10, 132, 255, .14);
}

/* ────────────────────────────────────────────────────────────
   3) 右上浮岛：主题开关移到用户区左侧 + 分隔竖线（纯 order，不改 DOM）
   ──────────────────────────────────────────────────────────── */
.top-actions .theme-toggle { order: 1; margin-right: 1px; }
.top-actions .user-menu-wrap { order: 2; }
.top-actions .user-menu-wrap::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  width: 1px;
  height: 14px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .22);
}
[data-theme="light"] .top-actions .user-menu-wrap::before { background: rgba(16, 22, 38, .12); }

.top-bar .user-btn:hover,
.top-bar .theme-toggle:hover { background: rgba(255, 255, 255, .12) !important; }
[data-theme="light"] .top-bar .user-btn:hover,
[data-theme="light"] .top-bar .theme-toggle:hover { background: rgba(16, 22, 38, .07) !important; }

/* ────────────────────────────────────────────────────────────
   4) 搜索框：浅色玻璃（与深色顶栏形成参考图的明暗对比）
   ──────────────────────────────────────────────────────────── */
.search-box {
  border: 1px solid rgba(255, 255, 255, .62) !important;
  border-radius: 999px !important;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .50) 0%, rgba(255, 255, 255, .18) 40%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, .30), rgba(255, 255, 255, .06) 52%),
    rgba(255, 255, 255, .36) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .75),
    inset 0 -1px 0 rgba(16, 22, 38, .05),
    0 2px 8px rgba(6, 10, 24, .14),
    0 26px 60px rgba(6, 10, 24, .30) !important;
  backdrop-filter: blur(24px) saturate(165%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(165%) !important;
}
[data-theme="dark"] .search-box {
  /* 深色主题下依然是浅玻璃：这是参考图的核心对比 */
  border-color: rgba(255, 255, 255, .58) !important;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, .14) 40%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .04) 52%),
    rgba(255, 255, 255, .30) !important;
}
[data-theme="light"] .search-box {
  border-color: rgba(255, 255, 255, .85) !important;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, .24) 40%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .10) 52%),
    rgba(255, 255, 255, .50) !important;
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -1px 0 rgba(16, 22, 38, .04),
    0 2px 8px rgba(30, 41, 66, .10),
    0 26px 60px rgba(30, 41, 66, .18) !important;
}

/* 浅玻璃上的内容换深色墨水 */
.search-box .engine-btn { color: rgba(29, 29, 31, .78) !important; background: transparent !important; }
.search-box .engine-btn:hover { background: rgba(16, 22, 38, .06) !important; }
.search-box .search-input { color: #1d1d1f !important; }
.search-box .search-input::placeholder { color: rgba(29, 29, 31, .42) !important; }
.search-box .search-submit {
  border-radius: 999px !important;
  background: linear-gradient(180deg, #339bff, #0a84ff) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 16px rgba(10, 132, 255, .38) !important;
}

/* ────────────────────────────────────────────────────────────
   5) 顶栏弹出面板（引擎下拉 / 用户菜单）：同款深玻璃
   ──────────────────────────────────────────────────────────── */
.engine-dropdown,
.dropdown {
  border: 1px solid rgba(255, 255, 255, .18) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 40%),
    rgba(16, 22, 38, .52) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    0 18px 46px rgba(6, 10, 24, .38) !important;
  backdrop-filter: blur(24px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
}
[data-theme="light"] .engine-dropdown,
[data-theme="light"] .dropdown {
  border-color: rgba(255, 255, 255, .70) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .50), rgba(255, 255, 255, 0) 40%),
    rgba(255, 255, 255, .66) !important;
  box-shadow:
    inset 0 1px 0 #fff,
    0 18px 46px rgba(30, 41, 66, .20) !important;
}

/* ────────────────────────────────────────────────────────────
   6) 兜底与降级
   ──────────────────────────────────────────────────────────── */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-brand, .site-links, .top-actions { background: rgba(16, 22, 38, .82) !important; }
  .search-box { background: rgba(250, 250, 252, .94) !important; }
  .engine-dropdown, .dropdown { background: rgba(16, 22, 38, .92) !important; }
}

@media (max-width: 900px) {
  .site-links { display: none !important; } /* 与原断点行为一致：窄屏隐藏中段导航 */
  .top-bar { gap: 8px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .site-links a { transition: none; }
}
