/* ============================================================
   TriM3 · 友链页（page-links.php）—— 矩形卡片
   整卡为网站实时截图背景，底部渐变信息层（头像 + 名称/描述）
   列数随可用宽度自适应（auto-fill minmax）
   ============================================================ */
.links-page {
  padding: 4px 16px 26px;
}
.links-apply {
  margin: 0 8px 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--md-sys-color-surface-container-high, #ece6f0);
  color: var(--md-sys-color-on-surface-variant, #49454f);
  font-size: 12.5px;
  line-height: 1.6;
}
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.links-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 20px 2px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant, #49454f);
}
.links-group-title:first-child {
  margin-top: 4px;
}
.links-group-title i {
  font-size: 15px;
  color: var(--md-sys-color-primary, #6750a4);
}

/* ---- 矩形卡片 ---- */
.link-bar {
  position: relative;
  display: block;
  height: 100px;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--md-sys-color-primary, #6750a4) 80%, transparent) 0%, color-mix(in srgb, var(--md-sys-color-tertiary, #7d5260) 74%, transparent) 100%);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.link-bar:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--md-sys-color-primary, #6750a4) 24%, transparent);
}
/* 截图背景：直角铺满整卡 */
.link-bar-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0 !important;
  transition: transform 0.5s ease;
}
.link-bar:hover .link-bar-bg {
  transform: scale(1.06);
}
/* 底部渐变遮罩：上部轻透、底部加深保证文字可读 */
.link-bar-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04) 38%, rgba(0, 0, 0, 0.68) 100%);
  pointer-events: none;
}
/* 截图加载失败：渐变底 + 图标/域名 */
.link-bar.is-fallback .link-bar-fallback {
  display: flex;
}
.link-bar-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #fff;
  z-index: 1;
}
.link-bar-fallback i {
  font-size: 24px;
  opacity: 0.85;
}
.link-bar-fallback span {
  font-size: 11px;
  opacity: 0.92;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 底部信息层：一行两列（左头像 / 右名称+描述） */
.link-bar-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
}
.link-bar-avatar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in srgb, var(--md-sys-color-primary, #6750a4) 60%, #000);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32);
  transition: transform 0.25s ease;
}
.link-bar:hover .link-bar-avatar {
  transform: scale(1.06) rotate(-2deg);
}
.link-bar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}
.link-bar-avatar-fallback {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.link-bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.link-bar-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  line-height: 1.3;
}
.link-bar-desc {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1.4;
}
.links-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--md-sys-color-on-surface-variant, #49454f);
}
.links-empty i {
  font-size: 42px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.55;
}
.links-empty p {
  margin: 0;
  font-size: 13px;
}

@media (max-width: 640px) {
  .links-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
  .link-bar {
    height: 92px;
  }
  .link-bar-content {
    padding: 10px 11px;
  }
  .link-bar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
  }
  .links-apply {
    margin: 0 0 12px;
  }
}
