/*
 * report-kit.css: styles for the pieces report-kit-ui.js draws (rk- classes),
 * shared by every report built on the report kit (FRAMEWORK_TEMPLATE.md §3e).
 *
 * A framework sets its own colour on the page:
 *   :root { --rk-accent: #be123c; }
 * Report sections use the light results-panel palette every framework's
 * report sits on. The target bar sits above the questions, on whatever the
 * page's own background is, so it takes its colours from the page (a
 * translucent ground and inherited text) and works on light and dark pages.
 * Lists reuse each framework's results-issues, issue-item and issue-badge.
 */

/* ── The target bar and picker ── */
.rk-target-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  margin-bottom: 18px;
  border: 1px solid rgba(127, 127, 127, .3);
  border-radius: 10px;
  background: rgba(127, 127, 127, .07);
  color: inherit;
}
.rk-target-label { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.rk-target-select {
  padding: 6px 10px;
  border: 1.5px solid rgba(127, 127, 127, .45);
  border-radius: 8px;
  background: #fff;
  color: #1c2a38;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  max-width: 100%;
}
.rk-target-select:focus-visible { outline: 2px solid var(--rk-accent, #1d4ed8); outline-offset: 2px; }
.rk-target-select:disabled { opacity: .7; cursor: not-allowed; }
.rk-target-hint { font-size: .8rem; opacity: .8; flex: 1 1 14rem; min-width: 0; }

.rk-target-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.rk-target-head h3 { margin: 0; }
.rk-target-picker { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; font-size: .82rem; font-weight: 600; color: #5a6a7a; }
/* A long target name doesn't widen a narrow phone: the select shrinks with the line. */
.rk-target-picker .rk-target-select { min-width: 0; }

/* ── Text in a report section ── */
.rk-lead { font-size: .87rem; color: #1c2a38; margin: 0 0 12px; line-height: 1.55; max-width: 80ch; }
.rk-muted { font-size: .82rem; color: #5a6a7a; margin: 0 0 12px; line-height: 1.5; max-width: 80ch; }
.rk-summary {
  font-size: .9rem;
  font-weight: 600;
  color: var(--rk-accent, #1d4ed8);
  background: #f4f7fb;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 14px;
  line-height: 1.5;
}
.rk-note {
  font-size: .82rem;
  color: #7a4f00;
  background: #fff8e6;
  border: 1px solid #f3d38a;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
  line-height: 1.5;
}

/* ── The ladder: each unit against the target ── */
.rk-ladder { display: grid; gap: 8px; margin: 0 0 18px; }
.rk-ladder-row {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 3rem minmax(0, 8rem);
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: #1c2a38;
}
.rk-ladder-name { font-weight: 600; color: var(--rk-accent, #1d4ed8); overflow-wrap: anywhere; }
.rk-ladder-bar { position: relative; height: 8px; background: #dde3ea; border-radius: 4px; }
.rk-ladder-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--rk-accent, #1d4ed8); }
.rk-target-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: #1c2a38;
  border-radius: 1px;
}
.rk-ladder-score { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.rk-ladder-status { color: #1a7a4a; font-weight: 600; }
.rk-ladder-row.is-below .rk-ladder-status { color: #c0392b; }

/* ── Items to put in place ── */
.rk-items { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
ul.rk-items { list-style: none; padding-left: 0; }
.rk-item { font-size: .87rem; color: #1c2a38; }
.rk-item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rk-item-name { font-weight: 700; color: var(--rk-accent, #1d4ed8); overflow-wrap: anywhere; }
.rk-item-line { margin: 4px 0 0; line-height: 1.5; max-width: 80ch; }
.rk-item-line strong { color: var(--rk-accent, #1d4ed8); font-weight: 600; }
.rk-item-line--muted { color: #5a6a7a; }
.rk-item-line--warn strong { color: #b45309; }
.rk-chip {
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
  background: #eef1f5;
  color: #5a6275;
}
.rk-chip--critical { background: #c0392b; color: #fff; }
.rk-chip--bad      { background: #fde8e8; color: #a12a1f; }
.rk-chip--warn     { background: #fef3cd; color: #856404; }
.rk-chip--good     { background: #e6f4ec; color: #1a7a4a; }
.rk-gain { font-size: .75rem; font-weight: 600; color: #1a7a4a; white-space: nowrap; }
.rk-ref {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: .72rem;
  color: #5a6a7a;
  background: #f1f4f8;
  border-radius: 4px;
  padding: 0 5px;
}
.rk-tag {
  margin-left: 6px;
  font-size: .7rem;
  font-weight: 600;
  color: #5a6a7a;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 0 6px;
}
.rk-unit { border-top: 1px solid #dde3ea; padding-top: 14px; margin-top: 14px; }
.rk-unit h4 { font-size: .95rem; color: var(--rk-accent, #1d4ed8); margin: 0 0 4px; }
.rk-also { margin-top: 10px; font-size: .82rem; color: #5a6a7a; }
.rk-also summary { cursor: pointer; font-weight: 600; }
.rk-also ul { margin: 6px 0 0; padding-left: 20px; }
.rk-next {
  margin-top: 12px;
  background: none;
  border: 1.5px solid var(--rk-accent, #1d4ed8);
  color: var(--rk-accent, #1d4ed8);
  border-radius: 8px;
  padding: 7px 14px;
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
.rk-next:focus-visible { outline: 2px solid var(--rk-accent, #1d4ed8); outline-offset: 2px; }

/* ── The roadmap ── */
.rk-phase { border: 1px solid #dde3ea; border-radius: 8px; padding: 12px 14px; margin-top: 10px; color: #1c2a38; }
.rk-phase-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rk-phase-name { font-weight: 700; color: var(--rk-accent, #1d4ed8); }
.rk-phase-focus { font-size: .85rem; color: #5a6a7a; }
.rk-phase-date { margin-left: auto; font-size: .82rem; font-weight: 600; color: #5a6a7a; white-space: nowrap; }
.rk-phase-closes, .rk-phase-actions { margin: 4px 0 0; padding-left: 20px; font-size: .85rem; line-height: 1.5; }
.rk-phase-closes { list-style: none; padding-left: 0; display: grid; gap: 3px; }
.rk-phase-actions li { margin-top: 3px; }

/* ── Under each question ── */
.rk-good-note { margin: 6px 0 10px; font-size: .82rem; }
.rk-good-note summary { cursor: pointer; font-weight: 600; color: var(--rk-accent, #1d4ed8); }
.rk-good-note p { margin: 6px 0 0; line-height: 1.5; max-width: 80ch; }

/* ── The print cover's "At a glance" box ── */
.rk-glance {
  margin: 14px 0;
  padding: 10px 14px;
  border: 1px solid #dde3ea;
  border-left: 4px solid var(--rk-accent, #1d4ed8);
  border-radius: 6px;
  background: #fbfcfd;
  font-size: 9.5pt;
  color: #1c2a38;
}
.rk-glance-title { font-weight: 700; color: var(--rk-accent, #1d4ed8); margin-bottom: 4px; }
.rk-glance-row { display: flex; gap: 10px; padding: 2px 0; border-top: 1px solid #eef1f5; }
.rk-glance-row:first-of-type { border-top: none; }
.rk-glance-row > span { flex: 0 0 38mm; color: #5a6a7a; }
.rk-glance-row > strong { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  .rk-ladder-fill { transition: none; }
}

/* ── Phones ── */
@media (max-width: 600px) {
  .rk-target-bar { flex-direction: column; align-items: stretch; padding: 10px 14px; }
  .rk-target-label { white-space: normal; }
  .rk-target-hint { flex: none; }
  .rk-ladder-row { grid-template-columns: minmax(0, 1fr) 3rem minmax(0, 7rem); row-gap: 4px; }
  .rk-ladder-name { grid-column: 1 / -1; }
  .rk-glance-row { flex-direction: column; gap: 0; }
  .rk-glance-row > span { flex: none; }
}

/* ── Print ── */
@media print {
  .rk-target-bar, .rk-target-picker, .rk-next { display: none !important; }
  .rk-good-note { display: none !important; }
  .rk-phase, .rk-item, .rk-ladder-row, .rk-glance, .rk-note, .rk-summary, .rk-lead { break-inside: avoid; page-break-inside: avoid; }
  .rk-section h3, .rk-unit h4, .rk-lead, .rk-muted, .rk-target-head { break-after: avoid; page-break-after: avoid; }
  .rk-target-marker, .rk-ladder-fill, .rk-ladder-bar, .rk-chip, .rk-ref {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
