/* Random Group Generator (#003). Only this tool's own pieces; everything else is the shared tool frame.
   Colours come from the site's variables only (tests/catalogue.test.mjs checks there are no hex values here). */

/* The names box is the whole input for most people, so it gets room. */
.rg-names { min-height: 196px; font-size: 17px; line-height: 1.55; }
.rg-status { margin: -2px 0 0; min-height: 1.4em; font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }
.rg-status.is-problem, .rg-shape .is-problem { color: var(--graphite); font-weight: 600; }

/* Split: the choice, then the number, then the shape it makes, read as one line of thought. */
.rg-split .chips { margin-bottom: 4px; }
.rg-count { display: flex; align-items: center; gap: 12px; }
.rg-count__l { font-size: 15px; font-weight: 600; }
.rg-shape { margin: 0; min-height: 1.4em; font-size: 15px; color: var(--slate); font-variant-numeric: tabular-nums; }
.rg-shape .link-btn { margin-left: 4px; font-size: 15px; }

/* Rule rows: the shared /css/rules-ui.css (moved there unchanged for #025). */

/* The groups: the people are the content, so names are large and groups are plain columns, not cards. */
.rg-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 26px 30px; margin-top: 28px; }
/* Wider screens and the PDF: the balanced column count the page chooses (data-cols), the same on both so the sheet on
   screen is a true preview of the printout. Phones keep two narrow columns. */
@media (min-width: 561px) {
  .rg-groups[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rg-groups[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rg-groups[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.rg-group { min-width: 0; break-inside: avoid; }
.rg-group h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 10px; padding-bottom: 7px; border-bottom: 2px solid var(--graphite); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.rg-group h3 span { min-width: 0; overflow-wrap: anywhere; }
.rg-group h3 small { flex: none; font-size: 13px; font-weight: 500; color: var(--steel); font-variant-numeric: tabular-nums; }
.rg-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.rg-group li { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.rg-group--empty h3 { border-bottom-color: var(--silver); color: var(--slate); }
.rg-slot { height: 1.3em; border-bottom: 1px dashed var(--silver); }
.rg-more { margin: 8px 0 0; font-size: 13px; color: var(--steel); }
.rg-empty { margin: 0; padding: 36px 0 20px; font-size: 15px; color: var(--steel); }

/* Shuffled names settle into place; a change after making them leaves the old groups faint until made again. */
.rg-in { animation: rg-in 240ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 14ms); }
@keyframes rg-in { from { opacity: 0; transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .rg-in { animation: none; } }
.rg-paper.is-stale .rg-groups { opacity: .38; transition: opacity 200ms ease; }
.rg-stale { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--white); box-shadow: inset 0 0 0 1.5px var(--graphite); font-size: 14px; font-weight: 600; }

#rg-shuffle svg { width: 18px; height: 18px; }

.rg-send { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.rg-send h2 { margin: 0; color: var(--slate); }
.rg-send__btns { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 560px) {
  /* Phones: the shared bar puts Download PDF first; here Shuffle again is the action people repeat, so it leads. */
  .result-bar__actions:has(#rg-shuffle:not([hidden])) #rg-shuffle { grid-column: 1 / -1; order: -2; }
  .result-bar__actions:has(#rg-shuffle:not([hidden])) [data-pdf] { grid-column: auto; order: 0; }
  .result-bar__actions:has(#rg-shuffle:not([hidden])) .btn { padding-inline: 12px; white-space: nowrap; }
  /* Copy across the width, WhatsApp and Email paired underneath: the same rhythm as the bar above the groups. */
  .rg-send__btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .rg-send__btns .btn { width: 100%; justify-content: center; min-height: 44px; white-space: nowrap; }
  .rg-send__btns #rg-copy { grid-column: 1 / -1; }
  .rg-groups { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 22px 20px; }
}

@media print {
  .rg-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7mm 8mm; margin-top: 7mm; }
  .rg-groups[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14mm; }
  .rg-groups[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rg-groups[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 6mm; }
  .rg-group h3 { font-size: 12pt; padding-bottom: 1.5mm; border-bottom-width: 1.5pt; margin-bottom: 2.5mm; }
  .rg-group h3 small { font-size: 9pt; }
  .rg-group ul { gap: 1.8mm; }
  .rg-group li { font-size: 11.5pt; }
  .rg-paper.is-stale .rg-groups { opacity: 1; }
}
