/* Share and print (sharepanel.js, export.js). The Share screen, its cards, the QR card, the size tiles and the QR
   full-screen sheet are the shell's (app.css v2, brief §7); this file holds only what the shell does not draw: the
   print preview and the print documents at their own page sizes (export.js), and the share-screen details the
   module adds. Tokens from app.css. */

/* ---------- Share screen details ---------- */
#share-native[hidden], #share-qr-full[hidden], .qrcard[hidden], #share-qr-note[hidden], #export-qr-note[hidden], #email-status[hidden] { display: none; }
#email-to b { font-weight: 600; overflow-wrap: anywhere; }
#email-status.err .ico, #email-status.ok-line .ico { width: 18px; height: 18px; }
.checks input:disabled + span { color: var(--muted); }

/* ---------- print preview (screen) ---------- */
#sp-print { display: none; }
/* the print document takes the whole width: the desktop shell's two-column body grid (app.css, >= 960px) would put it
   in the 248px rail and squeeze every sheet (M1e item 4); block on screen and on paper */
body.sp-printing { display: block; }
body.sp-printing > :not(#sp-print) { display: none !important; }
body.sp-printing #sp-print { display: block; padding: 0 max(16px, env(safe-area-inset-left)); }
.sp-pv-bar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--rule); padding: 12px 0; display: flex; flex-wrap: wrap; gap: 10px; }
.sp-pv-bar .btn { flex: 1 1 200px; }
.sp-pv-bar .ico { width: 18px; height: 18px; }
.sp-tip-desk { display: none; }
.sp-tip-phone { display: inline; }
@media (hover: hover) and (pointer: fine) { .sp-tip-desk { display: inline; } .sp-tip-phone { display: none; } }   /* flows G5: Ctrl+P only where there is a keyboard */
.sp-pv-tip { color: var(--muted); font-size: 15px; padding: 14px 0 6px; max-width: 70ch; }
.sp-pv-note { display: flex; gap: 8px; align-items: center; font-weight: 500; padding: 6px 0 4px; }
.sp-pv-note .ico { width: 18px; height: 18px; }
.sp-pages { display: grid; gap: 20px; padding: 14px 0 48px; justify-items: center; }

