/* Number plates, by country (templates/_partials/_reg_plate.html.twig, src/Module/Reference/Plate/NumberPlateCatalog.php).

   Every plate is laid out in real millimetres. The partial sets, on the plate itself: --ph the plate's height and --ch / --cw / --cn the
   character height / width / narrow width (the 1 and the I), --gap between characters, --gg between groups, --hy a hyphen, all in mm, and
   --plate-h the height the plate is drawn at in the page. --mm is therefore "one real millimetre, at this size", and every width,
   margin and the lettering's size are multiples of it — so the spacing a plate's standard calls for holds at any size.
   GB is BS AU 145e (79 mm characters, 11 mm apart, 33 mm between the age identifier and the three letters on a 111 mm plate);
   the rest are the front plate at that country's standard size and proportions. Colours are pinned, not theme tokens, so a plate
   reads the same in light and dark. */
.plate {
    --mm: calc(var(--plate-h) / var(--ph));
    --face: #ffffff; --face-solid: var(--face); --ink: #14171a; --edge: #14171a; --band: calc(40 * var(--mm)); --pad: calc(15 * var(--mm));
    box-sizing: border-box;
    height: var(--plate-h);
    padding: 0 var(--pad);
    gap: 0;
    font-family: var(--rs-font-plate), var(--bs-font-display);
    font-weight: 700;
    /* Barlow Condensed's capitals are 0.7em tall: size the em so the capitals are exactly the plate's character height. */
    font-size: calc((var(--ch) + var(--thin)) / 0.7 * var(--mm));
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ink);
    border: calc(1.5 * var(--mm)) solid var(--edge);
    border-radius: calc(7 * var(--mm));
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 1px 2px rgba(0, 0, 0, 0.18);
}
.plate:not(.reg-plate--uk) { background: var(--face); }
.plate__chars { display: inline-flex; align-items: center; gap: calc(var(--gap) * var(--mm)); height: 100%; flex: none; }
/* A plate keeps its own size: a row it sits in (a header, a card) must not squeeze it, and nothing on it shrinks to fit. */
.plate { flex: none; }
.plate__chars > *, .plate__seals > * { flex-shrink: 0; }
/* Each character sits in a cell of the plate's character width and is stretched or squeezed (--sx, from the font's measured ink width)
   until its ink fills the cell, so the space between characters is the standard's, edge to edge. */
.plate__c { display: inline-block; width: calc(var(--cw) * var(--mm)); text-align: center; transform: scaleX(var(--sx, 1)); -webkit-text-stroke: calc(var(--thin) * var(--mm)) var(--face-solid); }
.plate__c--narrow { width: calc(var(--cn) * var(--mm)); }
/* The numeral 1 is as narrow as it is: about two thirds of a digit cell, its own width (--w, mm). */
.plate__c--one { width: calc(var(--w) * var(--mm)); }
/* A character the plate font does not carry (a region character) keeps its natural width. */
.plate__c--free { width: auto; transform: none; }
/* A gap between groups is `--gg` from character to character: the flex gap already supplies --gap on each side of it. */
.plate__sp { display: inline-block; width: calc((var(--gg) - 2 * var(--gap)) * var(--mm)); }
.plate__hy { display: inline-block; width: calc(var(--hy) * var(--mm)); text-align: center; transform: scaleX(var(--sx, 1)); -webkit-text-stroke: calc(var(--thin) * var(--mm)) var(--face-solid); }
.plate__dot { display: inline-block; width: calc(10 * var(--mm)); text-align: center; }

