/* Random Pairs. Read on a projector and on paper: one display face for names
   and headings, the system face for everything else, one accent that behaves
   like a highlighter pen, and red only for an absent name. */
:root {
  --ink: #1b2a41;
  --paper: #ffffff;
  --sheet: #f3f5f7;
  --highlight: #ffe066;
  --highlight-edge: #e6c94a;
  --marker: #d62828;
  --muted: #5c6b7a;
  --line: #d5dbe1;
  --display: "Bricolage Grotesque Variable", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
html { background: var(--sheet); }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  line-height: 1.5;
}
main { max-width: 68rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* The hidden attribute must beat any display rule below. */
[hidden] { display: none !important; }
a, a:visited { color: var(--ink); text-underline-offset: 0.15em; }

/* Type */
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.02em; }
h1 { font-weight: 700; font-size: clamp(2rem, 4.5vw, 3.25rem); line-height: 1.02; margin: 0 0 0.75rem; }
h2 { font-weight: 700; font-size: 1.5rem; margin: 0 0 0.5rem; }
h3 { font-weight: 600; font-size: 1.1rem; margin: 1.5rem 0 0.25rem; }
.lede { max-width: 46rem; font-size: 1.1rem; color: var(--muted); margin: 0 0 2rem; }
.feedback, .hint { color: var(--muted); font-size: 0.95rem; margin: 0.35rem 0; }

/* Form */
label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; }
input[type="text"], textarea, select {
  width: 100%; font: inherit; padding: 0.6rem 0.75rem; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: inherit;
}
/* One chevron for every select, inset from the edge, instead of the native
   one that sits flush against it. */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%231b2a41' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 0.9rem center;
}
textarea { font-family: var(--display); font-size: 1.2rem; line-height: 1.4; min-height: 16rem; resize: vertical; }
button {
  font: inherit; padding: 0.55rem 1rem; cursor: pointer; color: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
button[disabled] { opacity: 0.45; cursor: default; }
/* The shorten-names offer: a highlighter band directly under the list box. */
.offer {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: baseline;
  margin: 0.5rem 0 0; padding: 0.6rem 0.9rem;
  background: var(--highlight); border: 1px solid var(--highlight-edge); border-radius: 8px;
  font-weight: 600;
}
.offer .textButton { color: var(--ink); font-weight: 600; }
button.textButton { border: none; background: transparent; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 0.15em; }
button.danger { color: var(--marker); border-color: currentColor; background: transparent; }
.controls { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0; align-items: center; }
#setupForm .controls .primary { padding: 0.8rem 1.6rem; font-size: 1.05rem; }
.setupOptions, .keepApartOptions { margin: 1.25rem 0; }
.optionsCard {
  margin-top: 0.75rem; padding: 0.25rem 1.25rem 1.25rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 0 rgba(27, 42, 65, 0.06);
}
.optionsCard > label:first-of-type { margin-top: 0.75rem; }
.setupOptions > summary, .keepApartOptions > summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.keepApartOptions fieldset { border: none; margin: 0; padding: 0.5rem 0 0; }
.keepApartRow { display: flex; gap: 0.5rem; }
.visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Round view: the wall chart */
.roundHeader { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.5rem; margin: 0 0 0.5rem; }
.roundHeading { font-size: clamp(1.75rem, 3.5vw, 2.75rem); line-height: 1.1; margin: 0; }
/* The highlighter sweep: a band that starts a little below the cap height, the
   way a marker pass does. */
.roundNumber {
  background: linear-gradient(transparent 30%, var(--highlight) 30%, var(--highlight) 92%, transparent 92%);
  padding: 0 0.15em; margin: 0 -0.05em;
}
#cycleNote { margin: 0; color: var(--muted); }
.groups {
  list-style: none; padding: 0; margin: 1rem 0 1.5rem;
  display: grid; gap: clamp(0.75rem, 1.2vw, 1rem); align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(clamp(11rem, 18vw, 16rem), 1fr));
}
.group {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; padding: 0.3rem 0;
  box-shadow: 0 1px 0 rgba(27, 42, 65, 0.06);
  animation: settle 200ms ease-out;
}
@keyframes settle { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.member {
  font-family: var(--display); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(1.25rem, 2.2vw, 2rem); line-height: 1.15; text-align: left;
  padding: 0.45rem 0.9rem; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: transparent; color: inherit;
}
.member:first-child { border-top: 0; }
/* The odd group, a three or a solo, is the highlighted card. */
.group[data-reason="trio"], .group[data-reason="solo"] { background: var(--highlight); border-color: var(--highlight-edge); }
.group[data-reason="trio"] .member, .group[data-reason="solo"] .member { border-top-color: rgba(27, 42, 65, 0.18); }
/* Who is away: one chip per person, struck through in marker red when away. */
.absence { margin: 0 0 1.25rem; }
.absence > summary { cursor: pointer; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 0; }
.chip { border-radius: 999px; padding: 0.35rem 0.9rem; font-family: var(--display); font-weight: 600; }
.chip[aria-pressed="true"] {
  color: var(--muted); border-style: dashed;
  text-decoration: line-through; text-decoration-color: var(--marker); text-decoration-thickness: 2px;
}
.group.shuffling { color: var(--muted); animation: none; }
.teacherNotes { font-size: 0.9rem; color: var(--muted); margin: 0 0 1rem; }
.teacherNotes summary { cursor: pointer; }

/* Actions, in order of how often they are used */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 0 0 0.75rem; }
.roundNav { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); overflow: hidden; }
.roundNav > * { border-radius: 0; }
.navArrow { border: 0; background: transparent; padding: 0 1rem; font-size: 1.5rem; line-height: 1; }
.roundInput { margin: 0; font-weight: 400; display: flex; }
.roundInput input {
  width: 4rem; text-align: center; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  border-radius: 0; font-family: var(--display); font-weight: 700; font-size: 1.2rem; padding: 0.5rem 0.25rem;
  appearance: textfield; -moz-appearance: textfield;
}
.roundInput input::-webkit-inner-spin-button, .roundInput input::-webkit-outer-spin-button { display: none; }
.roundNav .primary { padding: 0.6rem 1.25rem; border: 0; }
.quietLinks { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--muted); }
.quietLinks a, .quietLinks a:visited { color: var(--muted); }
#linkStatus { margin: 0; }
.controls.small { margin: 0 0 1rem; gap: 0.5rem; }
.controls.small button { font-size: 0.85rem; padding: 0.35rem 0.7rem; color: var(--muted); }
.controls.small button.danger { color: var(--marker); }

