/* ============================================================
 * 友情链接单页样式（仅 links 模板按需加载）
 * v4.9.2：linyu 式横排卡片 + 编号规则卡 + 双卡并排 + 复制按钮悬停显现
 * 颜色全部走主题 CSS 变量，html.dark 自动适配。
 * ============================================================ */

.yz-links {
  --yz-links-accent: var(--yz-primary, #000000);
  --yz-links-surface: var(--yz-card, #fff);
  --yz-links-line: var(--yz-border, #e2e8f0);
  --yz-links-line-soft: var(--yz-border-light, #f1f5f9);
  --yz-links-ink: var(--yz-text, #000000);
  --yz-links-muted: var(--yz-text-2, #64748b);
  --yz-links-faint: var(--yz-text-3, #94a3b8);
  --yz-links-canvas: var(--yz-bg, #f8fafc);
  padding: .2rem 0 .4rem;
}

/* ---- 空状态引导 ---- */
.yz-links-tip {
  display: flex; gap: .7rem; align-items: flex-start;
  margin: 0 0 1rem; padding: .8rem .95rem;
  font-size: .86rem; line-height: 1.7; color: var(--yz-links-muted);
  background: var(--yz-links-canvas);
  border: 1px solid var(--yz-links-line);
  border-radius: var(--yz-radius-md);
}
.yz-links-tip svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; color: var(--yz-links-accent); }
.yz-links-tip pre {
  white-space: pre-wrap; margin: .6rem 0 0; padding: .7rem .9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem; color: var(--yz-links-ink);
  background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line);
  border-radius: var(--yz-radius-md);
}

/* ---- 工具条：搜索 / 筛选 / 随机 ---- */
.yz-links-toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .6rem; margin: 0 0 1.15rem;
}
.yz-links-search {
  display: inline-flex; align-items: center; gap: .5rem;
  flex: 1 1 220px; min-width: 180px; max-width: 320px; height: 38px;
  padding: 0 .8rem; background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line); border-radius: 999px;
  transition: border-color .2s, box-shadow .2s;
}
.yz-links-search:focus-within {
  border-color: var(--yz-links-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yz-links-accent) 14%, transparent);
}
.yz-links-search svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--yz-links-faint); }
.yz-links-search input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0;
  background: transparent; color: var(--yz-links-ink); font-size: .86rem;
}
.yz-links-search input::placeholder { color: var(--yz-links-faint); }
/* 隐藏浏览器为 type=search 自带的清除按钮，避免与主题自定义清除按钮出现两个 × */
.yz-links-search input::-webkit-search-cancel-button,
.yz-links-search input::-webkit-search-decoration,
.yz-links-search input::-webkit-search-results-button,
.yz-links-search input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
.yz-links-search input::-moz-search-cancel-button { -moz-appearance: none; appearance: none; display: none; }
.yz-links-search-clear {
  appearance: none; border: 0; background: transparent;
  color: var(--yz-links-faint); font-size: 1.2rem; line-height: 1;
  cursor: pointer; padding: 0 .15rem;
}
.yz-links-search-clear:hover { color: var(--yz-links-ink); }

