@import url("page.css");

.error {
  color: #a00;
  font-weight: bold;
}

.fine-print {
  font-size: 0.85em;
  color: #666;
}

form.family-access {
  display: flex;
  gap: 0.5em;
  margin: 1em 0;
}

form.family-access input {
  flex: 1;
  max-width: 24em;
  padding: 0.4em;
  font-family: monospace;
}

button.copy-button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9em;
  padding: 0 0.25em;
  vertical-align: baseline;
}

button.copy-button:hover {
  color: #06c;
}

table {
  border-collapse: collapse;
}

td,
th {
  padding: 5px 10px;
  text-align: left;
}

.date {
  font-size: 0.75em;
  color: #555;
  white-space: nowrap;
}

th {
  background: #0000ff20;
}

/* Printable slips: two half-page slips per sheet. */

.slips {
  display: flex;
  flex-direction: column;
}

.slip {
  border: 1px dashed #999;
  padding: 1.5em 2em;
  margin: 1em 0;
  page-break-inside: avoid;
  break-inside: avoid;
  text-align: center;
}

.slip .passphrase {
  font-family: monospace;
  font-size: 1.6em;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.slip .qr {
  width: 180px;
  height: 180px;
}

/* Quarter-sheet class sets: four compact slips per printed page. */

.slips.quarter {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.slips.quarter .slip {
  margin: 0;
  padding: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.slips.quarter .slip h2 {
  font-size: 1em;
  margin: 0;
}

.slips.quarter .slip p {
  margin: 0.4em 0;
}

.slips.quarter .slip .student {
  font-size: 1.2em;
}

.slips.quarter .slip .passphrase {
  font-size: 1em;
}

.slips.quarter .slip .qr {
  width: 140px;
  height: 140px;
}

/*
 * Print: US letter with even half-inch margins, so the printable area (7.5in
 * x 10in) is centered on the paper and quartering the GRID also quarters the
 * PAPER — cut the sheet in half horizontally and vertically and each slip's
 * content is centered on its quarter sheet.
 */
@page {
  size: letter portrait;
  margin: 0.5in;
}

@media print {
  /* page.css/base.css lose the general site chrome; slips also drop the
   * heading so the sheet is nothing but slips. */
  h1 {
    display: none;
  }

  /* Half-sheet slips (single mints and family shares): two per page. The
   * box-sizing keeps the 1px cut guides inside the exact-inch boxes. */
  .slip {
    box-sizing: border-box;
    height: 5in;
    margin: 0;
    border: none;
    border-bottom: 1px dashed #999;
  }

  /* Quarter-sheet class sets: a 2x2 grid exactly filling the printable area,
   * four slips per page, content centered within each quarter. Dashed cut
   * guides only on the interior edges (right edge of the left column, bottom
   * edge of the top row of each page-of-four). */
  .slips.quarter {
    gap: 0;
    width: 7.5in;
    grid-template-columns: 3.75in 3.75in;
    grid-auto-rows: 5in;
  }

  .slips.quarter .slip {
    height: auto;
    margin: 0;
    padding: 0.35in;
    border: none;
    break-inside: avoid;
  }

  .slips.quarter .slip:nth-child(odd) {
    border-right: 1px dashed #999;
  }

  .slips.quarter .slip:nth-child(4n + 1),
  .slips.quarter .slip:nth-child(4n + 2) {
    border-bottom: 1px dashed #999;
  }

  /* Each cell's OUTER sides have the 0.5in page margin beyond them; its
   * interior sides (the cut lines) have nothing. Compensate with an extra
   * 0.5in of padding on each cell's two interior sides so that, after
   * cutting, the flex-centered content is centered on the physical quarter
   * sheet rather than a quarter inch toward the page center. Per page of
   * four: 4n+1 top-left, 4n+2 top-right, 4n+3 bottom-left, 4n bottom-right. */
  .slips.quarter .slip:nth-child(4n + 1) {
    padding-right: 0.85in;
    padding-bottom: 0.85in;
  }

  .slips.quarter .slip:nth-child(4n + 2) {
    padding-left: 0.85in;
    padding-bottom: 0.85in;
  }

  .slips.quarter .slip:nth-child(4n + 3) {
    padding-right: 0.85in;
    padding-top: 0.85in;
  }

  .slips.quarter .slip:nth-child(4n) {
    padding-left: 0.85in;
    padding-top: 0.85in;
  }
}
