/* Dépliant 3 volets (trifold.js): two A4 landscape sheets, letter-folded. One layout for the three templates, themed
   only by their tokens (--b-ground, --b-ink, --b-muted, --b-accent, --b-rule, --b-display, --b-text,
   --b-display-weight, --b-display-case, --b-display-track). Layout in mm, type in pt, square corners.
   Panels: outside [flap 0–97 | back 97–197 | front 197–297], inside [story 0–100 | middle 100–200 | flap 200–297].
   Every panel child is placed absolutely on the sheet; what touches the trim grows by var(--bleed) (3 mm in the
   print-shop file, 0 on screen). Text stays 12 mm from the trim and 9 mm from a fold. Two photos never meet on a
   fold: a 3 mm gutter of ground sits centred on it. */
.fmt-tri {
  --t-b: var(--bleed, 0mm);
  --t-m: 12mm;    /* text from the trim */
  --t-mf: 9mm;    /* text from a fold */
  --t-g: 3mm;     /* gutter between photos */
  --t-row: 80mm;  /* the inside's lower row: the middle photo and the facts */
  --t-ai: color-mix(in oklab, var(--b-accent) 62%, var(--b-ink));             /* the accent as text */
  --t-sunk: color-mix(in oklab, var(--b-ink) 5%, var(--b-ground));            /* the back panel */
  --t-field: color-mix(in oklab, var(--b-accent) 22%, var(--b-ink));          /* the facts field, inverted */
}
.fmt-tri > .plate .t-sheet { display: block; overflow: visible; background: var(--b-ground); color: var(--b-ink);
  font-family: var(--b-text); font-size: 9.5pt; line-height: 1.55; font-kerning: normal; }
.fmt-tri .t-sheet > * { position: absolute; box-sizing: border-box; }
/* a reset that loses to every class rule below (zero specificity beyond .fmt-tri) */
.fmt-tri :where(.t-sheet) :where(h1, h2, p, dl, dt, dd, ol, li, figure) { margin: 0; padding: 0; max-width: none; }
.fmt-tri .t-sheet .t-ph { overflow: hidden; background: var(--t-sunk); border-radius: 0; }
.fmt-tri .t-sheet .t-ph img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* the shared type: letter-spaced labels, the display face with the template's case and tracking */
.fmt-tri .t-label { font-size: 6.8pt; font-weight: 600; line-height: 1.3; letter-spacing: .26em; text-transform: uppercase;
  color: var(--t-ai); margin-bottom: 4mm; }
.fmt-tri :is(.t-title, .t-head, .t-sign, .t-agent__name, .t-price, .t-nums dd, .t-facts__price, .t-high__n) {
  font-family: var(--b-display); font-weight: var(--b-display-weight); letter-spacing: var(--b-display-track);
  font-variant-numeric: lining-nums; }
