/* ===================================================================
 * letter.css — the admission letter itself.
 *
 * Every number here was measured out of the centre's own PDF
 * (nuhu bamalli admission letter.pdf) with a PDF content-stream dump:
 * text baselines, image placements and rule rectangles, in PostScript
 * points on a 612 x 792 page. Units are pt throughout so the values in
 * this file can be read straight against that measurement.
 *
 * Do not "tidy" these into round numbers. They are the match.
 * =================================================================== */

.letter {
  /* Paper. The centre prints on A4; Letter is available for the original
   * US page. The 468pt text block is identical on both - only --ml, the
   * side margin, changes - so no line ever re-wraps. */
  --page-w: 595.28pt;
  --page-h: 841.89pt;
  --ml: 63.64pt;

  /* Logo and QR. Both are the same height and share one top edge, so they
   * read as an aligned pair across the header. Enlarged from the source
   * document's 46.6x56.2pt logo and 45.5pt QR at the centre's request -
   * the bigger QR also prints at 0.37mm per module, comfortably above the
   * ~0.33mm a phone camera needs. */
  --art-top: 46pt;
  --art-h: 60pt;
  --logo-w: 49.8pt;
  --qr-size: 60pt;

  position: relative;
  box-sizing: border-box;
  width: var(--page-w);
  height: var(--page-h);
  margin: 0;
  background: #fff;
  color: #202529;
  font-family: 'Roboto', sans-serif;
  font-size: 9pt;
  line-height: 1.2;
  /* Deliberately NOT overflow:hidden. If a letter ever outgrows its page,
   * the spill must be visible - a silently clipped signature block is a
   * worse failure than an obviously broken page. The app also outlines the
   * letter in red and says so. */
  overflow: visible;
  /* Letter-spacing: Word's per-run kerning (w:spacing -2/-4 twentieths)
   * averages out to a hair under zero; left at normal so the browser's
   * Roboto metrics drive line breaking, as they do in the source PDF. */
}

/* ---- Header images ------------------------------------------------ */

/* Logo: PDF places Image15 at 46.6 x 56.189pt, origin (86.55, 686.41). */
.letter[data-paper="letter"] {
  --page-w: 612pt;
  --page-h: 792pt;
  --ml: 72pt;
}

.letter__logo {
  position: absolute;
  left: calc(var(--ml) + 12.95pt);
  top: var(--art-top);
  width: var(--logo-w);
  height: var(--art-h);
}

/* QR: PDF places Image18 at 45.5 x 45.5pt, origin (494.5, 697) — its
 * right edge lands exactly on the 540pt right margin. */
.letter__qr {
  position: absolute;
  /* Right edge flush with the right margin: 468pt text block - QR width. */
  left: calc(var(--ml) + 468pt - var(--qr-size));
  top: var(--art-top);
  width: var(--qr-size);
  height: var(--qr-size);
}
.letter__qr canvas,
.letter__qr img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated; /* keep the modules crisp, never blurred */
}

/* ---- Absolutely placed header text ------------------------------- */
/* top = measured baseline - 0.9418 * font-size (Roboto ascent 0.9277em,
 * descent 0.2441em, line-height 1.2). */

.letter__title,
.letter__address,
.letter__centre,
.letter__notification,
.letter__rows {
  position: absolute;
  margin: 0;
}

/* "Nuhu Bamalli Polytechnic" — 22pt, #00B050, condensed to 90% width,
 * centred between the left margin and a 13.7pt right indent.
 * Baseline 70.6pt from the page top. */
.letter__title {
  left: var(--ml);
  top: 49.88pt;
  width: 454.3pt;
  text-align: center;
  font-size: 22pt;
  font-weight: 700;
  color: #00B050;
  white-space: nowrap;
}
.letter__title span {
  display: inline-block;
  transform: scaleX(0.9);
  transform-origin: center;
  /* Word widens the two inter-word gaps (w:spacing 19); without this the
   * title measures 3.6pt narrow and the centred text sits 1.8pt right. */
  word-spacing: 2pt;
}

/* Address line — 9pt, left edge 220.9pt, baseline 84.6pt. */
.letter__address {
  left: calc(var(--ml) + 148.9pt);
  top: 76.12pt;
  white-space: nowrap;
}

/* "Suleja Study Centre, Niger State." — 12pt RED, centred, baseline 99.7pt. */
.letter__centre {
  left: var(--ml);
  top: 88.4pt;
  width: 454.3pt;
  text-align: center;
  font-size: 12pt;
  color: #FF0000;
}

/* "ADMISSION NOTIFICATION" — 10pt bold, centred on the full measure,
 * baseline 123.1pt. */
.letter__notification {
  left: var(--ml);
  top: 113.68pt;
  width: 468pt;
  text-align: center;
  font-size: 10pt;
  font-weight: 700;
  word-spacing: 1.8pt;
}

/* ---- Rules -------------------------------------------------------- */
/* All three: x 75.95pt, width 464.26pt, height 0.5pt.
 * Two are #DFDFDF; the third is black at 10.196% opacity. */
