/**
 * App 推荐工具样式
 * 独立于博客主题，仅作用于页面里的 .ar-grid / .ar-card。
 * 纯静态渲染（数据源 _data/app_recommend.yml），无 JS，暗色模式靠 html[mode=dark]。
 */

#ar-app {
  --ar-border: rgba(128, 128, 128, 0.35);
  --ar-border-strong: rgba(128, 128, 128, 0.55);
  --ar-bg: rgba(128, 128, 128, 0.07);
  --ar-bg-hover: rgba(128, 128, 128, 0.14);
  --ar-text-muted: rgba(128, 128, 128, 0.95);
  --ar-accent: #2f6fde;
  --ar-radius: 8px;
}

html[mode='dark'] #ar-app {
  --ar-bg: rgba(255, 255, 255, 0.06);
  --ar-bg-hover: rgba(255, 255, 255, 0.12);
  --ar-text-muted: rgba(190, 190, 190, 0.95);
  --ar-accent: #5b8ff0;
}

@media (prefers-color-scheme: dark) {
  html:not([mode='light']) #ar-app {
    --ar-bg: rgba(255, 255, 255, 0.06);
    --ar-bg-hover: rgba(255, 255, 255, 0.12);
    --ar-text-muted: rgba(190, 190, 190, 0.95);
    --ar-accent: #5b8ff0;
  }
}

#ar-app .ar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

#ar-app .ar-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--ar-border);
  border-radius: var(--ar-radius);
  background: var(--ar-bg);
  color: inherit;
  text-decoration: none !important;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#ar-app .ar-card:hover {
  background: var(--ar-bg-hover);
  border-color: var(--ar-accent);
  box-shadow: 0 2px 10px rgba(47, 111, 222, 0.12);
}

/* 首字母色块：按序号轮换 6 色（无 JS 也能有区分度） */
#ar-app .ar-dot {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ar-app .ar-c0 { background: #2f6fde; }
#ar-app .ar-c1 { background: #1d9e75; }
#ar-app .ar-c2 { background: #ef9f27; }
#ar-app .ar-c3 { background: #d8442f; }
#ar-app .ar-c4 { background: #7d5bd6; }
#ar-app .ar-c5 { background: #0f9bb5; }

/* 图标容器：色块垫底，线上图标盖在上面；图标加载失败会被 onerror 移除，露出色块 */
#ar-app .ar-icowrap {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
}

/* 站点图标（线上拉取），与色块同尺寸同圆角 */
#ar-app .ar-icon {
  position: absolute;
  inset: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

/* 图标加载成功后隐藏底下的色块（透明图标不再露出灰底/色块） */
#ar-app .ar-icowrap.ar-loaded .ar-dot { visibility: hidden; }

#ar-app .ar-txt { display: flex; flex-direction: column; min-width: 0; gap: 0.12rem; }

#ar-app .ar-name {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ar-app .ar-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#ar-app .ar-meta {
  margin-top: 0.1rem;
  font-size: 0.75rem;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: var(--ar-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ar-app .ar-empty {
  margin: 1.2rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ar-text-muted);
}