.yz-links-filter { display: flex; flex-wrap: wrap; gap: .35rem; flex: 1 1 auto; }
.yz-links-chip {
  appearance: none; display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .75rem; font-size: .8rem; line-height: 1;
  color: var(--yz-links-muted); background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line); border-radius: 999px;
  cursor: pointer; transition: all .2s;
}
.yz-links-chip:hover { color: var(--yz-links-accent); border-color: var(--yz-links-accent); }
.yz-links-chip.is-active { color: #fff; background: var(--yz-links-accent); border-color: var(--yz-links-accent); }
html.dark .yz-links-chip.is-active { color: #0f172a; }
.yz-links-chip-count {
  font-size: .7rem; opacity: .75; padding: .08rem .35rem; border-radius: 999px;
  background: color-mix(in srgb, currentColor 15%, transparent);
}
.yz-links-random {
  appearance: none; display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .75rem; font-size: .8rem; color: var(--yz-links-muted);
  background: var(--yz-links-surface); border: 1px solid var(--yz-links-line);
  border-radius: 999px; cursor: pointer; transition: all .2s;
}
.yz-links-random:hover { color: var(--yz-links-accent); border-color: var(--yz-links-accent); }
.yz-links-random svg { width: 15px; height: 15px; }

/* ---- 分组 ---- */
.yz-links-group { margin: 0 0 1.45rem; scroll-margin-top: 90px; }
.yz-links-group-title {
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .7rem; font-size: 1rem; font-weight: 700; color: var(--yz-links-ink);
}
.yz-links-group-bar {
  width: 6px; height: 6px; border-radius: 50%; background: var(--yz-links-accent);
}
.yz-links-group-count {
  font-size: .72rem; font-weight: 500; color: var(--yz-links-muted);
  padding: .12rem .45rem; border-radius: 999px;
  background: var(--yz-links-canvas); border: 1px solid var(--yz-links-line-soft);
}

/* ---- 卡片网格（linyu：auto-fill minmax 240px） ---- */
.yz-links-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem;
}
[data-yz-links-cols="2"] .yz-links-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
[data-yz-links-cols="4"] .yz-links-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (max-width: 560px) {
  .yz-links-grid,
  [data-yz-links-cols="2"] .yz-links-grid,
  [data-yz-links-cols="3"] .yz-links-grid,
  [data-yz-links-cols="4"] .yz-links-grid { grid-template-columns: 1fr; }
}

/* linyu 式横排卡片：头像在左，文字在右，固定高度 6rem
 * v4.9.6：去掉淡绿底色，改为纯白 + 浅灰边框 + 轻阴影，与页面白底温和区分 */
.yz-links-card {
  position: relative; display: flex; align-items: center; gap: .7rem;
  height: 6rem; padding: .8rem; overflow: hidden;
  color: var(--yz-links-ink); text-decoration: none;
  background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line);
  border-radius: var(--yz-radius-md); box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.03);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.yz-links-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--yz-links-accent) 45%, var(--yz-links-line));
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--yz-links-accent) 35%, transparent), 0 3px 10px rgba(0,0,0,.05);
}
.yz-links-card[hidden] { display: none !important; }

.yz-links-avatar {
  position: relative; flex: 0 0 48px; width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--yz-radius-md); overflow: hidden;
  background: var(--yz-links-line-soft);
  color: var(--yz-links-muted); font-weight: 700; font-size: 1.15rem;
}
.yz-links-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yz-links-avatar img[hidden],
.yz-links-avatar.is-fallback img { display: none; }
.yz-links-letter { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 0 2px; line-height: 1.1; overflow: hidden; }
.yz-links-avatar.is-text .yz-links-letter,
.yz-links-avatar.is-fallback .yz-links-letter { display: flex; }
.yz-links-avatar.is-text-long .yz-links-letter { font-size: .8rem; }