/* ---------- print documents: one size system, millimetres of the page (export.js) ---------- */
.sp-sheet { --mm: calc(100cqw / var(--w)); container-type: inline-size; position: relative; overflow: hidden; background: #fff; color: #14261D; width: 100%; max-width: 860px; aspect-ratio: var(--w) / var(--h); box-shadow: var(--shadow); }
.sp-pframe { position: absolute; border-style: solid; border-color: #9C7A3C; }
.sp-pin { position: absolute; border-style: solid; border-color: #9C7A3C; display: flex; flex-direction: column; }
.sp-phead { display: grid; text-align: center; }
.sp-ptitle { font-family: var(--f-display); font-weight: 500; line-height: 1.05; overflow-wrap: anywhere; }
.sp-psub { font-family: var(--f-body); text-transform: uppercase; letter-spacing: .22em; color: #7A5C24; font-weight: 500; overflow-wrap: anywhere; }
.sp-pgrid { display: grid; align-content: start; flex: 1 1 auto; min-height: 0; }
.sp-ptable { text-align: center; break-inside: avoid; min-width: 0; }
.sp-ptname { font-family: var(--f-script); font-weight: 400; font-size: 1.55em; line-height: 1.1; overflow-wrap: anywhere; }
.sp-ptname::after { content: ""; display: block; width: 30%; margin: .25em auto .3em; border-top: calc(var(--mm) * .25) solid #9C7A3C; }
.sp-pnames { list-style: none; margin: 0; padding: 0; font-family: var(--f-display); line-height: 1.45; overflow-wrap: anywhere; }
.sp-pqr { margin: 0; align-self: flex-end; display: grid; justify-items: center; text-align: center; }
.sp-pqr-code svg { width: 100%; height: 100%; display: block; }
.sp-pqr-line { font-family: var(--f-body); letter-spacing: .04em; line-height: 1.3; }
.sp-proom { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
/* the room's width and height are set in mm of the page by export.js (roomBox), in the drawing's own shape */
.sp-proom svg.room-print { display: block; max-width: none; max-height: none; flex: none; }
.sp-card { position: absolute; display: flex; flex-direction: column; }
.sp-card::after { content: ""; position: absolute; inset: 0; border: calc(var(--mm) * .2) solid #8E9690; pointer-events: none; }
.sp-tent::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: calc(var(--mm) * .25) dashed #8E9690; }
.sp-cface { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.sp-cback { transform: rotate(180deg); }
.sp-ckey { position: absolute; border: calc(var(--mm) * .35) solid #9C7A3C; }
.sp-cname { position: relative; font-family: var(--f-script); line-height: 1.05; overflow-wrap: anywhere; }
.sp-ctable { position: relative; display: inline-flex; align-items: center; font-family: var(--f-body); text-transform: uppercase; letter-spacing: .24em; color: #7A5C24; font-weight: 500; }

/* ---------- print: only the print document, at its own page size (the @page rule is set per document) ---------- */
@media print {
  body.sp-printing { display: block !important; }
  body.sp-printing > :not(#sp-print) { display: none !important; }
  #sp-print .sp-pv-bar, #sp-print .sp-pv-tip, #sp-print .sp-pv-note { display: none !important; }
  body.sp-printing #sp-print { display: block; padding: 0; }
  #sp-print .sp-pages { display: block; padding: 0; }
  /* on paper a sheet is its real size, so --mm is a real millimetre: no container units here. Firefox resolves cqw
     wrongly in print (its preview overlaps the text; the saved file clips the title and leaves the frame short) */
  #sp-print .sp-sheet { --mm: 1mm; container-type: normal; width: calc(var(--w) * 1mm); height: calc(var(--h) * 1mm - 1px); max-width: none; aspect-ratio: auto; box-shadow: none; margin: 0; break-after: page; }
  #sp-print .sp-sheet:last-child { break-after: auto; }
}

/* ---------- the print panel: the stationer's proof (M1f, design/flows-2026-10-29.md section P) ---------- */
/* the sheet on the left, five short groups on the right; one column on a phone with the proof as a sticky strip */
.pp-wrap { display: grid; gap: 14px; min-width: 0; }
.pp { display: grid; gap: 16px; }
.pp-proof { display: grid; gap: 8px; align-content: start; min-width: 0; }
.pp-proof .cap { font-size: 12px; text-transform: uppercase; letter-spacing: .16em; font-weight: 500; color: var(--foil-ink); display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; }
.pp-proof .cap .btn-quiet { font-size: 14px; text-transform: none; letter-spacing: 0; min-height: 32px; color: var(--fg); }
.pp-proof .cap .btn-quiet[hidden] { display: none; }
.proof-wrap { position: relative; background: var(--tint); border: 1px solid var(--rule); padding: 12px; min-height: 120px; }
.proof-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.proof-page { max-width: 100%; flex: none; }
.proof-page .sp-sheet { max-width: none; }
/* locked: the sample's lines are soft (they are "Guest n", never a name) and the gate button sits over the sheet */
.proof-wrap.locked .sp-pnames { filter: blur(2.5px); opacity: .8; }
.proof-gate { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: calc(100% - 24px); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.proof-gate[hidden] { display: none; }
.pp-opts { display: grid; gap: 16px; min-width: 0; }
.pp-opts .card { gap: 12px; }
.pp-opts h3.h3 { font-size: 18px; }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.four label.tile { padding: 10px 8px; }
.tiles.four label.tile .sz { font-size: 12px; }
.tiles.four label.tile svg.paper { width: 100%; max-width: 44px; height: auto; }
.blocks { display: grid; gap: 2px; }
.blocks .check { min-height: 48px; justify-content: space-between; }
.blocks .check .l { display: flex; align-items: center; gap: 10px; }
.blocks .check .thumb { width: 28px; height: 36px; flex: none; border: 1px solid var(--rule); background: var(--surface); display: grid; place-items: center; }
.blocks .check .thumb i { display: block; background: var(--muted); }
.blocks .check .thumb i.room { width: 18px; height: 12px; border: 1px solid var(--fg); background: none; }
.blocks .check .thumb i.lists { width: 18px; height: 16px; background: repeating-linear-gradient(var(--muted) 0 2px, transparent 2px 4px); }
.blocks .check .thumb i.tags { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.blocks .check .thumb i.qr { width: 14px; height: 14px; background: repeating-conic-gradient(var(--fg) 0 25%, transparent 0 50%) 0 0 / 7px 7px; }
.blocks .check:has(input:disabled) { color: var(--muted); cursor: default; }
.blocks .check:has(input:disabled) .thumb { opacity: .5; }
.blocks .help { margin: 0 0 6px 38px; }
.blocks .help[hidden] { display: none; }
.sub-opt { display: grid; gap: 8px; margin: 0 0 4px 38px; }
.sub-opt[hidden] { display: none; }
.pos { display: inline-grid; grid-template-columns: repeat(3, auto); border: 1px solid var(--fg); border-radius: var(--radius); overflow: hidden; justify-self: start; max-width: 100%; }
.pos input { position: absolute; opacity: 0; pointer-events: none; }
.pos label { min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; cursor: pointer; }
.pos label + input + label { border-left: 1px solid var(--fg); }
.pos input:checked + label { background: var(--fg); color: var(--bg); }
.pos input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -4px; }
.pos .pic { width: 16px; height: 20px; flex: none; border: 1px solid currentColor; position: relative; }
.pos .pic::after { content: ""; position: absolute; width: 5px; height: 5px; background: currentColor; }
.pos .pic.br::after { right: 2px; bottom: 2px; }
.pos .pic.bl::after { left: 2px; bottom: 2px; }
.pos .pic.ut::after { left: 5px; top: 4px; }
.pp-actions { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .pp-actions { grid-template-columns: 1fr 1fr; } }
.pp-actions .help { grid-column: 1 / -1; }

/* phone: one column, the proof a sticky strip 280px tall under the app bar, the groups scroll beneath it */
@media (max-width: 959px) {
  /* a block, not a grid: a sticky box can only travel inside its own grid area, and the strip must follow the whole panel */
  .pp { display: block; }
  .pp-opts { margin-top: 16px; }
  .pp-proof { position: sticky; top: var(--bar); z-index: 5; height: 280px; background: var(--bg); }
  .proof-wrap { height: 240px; overflow: hidden; padding: 8px; display: grid; place-items: center; }
  .proof-pages { flex-direction: row; justify-content: center; }
}
@media (max-width: 380px) { .pos label { padding: 0 8px; gap: 6px; font-size: 13px; } .tiles.four { gap: 6px; } }
/* desktop: the proof is the left column, sticky, the choices 380px on the right */
@media (min-width: 960px) {
  .pp { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 24px; }
  .pp-proof { position: sticky; top: 16px; max-height: calc(100vh - 32px); }
  .proof-wrap { overflow: auto; max-height: calc(100vh - 80px); display: grid; place-items: start center; }
  /* the other Share cards keep their reading width; only the proof and its choices use the wide screen */
  #step-share .printbox > :not(.pp-wrap) { max-width: 760px; width: 100%; justify-self: center; }
}
@media print { .pp-wrap { display: none !important; } }
.pos label { line-height: 1.15; }
@media (max-width: 639px) { .sub-opt, .blocks .help { margin-left: 0; } }