/* figures keep the face but not a wide capital tracking: 1 250 000 € must read as one number */
.fmt-tri :is(.t-price, .t-nums dd, .t-facts__price, .t-high__n) { letter-spacing: min(var(--b-display-track), .02em); }
.fmt-tri :is(.t-title, .t-head, .t-sign, .t-agent__name) { text-transform: var(--b-display-case); text-wrap: balance; }
.fmt-tri [data-fit] { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- outside: the flap (highlights between two photos) ---------- */
.fmt-tri .t-flap { left: calc(-1 * var(--t-b)); top: calc(-1 * var(--t-b)); bottom: calc(-1 * var(--t-b)); width: calc(97mm + var(--t-b));
  display: flex; flex-direction: column; }
.fmt-tri .t-flap > .t-ph { flex: 1 1 0; min-height: 0; }
.fmt-tri .t-flap > .t-ph + .t-ph { margin-top: var(--t-g); }
.fmt-tri .t-flap:has(.t-high) > .t-flap__a { flex: 0 0 calc(76mm + var(--t-b)); }
.fmt-tri .t-flap:has(.t-high) > .t-flap__b { flex: 0 0 calc(56mm + var(--t-b)); }
.fmt-tri .t-high { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: 8mm var(--t-mf) 8mm calc(var(--t-m) + var(--t-b)); }
.fmt-tri .t-high:first-child { padding-top: calc(var(--t-m) + var(--t-b)); }
.fmt-tri .t-high:last-child { padding-bottom: calc(var(--t-m) + var(--t-b)); }
.fmt-tri .t-high ol { list-style: none; border-bottom: .2mm solid var(--b-rule); }
.fmt-tri .t-high li { display: grid; grid-template-columns: 8mm minmax(0, 1fr); align-items: baseline; padding: 1.9mm 0 2.1mm;
  border-top: .2mm solid var(--b-rule); font-size: 8.8pt; line-height: 1.38; }
.fmt-tri .t-high li:first-child { border-top-color: var(--b-accent); }
.fmt-tri .t-high__n { font-size: 8.8pt; color: var(--t-ai); }
.fmt-tri .t-high__t { -webkit-line-clamp: 2; }
/* only the highlights, no photo: they open the panel from the top, like a contents page */
.fmt-tri .t-high:only-child { justify-content: flex-start; padding-top: calc(28mm + var(--t-b)); }

/* ---------- outside: the back (title, facts, contact, legal line) on a sunk ground ---------- */
.fmt-tri .t-back { left: 97mm; width: 100mm; top: calc(-1 * var(--t-b)); bottom: calc(-1 * var(--t-b)); background: var(--t-sunk);
  display: flex; flex-direction: column; padding: calc(16mm + var(--t-b)) 10mm calc(var(--t-m) + var(--t-b)); }
.fmt-tri .t-out.no-flap .t-back { left: calc(-1 * var(--t-b)); width: calc(197mm + var(--t-b)); padding-left: calc(107mm + var(--t-b)); }
.fmt-tri .t-sign { font-size: 15pt; line-height: 1.14; -webkit-line-clamp: 3; }
.fmt-tri .t-back__city { margin: 3.5mm 0 0; }
.fmt-tri .t-table { margin-top: 10mm; border-bottom: .2mm solid var(--b-rule); }
.fmt-tri .t-table > div { display: flex; justify-content: space-between; gap: 6mm; padding: 2.1mm 0 2.3mm; border-top: .2mm solid var(--b-rule);
  font-size: 8.5pt; line-height: 1.35; }
.fmt-tri .t-table > div:first-child { border-top-color: var(--b-accent); }
.fmt-tri .t-table dt { flex: none; color: var(--b-muted); }
.fmt-tri .t-table dd { min-width: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.fmt-tri .t-agent { margin-top: auto; padding-top: 10mm; }
.fmt-tri .t-back__top:not(:has(+ .t-agent)) { margin-block: auto; }   /* no contact: the title and facts sit centred */
.fmt-tri .t-agent__name { font-size: 14pt; line-height: 1.2; }
.fmt-tri .t-agent__co { margin-top: 1mm; font-size: 8.5pt; color: var(--b-muted); }
.fmt-tri .t-agent__lines { margin-top: 3.5mm; font-size: 8.5pt; line-height: 1.6; }
.fmt-tri .t-agent__lines span { display: block; overflow-wrap: anywhere; }
/* the logo alone, its background removed (brochure/logo.js), in its own colours */
.fmt-tri .t-plate { display: inline-flex; align-self: flex-start; margin-top: 4mm; }
.fmt-tri .t-logo { display: block; max-width: 42mm; max-height: 12mm; object-fit: contain; }
.fmt-tri .t-legal { margin-top: auto; padding-top: 6mm; font-size: 6.5pt; line-height: 1.4; letter-spacing: .04em; color: var(--b-muted); }
.fmt-tri .t-agent + .t-legal { margin-top: 0; }

/* ---------- outside: the front cover. The photo on the top two thirds, the title on the ground under it ---------- */
.fmt-tri .t-front { left: 197mm; right: calc(-1 * var(--t-b)); top: calc(-1 * var(--t-b)); bottom: calc(-1 * var(--t-b));
  display: flex; flex-direction: column; }
.fmt-tri .t-front__ph { flex: 0 0 calc(138mm + var(--t-b)); }
.fmt-tri .t-front__band { flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 9mm calc(var(--t-m) + var(--t-b)) calc(var(--t-m) + var(--t-b)) var(--t-mf); }
.fmt-tri .t-front:not(.has-photo) .t-front__band { justify-content: flex-end; padding-bottom: calc(30mm + var(--t-b)); }
.fmt-tri .t-kicker { margin-bottom: 3mm; }
.fmt-tri .t-title { font-size: 21pt; line-height: 1.06; -webkit-line-clamp: 3; }
.fmt-tri .t-title.is-m { font-size: 25pt; }
.fmt-tri .t-title.is-s { font-size: 38pt; line-height: 1; -webkit-line-clamp: 2; }
.fmt-tri .t-front__foot { margin-top: auto; padding-top: 3.4mm; border-top: .25mm solid var(--b-accent); }
.fmt-tri .t-price { font-size: 15pt; line-height: 1.1; white-space: nowrap; }
.fmt-tri .t-strip { margin-top: 1.6mm; font-size: 7.2pt; letter-spacing: .08em; color: var(--b-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmt-tri .t-strip:only-child { margin-top: 0; }

/* ---------- inside: the story panel ---------- */
.fmt-tri .t-story { left: calc(-1 * var(--t-b)); top: calc(-1 * var(--t-b)); bottom: calc(-1 * var(--t-b)); width: calc(100mm + var(--t-b));
  display: flex; flex-direction: column; padding: calc(18mm + var(--t-b)) var(--t-mf) calc(var(--t-m) + var(--t-b)) calc(var(--t-m) + var(--t-b) + 1mm); }
/* the label and the headline at the top; the text low, its rule on the line where the photos below the spread
   begin (210 mm - the lower row), so one horizontal runs across the whole inside. A long text grows upward. With no
   photo below the spread (the facts close the story), the headline floats between the label and the facts. */
.fmt-tri .t-story__label { margin-bottom: auto; padding-bottom: 8mm; }
.fmt-tri .t-in.has-mid .t-story__label { margin-bottom: 0; padding-bottom: 0; }
.fmt-tri .t-in.has-mid .t-story__label + .t-head { margin-top: 1mm; }
.fmt-tri .t-in.has-mid .t-head { margin-bottom: auto; }
.fmt-tri .t-story > * { flex: none; }
.fmt-tri .t-in.has-mid .t-intro { box-sizing: border-box; min-height: calc(var(--t-row) - var(--t-m)); }
.fmt-tri .t-head { font-size: 19pt; line-height: 1.14; -webkit-line-clamp: 5; }
.fmt-tri .t-head.is-title { font-size: 26pt; line-height: 1.06; -webkit-line-clamp: 4; }
/* a short accent rule between the headline and the text, outside the clamped headline so it always shows */
.fmt-tri .t-head + .t-intro { margin-top: 7mm; padding-top: 7mm; background: linear-gradient(var(--b-accent), var(--b-accent)) 0 0 / 12mm .25mm no-repeat; }
.fmt-tri .t-intro { font-size: 9.5pt; line-height: 1.62; hyphens: auto; text-wrap: pretty; -webkit-line-clamp: 19; }
.fmt-tri .t-story:has(> .t-facts) .t-intro { -webkit-line-clamp: 13; }
.fmt-tri .t-story > .t-facts { margin-top: auto; padding-top: 8mm; }
/* with a sixth photo on the lower row (2026-11-11 review: the low text left a hole under the headline), the text
   follows the headline and the photo fills the panel's lower row, edge to edge on the trim side */
.fmt-tri .t-story:has(> .t-story__ph) { padding-bottom: calc(var(--t-row) + 9mm + var(--t-b)); }
.fmt-tri .t-in.has-mid .t-story:has(> .t-story__ph) .t-head { margin-bottom: 0; }
.fmt-tri .t-story:has(> .t-story__ph) .t-intro { min-height: 0; -webkit-line-clamp: 11; }
.fmt-tri .t-story__ph { position: absolute; left: 0; bottom: 0; top: calc(210mm - var(--t-row) + var(--t-b));
  width: calc(100mm + var(--t-b) - var(--t-g)); }

/* ---------- inside: the spread across the middle panel and the flap, the middle photo, the facts field ---------- */
.fmt-tri .t-spread { left: 100mm; right: calc(-1 * var(--t-b)); top: calc(-1 * var(--t-b)); height: calc(210mm - var(--t-row) - var(--t-g) + var(--t-b)); }
.fmt-tri .t-in:not(.has-mid) .t-spread { height: auto; bottom: calc(-1 * var(--t-b)); }
.fmt-tri .t-mid { left: 100mm; width: calc(100mm - var(--t-g) / 2); top: calc(210mm - var(--t-row)); bottom: calc(-1 * var(--t-b)); }
.fmt-tri .t-in:not(.has-facts) .t-mid { width: auto; right: calc(-1 * var(--t-b)); }
.fmt-tri .t-side { left: calc(200mm + var(--t-g) / 2); right: calc(-1 * var(--t-b)); top: calc(210mm - var(--t-row)); bottom: calc(-1 * var(--t-b));
  display: flex; flex-direction: column; padding: 8mm calc(var(--t-m) + var(--t-b)) calc(10mm + var(--t-b)) calc(var(--t-mf) - var(--t-g) / 2);
  background: var(--t-field); color: var(--b-ground);
  --t-ai: color-mix(in oklab, var(--b-accent) 62%, var(--b-ground)); --b-rule: color-mix(in oklab, var(--b-ground) 22%, var(--t-field)); }
.fmt-tri .t-in:not(.has-spread) .t-side { left: 100mm; top: calc(-1 * var(--t-b)); justify-content: center;
  padding: calc(var(--t-m) + var(--t-b)) calc(var(--t-m) + var(--t-b)) calc(var(--t-m) + var(--t-b)) var(--t-mf); }
.fmt-tri .t-side .t-facts { flex: 1; display: flex; flex-direction: column; }
.fmt-tri .t-in:not(.has-spread) .t-side .t-facts { flex: none; width: calc(100mm - 2 * var(--t-mf)); }   /* the field spans two panels, its words stay off the fold */
.fmt-tri .t-side .t-nums > div:nth-child(-n + 2) { border-top-color: var(--t-ai); }   /* a dark accent vanishes on the field */

/* the facts as numerals: value large, its word small under it */
.fmt-tri .t-nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 5mm; }
.fmt-tri .t-nums > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: 2.4mm 0 2.6mm;
  border-top: .2mm solid var(--b-rule); min-width: 0; }
.fmt-tri .t-nums > div:nth-child(-n + 2) { border-top-color: var(--b-accent); }
.fmt-tri .t-nums dd { font-size: 21pt; line-height: 1.05; white-space: nowrap; }
.fmt-tri .t-nums dd small { font-size: .5em; letter-spacing: .02em; }
.fmt-tri .t-nums dt { margin-top: 1mm; font-size: 6.8pt; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--t-ai);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmt-tri .t-nums.n-1 { grid-template-columns: minmax(0, 1fr); }
.fmt-tri .t-nums.n-1 dd { font-size: 34pt; }
.fmt-tri .t-facts__price { margin-top: auto; padding-top: 3mm; border-top: .2mm solid var(--b-rule); font-size: 15pt; line-height: 1.15; white-space: nowrap; }
.fmt-tri .t-nums + .t-facts__price { margin-top: 4mm; }
.fmt-tri .t-side .t-nums + .t-facts__price { margin-top: auto; }

/* uppercase, letter-spaced display faces take more room: one step down */
@container style(--b-display-case: uppercase) {
  .fmt-tri .t-title { font-size: 15pt; line-height: 1.3; }
  .fmt-tri .t-title.is-m { font-size: 18pt; }
  .fmt-tri .t-title.is-s { font-size: 27pt; line-height: 1.15; }
  .fmt-tri .t-head { font-size: 14pt; line-height: 1.35; }
  .fmt-tri .t-head.is-title { font-size: 19pt; line-height: 1.25; }
  .fmt-tri .t-sign { font-size: 11pt; line-height: 1.4; }
  .fmt-tri .t-agent__name { font-size: 11pt; line-height: 1.35; }
}
