/* ==========================================================================
   全天电脑维修 · 全站共享导航样式（唯一真源）
   --------------------------------------------------------------------------
   适用：SSR 页面（app/web/view/layout/base.html）与 9 个独立静态页
        /tools/ 7 页、/speedtest/ 2 页。
   规则与 public/static/web/site.css 中的导航段保持一致，另加「当前页高亮」。
   所有值均为硬编码色值，不依赖 :root 变量，避免被静态页自身的 CSS 变量覆盖。
   加载顺序：必须放在各页自有样式表之后。
   ========================================================================== */

/* ---------- 作用域重置：抵消静态页自带全局样式，保证与 SSR 首页同款 ----------
   仅作用于 .hf-header / .hf-footer 内部，不污染页面主体。 */
.hf-header, .hf-footer {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
.hf-header *, .hf-header *::before, .hf-header *::after,
.hf-footer *, .hf-footer *::before, .hf-footer *::after { box-sizing: border-box; }
.hf-header, .hf-header *, .hf-footer, .hf-footer * { margin: 0; padding: 0; }
.hf-header a, .hf-footer a {
  color: inherit; text-decoration: none;
  -webkit-tap-highlight-color: rgba(22, 69, 124, .10);
}
.hf-header img, .hf-footer img { max-width: 100%; display: block; }
.hf-header button { font-family: inherit; font-size: inherit; line-height: inherit; }
.hf-header :focus-visible, .hf-footer :focus-visible {
  outline: 2px solid #2f6fb5; outline-offset: 2px; border-radius: 4px;
}

/* ---------- 布局骨架 ---------- */
.hf-wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hf-muted { color: #6b7280; font-size: 14px; }

/* ---------- 顶部 Header ---------- */
.hf-header { background: #16457c; color: #fff; }
.hf-header-in { display: flex; align-items: center; gap: 28px; height: 60px; }
.hf-logo {
  font-size: 20px; font-weight: 700; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.hf-logo-img {
  height: 34px; width: auto; max-width: 180px; object-fit: contain; display: block;
  border-radius: 6px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.hf-nav { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.hf-nav a {
  opacity: .9; padding: 0 10px; min-height: 44px;
  display: inline-flex; align-items: center;
  border-bottom: 2px solid transparent;
  transition: opacity .15s, border-color .15s, background .15s;
}
.hf-nav a:hover { opacity: 1; border-bottom-color: #f59e0b; }
.hf-nav a:active { opacity: 1; border-bottom-color: #f59e0b; background: rgba(255, 255, 255, .08); }
.hf-hotline {
  font-size: 14px; background: rgba(255, 255, 255, .12);
  padding: 8px 14px; border-radius: 20px; white-space: nowrap;
}

/* ---------- 顶部一级下拉 ---------- */
.hf-has-dropdown { position: relative; display: inline-flex; align-items: center; }
.hf-nav-drop-btn {
  -webkit-appearance: none; appearance: none;
  background: none; border: none; color: inherit; font: inherit; cursor: pointer;
  opacity: .9; padding: 0 10px; min-height: 44px;
  display: inline-flex; align-items: center; gap: 4px;
  border-bottom: 2px solid transparent;
  transition: opacity .15s, border-color .15s, background .15s;
}
.hf-nav-drop-btn:hover,
.hf-nav-drop-btn:focus-visible { opacity: 1; border-bottom-color: #f59e0b; }
.hf-nav-drop-btn:focus-visible { outline: 2px solid #2f6fb5; outline-offset: 2px; }
.hf-caret {
  display: inline-block; margin-left: 2px; font-size: 10px; line-height: 1;
  transition: transform .2s ease; opacity: .85;
}
.hf-has-dropdown:hover .hf-caret,
.hf-has-dropdown.is-open .hf-caret { transform: rotate(180deg); }
.hf-dropdown {
  position: absolute; top: 100%; left: 0; min-width: 184px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(22, 69, 124, .18);
  padding: 6px; z-index: 90;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.hf-has-dropdown:hover .hf-dropdown,
.hf-has-dropdown:focus-within .hf-dropdown,
.hf-has-dropdown.is-open .hf-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.hf-dropdown a {
  display: flex; align-items: center; gap: 8px;
  opacity: 1 !important; min-height: 42px; padding: 0 14px;
  border-bottom: none !important; border-radius: 8px;
  color: #1f2937; font-size: 15px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.hf-dropdown a:hover {
  opacity: 1 !important; background: #eef4fb; color: #16457c; border-bottom: none !important;
}
.hf-dropdown a:active { background: #e2ecf7; }

/* ---------- 二/三级飞出 ---------- */
.hf-drop-item { position: relative; }
.hf-fly-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  opacity: 1 !important; min-height: 42px; padding: 0 14px;
  border-bottom: none !important; border-radius: 8px;
  color: #1f2937; font-size: 15px; white-space: nowrap; cursor: default;
  transition: background .15s ease, color .15s ease;
}
.hf-dropdown a.hf-fly-trigger:hover,
.hf-drop-item:hover > .hf-fly-trigger { background: #eef4fb; color: #16457c; }
.hf-caret-r {
  margin-left: auto; font-size: 13px; line-height: 1; opacity: .7;
  transition: transform .2s ease;
}
.hf-flyout {
  position: absolute; left: 100%; top: 0; min-width: 184px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(22, 69, 124, .18); padding: 6px; z-index: 95;
  opacity: 0; visibility: hidden; transform: translateX(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.hf-has-flyout:hover > .hf-flyout,
.hf-has-flyout:focus-within > .hf-flyout { opacity: 1; visibility: visible; transform: translateX(0); }
.hf-flyout a {
  display: flex; align-items: center; gap: 8px; opacity: 1 !important;
  min-height: 42px; padding: 0 14px; border-bottom: none !important; border-radius: 8px;
  color: #1f2937; font-size: 14.5px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.hf-flyout a:hover { background: #eef4fb; color: #16457c; }

/* ---------- 底部 Footer ---------- */
.hf-footer {
  background: #0d2f57; color: rgba(255, 255, 255, .85);
  padding: 28px 0; margin-top: 48px; text-align: center;
}
.hf-footer .hf-muted { color: rgba(255, 255, 255, .5); }
.hf-footer a:hover, .hf-footer a:focus-visible { color: #fff; }
.hf-foot-nav {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px 20px; margin-bottom: 12px;
}
.hf-foot-nav a { color: rgba(255, 255, 255, .85); text-decoration: none; font-size: 14px; }
.hf-foot-nav a:hover { color: #fff; }
.hf-muted a { color: inherit; text-decoration: none; }
.hf-muted a:hover { text-decoration: underline; }
.hf-footer .hf-muted img { display: inline-block; vertical-align: middle; margin-right: 5px; }

/* ---------- 当前页高亮（全站统一，由 site-nav.js 写入 aria-current="page"） ---------- */
.hf-nav > a[aria-current="page"],
.hf-nav > .hf-nav-item > .hf-nav-drop-btn[aria-current="page"] {
  opacity: 1; border-bottom-color: #f59e0b;
  background: rgba(255, 255, 255, .12); font-weight: 600;
}
.hf-dropdown a[aria-current="page"],
.hf-flyout a[aria-current="page"] {
  background: #eef4fb !important; color: #16457c !important; font-weight: 600;
}
.hf-foot-nav a[aria-current="page"] { color: #fff; font-weight: 700; }

/* ---------- 测速页页面专属控件 ----------
   置于内容区顶部，绝不放进共享 header，保证 header/footer 与首页逐节点一致。
   按钮外观沿用 speedtest/style.css 的 .nav__share / .nav__theme，这里只做布局。 */
.st-page-tools {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin: 4px 0 12px;
}
.st-page-tools button { margin-left: 0; }

/* ---------- 响应式：与首页 site.css 断点一致 ---------- */
@media (max-width: 1024px) {
  .hf-wrap { padding: 0 20px; }
}
@media (max-width: 768px) {
  .hf-header-in { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 10px; }
  .hf-logo { font-size: 18px; }
  .hf-logo-img { height: 30px; }
  .hf-nav { width: 100%; order: 3; gap: 4px; }
  .hf-nav a { flex: 1 1 auto; justify-content: center; font-size: 14px; }
  .hf-hotline { display: none; }
  .st-page-tools { justify-content: flex-start; margin-bottom: 8px; }
  .hf-has-dropdown { display: block; width: 100%; }
  .hf-nav-drop-btn { width: 100%; justify-content: center; }
  .hf-dropdown {
    position: static; min-width: 0; width: 100%;
    box-shadow: none; border: none; border-top: 1px solid #e5e7eb;
    border-radius: 0; padding: 0; margin-top: 4px;
    transform: none; max-height: 0; overflow: hidden;
    transition: opacity .18s ease, visibility .18s, max-height .22s ease;
  }
  /* 移动端仅由 .is-open 控制展开，避免触摸焦点粘滞 */
  .hf-has-dropdown:hover .hf-dropdown,
  .hf-has-dropdown:focus-within .hf-dropdown { opacity: 0; visibility: hidden; max-height: 0; }
  /* 统一放开到 640px：原 220px 会截断 3 组三级项共 10 条链接；SSR 与静态页同步生效 */
  .hf-has-dropdown.is-open .hf-dropdown { opacity: 1; visibility: visible; max-height: 640px; }
  .hf-dropdown a { justify-content: center; font-size: 14px; }
  .hf-flyout {
    position: static; left: auto; top: auto; min-width: 0; width: 100%;
    box-shadow: none; border: none; border-left: 2px solid #e5e7eb; border-radius: 0;
    padding: 0 0 0 12px; margin: 4px 0; transform: none; opacity: 1; visibility: visible;
  }
  .hf-fly-trigger { justify-content: flex-start; }
  .hf-caret-r { display: none; }
  .hf-flyout a { font-size: 14px; padding-left: 8px; }
}
@media (max-width: 480px) {
  .hf-wrap { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .hf-header *, .hf-footer * { transition: none !important; animation: none !important; }
}
