/*
 * Peg card print layout.
 *
 * Every measurement is in millimetres so the browser prints at true size.
 * An A4 sheet (210 x 297mm) holds two cards, one above the other, split by
 * the cut line at 148.5mm. Each card folds in half at 105mm.
 *
 *   OUTSIDE sheet                INSIDE sheet (back of the same paper)
 *   +-----------+-----------+    +-----------+-----------+
 *   | back      | front     |    | peg table | bag       |
 *   | cover     | cover     |    |           | record    |
 *   +- - - - - -+- - - - - -+    +- - - - - -+- - - - - -+   <- cut 148.5mm
 *   | back      | front     |    | peg table | bag       |
 *   +-----------+-----------+    +-----------+-----------+
 *
 * The layout is symmetric about the fold, so a long-edge flip (automatic
 * duplex, or re-feeding the paper) puts each inside directly behind its
 * outside. A printer that shifts the back side can be corrected with
 * --pc-back-x / --pc-back-y (set from the alignment test page).
 */

.pc-doc {
  --pc-font-event: 'EB Garamond', serif;
  --pc-font-msg: 'EB Garamond', serif;
  --pc-font-general: 'EB Garamond', serif;
  --pc-title-size: 24pt;
  --pc-ink: #1a1a1a;
  --pc-rule: #8a8a8a;
  --pc-accent: #1f3d2b;
  --pc-soft: #eef3ef;
  --pc-hair: #c3cfc6;
  --pc-warn: #8f1d1d;
  --pc-frame: block;
  --pc-back-x: 0mm;
  --pc-back-y: 0mm;
  --pc-row-h: 6mm;
  --pc-table-size: 10pt;
  --pc-names-size: 9pt;
  color: var(--pc-ink);
  font-family: var(--pc-font-general);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.pc-doc *,
.pc-doc *::before,
.pc-doc *::after {
  box-sizing: border-box;
}

.pc-sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  overflow: hidden;
  background: #fff;
  break-after: page;
  page-break-after: always;
}

.pc-sheet:last-child {
  break-after: auto;
  page-break-after: auto;
}

.pc-sheet-body {
  position: absolute;
  inset: 0;
}

.pc-inside .pc-sheet-body {
  transform: translate(var(--pc-back-x), var(--pc-back-y));
}

.pc-card {
  position: absolute;
  left: 0;
  width: 210mm;
  height: 148.5mm;
  display: flex;
}

.pc-card.pc-top { top: 0; }
.pc-card.pc-bottom { top: 148.5mm; }

.pc-panel {
  position: relative;
  width: 105mm;
  height: 148.5mm;
  padding: 12mm 11mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4mm;
  text-align: center;
  overflow: hidden;
}

/* Classic double-rule border: a heavier outer rule with a hairline inside */
.pc-frame {
  display: var(--pc-frame);
  position: absolute;
  inset: 5mm;
  border: 0.5mm solid var(--pc-accent);
  pointer-events: none;
}

.pc-frame::after {
  content: '';
  position: absolute;
  inset: 0.8mm;
  border: 0.15mm solid var(--pc-accent);
}

/* Small-caps section label */
.pc-heading {
  font-family: var(--pc-font-general);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pc-accent);
}

/* Rule - diamond - rule ornament */
.pc-orn {
  display: flex;
  align-items: center;
  gap: 2mm;
  width: 30mm;
  color: var(--pc-accent);
  flex: none;
}

.pc-orn::before,
.pc-orn::after {
  content: '';
  flex: 1;
  border-top: 0.2mm solid currentColor;
}

.pc-orn i {
  width: 1.5mm;
  height: 1.5mm;
  background: currentColor;
  transform: rotate(45deg);
}

.pc-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2mm;
}


/* ---------- Cut and fold guides ---------- */

.pc-mark {
  position: absolute;
  pointer-events: none;
}

.pc-cutline {
  left: 0;
  right: 0;
  top: 148.5mm;
  border-top: 0.2mm dashed var(--pc-rule);
}

