/* ==========================================================================
   hub.css — 工具门户与工具页共用外壳
   --------------------------------------------------------------------------
   一、设计令牌
   二、基础与工具类
   三、门户顶栏
   四、门户首屏（hero + 搜索）
   五、工具卡片网格
   六、领头羊入口条
   七、门户页脚
   八、工具页外壳（.tool-* 用于 tools/ 下的各个小工具）
   九、打印与降级
   ========================================================================== */

/* ---------- 一、设计令牌 ---------- */
:root {
  /* 主色系：深海军蓝，与领头羊商业咨询保持同一套语言 */
  --ink-900: #0a1f33;
  --ink-800: #0f2b46;
  --ink-700: #16395a;
  --ink-500: #4a6478;
  --ink-400: #6b8298;
  --ink-300: #93a7b8;
  --ink-200: #c3d0da;
  --ink-100: #dde5ec;
  --ink-50:  #f5f8fa;

  /* 强调色：金 */
  --gold-600: #b8791a;
  --gold-500: #c98a1f;
  --gold-400: #e0a63c;
  --gold-100: #fdf3e0;

  --paper: #ffffff;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(10, 31, 51, .05);
  --shadow-md: 0 2px 4px rgba(10, 31, 51, .04), 0 12px 28px -18px rgba(10, 31, 51, .35);
  --shadow-lg: 0 4px 8px rgba(10, 31, 51, .05), 0 24px 48px -24px rgba(10, 31, 51, .4);

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --wrap: 1080px;
  --header-h: 62px;
}

/* ---------- 二、基础与工具类 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

/* 屏幕阅读器专用（同时用于跳转链接） */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink-800);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

/* 统一的键盘焦点环。
   注意：这里不能设 border-radius —— 它会改掉元素自身的圆角。
   outline 会自动跟随元素已有的圆角。 */
:focus-visible {
  outline: 3px solid var(--gold-400);
  outline-offset: 3px;
}

/* 统一按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease,
              color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink-800);
  color: #fff;
  box-shadow: 0 8px 20px -12px rgba(10, 31, 51, .8);
}
.btn-primary:hover { background: var(--ink-700); }

.btn-gold {
  background: var(--gold-400);
  color: var(--ink-900);
}
.btn-gold:hover { background: #eeb455; }

.btn-ghost {
  background: transparent;
  border-color: var(--ink-200);
  color: var(--ink-700);
}
.btn-ghost:hover { border-color: var(--ink-800); color: var(--ink-800); }

/* ---------- 三、门户顶栏 ---------- */
.hub-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--ink-100);
}

.hub-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: var(--header-h);
}

.hub-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-800);
}
.hub-brand svg { flex: none; }
.hub-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.hub-brand-text strong { font-size: 16px; letter-spacing: .2px; }
.hub-brand-text small {
  font-size: 10.5px;
  color: var(--ink-400);
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* 「领头羊」按钮 —— 门户里唯一的对外出口 */
.hub-leader-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-800);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.hub-leader-btn:hover {
  border-color: var(--gold-400);
  background: var(--gold-100);
  box-shadow: 0 6px 16px -12px rgba(184, 121, 26, .9);
}
.hub-leader-btn svg { transition: transform .18s ease; }
.hub-leader-btn:hover svg { transform: translateX(2px); }

/* ---------- 四、门户首屏 ---------- */
.hub-hero {
  position: relative;
  padding: 56px 0 40px;
  overflow: hidden;
}
/* 首屏的柔和光晕，纯装饰 */
.hub-hero::before {
  content: "";
  position: absolute;
  inset: -40% 20% auto -10%;
  height: 520px;
  background:
    radial-gradient(closest-side, rgba(224, 166, 60, .16), transparent 70%),
    radial-gradient(closest-side, rgba(15, 43, 70, .09), transparent 70%);
  background-position: 0 0, 60% 30%;
  background-size: 60% 100%, 55% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}

.hub-hero-inner { position: relative; }

.hub-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px 13px;
  border: 1px solid var(--ink-100);
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: var(--ink-500);
  font-size: 12.5px;
  letter-spacing: .04em;
}
.hub-eyebrow i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(224, 166, 60, .2);
}

.hub-title {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 5.6vw, 3rem);
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--ink-800);
}
.hub-title em {
  font-style: normal;
  color: var(--gold-500);
  /* 金色下划线装饰 */
  background: linear-gradient(transparent 62%, rgba(224, 166, 60, .28) 62%);
  padding-inline: 2px;
}

.hub-sub {
  max-width: 46ch;
  color: var(--ink-500);
  font-size: 15.5px;
}

/* 搜索框 */
.hub-search {
  position: relative;
  max-width: 440px;
  margin-top: 26px;
}
.hub-search svg {
  position: absolute;
  top: 50%; left: 15px;
  transform: translateY(-50%);
  color: var(--ink-300);
  pointer-events: none;
}
.hub-search input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--ink-100);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-900);
  font: inherit;
  /* ≥16px 避免 iOS 聚焦缩放 */
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.hub-search input::placeholder { color: var(--ink-300); font-size: 14.5px; }
.hub-search input:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 4px rgba(224, 166, 60, .16);
}

