/* Shop QR sheet (/shop-upi-qr-code/). Screen preview and print share one DOM: .shop-sheet.
   Everything inside the sheet is sized in container units (cqw), so the same layout scales from a
   390 px phone preview up to the real paper size in print. The sheet is paper: always black on white. */

/* ---- Form ---------------------------------------------------------------- */
.shop-sizes { border: 0; margin: 0 0 1.1rem; padding: 0; min-width: 0; }
.shop-sizes legend { padding: 0; }
.shop-size-list { display: grid; gap: 0.5rem; }
@media (min-width: 36rem) { .shop-size-list { grid-template-columns: repeat(3, 1fr); } }
.shop-size {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 0.75rem;
  min-height: var(--tap); padding: 0.7rem 0.85rem; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
@media (min-width: 36rem) {
  .shop-size { grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: start; }
  .shop-size-icon { grid-row: 1; grid-column: 2; justify-self: start; }
  .shop-size-text { grid-column: 1 / -1; }
}
.shop-size:hover { background: var(--surface-2); }
.shop-size:has(input:checked) { border-color: var(--accent); border-width: 2px; padding: calc(0.7rem - 1px) calc(0.85rem - 1px); background: var(--accent-soft); }
.shop-size:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.shop-size input { width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--accent); }
.shop-size-text { display: block; line-height: 1.3; }
.shop-size-title { display: block; font-weight: 600; }
.shop-size-sub { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
/* Little paper shapes, drawn to relative scale */
.shop-size-icon {
  display: block; width: 1.35rem; height: 1.9rem; border: 1.5px solid currentColor; border-radius: 2px;
  color: var(--muted); background: var(--surface);
}
.shop-size-icon--a5 { width: 1rem; height: 1.4rem; margin: 0.25rem 0.18rem; }
.shop-size-icon--stickers {
  background-image:
    linear-gradient(to right, transparent 32%, currentColor 32%, currentColor 36%, transparent 36%, transparent 64%, currentColor 64%, currentColor 68%, transparent 68%),
    linear-gradient(to bottom, transparent 24%, currentColor 24%, currentColor 27%, transparent 27%, transparent 49%, currentColor 49%, currentColor 52%, transparent 52%, transparent 74%, currentColor 74%, currentColor 77%, transparent 77%);
}
.shop-size:has(input:checked) .shop-size-icon { color: var(--accent); }

.shop-more { margin: 0; border-top: 1px dashed var(--border); }
.shop-more > summary {
  cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; color: var(--accent); padding: 0.5rem 0 0;
}
.shop-more > summary::marker { color: var(--muted); }
.shop-more-body { padding-top: 0.75rem; }

/* ---- Preview ------------------------------------------------------------- */
.shop-preview { margin-top: 2rem; }
/* Same small label as the result panels on the other tools. */
.shop-preview-title { margin: 0 0 0.75rem; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; line-height: 1.5rem; }
.shop-empty {
  display: flex; align-items: center; gap: 1rem; padding: 1.25rem; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.shop-empty p { margin: 0; }
.shop-empty-paper {
  flex: none; width: 2.6rem; height: 3.6rem; border: 1.5px solid var(--border-strong); border-radius: 3px;
  background:
    linear-gradient(var(--border) 0 0) 50% 22% / 60% 3px no-repeat,
    linear-gradient(var(--border) 0 0) 50% 62% / 55% 45% no-repeat,
    var(--surface);
}
.shop-stage {
  display: grid; place-items: center; padding: 1rem; background: var(--surface-2);
  border-radius: var(--radius); border: 1px solid var(--border);
}
@media (min-width: 30rem) { .shop-stage { padding: 1.75rem; } }
.shop-stage-note { margin: 0.6rem 0 0; }

/* ---- The sheet (paper) --------------------------------------------------- */
.shop-sheet {
  container-type: inline-size; position: relative; overflow: hidden;
  width: 100%; background: #fff; color: #000;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 6px 22px rgb(0 0 0 / 0.14);
  font-family: var(--font); line-height: 1.2; text-align: center;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.shop-sheet--a4, .shop-sheet--stickers { aspect-ratio: 210 / 297; max-width: 26rem; }
.shop-sheet--a5 { aspect-ratio: 148 / 210; max-width: 21rem; }
.shop-sheet-inner { position: absolute; inset: 0; padding: 5cqw; }
.shop-sheet--stickers .shop-sheet-inner { padding: 3.8cqw; } /* 8 mm on A4 */
.shop-sheet p { margin: 0; }

/* A4 poster and A5 sign: one framed sign filling the page. Units are % of the sheet width. */
.shop-sign--sign { height: 100%; border: 0.55cqw solid #000; border-radius: 3.5cqw; }
.shop-sign--sign > .shop-sign-inner {
  height: 100%; display: flex; flex-direction: column; align-items: center; padding: 6.5cqw 7cqw 3.2cqw;
}
.shop-sign--sign .shop-sign-eyebrow {
  background: #000; color: #fff; border-radius: 99cqw; padding: 1.1cqw 3.4cqw;
  font-size: 2.5cqw; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
}
.shop-sign--sign .shop-sign-name {
  margin-top: 4.2cqw; font-size: 8.6cqw; font-weight: 750; line-height: 1.08; letter-spacing: -0.015em;
  text-wrap: balance; overflow-wrap: anywhere; max-width: 100%;
}
.shop-sign--sign .shop-sign-name--long { font-size: 6.6cqw; }
.shop-sign--sign .shop-sign-name--xlong { font-size: 5.2cqw; }
.shop-sign--sign .shop-sign-qr {
  /* Square, 63% of the width when there is room; shrinks (never below 36%) when long text needs the space. */
  margin-top: auto; flex: 0 1 63cqw; min-height: 36cqw; width: 100%; display: flex; justify-content: center;
}
.shop-sign--sign .shop-sign-qr svg { width: auto; height: 100%; aspect-ratio: 1; }
.shop-sign--sign .shop-sign-id { margin-top: 2.4cqw; max-width: 100%; }
.shop-sign--sign .shop-sign-id-label {
  font-size: 2.1cqw; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #333;
}
.shop-sign--sign .shop-sign-id-value {
  margin-top: 0.6cqw; font-family: var(--mono); font-size: 4.4cqw; font-weight: 650; overflow-wrap: anywhere;
}
.shop-sign--sign .shop-sign-id-value--long { font-size: 3.5cqw; }
.shop-sign--sign .shop-sign-id-value--xlong { font-size: 2.6cqw; }
.shop-sign--sign .shop-sign-line { margin-top: 3.2cqw; font-size: 3.3cqw; font-weight: 500; overflow-wrap: anywhere; }
.shop-sign--sign .shop-sign-check {
  margin-top: auto; padding-top: 2.4cqw; border-top: 0.2cqw solid #000; width: 82%;
  font-size: 2.35cqw; color: #222; line-height: 1.35; overflow-wrap: anywhere;
}
.shop-sign--sign .shop-sign-check strong { display: block; margin-top: 0.3cqw; font-size: 2.9cqw; color: #000; font-weight: 700; text-wrap: balance; }
.shop-sign--sign .shop-sign-made { margin-top: 1.8cqw; font-size: 1.5cqw; color: #555; letter-spacing: 0.04em; }

.shop-sign-qr svg { display: block; width: 100%; height: auto; }

/* Sticker sheet: 3 x 4 stickers on A4, dashed cut lines. Inside a sticker, cqw is % of the sticker. */
.shop-stickers {
  height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr);
  border-top: 0.15cqw dashed #777; border-left: 0.15cqw dashed #777;
}
.shop-sign--sticker {
  container-type: inline-size; position: relative; overflow: hidden; min-height: 0;
  border-right: 0.15cqw dashed #777; border-bottom: 0.15cqw dashed #777;
  break-inside: avoid;
}
.shop-sign--sticker > .shop-sign-inner {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5cqw 6cqw;
}
.shop-sign--sticker .shop-sign-name {
  font-size: 7.6cqw; font-weight: 750; line-height: 1.1; max-width: 100%; overflow-wrap: anywhere;
  text-wrap: balance; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.shop-sign--sticker .shop-sign-name--long { font-size: 6.4cqw; }
.shop-sign--sticker .shop-sign-name--xlong { font-size: 5.4cqw; }
.shop-sign--sticker .shop-sign-qr { width: 64cqw; margin-top: 2.5cqw; flex: none; }
.shop-sign--sticker .shop-sign-id { margin-top: 1.5cqw; max-width: 100%; }
.shop-sign--sticker .shop-sign-id-value { font-family: var(--mono); font-size: 4.8cqw; font-weight: 650; overflow-wrap: anywhere; }
.shop-sign--sticker .shop-sign-id-value--long { font-size: 3.9cqw; }
.shop-sign--sticker .shop-sign-id-value--xlong { font-size: 3.2cqw; }
.shop-sign--sticker .shop-sign-check {
  margin-top: 1.8cqw; font-size: 3.5cqw; color: #222; line-height: 1.25; max-width: 100%; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.shop-sign--sticker .shop-sign-check strong { color: #000; }

.shop-warning { margin-top: 1.75rem; }
.shop-merchant { margin-top: 1rem; }
/* Wide screens: the preview sits beside the form, so keep the sheet short enough to see the Print button. */
@media (min-width: 64rem) {
  .shop-preview { margin-top: 0; }
  .shop-sheet--a4, .shop-sheet--stickers { max-width: 21rem; }
  .shop-sheet--a5 { max-width: 19rem; }
}
.shop-help h2:first-child { margin-top: 2.25rem; }

/* ---- Print: only the sheet, at its real paper size, one page ------------- */
@page { size: A4 portrait; margin: 0; }
@page shop-a4 { size: A4 portrait; margin: 0; }
@page shop-a5 { size: A5 portrait; margin: 0; }

@media print {
  /* Light tokens win over the dark ones whatever the system or toggle says (same specificity, later). */
  :root:not([data-theme="light"]), :root[data-theme] {
    color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #333;
    --border: #999; --border-strong: #666; --accent: #000; --shadow: none;
  }
  html, body.shop-page { background: #fff !important; color: #000; }
  body.shop-page { display: block; min-height: 0; margin: 0; }
  .shop-page .site-main { margin: 0; padding: 0; max-width: none; }
  .shop-page .site-main > :not(.tool-layout), .shop-page .tool-layout > :not(.tool-aside),
  .shop-page .tool-aside > :not(.shop-preview) { display: none !important; }
  .shop-page .tool-layout, .shop-page .tool-aside { display: block; position: static; margin: 0; padding: 0; max-width: none; }
  .shop-preview > :not(.shop-stage) { display: none !important; }
  .shop-preview, .shop-stage { display: block; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }

  .shop-sheet { box-shadow: none; max-width: none; aspect-ratio: auto; margin: 0; break-inside: avoid; }
  .shop-sheet--a4, .shop-sheet--stickers { page: shop-a4; width: 210mm; height: 297mm; }
  .shop-sheet--a5 { page: shop-a5; width: 148mm; height: 210mm; }
}

/* Keep a minimum gap where auto margins collapse with long text. */
.shop-sign--sign .shop-sign-name { margin-bottom: 3cqw; }
.shop-sign--sign .shop-sign-id:last-of-type, .shop-sign--sign .shop-sign-line { margin-bottom: 2.8cqw; }