.pc-cut-tick {
  top: 148.5mm;
  width: 9mm;
  border-top: 0.25mm solid var(--pc-ink);
}

.pc-cut-tick.pc-l { left: 0; }
.pc-cut-tick.pc-r { right: 0; }

.pc-fold-tick {
  left: 105mm;
  height: 3mm;
  border-left: 0.2mm solid var(--pc-rule);
}

/* ---------- Front cover ---------- */

.pc-front {
  gap: 4.5mm;
}

.pc-title {
  font-family: var(--pc-font-event);
  font-size: var(--pc-title-size);
  font-weight: 700;
  line-height: 1.12;
  color: var(--pc-accent);
  overflow-wrap: break-word;
  width: 100%;
}

.pc-image {
  display: block;
  max-width: 70mm;
  max-height: 48mm;
  object-fit: contain;
}

.pc-image.pc-badge {
  width: 38mm;
  height: 38mm;
}

.pc-date {
  font-family: var(--pc-font-msg);
  font-size: 9pt;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pc-welcome {
  font-family: var(--pc-font-msg);
  font-size: 11pt;
  font-style: italic;
  white-space: pre-line;
  line-height: 1.35;
}

.pc-warning {
  max-width: 76mm;
  padding: 1.4mm 3mm;
  border-top: 0.8mm double var(--pc-warn);
  border-bottom: 0.8mm double var(--pc-warn);
  color: var(--pc-warn);
  font-family: var(--pc-font-general);
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: pre-line;
}

/* "Peg 4" roundel for random-draw cards */
.pc-roundel {
  position: relative;
  width: 22mm;
  height: 22mm;
  border-radius: 50%;
  border: 0.5mm solid var(--pc-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--pc-accent);
  flex: none;
}

.pc-roundel::after {
  content: '';
  position: absolute;
  inset: 0.8mm;
  border-radius: 50%;
  border: 0.15mm solid var(--pc-accent);
}

.pc-roundel small {
  font-family: var(--pc-font-general);
  font-size: 6.5pt;
  font-weight: 700;
  letter-spacing: 0.25em;
  margin-left: 0.25em;
}

.pc-roundel b {
  font-family: var(--pc-font-event);
  font-size: 20pt;
  line-height: 1;
}

.pc-tag {
  font-family: var(--pc-font-general);
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pc-accent);
  border: 0.3mm solid var(--pc-accent);
  padding: 1.2mm 3.5mm 1.2mm 4mm;
}

/* ---------- Back cover ---------- */

.pc-back-message {
  font-family: var(--pc-font-msg);
  font-size: 11pt;
  line-height: 1.45;
  white-space: pre-line;
}

