/* 算法手册首页样式：只作用于 index.html */

.algo-home {
  --home-ink: #0b1b2b;
  --home-muted: #5c6b7e;
  --home-soft: #5c6b7e;
  --home-line: #e6ecf3;
  /* 文本与可点击元素统一用 #0f6fc4（白底 5.1:1）；#178aec 只留给装饰 */
  --home-blue: #0f6fc4;
  --home-blue-dark: #0a5ba8;
  --home-blue-darker: #084c8c;
  --home-blue-bright: #178aec;
  --home-navy: #0b1f33;
  background: #fff;
  color: var(--home-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  /* 首页正文含 TOPSIS、GLMM 等英文缩写，按词换行，不从单词中间断开 */
  word-break: normal;
}

/* main.css 里有全局 p{word-break:break-all}，这里按词换行 */
.algo-home p { word-break: normal; }

.algo-home .home-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* 示例提示条 */
.home-notice {
  border-bottom: 1px solid #e8eef5;
  background: #f7f9fc;
  font-size: 12px;
  color: var(--home-muted);
}

.home-notice .home-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 9px;
  padding-bottom: 9px;
  flex-wrap: wrap;
}

.home-notice strong {
  color: #3d4d5f;
  font-weight: 600;
}

.home-notice a {
  color: var(--home-blue);
  text-decoration: none;
}

.home-notice a:hover { text-decoration: underline; }

/* 首屏：淡蓝底铺满整幅，向下渐隐到白色 */
.algo-home { position: relative; }

.algo-home::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 560px;
  z-index: 0;
  background:
    radial-gradient(720px 360px at 78% 0%, rgba(23, 138, 236, .09), transparent 62%),
    linear-gradient(180deg, #f5faff 0%, #fbfdff 52%, #ffffff 100%);
  pointer-events: none;
}

.home-shell,
.home-footer { position: relative; z-index: 1; }

.home-hero {
  position: relative;
  overflow: visible;
  background: transparent;
}

.home-hero .home-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  gap: 64px;
  align-items: center;
  padding-top: 68px;
  padding-bottom: 68px;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--home-blue-dark);
  text-transform: uppercase;
}

.home-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--home-blue-bright);
}

.home-hero h1 {
  margin: 18px 0 18px !important;
  font-size: 44px;
  line-height: 1.18;
  letter-spacing: -.02em;
  font-weight: 700;
  color: var(--home-ink);
}

.home-hero h1 em {
  font-style: normal;
  color: var(--home-blue);
}

.home-lead {
  max-width: 520px;
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.85;
  color: var(--home-muted);
}

/* 搜索 */
.home-search {
  position: relative;
  display: flex;
  max-width: 520px;
  background: #fff;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(11, 27, 43, .05);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.home-search:focus-within {
  border-color: #a8cff0;
  box-shadow: 0 0 0 3px rgba(23, 138, 236, .10);
}

.home-search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--home-ink);
  font-size: 14px;
  font-family: inherit;
}

.home-search input::placeholder { color: #5c6b7e; }

.home-search button {
  flex: none;
  height: 38px;
  margin: 5px;
  padding: 0 20px;
  border: 0;
  border-radius: 7px;
  background: var(--home-blue-dark);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease;
}

.home-search button:hover { background: var(--home-blue-darker); }

.home-search__msg {
  max-width: 520px;
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #5c6b7e;
}

.home-search__suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  background: #fff;
  border: 1px solid #e3e9f0;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(11, 27, 43, .12);
}

.home-search__suggest.is-open { display: block; }

.home-search__suggest a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 7px;
  color: #1f2d3d;
  font-size: 13.5px;
  text-decoration: none;
}

.home-search__suggest a:hover {
  background: #f2f8ff;
  color: var(--home-blue-dark);
}

.home-search__suggest span {
  font-size: 11px;
  color: #5c6b7e;
}

.home-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--home-soft);
}

.home-hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.home-hero__meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #c3ceda;
}

/* 方法页预览 */
.home-preview {
  overflow: hidden;
  background: #fff;
  border: 1px solid #dcebfa;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(15, 111, 196, .10);
}

.home-preview__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: #fbfdff;
  border-bottom: 1px solid #edf2f7;
  font-size: 11.5px;
  color: #5c6b7e;
}

.home-preview__status {
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--home-blue);
  font-size: 11px;
  font-weight: 600;
}

.home-preview__status::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--home-blue-bright);
  vertical-align: middle;
}

