/* ============================================================================
   ATLAS REDESIGN — Training & Resources screen styles  ·  Phase 2
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-resources. Tokens only (--r-*) so Calm (almanac) + Operator
   themes both work automatically. No hardcoded hex. Theme-specific selectors
   (html[data-rtheme="operator"] …) are used only where a token can't express
   the tweak (rare).
   ========================================================================== */

.rd-resources {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- page header --------------------------------------------------------- */
.rd-res-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-res-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-res-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--r-ink);
  margin: 0;
}
.rd-res-sub {
  margin: 2px 0 0;
  font-size: var(--r-fs-body);
  line-height: 1.5;
  color: var(--r-muted);
  max-width: 620px;
}

/* ---- 2-col body (knowledge base | quick reference) ----------------------- */
.rd-res-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
  min-height: 0;
}

/* ---- shared card ----------------------------------------------------------
   Named rd-res-block (not -card/-tile) to avoid the v6-shell [class*="-card"]
   skin AND a literal collision with the unrelated .rd-res-tile category-grid
   item class below (same token would double-apply grid-item chrome + break
   the querySelectorAll(".rd-res-tile") category-fill loop). */
.rd-res-block {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 20px 22px;
  min-height: 0;
}
.rd-res-block-title {
  margin: 0 0 14px;
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h2);
  font-weight: 600;
  color: var(--r-ink);
}

/* ---- knowledge base: 6-tile category grid -------------------------------- */
.rd-res-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rd-res-tile {
  background: var(--r-surface-2);
  border: 1px solid var(--r-hairline);
  border-radius: 13px;
  padding: 15px;
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease);
}
.rd-res-tile:hover {
  border-color: color-mix(in srgb, var(--r-primary) 32%, var(--r-border));
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-2px);
}
.rd-res-tile:active {
  box-shadow: var(--r-shadow-card);
  transform: translateY(-1px);
}
.rd-res-tile:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

.rd-res-tile-chip {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--r-mint-surface);
  color: var(--r-mint-ink);
  align-items: center;
  justify-content: center;
  transition: background var(--r-dur) var(--r-ease),
              color var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease);
}
.rd-res-tile-chip i { font-size: 18px; }
.rd-res-tile:hover .rd-res-tile-chip {
  background: var(--r-primary);
  color: var(--r-primary-ink);
  transform: scale(1.06);
}
.rd-res-tile:active .rd-res-tile-chip { transform: scale(1); }
.rd-res-tile-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
  margin-top: 10px;
}
/* pre-connect: a one-line category purpose (body face, readable) — S1 sweep
   2026-07-03. A real feed count flips it back to the mono data voice. */
.rd-res-tile-count {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--r-muted);
  margin-top: 4px;
}
.rd-res-tile-count[data-live] {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  color: var(--r-faint);
}

/* ---- quick reference: list ----------------------------------------------- */
.rd-res-qref-list {
  display: flex;
  flex-direction: column;
  overflow: auto;
  max-height: calc(100vh - 320px);
}
.rd-res-qref {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 6px;
  border-top: 1px solid var(--r-hairline);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-res-qref:first-child { border-top: none; }
.rd-res-qref:hover { background: var(--r-canvas-raised); }
.rd-res-qref:active { background: var(--r-well); }
.rd-res-qref:focus-visible { outline: var(--r-focus); outline-offset: 2px; }
.rd-res-qref-star { flex: 0 0 auto; font-size: 14px; color: var(--r-amber); }
.rd-res-qref-body { flex: 1 1 auto; min-width: 0; }
.rd-res-qref-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-res-qref-meta {
  font-size: 12px;
  color: var(--r-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-res-qref-go { flex: 0 0 auto; font-size: 13px; color: var(--r-faint); }

/* ---- honest empty state (sells the feature, then states the gap) --------- */
.rd-res-empty {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--r-muted);
  text-align: center;
  padding: 24px 14px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
}

/* ---- entrance motion ------------------------------------------------------ */
@keyframes rd-res-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.rd-resources > * { animation: rd-res-rise .32s var(--r-ease) both; }
.rd-resources > *:nth-child(1) { animation-delay: 0ms; }
.rd-resources > *:nth-child(2) { animation-delay: 70ms; }

@keyframes rd-res-tile-rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.rd-res-tile { animation: rd-res-tile-rise .28s var(--r-ease) both; }
.rd-res-tile:nth-child(1) { animation-delay: 100ms; }
.rd-res-tile:nth-child(2) { animation-delay: 130ms; }
.rd-res-tile:nth-child(3) { animation-delay: 160ms; }
.rd-res-tile:nth-child(4) { animation-delay: 190ms; }
.rd-res-tile:nth-child(5) { animation-delay: 220ms; }
.rd-res-tile:nth-child(6) { animation-delay: 250ms; }

@media (prefers-reduced-motion: reduce) {
  .rd-resources > *, .rd-res-tile { animation: none !important; }
}
html[data-rmotion="reduced"] .rd-resources > *,
html[data-rmotion="reduced"] .rd-res-tile { animation: none !important; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .rd-res-grid { grid-template-columns: 1fr; }
  .rd-res-qref-list { max-height: 52vh; }
}
@media (max-width: 720px) {
  .rd-res-tiles { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .rd-res-block { padding: 16px; }
  .rd-res-tile { padding: 13px; }
  .rd-resources { gap: 14px; }
}