.pc-back-message strong {
  color: var(--pc-accent);
  font-family: var(--pc-font-general);
  font-size: 7.5pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pc-brand {
  position: absolute;
  bottom: 10mm;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.pc-brand img {
  width: 13mm;
  height: 13mm;
}

.pc-backcover.pc-has-brand {
  padding-bottom: 26mm;
}

/* Staff cards: list of Guns on the back */
.pc-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 70mm;
  font-family: var(--pc-font-general);
  font-size: var(--pc-table-size);
  text-align: left;
}

.pc-roster li {
  display: flex;
  align-items: center;
  gap: 2.5mm;
  height: var(--pc-row-h);
  line-height: 1.15;
  border-bottom: 0.1mm solid var(--pc-hair);
}

.pc-roster .pc-n {
  width: 6mm;
  text-align: right;
  color: var(--pc-accent);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.pc-roster .pc-who {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pc-roster .pc-write {
  flex: none;
  font-size: 0.8em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pc-accent);
}

.pc-roster .pc-write::after {
  content: '';
  display: inline-block;
  width: 10mm;
  margin-left: 1.5mm;
  border-bottom: 0.15mm solid var(--pc-ink);
}

/* ---------- Inside: peg plan ---------- */

.pc-pegs {
  gap: 3mm;
  padding: 11mm 9mm;
}

.pc-table {
  border-collapse: collapse;
  font-family: var(--pc-font-general);
  font-size: var(--pc-table-size);
}

.pc-table th,
.pc-table td {
  height: var(--pc-row-h);
  padding: 0 1.7mm;
  text-align: center;
  white-space: nowrap;
}

.pc-table td {
  border-bottom: 0.1mm solid var(--pc-hair);
}

.pc-table tbody tr:nth-child(even) td {
  background: var(--pc-soft);
}

.pc-table tbody tr:last-child td {
  border-bottom: 0.35mm solid var(--pc-accent);
}

.pc-table thead th {
  font-size: 7pt;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pc-accent);
  vertical-align: bottom;
  padding-bottom: 1.2mm;
  border-bottom: 0.35mm solid var(--pc-accent);
}

.pc-table thead tr.pc-caption th {
  border-bottom: 0;
  padding-bottom: 0;
  height: auto;
  letter-spacing: 0.22em;
}

.pc-table th.pc-name,
.pc-table td.pc-name {
  text-align: left;
  padding-left: 1mm;
  padding-right: 3mm;
}

.pc-table td.pc-name span {
  display: block;
  max-width: 36mm;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-table .pc-num {
  font-variant-numeric: tabular-nums lining-nums;
  min-width: 6.5mm;
}

.pc-vertical {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-height: 28mm;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.pc-names {
  font-family: var(--pc-font-general);
  font-size: var(--pc-names-size);
  line-height: 1.4;
  columns: 2;
  column-gap: 5mm;
  text-align: left;
  width: 78mm;
}

.pc-names div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-names.pc-single {
  columns: 1;
  text-align: center;
  width: auto;
}

/* Random draw: this card's pegs as a row of rings */
.pc-yours {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.5mm;
}

.pc-yours > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2mm;
  font-family: var(--pc-font-general);
  font-size: 7pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pc-accent);
}

.pc-ring {
  width: 8mm;
  height: 8mm;
  border-radius: 50%;
  border: 0.35mm solid var(--pc-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pc-font-general);
  font-size: 12pt;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--pc-ink);
  font-variant-numeric: lining-nums;
}

/* ---------- Inside: bag record ---------- */

.pc-bag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 68mm;
  font-family: var(--pc-font-general);
  font-size: 11pt;
  text-align: left;
}

.pc-bag-list li {
  display: grid;
  grid-template-columns: 24mm 1fr;
  align-items: end;
  height: 9mm;
  padding-bottom: 1mm;
}

.pc-bag-list li::after {
  content: '';
  flex: 1;
  border-bottom: 0.15mm solid var(--pc-hair);
  margin-bottom: 0.6mm;
}

.pc-bag-list li.pc-total {
  margin-top: 2.5mm;
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pc-accent);
}

.pc-bag-list li.pc-total::after {
  border-bottom: 0.8mm double var(--pc-accent);
}

/* ---------- Printer alignment test page ---------- */

.pc-cal-line-v {
  left: 105mm;
  top: 0;
  bottom: 0;
  border-left: 0.25mm solid #000;
}

.pc-cal-line-h {
  left: 0;
  right: 0;
  top: 148.5mm;
  border-top: 0.25mm solid #000;
}

.pc-cal-ruler {
  font-family: 'Inter', sans-serif;
  font-size: 5pt;
  line-height: 1;
}

.pc-cal-label.pc-cal-vlabel {
  transform: translate(0, -50%);
}

.pc-cal-tick {
  position: absolute;
  background: #000;
}

.pc-cal-label {
  position: absolute;
  transform: translate(-50%, 0);
}

.pc-cal-note {
  position: absolute;
  left: 15mm;
  right: 15mm;
  font-family: 'Inter', sans-serif;
  font-size: 9pt;
  line-height: 1.45;
  text-align: center;
}

/* keep the back message clear of the logo badge */
.pc-backcover {
  padding-bottom: 30mm;
}
