/*
 * Admit card. Shared by the screen views, browser printing and the PDF.
 * Everything is scoped to `.ac` so it can be loaded on any page.
 *
 * Designed to print on ONE A4 portrait page (194mm × ~270mm usable after the
 * 8mm page margins and the "Downloaded on" footer) with at least 14 papers,
 * including paper names that wrap onto a second line. Keep vertical sizes
 * compact when changing anything here; `fitAdmitCard` (admit-card-print.js)
 * only scales the card down as a last resort.
 */
.ac {
  --ac-ink: #000;
  --ac-muted: #555;
  --ac-rule: #000;
  --ac-hairline: #9a9a9a;
  --ac-fill: #ececec;

  box-sizing: border-box;
  width: 100%;
  max-width: 194mm;
  margin: 0 auto;
  padding: 0;
  background: #fff;
  color: var(--ac-ink);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 9pt;
  line-height: 1.3;
  text-align: left;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ac *,
.ac *::before,
.ac *::after {
  box-sizing: border-box;
}

.ac h1,
.ac h2,
.ac p,
.ac dl,
.ac dd,
.ac ol {
  margin: 0;
}

.ac img {
  max-width: 100%;
}

/* ── Header ─────────────────────────────────────────────── */
.ac-header {
  text-align: center;
  padding-bottom: 2mm;
  border-bottom: 0.5mm solid var(--ac-rule);
}

.ac-logo {
  display: block;
  width: 125mm;
  height: auto;
  margin: 0 auto 2mm;
}

.ac-title {
  display: inline-block;
  padding: 0.6mm 5mm;
  border: 0.35mm solid var(--ac-rule);
  font-size: 12pt;
  font-weight: 700;
  letter-spacing: 0.25em;
  line-height: 1.2;
  text-transform: uppercase;
  /* Optical centring: letter-spacing adds trailing space after the last letter. */
  text-indent: 0.25em;
}

.ac .ac-subtitle {
  margin-top: 1.2mm;
  font-size: 10pt;
  font-weight: 700;
}

.ac .ac-note {
  color: var(--ac-muted);
  font-size: 7.5pt;
  font-style: italic;
}

/* ── Candidate details + photograph ─────────────────────── */
.ac-identity {
  display: flex;
  gap: 4mm;
  align-items: flex-start;
  margin-top: 3mm;
}

.ac-details {
  flex: 1;
  display: grid;
  grid-template-columns: 2fr 1fr;
  border-top: 0.25mm solid var(--ac-hairline);
  border-left: 0.25mm solid var(--ac-hairline);
}

.ac-field {
  min-width: 0;
  padding: 0.9mm 2mm;
  border-right: 0.25mm solid var(--ac-hairline);
  border-bottom: 0.25mm solid var(--ac-hairline);
}

.ac-field dt {
  color: var(--ac-muted);
  font-size: 6.5pt;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.ac-field dd {
  font-size: 8.5pt;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ac-field .ac-name {
  font-size: 9.5pt;
}

.ac-photo {
  flex: 0 0 26mm;
  height: 32mm;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.35mm solid var(--ac-rule);
  padding: 0.6mm;
  text-align: center;
  color: var(--ac-muted);
  font-size: 6.5pt;
}

.ac-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Schedule ───────────────────────────────────────────── */
.ac-schedule {
  margin-top: 3.5mm;
}

.ac .ac-section-title {
  margin-bottom: 1mm;
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ac-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.5pt;
  line-height: 1.25;
}

.ac-table th,
.ac-table td {
  padding: 0.9mm 1.8mm;
  border: 0.25mm solid var(--ac-rule);
  text-align: left;
  vertical-align: middle;
}

.ac-table th {
  background: var(--ac-fill);
  font-size: 7pt;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ac-table tr {
  break-inside: avoid;
}

.ac .ac-center {
  text-align: center;
}

.ac-strong {
  font-weight: 700;
}

.ac-mono {
  font-variant-numeric: tabular-nums;
}

.ac-nowrap {
  white-space: nowrap;
}

.ac-muted {
  color: var(--ac-muted);
  font-style: italic;
}

/* ── QR code + signature ────────────────────────────────── */
.ac-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6mm;
  margin-top: 4mm;
}

.ac-qr {
  display: flex;
  align-items: center;
  gap: 2.5mm;
  max-width: 75mm;
  color: var(--ac-muted);
  font-size: 7pt;
  line-height: 1.3;
}

.ac-qr img {
  display: block;
  flex: 0 0 21mm;
  width: 21mm;
  height: 21mm;
  image-rendering: pixelated;
}

.ac-signature {
  margin-left: auto;
  min-width: 50mm;
  text-align: center;
}

.ac-signature img {
  display: block;
  height: 13mm;
  width: auto;
  max-width: 55mm;
  margin: 0 auto 0.8mm;
  object-fit: contain;
}

.ac-signature span {
  display: block;
  padding-top: 0.8mm;
  border-top: 0.25mm solid var(--ac-rule);
  font-size: 8pt;
  font-weight: 700;
}

/* ── Instructions ───────────────────────────────────────── */
.ac-instructions {
  margin-top: 3mm;
  padding-top: 2mm;
  border-top: 0.25mm solid var(--ac-hairline);
  font-size: 7.5pt;
  line-height: 1.35;
  break-inside: avoid;
}

.ac-instructions ol {
  padding-left: 4.5mm;
}

.ac-instructions li + li {
  margin-top: 0.5mm;
}

/* ── Small screens (QR verification page on phones) ────── */
@media screen and (max-width: 640px) {
  .ac-logo {
    width: 100%;
  }

  .ac-identity {
    flex-direction: column-reverse;
  }

  .ac-photo {
    flex-basis: auto;
    width: 26mm;
    align-self: center;
  }

  .ac-details {
    grid-template-columns: 1fr;
  }

  .ac-schedule {
    overflow-x: auto;
  }

  .ac-table {
    min-width: 150mm;
  }
}