/* ---------- 五、工具卡片网格 ---------- */
.tool-section { padding: 8px 0 56px; }

.tool-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.tool-section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.tool-count { font-size: 12.5px; color: var(--ink-300); }

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 20px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  /* 整卡可点，但保留内部真实链接的语义 */
  overflow: hidden;
}
/* 顶部一道金线，hover 时才显现 */
.tool-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-500));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink-200);
  box-shadow: var(--shadow-md);
}
.tool-card:hover::after { transform: scaleX(1); }
.tool-card:focus-visible { outline-offset: 2px; }

.tool-icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  color: var(--ink-800);
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.tool-card:hover .tool-icon {
  background: var(--gold-100);
  border-color: rgba(224, 166, 60, .45);
  color: var(--gold-600);
}

.tool-name {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink-800);
}

.tool-desc {
  margin: 0;
  color: var(--ink-500);
  font-size: 13.8px;
  line-height: 1.6;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}
.tool-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  color: var(--ink-400);
  font-size: 11.5px;
  letter-spacing: .02em;
}
/* 「新」标记 */
.tool-tag.is-new {
  background: var(--gold-100);
  border-color: rgba(224, 166, 60, .4);
  color: var(--gold-600);
  font-weight: 600;
}

/* 搜索无结果 */
.tool-empty {
  grid-column: 1 / -1;
  padding: 44px 20px;
  border: 1px dashed var(--ink-200);
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink-400);
  font-size: 14px;
}
.tool-empty b { color: var(--ink-700); }
.tool-empty[hidden] { display: none; }

/* ---------- 六、领头羊入口条 ---------- */
.leader-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 64px;
  padding: 26px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--ink-800) 0%, var(--ink-700) 55%, #1b4a6f 100%);
  color: #fff;
  overflow: hidden;
}
/* 背景上的金色弧线，纯装饰 */
.leader-banner::before {
  content: "";
  position: absolute;
  top: -60%; right: -12%;
  width: 340px; height: 340px;
  border: 1px solid rgba(224, 166, 60, .28);
  border-radius: 50%;
  pointer-events: none;
}
.leader-banner::after {
  content: "";
  position: absolute;
  bottom: -80%; right: 4%;
  width: 260px; height: 260px;
  border: 1px solid rgba(224, 166, 60, .16);
  border-radius: 50%;
  pointer-events: none;
}

.leader-banner-body { position: relative; }
.leader-banner .kicker {
  font-size: 11.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: 8px;
}
.leader-banner h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
}
.leader-banner p {
  max-width: 52ch;
  color: #c9dae6;
  font-size: 14px;
}
.leader-banner .btn {
  position: relative;
  align-self: flex-start;
}

/* ---------- 七、门户页脚 ---------- */
.hub-footer {
  padding: 26px 0 34px;
  border-top: 1px solid var(--ink-100);
  background: var(--paper);
}
.hub-footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink-400);
  font-size: 12.5px;
}
.hub-footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.hub-footer-inner a {
  color: var(--ink-500);
  text-decoration: none;
}
.hub-footer-inner a:hover { color: var(--ink-800); text-decoration: underline; }

/* ---------- 八、工具页外壳 ---------- */
.tool-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.tool-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--ink-100);
}
.tool-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--ink-100);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-700);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease;
}
.tool-back:hover { border-color: var(--ink-300); background: var(--ink-50); }
.tool-back svg { transition: transform .18s ease; }
.tool-back:hover svg { transform: translateX(-2px); }

.tool-topbar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: .02em;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-main { flex: 1; }

.tool-foot {
  padding: 20px 0 28px;
  border-top: 1px solid var(--ink-100);
  color: var(--ink-300);
  font-size: 12px;
  text-align: center;
}
.tool-foot a { color: var(--ink-400); }

/* ---------- 九、响应式 ---------- */
@media (min-width: 600px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-hero { padding: 68px 0 44px; }
  .leader-banner { flex-direction: row; align-items: center; justify-content: space-between; padding: 30px 32px; }
  .leader-banner .btn { align-self: center; flex: none; }
  .hub-footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (min-width: 900px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .hub-hero { padding: 84px 0 52px; }
  .hub-title { margin-bottom: 18px; }
  .tool-card { padding: 22px; }
}

/* ---------- 十、无障碍与降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* 高对比度偏好：把浅灰字压深，保证可读性 */
@media (prefers-contrast: more) {
  :root {
    --ink-400: #3b556c;
    --ink-300: #56708a;
    --ink-200: #8298ac;
    --ink-100: #b8c8d6;
  }
  .tool-desc, .hub-sub { color: var(--ink-700); }
}

@media print {
  .hub-header, .hub-footer, .hub-search, .leader-banner .btn,
  .tool-topbar, .tool-foot { display: none !important; }
  body { background: #fff; }
}
