/* Resource library — hub cards, detail layout, spreadsheet preview.
   Tokens come from kh.css; this file only adds what the library needs. */

.kh-resources-chips { margin: calc(-1 * var(--sp-3)) 0 var(--sp-4); }
.kh-resources-chips + .kh-resources-chips { margin-top: 0; }
.kh-resources-chip__count {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--text-3);
}
.kh-chip.is-active .kh-resources-chip__count { color: var(--on-accent); }

.kh-resource-card__tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.kh-resources-nearest { max-width: 32rem; margin-inline: auto; text-align: start; }

/* detail: main column + sticky aside, stacking on phones */
.kh-resource-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-5);
}
@media (min-width: 900px) {
  .kh-resource-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-6) var(--sp-5); }
  .kh-resource-aside { position: sticky; top: 5.5rem; align-self: start; }
}
.kh-resource-main { display: grid; gap: var(--sp-5); min-width: 0; }
.kh-resource-aside { display: grid; gap: var(--sp-5); align-content: start; }
.kh-resource-block { min-width: 0; }

.kh-resource-steps {
  padding-inline-start: 1.4rem;
  list-style: persian;
  display: grid;
  gap: 0.45rem;
  color: var(--text-2);
  line-height: 1.9;
}
[dir='ltr'] .kh-resource-steps { list-style: decimal; }
.kh-resource-steps li::marker { color: var(--accent); font-weight: 700; }

.kh-resource-example {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  display: grid;
  gap: 0.4rem;
}
.kh-resource-example .kh-kicker { color: var(--accent); }
.kh-resource-example p { margin: 0; font-size: var(--fs-small); }

.kh-resource-download {
  display: grid;
  gap: 0.6rem;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.kh-resource-download__btn { width: 100%; }
.kh-resource-download__btn.is-disabled { opacity: 0.55; cursor: not-allowed; }
.kh-resource-download__note { margin: 0; font-size: var(--fs-caption); }

.kh-resource-facts { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
.kh-resource-list {
  display: grid;
  gap: 0.35rem;
  padding-inline-start: 1.1rem;
  list-style: disc;
  font-size: var(--fs-caption);
  color: var(--text-3);
  line-height: 1.8;
}
.kh-resource-list li::marker { color: var(--accent); }

/* spreadsheet preview table */
.kh-resource-preview-wrap {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.kh-resource-preview { min-width: 100%; }
.kh-resource-preview th,
.kh-resource-preview td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.kh-resource-preview th { background: var(--surface); color: var(--text-2); }
.kh-resource-preview td.is-input { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.kh-resource-preview td:empty::after { content: '\00a0'; }
.kh-resource-hint { margin-top: var(--sp-2); font-size: var(--fs-caption); }