.yz-links-card-body { display: flex; flex-direction: column; gap: .18rem; min-width: 0; flex: 1 1 auto; }
.yz-links-card-line1 { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.yz-links-card-title {
  min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: .92rem; font-weight: 700; line-height: 1.3; color: inherit;
}
.yz-links-badge {
  flex: 0 0 auto; padding: .08rem .34rem; font-size: .64rem; line-height: 1.45;
  color: var(--yz-links-accent);
  background: color-mix(in srgb, var(--yz-links-accent) 12%, transparent);
  border-radius: 5px;
}
.yz-links-card-desc {
  display: block; min-width: 0; max-width: 100%;
  font-size: .78rem; line-height: 1.4; color: var(--yz-links-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.yz-links-card-foot { display: flex; flex-wrap: nowrap; gap: .2rem; overflow: hidden; margin-top: .05rem; }
.yz-links-tag {
  flex-shrink: 0; white-space: nowrap;
  padding: .02rem .32rem; font-size: .65rem; line-height: 1.45;
  color: var(--yz-links-muted); background: var(--yz-links-canvas);
  border: 1px solid var(--yz-links-line-soft); border-radius: 5px;
}

/* 右上角状态：默认半透明，hover 时显现（linyu） */
.yz-links-card-meta { position: absolute; top: .5rem; right: .65rem; z-index: 2; pointer-events: none; }
.yz-links-status {
  display: inline-flex; align-items: center; gap: .28rem;
  font-size: .65rem; letter-spacing: .05em; line-height: 1;
  color: #ef4444; opacity: 1;
}
.yz-links-status i {
  width: 6px; height: 6px; border-radius: 50%; flex: none; background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239,68,68,.14);
}

/* 空结果 */
.yz-links-empty {
  display: none; padding: 2rem 1rem; text-align: center;
  color: var(--yz-links-muted); font-size: .9rem;
}
.yz-links.is-empty .yz-links-empty { display: block; }
.yz-links.is-empty .yz-links-group { display: none; }

/* ---- 底部双卡并排：申请要求 + 本站信息 ---- */
.yz-links-bottom {
  display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1.35rem;
}
@media (max-width: 760px) { .yz-links-bottom { grid-template-columns: 1fr; } }
.yz-links-mecard, .yz-links-apply {
  padding: 1rem 1.05rem; border-radius: var(--yz-radius-md); min-width: 0;
  background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line);
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.yz-links-me-head, .yz-links-apply-head {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .75rem; color: var(--yz-links-accent); font-size: .9rem;
}
.yz-links-me-head svg, .yz-links-apply-head svg { width: 17px; height: 17px; flex: 0 0 17px; }

/* 本站信息：逐行独立复制，按钮默认隐藏、悬停显现 */
.yz-links-me-rows { display: flex; flex-direction: column; gap: .4rem; }
.yz-links-me-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .7rem; min-height: 2.4rem;
  background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line-soft);
  border-radius: var(--yz-radius-md); font-size: .8rem;
  transition: border-color .2s, background .2s;
}
.yz-links-me-row:hover {
  border-color: color-mix(in srgb, var(--yz-links-accent) 35%, var(--yz-links-line));
  background: color-mix(in srgb, var(--yz-links-accent) 4%, var(--yz-links-surface));
}
.yz-links-me-key { flex: 0 0 auto; min-width: 2.6rem; color: var(--yz-links-faint); font-size: .74rem; white-space: nowrap; }
.yz-links-me-val { flex: 1 1 auto; min-width: 0; color: var(--yz-links-ink); word-break: break-all; }
.yz-links-me-copy {
  flex: 0 0 auto; appearance: none; cursor: pointer;
  padding: .22rem .62rem; font-size: .72rem;
  color: var(--yz-links-accent);
  background: color-mix(in srgb, var(--yz-links-accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--yz-links-accent) 28%, var(--yz-links-line));
  border-radius: 999px;
  opacity: 0; transform: translateX(3px); pointer-events: none;
  transition: opacity .2s, transform .2s, background .2s, color .2s;
}
.yz-links-me-row:hover .yz-links-me-copy,
.yz-links-me-copy:focus-visible { opacity: 1; transform: translateX(0); pointer-events: auto; }
.yz-links-me-copy:hover { background: var(--yz-links-accent); color: #fff; border-color: var(--yz-links-accent); }
html.dark .yz-links-me-copy:hover { color: #0f172a; }
/* 触屏设备无 hover：始终显示复制按钮 */
@media (hover: none) {
  .yz-links-me-copy { opacity: 1; transform: none; pointer-events: auto; }
}

/* 申请要求：数字圆标 + 加粗标题 + 描述 */
.yz-links-apply-body { color: var(--yz-links-muted); font-size: .84rem; line-height: 1.7; }
.yz-links-apply-body p { margin: .3rem 0; }
/* 去掉 Markdown 空段落造成的顶部空白 */
.yz-links-apply-body p:empty { display: none; }
.yz-links-apply-body > p:first-child { margin-top: 0; }
.yz-links-rule { display: flex; align-items: flex-start; gap: .55rem; margin: 0 0 .7rem; }
.yz-links-rule:last-child { margin-bottom: 0; }
.yz-links-rule-num {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; line-height: 1;
  color: #fff; background: var(--yz-links-accent); border-radius: 6px;
}
.yz-links-rule-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.yz-links-rule-body strong { color: var(--yz-links-ink); font-size: .84rem; font-weight: 700; line-height: 1.55; }
.yz-links-rule-desc { color: var(--yz-links-muted); font-size: .84rem; line-height: 1.55; }

/* ---- 悬停截图浮层 ---- */
.yz-links-shot {
  position: absolute; z-index: 30; left: 50%; top: calc(100% + 8px);
  width: 250px; transform: translateX(-50%) translateY(4px);
  padding: 5px; pointer-events: none; opacity: 0; visibility: hidden;
  background: var(--yz-links-surface);
  border: 1px solid var(--yz-links-line);
  border-radius: 10px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.35);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.yz-links-shot img { width: 100%; display: block; border-radius: 6px; aspect-ratio: 16/9; object-fit: cover; }
.yz-links-card:hover .yz-links-shot { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .yz-links-shot { display: none; }
  .yz-links-toolbar { gap: .5rem; }
  .yz-links-search { max-width: none; }
  .yz-links-me-row { flex-wrap: wrap; }
  .yz-links-me-val { flex-basis: 100%; order: 3; }
}