.letter__rule {
  position: absolute;
  left: calc(var(--ml) + 3.95pt);
  width: 464.26pt;
  height: 0.5pt;
  background: #DFDFDF;
}
.letter__rule--top { top: 113.16pt; }
.letter__rule--under-heading { top: 125.96pt; }
.letter__rule--faint {
  top: 175.71pt;
  background: #000;
  opacity: 0.10196;
}

/* ---- Data rows ---------------------------------------------------- */
/* Column 1 at 75.95pt, column 2 at 315.6pt.
 * Baselines 139.1, 152.7, 165.7pt. */
/* One anchored block, three rows in normal flow. If a very long name wraps,
 * the rows below move down with it rather than printing over it. */
.letter__rows {
  left: calc(var(--ml) + 3.95pt);
  width: 464.05pt;
  top: 130.62pt;
}
.letter__row { display: flex; }
.letter__row--1 { line-height: 13.6pt; }
.letter__row--2 { line-height: 13pt; }
.letter__row--3 { line-height: 10.8pt; }
.letter__row > span:first-child {
  width: 239.65pt;
  flex: 0 0 239.65pt;
}

/* ---- Flowed body -------------------------------------------------- */
/* Everything from the opening sentence down flows, so a value that wraps
 * to an extra line pushes what follows down — exactly as it does in Word.
 * Anchored so the opening sentence's first baseline lands at 195.7pt. */
.letter__body {
  position: absolute;
  left: var(--ml);
  top: 185.47pt;
  width: 468pt;
}

.letter__body p,
.letter__body ol {
  margin: 0;
  padding: 0;
}

/* Opening sentence — indented 11.9pt, right edge 510.65pt, leading 13.1pt. */
.letter__intro {
  margin-left: 11.9pt !important;
  width: 426.75pt;
  line-height: 13.1pt;
}

/* a. / b. / c. — markers at 22.9pt, text at 31.85pt (relative to the
 * margin). Label bold, value regular. */
.letter__programme {
  list-style: none;
  margin-top: 10.35pt !important;
}
.letter__programme li {
  position: relative;
  padding-left: 31.85pt;
  line-height: 10.8pt;
  margin-top: 2.55pt;
}
.letter__programme li:first-child { margin-top: 0; }
.letter__programme li .letter__marker { left: 22.9pt; }
.letter__programme b { font-weight: 700; }

/* "It is also subject to your:" / "You should also note the followings:"
 * both sit on the left margin. The second is bold. */
.letter__lead {
  line-height: 12pt;
  margin-top: 13.8pt !important;
  margin-bottom: -1.3pt !important;
}
.letter__lead--bold {
  font-weight: 700;
  line-height: 16.2pt;
  margin-top: 0 !important;
  margin-bottom: 4.1pt !important;
}

/* The eleven clauses — markers at 18pt, text at 36pt, justified to the
 * right margin, 1.5 line spacing (16.2pt at 9pt). */
.letter__clauses { list-style: none; }

/* List markers are literal text in the markup, not CSS counters: counters
 * are scoped per list and the html2canvas export path renders them wrong,
 * which restarted the second list at 2 instead of 6. */
.letter__marker {
  position: absolute;
  font-style: normal;
}
.letter__clauses li {
  position: relative;
  padding-left: 36pt;
  line-height: 16.2pt;
  text-align: justify;
  text-justify: inter-word;
}
.letter__clauses li .letter__marker { left: 18pt; }
/* Items 7-11 carry Word's 4pt "after" spacing; item 6 does not. */
.letter__clauses--rest li { margin-bottom: 4pt; }
.letter__clauses--rest li:first-child { margin-bottom: 0; }

/* Item 8 underlines the session and the commencement date, and the
 * ordinal suffix is superscript — both as in the original. */
.letter__clauses u { text-decoration: underline; }
.letter__clauses sup {
  font-size: 6pt;
  vertical-align: 2.5pt;
  line-height: 0;
}

/* ---- Signature ---------------------------------------------------- */

.letter__congrats {
  line-height: 16.2pt;
  margin-left: 4pt !important;
  margin-top: 24.3pt !important;
}
.letter__sign {
  width: 463.95pt;
  text-align: center;
  line-height: 10.9pt;
}

/* The signature line: in the source it is a run of underscores in the
 * theme font (not Roboto) plus Word's own underline rectangle, which the
 * PDF draws at x 196.37pt, width 215.18pt, height 0.6pt. Reproduced as
 * that rectangle — underscores in Roboto measure 20pt narrower. */
.letter__sign-rule {
  width: 215.18pt;
  height: 0.6pt;
  /* Left offset measured from the PDF (196.37pt) rather than auto-centred,
   * which would centre it in the 468pt measure instead. */
  margin: 14.64pt 0 0 124.385pt;
  background: #202529;
}

.letter__sign--name,
.letter__sign--role { font-weight: 700; }
.letter__sign--name {
  margin-top: 0.81pt !important;
  word-spacing: 0.53pt;
}
.letter__sign--role {
  line-height: 10.35pt;
  margin-top: 0.78pt !important;
  letter-spacing: -0.14pt;
}
