/* /app/brochure: the editor, and the three A4 sheets that are both the live preview and the printed PDF.
   Loaded after site.css and app.css; uses their tokens. The sheets are laid out in millimetres and points at
   print size, and the preview zooms them to its column (--k, set by app-brochure.js). When printing, only the
   sheets print, at 1:1, one per page.
   Print type: Fraunces for titles, the price and the agent's name; Satoshi for everything else. Ink #1B1915 on
   paper #FBF9F5 (16.9:1), muted #5E5A52 (6.3:1), brass-ink #7A6233 for the small labels (5.5:1); brass #B8975F
   only as hairlines. Smallest print text: 7 pt uppercase labels and folios; running text 9.5 to 10.5 pt. */

/* ---------- screen: editor beside the preview ---------- */
.bro { max-width: calc(1360px + 2 * var(--gutter)); }
.bro__layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
@media (max-width: 900px) { .bro__layout { grid-template-columns: minmax(0, 1fr); } }

.editor__go { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.editor__go .btn { width: 100%; justify-content: center; }
.editor__go p { margin-top: 10px; color: var(--muted); font-size: var(--t-sm); }

/* the photos in the brochure: one card each, with its original / staged switch; the others below, a tap adds one */
.cards { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.card { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); align-items: start; }
.card__pic { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: var(--sand); }
.card__pic img, .tile__pick img { width: 100%; height: 100%; object-fit: cover; }
.card[data-state="cover"] .card__pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px var(--ink); pointer-events: none; }
.card__busy { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; background: rgba(251,249,245,.86); color: var(--ink); font-size: var(--t-sm); font-weight: 600; text-align: center; line-height: 1.35; }
.card__side { display: grid; gap: 8px; min-width: 0; }
.card__one, .card__note { font-size: var(--t-sm); color: var(--muted); }
.card__note { color: var(--ink); font-weight: 500; }
.card__style { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 12px; background: #fff; color: inherit; font: inherit; font-size: var(--t-sm); }
.card__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.card { outline: 0; }
.card:focus-visible { outline: 2px solid #1E2F4D; outline-offset: 4px; }
.card__act[data-act="stage"] { flex: 0 0 auto; margin: 2px 0 4px; }
.card__act:not(.btn) { min-height: 44px; color: var(--muted); font-size: var(--t-sm); font-weight: 500; text-align: left; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.card__act:not(.btn):hover { color: var(--ink); text-decoration-color: currentColor; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; background: var(--sand); }
.seg__side span { display: grid; place-items: center; min-height: 44px; padding: 0 6px; border-radius: 999px; color: var(--muted); font-size: var(--t-sm); font-weight: 600; cursor: pointer; }
.seg__side input:checked + span { background: var(--ink); color: #fff; }
.card :is(button, select):focus-visible, .seg__side input:focus-visible + span, .tile__pick:focus-visible { outline: 2px solid #1E2F4D; outline-offset: 2px; }
.tiles { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile__pick { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: var(--sand); }
.tile__pick:hover { outline: 2px solid var(--ink); outline-offset: 2px; }
.tile__n { position: absolute; left: 6px; top: 6px; display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 9px; border-radius: 999px; background: var(--ink); color: #fff; font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
#rest { margin-top: 20px; }

/* the two dialogs: staging a photo, paying for the staged ones */
.stagebox { max-height: calc(100dvh - 32px); overflow: auto; }
.stagebox .terms__box { gap: 14px; }
.stagebox .terms__go { position: sticky; bottom: 0; margin: 0 calc(-1 * clamp(22px, 4vw, 32px)) calc(-1 * clamp(22px, 4vw, 32px)); padding: 14px clamp(22px, 4vw, 32px); background: var(--card); border-top: 1px solid var(--line); }
.stagebox__pic { max-height: 24vh; overflow: hidden; border-radius: 12px; background: var(--sand); }
.stagebox__pic img { width: 100%; max-height: 24vh; object-fit: cover; }
.stagebox .pick > span { min-height: 44px; padding: 0 15px; }
.buy { display: grid; gap: 16px; }
.buy h2 { outline: 0; }
.buy__go { display: grid; gap: 10px; }
.buy__go .btn { justify-content: center; text-align: center; }
.buy__go .linkbtn { min-height: 44px; justify-content: center; }

/* the preview: sheets on a sand table, zoomed to the column */
.preview { --k: .5; min-width: 0; padding: clamp(14px, 2.4vw, 32px); border-radius: var(--r); background: var(--sand); }
.pages { zoom: var(--k); display: grid; gap: 12mm; }


/* ---------- the plates: one per printed page ----------
   A plate is the printed page: the trim size, plus in « Fichier imprimeur » mode a 3 mm bleed and a 5 mm slug on
   every side with crop marks drawn in the slug. The bleed box clips at the bleed; the sheet inside is the trim size
   and its full-bleed elements reach into the bleed with negative offsets of var(--bleed) (0 on screen files). */
.pages { --bleed: 0mm; --slug: 0mm; --tw: 210mm; --th: 297mm; zoom: var(--k); display: grid; gap: 12mm; justify-content: start; }
.pages.fmt-tri { --tw: 297mm; --th: 210mm; }
.pages.pro { --bleed: 3mm; --slug: 5mm; }
.plate { position: relative; width: calc(var(--tw) + 2 * (var(--bleed) + var(--slug))); height: calc(var(--th) + 2 * (var(--bleed) + var(--slug)));
  background: #fff; box-shadow: 0 .4mm 1.5mm rgba(27,25,21,.1), 0 18mm 36mm -18mm rgba(27,25,21,.3);
  break-after: page; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.plate:last-child { break-after: auto; }
.bleedbox { position: absolute; inset: var(--slug); overflow: hidden; background: var(--b-ground, var(--paper)); }
.pages > .plate .sheet { position: absolute; left: var(--bleed); top: var(--bleed); width: var(--tw); height: var(--th); margin: 0; border: 0;
  padding: 0; overflow: visible; display: flex; flex-direction: column; background: var(--b-ground, var(--paper)); color: var(--b-ink, var(--ink));
  font-family: var(--b-text, var(--sans)); font-size: 10pt; line-height: 1.5; box-shadow: none; }
.sheet figure { margin: 0; }
.sheet figure img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sheet h2, .sheet h3 { max-width: none; }

/* crop marks: 0.25 pt, 4 mm long, in the slug, 1 mm clear of the bleed, at the four trim corners */
.pro .plate::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  --o: calc(var(--slug) + var(--bleed)); --len: calc(var(--slug) - 1mm); --t: .25pt;
  background:
    linear-gradient(#000, #000) left 0 top var(--o) / var(--len) var(--t) no-repeat,
    linear-gradient(#000, #000) right 0 top var(--o) / var(--len) var(--t) no-repeat,
    linear-gradient(#000, #000) left 0 top calc(var(--o) + var(--th)) / var(--len) var(--t) no-repeat,
    linear-gradient(#000, #000) right 0 top calc(var(--o) + var(--th)) / var(--len) var(--t) no-repeat,
    linear-gradient(#000, #000) left var(--o) top 0 / var(--t) var(--len) no-repeat,
    linear-gradient(#000, #000) left calc(var(--o) + var(--tw)) top 0 / var(--t) var(--len) no-repeat,
    linear-gradient(#000, #000) left var(--o) bottom 0 / var(--t) var(--len) no-repeat,
    linear-gradient(#000, #000) left calc(var(--o) + var(--tw)) bottom 0 / var(--t) var(--len) no-repeat; }

/* the PDF pages are exactly the plate: one named page size per format and mode */
@page { margin: 0; }
@page a4 { size: 210mm 297mm; margin: 0; }
@page a4pro { size: 226mm 313mm; margin: 0; }
@page tri { size: 297mm 210mm; margin: 0; }
@page tripro { size: 313mm 226mm; margin: 0; }
.fmt-a4 .plate { page: a4; }
.fmt-a4.pro .plate { page: a4pro; }
.fmt-tri .plate { page: tri; }
.fmt-tri.pro .plate { page: tripro; }

/* the template and format choice in the editor */
.tpls { display: grid; gap: 10px; margin-top: 14px; }
.tpl { display: block; cursor: pointer; }
.tpl span { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .3s, background .3s; }
.tpl b { font-weight: 600; }
.tpl small { color: var(--muted); font-size: var(--t-sm); }
.tpl input:checked + span { box-shadow: inset 0 0 0 2px var(--ink); background: #fff; }
.tpl input:focus-visible + span { outline: 2px solid #1E2F4D; outline-offset: 3px; }
.group .picks { margin-top: 14px; }

/* versions made by the agent: a small label on the tile */
.tile__tag { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.3; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- print: the plates only, 1:1 ---------- */
@media print {
  .top, .foot, .skip, .app__head, .msg, .editor, dialog { display: none !important; }
  html, body { background: #fff; }
  .app { max-width: none; min-height: 0; margin: 0; padding: 0; }
  .bro__layout { display: block; }
  .preview { padding: 0; border-radius: 0; background: none; }
  .pages { zoom: 1; display: block; }
  .plate { box-shadow: none; }
}

/* before the brochure is unlocked: our three designs on a sample listing (Maher, 2026-11-16) */
.choose__title { font-size: clamp(1.5rem, 2.4vw, 2rem); max-width: none; }
.models { display: grid; gap: clamp(28px, 4vw, 44px); margin-top: 28px; }
.model { display: grid; gap: 12px; justify-items: start; }
.model img { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 24px 48px -36px rgba(30,47,77,.5); }
.model__name { display: grid; gap: 2px; }
.model__name b { font-weight: 600; }
.model__name small { color: var(--muted); font-size: var(--t-sm); }