.home-preview__body { padding: 24px; }

.home-preview h2,
.home-preview h3 {
  margin: 0 0 16px !important;
  font-size: 20px;
  letter-spacing: -.01em;
}

.home-preview__formula {
  padding: 15px 16px;
  background: #f4f9ff;
  border: 1px solid #e1eefb;
  border-radius: 8px;
  font-family: "Cambria Math", Georgia, "Times New Roman", serif;
  font-size: 14.5px;
  line-height: 1.85;
  color: #1f2d3d;
  text-align: center;
}

.home-preview__rows {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.home-preview__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #eef2f7;
  font-size: 13px;
}

.home-preview__row:last-child { border-bottom: 0; padding-bottom: 0; }
.home-preview__row span { color: #5c6b7e; }
.home-preview__row strong { font-weight: 600; color: #1f2d3d; }

.home-preview__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #edf2f7;
  font-size: 12px;
  color: #5c6b7e;
}

.home-preview__foot a {
  color: var(--home-blue);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* 指标条 */
.home-stats {
  border-bottom: 1px solid #e9eff6;
  background: #fff;
}

.home-stats .home-wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-top: 28px;
  padding-bottom: 28px;
}

.home-stat {
  text-align: center;
  border-right: 1px solid #edf2f7;
}

.home-stat:last-child { border-right: 0; }

.home-stat strong {
  display: block;
  margin-bottom: 3px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--home-ink);
  font-variant-numeric: tabular-nums;
}

.home-stat span {
  font-size: 12.5px;
  color: #5c6b7e;
}

/* 正文区块 */
.home-main { padding-bottom: 84px; }

.home-section { padding-top: 72px; }

.home-section__head {
  max-width: 700px;
  margin-bottom: 28px;
}

.home-section h2 {
  margin: 10px 0 10px !important;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--home-ink);
}

.home-section__desc {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--home-muted);
}

/* 三根支柱 */
.home-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.home-pillar {
  padding: 26px;
  background: #fff;
  border: 1px solid var(--home-line);
  border-radius: 12px;
}

.home-pillar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: #eef6ff;
  color: var(--home-blue);
}

.home-pillar h3 {
  margin: 0 0 8px !important;
  font-size: 16.5px;
  color: var(--home-ink);
}

.home-pillar p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--home-muted);
}

/* 模块目录 */
.home-modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 48px;
  border-top: 1px solid var(--home-line);
}

.home-module {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 4px;
  border-bottom: 1px solid var(--home-line);
  color: inherit;
  text-decoration: none;
}

a.home-module:hover h3 { color: var(--home-blue-dark); }

.home-module__no {
  width: 22px;
  flex: none;
  font-size: 11px;
  color: #5c6b7e;
  font-variant-numeric: tabular-nums;
}

.home-module h3 {
  margin: 0 0 3px !important;
  font-size: 15px;
  font-weight: 600;
  color: var(--home-ink);
  transition: color .15s ease;
}

.home-module p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #5c6b7e;
}

.home-module__count {
  flex: none;
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f4f7fb;
  color: #5c6b7e;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.home-module__arrow {
  flex: none;
  color: #b6c2d1;
  font-size: 15px;
}

.home-module--soon { cursor: default; }
.home-module--soon h3 { color: #5c6b7e; }
.home-module--soon .home-module__count { background: #f5f7f9; color: #5c6b7e; }

.home-module__soon {
  flex: none;
  font-size: 11px;
  color: #5c6b7e;
  white-space: nowrap;
}

.home-modules__foot {
  margin-top: 18px;
  font-size: 13px;
  color: var(--home-muted);
}

.home-modules__foot a {
  color: var(--home-blue);
  font-weight: 600;
  text-decoration: none;
}

/* 示例链路 */
.home-verify {
  display: grid;
  grid-template-columns: .92fr 1.08fr;
  gap: 48px;
  margin-top: 72px;
  padding: 42px;
  border: 1px solid #dcebfa;
  border-radius: 16px;
  background:
    radial-gradient(560px 280px at 100% 0%, rgba(23, 138, 236, .08), transparent 70%),
    #f5faff;
  color: var(--home-ink);
}

.home-verify h2 {
  margin: 10px 0 12px !important;
  font-size: 26px;
  line-height: 1.35;
  color: var(--home-ink);
}

.home-verify p {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--home-muted);
}

.home-verify__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--home-blue);
  text-decoration: none;
}

.home-verify__link:hover { text-decoration: underline; }

.home-flow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