/* Explainer, questions, footer */
.explainer { margin-top: 3.5rem; border-top: 1px solid var(--line); padding-top: 1.5rem; max-width: 46rem; }
.faq { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1.5rem; max-width: 46rem; }
.siteFooter { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 1rem; font-size: 0.9rem; color: var(--muted); }
.siteFooter a, .siteFooter a:visited { color: inherit; }
.siteFooter a + a { margin-left: 1rem; }

/* Cycle sheet */
.cycleRound { break-inside: avoid; margin-bottom: 1.25rem; }
.cycleRound h2 { font-size: 1.15rem; margin: 0 0 0.25rem; }
.cycleRound ul { columns: 2; margin: 0; padding-left: 1.2rem; }
.cycleRound .joiner { opacity: 0.5; }

@media (max-width: 40rem) {
  .groups { gap: 0.9rem; }
  .group { padding: 0.4rem 0; }
  .member { padding: 0.55rem 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .group { animation: none; }
}

.printOnly { display: none; }
@media print {
  /* Nothing that hints at a keep-apart rule or a swap may reach the class. */
  .lede, .hint, .controls, .toolbar, .quietLinks, .absence, .explainer, .faq, .siteFooter,
  .teacherNotes, #setupView, #teacherNotes { display: none !important; }
  html { background: #fff; }
  main { max-width: none; padding: 0; }
  .roundNumber { background: none; }
  .groups { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .group { break-inside: avoid; border: 1px solid #999; box-shadow: none; animation: none; }
  .group[data-reason="trio"], .group[data-reason="solo"] { background: #fff; border: 2px solid #333; }
  .member { font-size: 1.3rem; }
  /* The footer simply follows the content, kept in one piece. */
  .printOnly {
    display: flex; gap: 1rem; align-items: flex-start; font-size: 0.85rem;
    margin-top: 2.5rem; padding-top: 0; break-inside: avoid;
  }
  .printQr svg { width: 3.2cm; height: 3.2cm; }
  .printQr.large svg { width: 5cm; height: 5cm; }
  .printText a { color: inherit; text-decoration: underline; }
}
