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

   Prefix: .rd-training. 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-training {
  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-tr-head {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rd-tr-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-tr-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  color: var(--r-ink);
  margin: 0;
}
.rd-tr-sub {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--r-muted);
  max-width: 640px;
}

/* ---- KPI strip (4-up) ---------------------------------------------------- */
.rd-tr-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.rd-tr-kpi {
  background: var(--r-surface);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-tr-kpi-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-tr-kpi-value {
  font-family: var(--r-font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  color: var(--r-ink);
}
.rd-tr-kpi-sub {
  font-size: 12px;
  color: var(--r-faint);
}

/* ---- main grid (left main | right side) ---------------------------------- */
.rd-tr-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  align-items: start;
  min-height: 0;
}
.rd-tr-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---- shared card chrome -------------------------------------------------- */
.rd-tr-tile {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 18px 20px;
  transition: box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease);
}
.rd-tr-tile:hover {
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-2px);
}
.rd-tr-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.rd-tr-card-title {
  margin: 0;
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h2);
  font-weight: 600;
  color: var(--r-ink);
}
.rd-tr-card-note {
  font-size: 12px;
  color: var(--r-muted);
}

/* ---- Teach Atlas composer ------------------------------------------------ */
.rd-tr-teach {
  background: var(--r-surface);
  border: 1px solid color-mix(in srgb, var(--r-primary) 22%, var(--r-border));
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 18px 20px;
}
.rd-tr-teach-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--r-font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-primary);
  background: var(--r-mint-surface);
  border-radius: 7px;
  padding: 4px 9px;
  margin-bottom: 13px;
}
.rd-tr-teach-tag i { font-size: 12px; }

.rd-tr-teach-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.rd-tr-teach-field {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}
.rd-tr-teach-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  font-family: var(--r-font-body);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--r-body);
  background: var(--r-surface-2);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-control);
  padding: 11px 13px;
  min-height: 60px;
  transition: border-color var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease);
}
.rd-tr-teach-input::placeholder { color: var(--r-faint); }
.rd-tr-teach-input:focus {
  border-color: color-mix(in srgb, var(--r-primary) 55%, transparent);
}
.rd-tr-teach-input:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

.rd-tr-teach-send {
  appearance: none;
  flex: none;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-radius-control);
  background: var(--r-primary);
  color: var(--r-primary-ink);
  font-family: var(--r-font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease);
}
.rd-tr-teach-send:not(:disabled):hover {
  filter: brightness(1.06);
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-1px);
}
.rd-tr-teach-send:not(:disabled):active {
  filter: brightness(.98);
  box-shadow: none;
  transform: translateY(0);
}
.rd-tr-teach-send:disabled { opacity: .5; cursor: not-allowed; }
.rd-tr-teach-send:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

.rd-tr-teach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.rd-tr-chip {
  appearance: none;
  background: var(--r-well);
  color: var(--r-body);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-pill);
  padding: 7px 13px;
  font-family: var(--r-font-body);
  font-size: 12.5px;
  font-weight: 500;
  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-tr-chip:not(:disabled):hover {
  background: var(--r-canvas-raised);
  border-color: color-mix(in srgb, var(--r-primary) 30%, var(--r-border));
  box-shadow: var(--r-shadow-card);
  transform: translateY(-1px);
}
.rd-tr-chip:not(:disabled):active {
  background: var(--r-well);
  box-shadow: none;
  transform: translateY(0);
}
.rd-tr-chip:disabled { opacity: .55; cursor: not-allowed; }
.rd-tr-chip:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

.rd-tr-teach-note {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .02em;
  color: var(--r-faint);
  margin-top: 12px;
}

/* ---- Skills proficiency list --------------------------------------------- */
.rd-tr-skill-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 14px;
  overflow: auto;
  max-height: calc(100vh - 470px);
}
.rd-tr-skill {
  min-width: 0;
}
.rd-tr-skill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.rd-tr-skill-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-tr-skill-meta {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rd-tr-skill-pct {
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-muted);
}
.rd-tr-skill-state {
  font-family: var(--r-font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--r-well);
  color: var(--r-muted);
}
.rd-tr-skill-state[data-band="live"] {
  background: var(--r-mint-surface);
  color: var(--r-mint-ink);
}
.rd-tr-skill-state[data-band="learning"] {
  background: color-mix(in srgb, var(--r-amber) 18%, transparent);
  color: var(--r-amber);
}

.rd-tr-bar {
  height: 7px;
  border-radius: 5px;
  background: var(--r-well);
  overflow: hidden;
}
.rd-tr-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--r-primary), var(--r-primary-2));
  transition: width var(--r-dur) var(--r-ease);
}
.rd-tr-skill-foot {
  font-size: 12px;
  color: var(--r-muted);
  margin-top: 4px;
}

/* ---- Recent learning timeline -------------------------------------------- */
.rd-tr-learn-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}
.rd-tr-learn {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-tr-learn-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--r-mint-surface);
  color: var(--r-primary);
}
.rd-tr-learn-icon i { font-size: 14px; }
.rd-tr-learn-body { flex: 1 1 auto; min-width: 0; }
.rd-tr-learn-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--r-body);
}
.rd-tr-learn-when {
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-faint);
  margin-top: 3px;
}

/* ---- Knowledge sources --------------------------------------------------- */
.rd-tr-src-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}
.rd-tr-src {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-tr-src-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--r-good);
}
.rd-tr-src-dot[data-state="none"] { background: var(--r-faint); }
.rd-tr-src-dot[data-state="learning"] { background: var(--r-amber); }
.rd-tr-src-id { flex: 1 1 auto; min-width: 0; }
.rd-tr-src-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
}
.rd-tr-src-sub {
  display: block;
  font-size: 12px;
  color: var(--r-muted);
}
.rd-tr-src-state {
  flex: none;
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-faint);
}

/* ---- honest empty state (house pattern: icon + title + note) ------------- */
.rd-tr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 28px 14px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
  margin-top: 12px;
}
.rd-tr-empty i { font-size: 26px; color: var(--r-faint); }
.rd-tr-empty-title {
  font-family: var(--r-font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--r-ink);
}
.rd-tr-empty-note {
  font-family: var(--r-font-body);
  font-size: var(--r-fs-body);
  line-height: 1.5;
  color: var(--r-muted);
  max-width: 320px;
}

/* visually-hidden label (accessible) */
.rd-tr-vis-hide {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- entrance motion ------------------------------------------------------ */
@keyframes rd-tr-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.rd-training > * { animation: rd-tr-rise .32s var(--r-ease) both; }
.rd-training > *:nth-child(1) { animation-delay: 0ms; }
.rd-training > *:nth-child(2) { animation-delay: 60ms; }
.rd-training > *:nth-child(3) { animation-delay: 110ms; }
@media (prefers-reduced-motion: reduce) {
  .rd-training > * { animation: none !important; }
}
html[data-rmotion="reduced"] .rd-training > * { animation: none !important; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .rd-tr-grid { grid-template-columns: 1fr; }
  .rd-tr-skill-list { max-height: 52vh; }
}
@media (max-width: 720px) {
  .rd-tr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-tr-teach-row { flex-direction: column; align-items: stretch; }
  .rd-tr-teach-send { width: 100%; }
}