.home-flow__item {
  padding: 16px;
  border: 1px solid #dcebfa;
  border-radius: 10px;
  background: #fff;
}

.home-flow__item b {
  display: block;
  margin-bottom: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--home-blue);
}

.home-flow__item span {
  font-size: 12.5px;
  line-height: 1.65;
  color: #3d4d5f;
}

/* 两套手册 */
.home-bridge__head { max-width: 780px; margin-bottom: 20px; }

.home-bridge__head h2 em {
  font-style: normal;
  font-weight: 500;
  color: var(--home-blue);
  margin: 0 2px;
}

.home-bridge__head .home-section__desc strong {
  color: #2b3b4d;
  font-weight: 600;
}

.home-bridge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 20px;
  margin-top: 24px;
}

.home-bridge__col {
  padding: 22px 24px 20px;
  border: 1px solid #e3ebf5;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6faff 100%);
}

.home-bridge__col h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px !important;
  font-size: 15px;
  color: var(--home-ink);
}

.home-bridge__col p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--home-muted);
}

.home-bridge__col a {
  display: inline-block;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--home-blue);
  text-decoration: none;
}

.home-bridge__arrow {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid #dbe7f4;
  border-radius: 50%;
  background: #fff;
  color: var(--home-blue);
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(15, 60, 110, .06);
}

/* 页脚 */
.home-footer {
  padding: 28px 0 40px;
  border-top: 1px solid #e9eff6;
  background: #fbfcfe;
  font-size: 12px;
  color: #5c6b7e;
}

.home-footer .home-wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}

.home-footer a {
  color: var(--home-muted);
  text-decoration: none;
}

.home-footer a:hover { color: var(--home-blue); }

@media print {
  .algo-home::before { display: none; }
  .home-notice, .home-search, .home-stats, .home-bridge, .home-footer { display: none !important; }
  .home-main { padding-bottom: 0; }
  .home-section, .home-pillar, .home-module { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .algo-home *, .algo-home *::before, .algo-home *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 响应式 */
@media (max-width: 980px) {
  .home-hero .home-wrap {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 52px;
    padding-bottom: 52px;
  }

  .home-hero h1 { font-size: 42px; }
  .home-preview { max-width: 560px; }

  .home-pillars { grid-template-columns: 1fr; }
  .home-modules { grid-template-columns: 1fr; gap: 0; }
  .home-verify { grid-template-columns: 1fr; gap: 28px; padding: 32px; }
}

@media (max-width: 640px) {
  .algo-home .home-wrap { padding-left: 18px; padding-right: 18px; }

  .home-hero h1 { font-size: 34px; }
  .home-lead { font-size: 14.5px; }

  .home-stats .home-wrap { grid-template-columns: 1fr 1fr; gap: 20px 0; }
  .home-stat:nth-child(2n) { border-right: 0; }
  .home-stat strong { font-size: 22px; }

  .home-section { padding-top: 52px; }
  .home-section h2 { font-size: 23px; }

  .home-verify { margin-top: 52px; padding: 24px; }
  .home-flow { grid-template-columns: 1fr; }

  .home-bridge { grid-template-columns: 1fr; gap: 14px; }
  .home-bridge__arrow { display: none; }
  /* 手机端按自然换行，不用桌面的分行 */
  .home-bridge__head .home-section__desc br { display: none; }

  .home-preview__body { padding: 18px; }
  .home-search button { padding: 0 14px; }
}

/* 首页右侧方法目录：与方法页一致，从页头下沿开始，随页面吸顶 */
.home-shell { display: block; }

@media (min-width: 981px) {
  .home-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 276px;
    gap: 24px;
    align-items: start;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
  }

  /* 留白由外壳负责，内部各段不再重复 */
  .home-shell .home-wrap {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  .home-footer .home-wrap { max-width: 1320px; }
}

/* 目录占位后，中等宽度下把两栏内容改为单栏，避免卡片和流程被压窄 */
@media (min-width: 981px) and (max-width: 1100px) {
  .home-pillars { grid-template-columns: 1fr; }
  .home-modules { grid-template-columns: 1fr; gap: 0; }
  .home-verify { grid-template-columns: 1fr; gap: 28px; }
}

/* 窄桌面下 hero 两栏太挤，改为上下排列 */
@media (min-width: 981px) and (max-width: 1280px) {
  .home-hero .home-wrap {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 52px;
    padding-bottom: 52px;
  }
  .home-preview { max-width: 560px; }
}
