/* =============================================
   Abrechnung — die Blätter (Papier): das Aufmaßblatt im Fremdformat iTWO (PAPIER.md Regel 12) und das Anlagenblatt,
   gebaut in ab-blatt.js. Lage und Größe der Texte stehen am Element (aus dem Original gemessen: AB_M in ab-blatt.js),
   hier Schrift, Linien und Zeilen. Papier bleibt im Druck, wie es ist; die Bedienteile auf dem Blatt (Felder, × je
   Zeile) stehen in ab.css.
   ============================================= */

/* Liberation Sans (SIL OFL 1.1, assets/fonts/OFL-Liberation.txt): gleich breit wie Arial, der Schrift des Originals,
   damit Zeilen an derselben Stelle enden. Nur hier; block: lieber kurz nichts als die Ersatzschrift im Druck */
@font-face { font-family: 'Liberation Sans'; font-style: normal; font-weight: 400; font-display: block; src: url('../../assets/fonts/liberation-sans-regular.ttf') format('truetype'); }
@font-face { font-family: 'Liberation Sans'; font-style: normal; font-weight: 700; font-display: block; src: url('../../assets/fonts/liberation-sans-bold.ttf') format('truetype'); }

.ab-seite { position: absolute; inset: 0; color: var(--papier-schrift); }
/* iTWO unterschneidet nicht (font-kerning). geometricPrecision: ohne Hinting, sonst rundet Chrome unter Linux die Breiten
   der Webschrift auf ganze Pixel (bis 2 % zu breit oder zu schmal, gemessen am Original) */
.ab-itwo { font-family: 'Liberation Sans', Arial, sans-serif; font-kerning: none; font-size: 9pt; text-rendering: geometricPrecision; }

/* Text an seiner Grundlinie (--y, --pt am Element): text-box schneidet die Zeile an der Grundlinie ab, die Unterkante
   ist dann genau dort (mit top und Zeilenhöhe allein rundet Chrome Ober- und Unterlänge auf ganze Pixel: bis 0,3 mm) */
.ab-t { position: absolute; bottom: calc(297mm - var(--y)); font-size: var(--pt); line-height: 1.117; white-space: pre; text-box: trim-end text alphabetic; }
.ab-fett { font-weight: 700; }
.ab-linie { position: absolute; height: 0; border-top: 0.5pt solid var(--papier-schrift); }
.ab-logo { position: absolute; object-fit: contain; object-position: left center; }

/* Titel und Blattnummer: die Mitte des Titels liegt 55,39 mm vor dem Anfang der Nummer (Breite 2 × 55,39 mm) */
.ab-titelzeile { position: absolute; right: 15mm; bottom: calc(297mm - 81.07mm); display: flex; align-items: flex-end; font-weight: 700; white-space: pre; }
.ab-titel, .ab-nummer { line-height: 1.117; text-box: trim-end text alphabetic; }
.ab-titel { width: 110.78mm; font-size: 11.04pt; text-align: center; }
.ab-nummer { font-size: 14.04pt; }

/* Zeilen zu 3,6 mm, Unterkante auf der Grundlinie (--y); Spalten am Element (links bzw. rechts in mm) */
.ab-zeile { position: absolute; bottom: calc(297mm - var(--y)); left: 0; width: 210mm; height: 3.6mm; }
.ab-z { position: absolute; bottom: 0; line-height: 1.117; white-space: pre; text-box: trim-end text alphabetic; }

/* Ohne text-box (ältere Browser): über die Oberlänge von Liberation Sans (0,905) und die Unterlänge (0,212) */
@supports not (text-box: trim-end text alphabetic) {
  .ab-t { bottom: auto; top: calc(var(--y) - 0.905 * var(--pt)); }
  .ab-titelzeile { bottom: calc(297mm - 81.07mm - 0.212 * 14.04pt); align-items: baseline; }
  .ab-z { bottom: calc(-0.212 * 9pt); }
}

/* Anlage: das Bild so groß wie möglich, darunter die Beschreibung; keine Kopfzeile (wie im Original) */
.ab-anlage { display: flex; flex-direction: column; padding: 10mm; }
.ab-anlage-bild { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.ab-anlage-bild img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ab-anlage-fehlt { padding: 8mm; border: 0.3mm dashed var(--papier-linie-fein); color: var(--papier-leise); font-size: 10pt; text-align: center; }
.ab-anlage-unter { display: flex; align-items: baseline; gap: 4mm; margin-top: 3mm; font-size: 10pt; }
.ab-anlage-unter .ab-wert, .ab-beschreibung { flex: 1; min-width: 0; }
.ab-anlage-zeit { white-space: nowrap; font-size: 7pt; color: var(--papier-leise); }