/* ---- GB: the yellow rear plate with the blue GB band (drawn in the base styles) ---- */
.reg-plate--uk.plate {
    --face-solid: #ffdc26;
    --strip: calc(1.625rem + 2px);
    padding: 0 calc(15 * var(--mm)) 0 calc(var(--strip) + 15 * var(--mm));
    border: 2px solid var(--rs-ink);
    border-radius: calc(7px * var(--rs-radius-scale));
    color: var(--rs-ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

/* ---- European front plates: white, the blue band with the ring of stars and the distinguishing sign ---- */
.reg-plate--eu { padding-left: calc(var(--band) + 15 * var(--mm)); border-radius: calc(6 * var(--mm)); }
.plate__band {
    position: absolute; inset: 0 auto 0 0; width: var(--band); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(11 * var(--mm)) 0 calc(9 * var(--mm)); box-sizing: border-box;
    background: #003399; color: #fff; border-radius: calc(4.5 * var(--mm)) 0 0 calc(4.5 * var(--mm)); font-family: var(--bs-font-ui);
}
.plate__stars { width: 62%; height: auto; display: block; }
.plate__sign { font-size: calc(18 * var(--mm)); line-height: 1; font-weight: 700; letter-spacing: 0.02em; margin-top: calc(1 * var(--mm)); }
.reg-plate--plain .plate__sign { font-size: calc(24 * var(--mm)); margin: 0; }
/* Netherlands: the amber-yellow plate, a wider band with a large NL, and long hyphens. */
.reg-plate--nl.plate { --band: calc(52 * var(--mm)); --face: #f5ae0e; --face-solid: #f5ae0e; background: linear-gradient(180deg, #f9b920, #f2a700); }
.reg-plate--nl .plate__sign { font-size: calc(22 * var(--mm)); }
/* Belgium: red characters. */
.reg-plate--be { --ink: #c8102e; }
/* India: the band reads IND, with the chakra drawn in the hologram's place. */
.reg-plate--in .plate__sign { font-size: calc(18 * var(--mm)); }
.reg-plate--in .plate__band::before { content: ''; width: calc(18 * var(--mm)); height: calc(18 * var(--mm)); border-radius: 50%; border: calc(1.6 * var(--mm)) solid #fff; margin-bottom: calc(4 * var(--mm)); }
/* France: a second blue band down the right, with the region's logo square (blank: the region is not in the registration). */
.reg-plate--fr.plate { --band: calc(50 * var(--mm)); --rband: calc(50 * var(--mm)); padding-right: calc(var(--rband) + 12 * var(--mm)); border-width: calc(3 * var(--mm)); border-radius: calc(8 * var(--mm)); }
/* United Arab Emirates (the Dubai plate): no band; the emirate's name, in Arabic over English, between the category letter and the number. */
.reg-plate--ae.plate { --pad: calc(14 * var(--mm)); border-width: calc(2 * var(--mm)); border-radius: calc(8 * var(--mm)); /* the standard 520 mm plate even for a short number, the number following the emirate with the spare length on the right; a longer number lengthens it */ min-width: calc(520 * var(--mm)); }
.plate__seals.plate__seals--ae { flex-direction: column; justify-content: space-between; align-items: center; gap: 0; width: calc(117 * var(--mm)); height: calc(var(--ch) * var(--mm)); margin-inline: calc(28 * var(--mm)) calc(32 * var(--mm)); }
/* As measured on the plate: the block is exactly as tall as the characters, the Arabic in the top ~45 mm and DUBAI (capitals 27 mm) at the foot. */
.plate__emirate-ar { display: flex; align-items: flex-start; justify-content: center; width: 100%; height: calc(46 * var(--mm)); font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, 'Arial Unicode MS', serif; font-size: calc(40 * var(--mm)); line-height: 1; font-weight: 700; text-transform: none; }
.plate__emirate-ar::before { content: none; }
.plate__emirate-en { display: block; font-size: calc(38.5 * var(--mm)); letter-spacing: 0.22em; margin-right: -0.22em; line-height: 0.7; padding-top: calc(1 * var(--mm)); }
/* The approved UAE spacing (public/mockups/uae-plate.html): the lettering sits a little high, as on the plate, with more room at the right. */
.reg-plate--ae.plate { padding: 0 calc(30 * var(--mm)) 0 calc(20 * var(--mm)); justify-content: center; }
.reg-plate--ae .plate__chars { box-sizing: border-box; padding-bottom: calc(11 * var(--mm)); }
.reg-plate--ae .plate__seals--ae { margin-inline: calc(18 * var(--mm)) calc(7.5 * var(--mm)); }
.reg-plate--ae .plate__emirate-ar { font-size: calc(36 * var(--mm)); }

/* The six other emirates (public/mockups/uae-emirate-plates.html): code · the emirate's name · number, text only. */
.em-plate { min-width: calc(520 * var(--mm)); }
.em-block { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: calc(2 * var(--mm)); height: calc(var(--ch) * var(--mm)); margin-inline: calc(22 * var(--mm)) calc(24 * var(--mm)); text-transform: none; flex: none; }
.em-ar { font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, 'Arial Unicode MS', serif; font-weight: 700; font-size: calc(22 * var(--mm)); line-height: 1; white-space: nowrap; }
.em-ar--lg { font-size: calc(32 * var(--mm)); }
.em-en { font-family: var(--rs-font-plate), var(--bs-font-display); font-weight: 700; font-size: calc(21 * var(--mm)); letter-spacing: 0.06em; line-height: 0.9; white-space: nowrap; }
.em-en--lg { font-size: calc(27 * var(--mm)); letter-spacing: 0.12em; }
/* Abu Dhabi: the code in white on the red band, pinned to the plate's left edge whatever the number's length; the emirate block and the
   number centre in the rest. In the band the code takes its natural glyph widths, so it centres on its ink, not on fixed cells. */
.em-plate--band { padding-left: 0 !important; padding-right: calc(20 * var(--mm)) !important; overflow: hidden; justify-content: flex-start !important; }
.em-band { display: inline-flex; align-items: center; justify-content: center; gap: calc(var(--gap) * var(--mm)); align-self: stretch; flex: none; margin: 0; padding: 0 calc(14 * var(--mm)) calc(9 * var(--mm)); background: #d40000; color: #fff; border-radius: calc(5.5 * var(--mm)) 0 0 calc(5.5 * var(--mm)); }
.em-plate--band .plate__chars { flex: 1 1 auto; justify-content: center; padding-right: calc(10 * var(--mm)); }
.em-band .plate__c { width: auto; transform: none; -webkit-text-stroke-color: #d40000; }
.em-block--auh .em-en { letter-spacing: 0.1em; }
/* Umm Al Quwain: the UAE flag over the emirate's name. */
.em-flag { display: grid; grid-template-columns: calc(12 * var(--mm)) calc(34 * var(--mm)); grid-template-rows: repeat(3, calc(7 * var(--mm))); }
.em-flag i { grid-row: 1 / 4; background: #ce1126; }
.em-flag b:nth-of-type(1) { background: #00732f; }
.em-flag b:nth-of-type(2) { background: #fff; box-shadow: inset 0 0 0 calc(0.6 * var(--mm)) #ddd; }
.em-flag b:nth-of-type(3) { background: #000; }

/* Diplomatic / consular plates (MOFA): the short 335 x 155 mm plate in yellow and white, as photographed. A plain number takes the
   yellow-band design; a mission / vehicle number (62/3) the hexagon. */
.mofa { --plate-h: 2.85rem; --mm: calc(var(--plate-h) / 155); position: relative; display: inline-flex; box-sizing: border-box; width: calc(335 * var(--mm)); height: var(--plate-h); flex: none; vertical-align: middle;
    padding: 0; align-items: stretch; letter-spacing: normal; text-transform: none; /* not the one-line .reg-plate look it also carries */
    background: #fff; border: calc(2 * var(--mm)) solid #14171a; border-radius: calc(9 * var(--mm)); color: #14171a; overflow: hidden; font-weight: 700; line-height: 1; text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 1px 2px rgba(0, 0, 0, 0.18); }
.mofa [lang="ar"] { font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, serif; }
.mofa--band { flex-direction: column; }
.mofa__band { display: flex; justify-content: space-between; align-items: center; height: calc(38 * var(--mm)); padding: 0 calc(12 * var(--mm)); background: #f4c20d; font-size: calc(24 * var(--mm)); border-radius: 0 0 calc(30 * var(--mm)) calc(30 * var(--mm)) / 0 0 calc(10 * var(--mm)) calc(10 * var(--mm)); }
.mofa__row { display: flex; justify-content: space-between; padding: calc(7 * var(--mm)) calc(46 * var(--mm)) 0; font-family: var(--rs-font-plate), var(--bs-font-display); font-size: calc(21 * var(--mm)); letter-spacing: 0.12em; }
.mofa__big { flex: 1; display: grid; place-items: center; padding-bottom: calc(6 * var(--mm)); font-family: var(--rs-font-plate), var(--bs-font-display); font-size: calc(84 * var(--mm)); letter-spacing: 0.04em; }
.mofa--hex { background: #f4c20d; justify-content: space-between; }
.mofa__side { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: center; width: calc(82 * var(--mm)); padding: calc(10 * var(--mm)) 0 calc(12 * var(--mm)); text-align: center; }
.mofa__side .mofa__ar { font-size: calc(19 * var(--mm)); line-height: 1.15; }
.mofa__lat { font-family: var(--rs-font-plate), var(--bs-font-display); font-size: calc(30 * var(--mm)); letter-spacing: 0.08em; }
.mofa__hex { position: absolute; inset: 0 calc(62 * var(--mm)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(6 * var(--mm));
    background: #f1f2f4; clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%); }
.mofa__hex::before { content: ''; position: absolute; inset: 0; background: #14171a; clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%, calc(0% + 2.5px) 50%, calc(14% + 1.5px) 100%, calc(86% - 1.5px) 100%, calc(100% - 2.5px) 50%, calc(86% - 1.5px) 0, calc(14% + 1.5px) 0, calc(0% + 2.5px) 50%, 0 50%); }
.mofa__num { position: relative; font-family: var(--rs-font-plate), var(--bs-font-display); font-size: calc(40 * var(--mm)); letter-spacing: 0.06em; }
.mofa__num--ar { unicode-bidi: bidi-override; direction: ltr; font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, serif; font-size: calc(36 * var(--mm)); }
.mofa__rule { position: relative; width: 74%; height: calc(3 * var(--mm)); background: #14171a; }

/* Spain: a heavy black frame and a large E in the band. */
.reg-plate--es.plate { border-width: calc(4.5 * var(--mm)); border-radius: calc(10 * var(--mm)); }
.reg-plate--es .plate__sign { font-size: calc(24 * var(--mm)); }
/* Italy: the EU band with a small I, and a right band carrying a gold ring where the year and province badge goes. */
.reg-plate--it.plate { --rband: calc(46 * var(--mm)); padding-right: calc(var(--rband) + 12 * var(--mm)); border-width: calc(3 * var(--mm)); border-radius: calc(10 * var(--mm)); }
.reg-plate--it .plate__sign { font-size: calc(15 * var(--mm)); }
.reg-plate--it .plate__logo { width: calc(30 * var(--mm)); height: calc(30 * var(--mm)); margin-top: calc(10 * var(--mm)); background: transparent; border: calc(2.4 * var(--mm)) solid #ffcc00; border-radius: 50%; box-sizing: border-box; }
.plate__rband { position: absolute; inset: 0 0 0 auto; width: var(--rband, var(--band)); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; background: #003399; border-radius: 0 calc(4.5 * var(--mm)) calc(4.5 * var(--mm)) 0; }
.plate__logo { display: block; width: calc(36 * var(--mm)); height: calc(36 * var(--mm)); margin-top: calc(9 * var(--mm)); background: #fff; border-radius: calc(2 * var(--mm)); }
/* Germany: the state seal over the inspection badge, between the district code and the letters. */
.plate__seals { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(4 * var(--mm)); width: calc((var(--gg) - 2 * var(--gap)) * var(--mm)); }
.plate__seal { display: block; width: calc(37 * var(--mm)); height: calc(37 * var(--mm)); }
.plate__seals--de { gap: calc(3 * var(--mm)); }
/* The German band is a little wider and its sign larger, as on the plate. */
.reg-plate--de { --band: calc(44 * var(--mm)); }
.reg-plate--de .plate__sign { font-size: calc(22 * var(--mm)); }

/* ---- Switzerland: black frame, the canton shield between the canton letters and the number ---- */
.reg-plate--ch { --pad: calc(8 * var(--mm)); border-width: calc(3 * var(--mm)); border-radius: calc(6 * var(--mm)); }
.plate__shield { display: block; width: calc(30 * var(--mm)); height: calc(34 * var(--mm)); margin-inline: calc(var(--gap) * var(--mm)); background: linear-gradient(135deg, #d52b1e 0 50%, #fff 50% 100%); border: calc(2 * var(--mm)) solid #14171a; border-radius: 0 0 calc(15 * var(--mm)) calc(15 * var(--mm)); box-sizing: border-box; }
.plate__seals--ch { width: auto; flex-direction: row; }

/* ---- USA, Canada, Australia, New Zealand: the plate's header above the number, navy lettering ---- */
.reg-plate--us { --ink: #0b2a6b; --edge: #0b2a6b; --pad: calc(18 * var(--mm)); flex-direction: column; justify-content: center; padding-top: calc(4 * var(--mm)); border-radius: calc(10 * var(--mm)); }
.reg-plate--us .plate__header { position: absolute; top: calc(8 * var(--mm)); left: 0; right: 0; text-align: center; font-size: calc(24 * var(--mm)); letter-spacing: 0.12em; color: #b31b2c; font-family: var(--bs-font-ui); font-weight: 700; }
.reg-plate--us .plate__chars { height: auto; margin-top: calc(18 * var(--mm)); }

/* ---- Japan: white face, green lettering and frame ---- */
.reg-plate--jp { --ink: #0b6b3a; --edge: #0b6b3a; --pad: calc(18 * var(--mm)); border-width: calc(3 * var(--mm)); border-radius: calc(10 * var(--mm)); }
.reg-plate--jp::after { content: ''; position: absolute; inset: calc(6 * var(--mm)); border: calc(1.4 * var(--mm)) solid #0b6b3a; border-radius: calc(5 * var(--mm)); pointer-events: none; }

/* ---- China: blue face, white characters and inner line ---- */
.reg-plate--cn { --face: #0a3d9b; --ink: #fff; --edge: #fff; --pad: calc(14 * var(--mm)); border-width: calc(2 * var(--mm)); box-shadow: 0 0 0 calc(2 * var(--mm)) #0a3d9b; border-radius: calc(6 * var(--mm)); }
.reg-plate--cn::after { content: ''; position: absolute; inset: calc(5 * var(--mm)); border: calc(1.4 * var(--mm)) solid #fff; border-radius: calc(4 * var(--mm)); pointer-events: none; opacity: 0.9; }

/* ---- Brazil (Mercosul): the blue top band with BRASIL ---- */
.reg-plate--br { --pad: calc(14 * var(--mm)); flex-direction: column; justify-content: flex-end; padding-bottom: calc(10 * var(--mm)); border-radius: calc(8 * var(--mm)); overflow: hidden; }
.reg-plate--br .plate__header { position: absolute; top: 0; left: 0; right: 0; height: calc(26 * var(--mm)); display: flex; align-items: center; justify-content: center; background: #003399; color: #fff; font-size: calc(18 * var(--mm)); letter-spacing: 0.3em; font-family: var(--bs-font-ui); font-weight: 700; }
.reg-plate--br .plate__chars { height: auto; }

/* ---- Russia: the region in its own box with RUS and the flag ---- */
.reg-plate--ru { --pad: calc(10 * var(--mm)); padding-right: 0; }
.plate__rule { display: inline-block; align-self: stretch; width: calc(2 * var(--mm)); background: var(--ink); margin-block: calc(-1 * var(--mm)); }
.plate__rus { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(4 * var(--mm)); width: calc(48 * var(--mm)); font-size: calc(18 * var(--mm)); font-family: var(--bs-font-ui); }
.plate__flag { display: block; width: calc(26 * var(--mm)); height: calc(17 * var(--mm)); background: linear-gradient(#fff 0 33%, #0039a6 33% 66%, #d52b1e 66% 100%); border: calc(1 * var(--mm)) solid #14171a; box-sizing: border-box; }

/* ---- South Africa (SANS 1116): white, black characters set high, the province's name along the foot ---- */
.reg-plate--za { --pad: calc(16 * var(--mm)); padding-bottom: calc(22 * var(--mm)); border-width: calc(2 * var(--mm)); border-radius: calc(6 * var(--mm)); }
.reg-plate--za .plate__province { position: absolute; left: 0; right: 0; bottom: calc(7 * var(--mm)); text-align: center; font-family: var(--bs-font-ui); font-size: calc(17 * var(--mm)); font-weight: 700; letter-spacing: 0.2em; line-height: 1; color: var(--ink); }

/* ---- Any other country: the plain white plate with its ISO code ---- */
.reg-plate--generic .plate__iso { position: absolute; top: calc(5 * var(--mm)); left: calc(9 * var(--mm)); font-size: calc(14 * var(--mm)); letter-spacing: 0.1em; font-family: var(--bs-font-ui); }
.reg-plate--generic { --pad: calc(16 * var(--mm)); border-width: calc(2.5 * var(--mm)); border-radius: calc(7 * var(--mm)); }

/* A plate that is a link keeps the plate face exactly (see the base .reg-plate rules). */
a.plate { text-decoration: none; }

/* ---- The UAE vehicle form (templates/reference/vehicle/form.html.twig, uae_registration_controller.js): Emirate / Code / Plate Number
   in a row, the tidy-up's note, and the live plate preview with what will be saved. ---- */
.uae-reg { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem; grid-column: 1 / -1; }
.uae-note { grid-column: 1 / -1; margin: 0; font-size: 0.85rem; min-height: 1.2em; }
.uae-note--ok { color: var(--rs-green); }
.uae-note--bad { color: var(--rs-danger); }
.uae-preview { grid-column: 1 / -1; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; min-height: 5rem; padding: 1rem; border: 1px dashed var(--bs-line); border-radius: 12px; }
.uae-preview__label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bs-muted); }
.uae-preview__saved { font-size: 0.9rem; color: var(--bs-muted); }
.uae-preview__saved b { color: var(--bs-text); font-family: ui-monospace, Menlo, monospace; }
.uae-preview .plate { --plate-h: 3.6rem !important; }
.uae-preview .mofa { --plate-h: 3.6rem; }
@media (max-width: 760px) { .uae-reg { grid-template-columns: 1fr; } }

/* Every UAE plate (Dubai, the other emirates, consular/diplomatic): a thin black line set just inside a white rim, as on
   the plates themselves (the reference photos of 2026-11 consular plates). The plate's own border becomes the white rim and
   the line is an inset outline, so the vehicle cards' dark-theme glow (box-shadow) is left alone. Only the line has a px floor,
   so it stays visible on the small card plates; the rim stays in proportion. A floored rim (1.5px) made the frame on a 1.2rem
   list-card plate twice its true depth, and the line then cut across the lettering, which is sized in real millimetres. */
.reg-plate[data-plate-country="AE"] {
    --uae-rim: calc(4 * var(--mm));
    --uae-line: max(1px, calc(2.2 * var(--mm)));
    border: var(--uae-rim) solid #fff;
    outline: var(--uae-line) solid #14171a;
    outline-offset: calc(-1 * (var(--uae-rim) + var(--uae-line)));
}
