/* Open-source catalog: list cards and the shared detail page. */

body.os-page .search-well {
  padding-bottom: 0;
}

body.search-only.os-page .layout {
  padding-top: 20px;
}

/* Filter panel shares the card grid's column: same left/right edges, 20px under the search. */
body.os-page .os-filter-panel {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
  padding: 14px 14px 12px;
}

.os-lead {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.os-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.os-filter-panel .chips {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 8px;
  width: auto;
}

.os-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.os-cat select {
  height: 32px;
  max-width: min(320px, 72vw);
  padding: 0 28px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e52' d='M1 1.2 6 6.2 11 1.2'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  appearance: none;
}

html[data-theme="dark"] .os-cat select {
  background-color: var(--card);
  border-color: var(--card-border);
}

.os-blurb {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.os-mark {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand-ink);
}

body.os-page .card {
  grid-template-columns: 64px minmax(0, 1fr);
}

body.os-page .card-cover {
  width: 64px;
  background: var(--surface-2);
  box-shadow: none;
  color: var(--brand-ink);
  font-size: 16px;
  font-weight: 700;
}

body.os-page .card-cover::before,
body.os-page .card-cover::after {
  display: none;
}

.os-avatar {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface);
}

.os-detail .soft-icon {
  position: relative;
}

.os-detail .soft-icon .os-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

body.os-page .card {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
}

body.os-page .card-cover {
  width: 48px;
  height: 48px;
  min-height: 48px;
  margin: 12px;
  align-self: center;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: none;
}

body.os-page .card-cover::before,
body.os-page .card-cover::after {
  content: none;
}

.os-avatar-slot {
  position: relative;
}

.os-avatar-slot .os-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.os-page .card-cover .os-avatar-fallback,
.os-detail .os-avatar-fallback {
  position: static;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  width: auto;
  max-width: none;
  inset: auto;
  margin: 0;
  font-size: 16px;
}

.os-detail .soft-icon .os-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 720px) {
  body.os-page .card {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

.os-desc {
  margin: 0;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.7;
}

.os-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.os-facts dt {
  color: var(--muted);
  font-size: 13px;
}

.os-facts dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.os-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.os-pending {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  line-height: 1.6;
}

html[data-theme="dark"] .os-pending {
  background: var(--surface-3);
}

.os-detail .detail-hero h1 {
  overflow-wrap: anywhere;
}

.os-detail .detail-hero {
  margin-bottom: 18px;
}

.os-detail .detail-body {
  display: grid;
  gap: 18px;
}

.os-detail .os-facts {
  gap: 12px 20px;
}

.os-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

@media (max-width: 720px) {
  body.os-page.search-only .topbar {
    height: auto !important;
    min-height: 0 !important;
  }

  body.os-page .search-well {
    top: var(--header-h, 7.75rem);
  }

  /* 窄屏无结果：收紧筛选区与列表之间的空隙，让空状态标题留在页脚上方。 */
  body.os-page:has(.empty:not([hidden])) .layout {
    padding-top: 8px;
  }
  body.os-page:has(.empty:not([hidden])) .os-filter-panel {
    margin-bottom: 8px;
    padding-top: 8px;
    padding-bottom: 6px;
  }
  body.os-page:has(.empty:not([hidden])) .os-lead {
    margin-bottom: 6px;
  }
  body.os-page .empty::before {
    width: 36px;
    height: 48px;
  }
}

/* Download rows reuse the book / Mac dialog: .dl-links, .dl-link, .dl-meta, .btn. */
body.os-page .card:has(.card-actions) {
  align-items: stretch;
}

body.os-page .card-actions {
  padding: 0 14px 12px;
}

body.os-page .dl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin: 0;
}

body.os-page .os-dl-filename {
  color: var(--text);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}

body.os-page .os-dl-filesize {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 同一安装包的多来源（夸克/城通）放在同一个卡片框内 */
body.os-page .os-dl-file-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
body.os-page .os-dl-file-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
body.os-page .os-dl-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
}
body.os-page .os-dl-source + .os-dl-source {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
