/* card screens. Owner: card worker (CONTRACTS.md). Scope rules under body[data-area="card"] or a screen class. */

/* ================= the table card itself (also used by setup's preview) =================
   Every size is in cqw so one design renders at any width: the big preview,
   the picker thumbnails and the printed page. Always paper, whatever the app theme. */
@font-face { font-family: "Pinyon Script"; src: url(/fonts/pinyon-script-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url(/fonts/cinzel-var.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Archivo"; src: url(/fonts/archivo-wdth.woff2) format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

.tc { container-type: inline-size; width: 100%; }
.cf {
  --accent: #6F8FDB; --script: "Pinyon Script", "Gloock", serif; --cinzel: "Cinzel", "Gloock", serif; --archivo: "Archivo", "Nunito", sans-serif;
  --card-serif: "Gloock", "Iowan Old Style", Georgia, serif; --card-sans: "Nunito", system-ui, sans-serif;
  position: relative; overflow: hidden; aspect-ratio: 5 / 7; border-radius: 1.6cqw;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: #FFFDFB; color: #1B1E2A; isolation: isolate; color-scheme: light;
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.tc[data-size="4x6"] .cf { aspect-ratio: 4 / 6; }
.cf > * { position: relative; z-index: 1; }
.cf p { margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.cf .qr { width: 50cqw; height: auto; display: block; border-radius: 1.4cqw; flex: none; }
.cf .how { font: 600 3.3cqw/1.35 var(--card-sans); color: #5A5F70; }
.cf svg { display: block; overflow: visible; }
.cf .photo { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 70%; display: block; }
/* the album's flower colours (FLOWER_COLOURS in src/shared/album.ts) */
.cf[data-accent="blue"] { --accent: #6F8FDB; }
.cf[data-accent="blush"] { --accent: #D98A9E; }
.cf[data-accent="sage"] { --accent: #86A68A; }
.cf[data-accent="lilac"] { --accent: #A68BD6; }
.cf[data-accent="marigold"] { --accent: #E0A23C; }

/* 1 Forget-me-not (floral) */
.d-bloom { padding: 9cqw 8cqw 6cqw; }
.d-bloom .fl { width: 12cqw; height: 12cqw; color: var(--accent); --pollen: #E2A93B; flex: none; }
.d-bloom .scatter { position: absolute; z-index: 0; color: var(--accent); --pollen: #E9C36A; }
.d-bloom .s1 { left: -3cqw; top: -2cqw; width: 17cqw; height: 17cqw; opacity: .5; transform: rotate(18deg); }
.d-bloom .s2 { left: 13cqw; top: 3cqw; width: 7cqw; height: 7cqw; opacity: .35; }
.d-bloom .s3 { right: -4cqw; top: 7cqw; width: 14cqw; height: 14cqw; opacity: .42; transform: rotate(-12deg); }
.d-bloom .s4 { right: 12cqw; top: -1cqw; width: 6cqw; height: 6cqw; opacity: .3; }
.d-bloom .s5 { left: 4cqw; bottom: 16cqw; width: 6cqw; height: 6cqw; opacity: .28; }
.d-bloom .s6 { right: 5cqw; bottom: 22cqw; width: 8cqw; height: 8cqw; opacity: .32; transform: rotate(30deg); }
.d-bloom .n { font: 400 10cqw/1.05 var(--card-serif); margin-top: 3cqw; letter-spacing: -0.01em; }
.d-bloom .d { font: 700 3.4cqw/1 var(--card-sans); letter-spacing: .1em; margin-top: 2.6cqw; color: #5A5F70; }
.d-bloom .m { font: 400 5.4cqw/1.2 var(--card-serif); margin-top: 5cqw; }
.d-bloom .qr { margin-top: 4cqw; }
.d-bloom .how { margin-top: auto; padding-top: 3cqw; }
.tc[data-size="4x6"] .d-bloom { padding-top: 6cqw; }
.tc[data-size="4x6"] .d-bloom .m { margin-top: 3cqw; }
.tc[data-size="4x6"] .d-bloom .qr { width: 44cqw; margin-top: 3cqw; }

/* 2 Minimal */
.d-minimal { background: #FFFFFF; padding: 11cqw 10cqw 9cqw; }
.d-minimal .k { font: 800 3cqw/1 var(--card-sans); letter-spacing: .28em; text-transform: uppercase; }
.d-minimal .qr { width: 56cqw; margin-top: 8cqw; border-radius: 0; }
.d-minimal .rule { width: 10cqw; height: .7cqw; background: var(--accent); margin-top: 8cqw; flex: none; }
.d-minimal .n { font: 400 7.4cqw/1.1 var(--card-serif); margin-top: 6cqw; }
.d-minimal .m { font: 500 3.6cqw/1.4 var(--card-sans); color: #545B71; margin-top: 2.4cqw; }
.d-minimal .d { font: 700 3cqw/1 var(--card-sans); letter-spacing: .2em; color: #545B71; margin-top: auto; padding-top: 3cqw; }
.tc[data-size="4x6"] .d-minimal { padding-top: 8cqw; }
.tc[data-size="4x6"] .d-minimal .qr { width: 48cqw; margin-top: 6cqw; }
.tc[data-size="4x6"] .d-minimal .rule { margin-top: 5cqw; }
.tc[data-size="4x6"] .d-minimal .n { margin-top: 4cqw; }

/* 3 Monogram */
.d-monogram { background: #FAF6EE; color: #22283A; padding: 8cqw 9cqw 6cqw; }
.d-monogram .ring { width: 46cqw; height: 46cqw; position: relative; display: grid; place-items: center; color: var(--accent); flex: none; }
.d-monogram .ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.d-monogram .ini { font: 500 13cqw/1 var(--cinzel); color: #22283A; display: flex; align-items: center; gap: 1.6cqw; position: relative; }
.d-monogram .ini i { font: 400 12cqw/1 var(--script); font-style: normal; color: var(--accent); margin-top: 1cqw; }
.d-monogram .n { font: 600 3.8cqw/1.2 var(--cinzel); letter-spacing: .2em; margin-top: 3cqw; }
.d-monogram .d { font: 500 3.2cqw/1 var(--cinzel); letter-spacing: .24em; margin-top: 1.8cqw; color: #6A6455; }
.d-monogram .m { font: 400 7.2cqw/1.05 var(--script); margin-top: 3.4cqw; }
.d-monogram .qr { width: 38cqw; margin-top: 2.6cqw; }
.d-monogram .how { margin-top: auto; padding-top: 2cqw; color: #6A6455; }
.tc[data-size="4x6"] .d-monogram { padding-top: 5cqw; }
.tc[data-size="4x6"] .d-monogram .ring { width: 36cqw; height: 36cqw; }
.tc[data-size="4x6"] .d-monogram .ini { font-size: 10cqw; }
.tc[data-size="4x6"] .d-monogram .qr { width: 32cqw; }

/* 4 Rustic (kraft paper, eucalyptus) */
.d-rustic { background:
  radial-gradient(70% 50% at 30% 20%, rgba(255, 240, 210, .45), transparent 70%),
  linear-gradient(160deg, #D9BC8E 0%, #CBA877 60%, #B8935F 100%); color: #3A2A1B; padding: 24cqw 9cqw 7cqw; }
.d-rustic::after { content: ""; position: absolute; inset: 0; z-index: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.d-rustic .sprig { position: absolute; z-index: 1; width: 32cqw; height: 32cqw; color: #5E7B5A; top: -4cqw; }
.d-rustic .sprig.left { left: -4cqw; }
.d-rustic .sprig.right { right: -4cqw; transform: scaleX(-1); }
.d-rustic .n { font: 400 14cqw/1 var(--script); }
.d-rustic .d { font: 800 3.2cqw/1 var(--card-sans); letter-spacing: .22em; text-transform: uppercase; margin-top: 2.6cqw; }
.d-rustic .tag { margin-top: 4cqw; background: #FBF5EA; border-radius: 2cqw; padding: 4.4cqw 4.4cqw 3.4cqw; box-shadow: 0 .4cqw 1.6cqw rgba(60, 40, 20, .25); display: flex; flex-direction: column; align-items: center; }
.d-rustic .tag .m { font: 400 4.8cqw/1.2 var(--card-serif); max-width: 46cqw; }
.d-rustic .tag .qr { width: 40cqw; margin-top: 3cqw; }
.d-rustic .how { color: #4A3826; margin-top: auto; padding-top: 3cqw; }
.tc[data-size="4x6"] .d-rustic { padding-top: 18cqw; }
.tc[data-size="4x6"] .d-rustic .tag .qr { width: 34cqw; }

/* 5 Bold modern */
.d-bold { background: var(--accent); color: #fff; padding: 9cqw 8cqw 7cqw; align-items: flex-start; text-align: left; }
.d-bold .blob { position: absolute; z-index: 0; right: -22cqw; top: -18cqw; width: 78cqw; height: 78cqw; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.d-bold .h { font: 900 15cqw/.9 var(--archivo); font-stretch: 78%; text-transform: uppercase; letter-spacing: -0.01em; text-shadow: 0 .2cqw .8cqw rgba(0, 0, 0, .12); }
.d-bold .m { font: 650 4.2cqw/1.3 var(--card-sans); margin-top: 4cqw; max-width: 60cqw; text-wrap: pretty; }
.d-bold .row { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; width: 100%; gap: 4cqw; }
.d-bold .qrbox { background: #fff; border-radius: 4cqw; padding: 3cqw; flex: none; }
.d-bold .qr { width: 42cqw; }
.d-bold .who { font: 800 4cqw/1.2 var(--archivo); font-stretch: 90%; text-transform: uppercase; letter-spacing: .04em; text-align: right; }
.d-bold .who small { display: block; font: 600 3.2cqw/1.3 var(--card-sans); text-transform: none; letter-spacing: 0; margin-top: 1cqw; }
/* light flower colours need dark ink to stay readable from across the room */
.d-bold[data-accent="marigold"], .d-bold[data-accent="sage"] { color: #1B1E2A; }
.d-bold[data-accent="marigold"] .h, .d-bold[data-accent="sage"] .h { text-shadow: none; }
.tc[data-size="4x6"] .d-bold .h { font-size: 13cqw; }
.tc[data-size="4x6"] .d-bold .qr { width: 36cqw; }

/* 6 Your photo (full bleed) */
.d-photo { background: #3E2B3A; color: #fff; padding: 9cqw 7cqw 6cqw; }
.d-photo::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(14, 12, 24, .5) 0%, rgba(14, 12, 24, 0) 34%, rgba(14, 12, 24, 0) 52%, rgba(14, 12, 24, .55) 100%); }
.d-photo > :not(.photo) { z-index: 2; }
.d-photo .n { font: 400 11cqw/1 var(--card-serif); letter-spacing: -0.01em; text-shadow: 0 .3cqw 2cqw rgba(0, 0, 0, .3); }
.d-photo .d { font: 700 3.4cqw/1 var(--card-sans); letter-spacing: .14em; margin-top: 2.6cqw; text-shadow: 0 .2cqw 1.2cqw rgba(0, 0, 0, .3); }
.d-photo .panel { margin-top: auto; width: 100%; background: rgba(255, 253, 251, .96); color: #1B1E2A; border-radius: 4cqw; padding: 3.4cqw; display: flex; align-items: center; gap: 4cqw; text-align: left; }
.d-photo .panel .qr { width: 34cqw; }
.d-photo .panel .m { font: 400 5cqw/1.15 var(--card-serif); }
.d-photo .panel .how { margin-top: 2cqw; font-size: 3cqw; }

/* 7 Snapshot (photo in a print) */
.d-polaroid { background: #F2EEE8; padding: 8cqw 9cqw 6cqw; }
.d-polaroid .tape { position: absolute; z-index: 2; top: 5.4cqw; left: 50%; width: 20cqw; height: 6cqw; transform: translateX(-50%) rotate(-3deg); background: color-mix(in srgb, var(--accent) 45%, rgba(255, 255, 255, .6)); }
.d-polaroid .print { background: #fff; padding: 3.4cqw 3.4cqw 0; width: 70cqw; transform: rotate(-2.5deg); box-shadow: 0 .6cqw 2.4cqw rgba(40, 30, 20, .22); flex: none; }
.d-polaroid .pic { position: relative; aspect-ratio: 1 / .86; overflow: hidden; }
.d-polaroid .print .n { font: 400 9cqw/1 var(--script); padding: 2.6cqw 0 3.6cqw; }
.d-polaroid .m { font: 400 4.8cqw/1.2 var(--card-serif); margin-top: 5.4cqw; }
.d-polaroid .row { display: flex; align-items: center; gap: 4cqw; margin-top: auto; text-align: left; }
.d-polaroid .qr { width: 32cqw; }
.d-polaroid .row .d { font: 800 3.2cqw/1.3 var(--card-sans); letter-spacing: .12em; color: color-mix(in srgb, var(--accent) 70%, #1B1E2A); }
.d-polaroid .row .how { margin-top: 1.4cqw; }
.tc[data-size="4x6"] .d-polaroid { padding-top: 6cqw; }
.tc[data-size="4x6"] .d-polaroid .print { width: 60cqw; }
.tc[data-size="4x6"] .d-polaroid .m { margin-top: 3.4cqw; }

/* 8 Art deco */
.d-deco { --gold: #C9A55C; background: #15171E; color: #F1EBDD; padding: 10cqw 10cqw 8cqw; }
.d-deco .frame { position: absolute; inset: 3.6cqw; z-index: 0; border: .45cqw solid var(--gold); }
.d-deco .frame::after { content: ""; position: absolute; inset: 1.4cqw; border: .25cqw solid var(--gold); opacity: .7; }
.d-deco .fan { width: 50cqw; height: 25cqw; color: var(--gold); flex: none; }
.d-deco .n { font: 600 6.6cqw/1.15 var(--cinzel); letter-spacing: .12em; color: var(--gold); margin-top: 3cqw; }
.d-deco .d { font: 500 3.2cqw/1 var(--cinzel); letter-spacing: .3em; margin-top: 2.4cqw; }
.d-deco .m { font: 400 4.8cqw/1.25 var(--card-serif); margin-top: 4.4cqw; max-width: 60cqw; }
.d-deco .qrbox { margin-top: 4.4cqw; padding: 2cqw; border: .45cqw solid var(--gold); flex: none; }
.d-deco .qr { width: 36cqw; border-radius: 0; }
.d-deco .how { color: #B9B2A2; margin-top: auto; padding-top: 2cqw; }
.tc[data-size="4x6"] .d-deco { padding-top: 8cqw; }
.tc[data-size="4x6"] .d-deco .fan { width: 40cqw; height: 20cqw; }
.tc[data-size="4x6"] .d-deco .qr { width: 32cqw; }

/* long names ("Alexandra & Christopher") step down so the code and footer still fit */
.cf[data-long].d-bloom .n { font-size: 8.4cqw; }
.cf[data-long].d-minimal .n { font-size: 6.4cqw; }
.cf[data-long].d-rustic { padding-top: 21cqw; }
.cf[data-long].d-rustic .n { font-size: 11.5cqw; }
.cf[data-long].d-photo .n { font-size: 9.4cqw; }
.cf[data-long].d-deco .n { font-size: 5.6cqw; }

/* ================= the designer (#/card) ================= */
body[data-area="card"] .app { max-width: 480px; }
.cd-head { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.cd-back { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; flex: none; text-decoration: none; }
.cd-back .i { width: 20px; height: 20px; }
.cd-head .cd-title { font: 700 17px/1.2 var(--sans); flex: 1; min-width: 0; }
.cd-head .cd-title small { display: block; font-weight: 600; font-size: 13px; color: var(--muted); }
.cd-saved { font: 700 13px/1 var(--sans); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.cd-saved .i { width: 16px; height: 16px; color: var(--ok); }

.cd-lead { margin-top: 10px; }
.cd-lead h1 { font-size: 32px; line-height: 1.08; margin: 0; }
.cd-lead p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }

.cd-stage { margin-top: 18px; border-radius: var(--r-xl); padding: 24px 0; background: var(--blue-soft); display: grid; justify-items: center; gap: 12px; }
.cd-card { width: 72%; max-width: 300px; }
.cd-stage .tc { filter: drop-shadow(0 2px 3px rgba(20, 24, 40, .1)) drop-shadow(0 22px 26px rgba(20, 24, 40, .3)); }
.cd-stage .cf { transform: rotate(-1.2deg); }
.cd-meta { font: 700 13.5px/1 var(--sans); color: var(--muted); margin: 0; }

.cd-sec { font-size: 22px; margin: 30px 2px 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cd-sec small { font: 650 14px/1 var(--sans); color: var(--muted); }

.cd-designs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.cd-designs input, .cd-swatches input, .cd-seg input { position: absolute; opacity: 0; pointer-events: none; }
.cd-opt { display: grid; gap: 7px; cursor: pointer; font: 700 12.5px/1.2 var(--sans); text-align: center; color: var(--muted); }
.cd-opt .tc { border-radius: 8px; outline: 2px solid transparent; outline-offset: 3px; box-shadow: var(--shadow); }
.cd-opt .cf { border-radius: 6px; }
.cd-designs input:checked + .cd-opt { color: var(--ink); }
.cd-designs input:checked + .cd-opt .tc { outline-color: var(--ink); }
.cd-designs input:focus-visible + .cd-opt .tc { outline-color: var(--blue); }
.cd-opt .tag { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }

.cd-photo { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-lg); }
.cd-photo [hidden] { display: none; }
.cd-photo .thumb { width: 64px; height: 64px; border-radius: 14px; background: #4A4560 center / cover no-repeat; flex: none; }
.cd-photo .txt { flex: 1; min-width: 0; }
.cd-photo b { display: block; font-weight: 750; }
.cd-photo small { display: block; color: var(--muted); font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.cd-photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.cd-photo-btns .btn { border-radius: 18px; padding: 0 12px; }
.cd-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cd-file:focus-visible + .btn { outline: 2.5px solid var(--blue); outline-offset: 3px; }
.cd-ico { width: 22px; height: 22px; flex: none; }
.cd-ico-sm { width: 18px; height: 18px; flex: none; }
.cd-opt .tag .cd-ico-sm { width: 13px; height: 13px; color: var(--blue); }

.cd-form { display: grid; gap: 16px; }
.cd-field { display: block; }
.cd-field > span, .cd-label { display: block; font: 700 14px/1.3 var(--sans); margin-bottom: 8px; }
.cd-input { min-height: 52px; border-radius: var(--r-md); background: var(--surface-2); padding: 0 16px; font: 600 16px/1.2 var(--sans); caret-color: var(--blue); }
.cd-input:focus { background: var(--surface); }
textarea.cd-input { min-height: 80px; padding: 14px 16px; line-height: 1.35; }
.cd-field .error { color: var(--danger); font-size: .9rem; font-weight: 600; margin: 6px 0 0; }
.cd-ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cd-ideas button { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 700 14px/1.2 var(--sans); cursor: pointer; }
.cd-ideas button[aria-pressed="true"] { border-color: var(--ink); }

.cd-swatches { display: flex; gap: 8px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.cd-swatch { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; border: 2px solid transparent; }
.cd-sw-blue { background: #6F8FDB; } .cd-sw-blush { background: #D98A9E; } .cd-sw-sage { background: #86A68A; }
.cd-sw-lilac { background: #A68BD6; } .cd-sw-marigold { background: #E0A23C; }
.cd-swatch i { width: 32px; height: 32px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
:root[data-theme="dark"] .cd-swatch i { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cd-swatch i { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); } }
.cd-swatches input:checked + .cd-swatch { border-color: var(--ink); }
.cd-swatches input:focus-visible + .cd-swatch { outline: 2.5px solid var(--blue); outline-offset: 2px; }
.cd-hint { color: var(--muted); font-size: 13.5px; font-weight: 600; margin: 8px 0 0; }

.cd-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); margin: 0; min-width: 0; }
.cd-seg label { min-height: 48px; display: grid; place-items: center; align-content: center; border-radius: 12px; font: 750 15px/1.1 var(--sans); cursor: pointer; color: var(--muted); text-align: center; padding: 6px; }
.cd-seg label small { display: block; font-weight: 600; font-size: 12.5px; margin-top: 2px; }
.cd-seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.cd-seg input:focus-visible + label { outline: 2.5px solid var(--blue); outline-offset: 1px; }

.cd-cta { margin-top: 18px; display: grid; gap: 10px; }
.cd-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.cd-note + .cd-note { margin-top: 6px; }

/* pick a photo from the album (in the sheet) */
.cd-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cd-pick button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.cd-pick img { width: 100%; height: 100%; object-fit: cover; }
.cd-pick button[aria-busy="true"] { opacity: .5; }
.cd-pick-more { margin-top: 12px; }

.cd-empty { text-align: center; padding: 28px 20px; }
.cd-empty h1 { font-size: 28px; }
.cd-empty p { color: var(--muted); }

@media (min-width: 960px) {
  body[data-area="card"] .app, body[data-area="card"] .topbar { max-width: 1120px; }
  .cd { display: grid; grid-template-columns: 1fr 420px; gap: 8px 56px; align-items: start; }
  .cd > .cd-head, .cd > .cd-lead { grid-column: 1 / -1; }
  .cd-preview { grid-column: 2; grid-row: 3 / span 2; position: sticky; top: 20px; }
  .cd-controls { grid-column: 1; grid-row: 3; }
  .cd-stage { margin-top: 0; padding: 40px 0; }
}

/* ================= print (#/card/print) ================= */
.cdp-sheet { margin-top: 18px; border-radius: var(--r-xl); padding: 24px 16px; background: var(--blue-soft); display: grid; justify-items: center; gap: 12px; }
/* the paper as it will come out of the printer, scaled to fit the screen */
.cdp-paper { background: #fff; box-shadow: var(--shadow-lift); width: 100%; position: relative; color-scheme: light; }
.cdp-paper[data-paper="card"][data-size="5x7"] { max-width: 300px; aspect-ratio: 5 / 7; }
.cdp-paper[data-paper="card"][data-size="4x6"] { max-width: 280px; aspect-ratio: 4 / 6; }
.cdp-paper[data-paper="sheet"] { max-width: 340px; aspect-ratio: 8.5 / 11; display: flex; justify-content: center; align-items: center; }
/* two 4 x 6 cards side by side on a landscape sheet */
.cdp-paper[data-paper="sheet"][data-size="4x6"] { max-width: 440px; aspect-ratio: 11 / 8.5; gap: 2.3%; }
.cdp-paper[data-paper="card"] .tc .cf { border-radius: 0; }
.cdp-paper[data-paper="sheet"][data-size="5x7"] .tc { width: 58.8%; } /* 5in of 8.5in */
.cdp-paper[data-paper="sheet"][data-size="4x6"] .tc { width: 36.4%; } /* 4in of 11in */
.cdp-paper[data-paper="sheet"] .cf { border-radius: 0; outline: 1px dashed #9AA0B3; outline-offset: 0; }
.cdp-tips { margin: 18px 0 0; padding: 0 0 0 20px; color: var(--muted); font-size: 15px; display: grid; gap: 6px; }
.cdp-tips b { color: var(--ink); }

/* the page size per choice (named pages: no inline styles under the CSP) */
@page card57 { size: 5in 7in; margin: 0; }
@page card46 { size: 4in 6in; margin: 0; }
@page sheet57 { size: portrait; margin: .5in; }
@page sheet46 { size: landscape; margin: .4in; }
.cdp-paper[data-paper="card"][data-size="5x7"] { page: card57; }
.cdp-paper[data-paper="card"][data-size="4x6"] { page: card46; }
.cdp-paper[data-paper="sheet"][data-size="5x7"] { page: sheet57; }
.cdp-paper[data-paper="sheet"][data-size="4x6"] { page: sheet46; }

/* what reaches the printer: only the paper. @page size is set by the screen per choice. */
@media print {
  body:has(.cdp) { background: #fff; padding: 0; }
  body:has(.cdp) > *:not(#app), body:has(.cdp) #app > :not(.cdp) , .cdp > :not(.cdp-sheet), .cdp-sheet > :not(.cdp-paper) { display: none !important; }
  body:has(.cdp) .app { max-width: none; padding: 0; margin: 0; }
  .cdp-sheet { margin: 0; padding: 0; background: none; border-radius: 0; display: block; }
  .cdp-paper { box-shadow: none; max-width: none !important; margin: 0; }
  .cdp-paper[data-paper="card"][data-size="5x7"] { width: 5in; height: 7in; }
  .cdp-paper[data-paper="card"][data-size="4x6"] { width: 4in; height: 6in; }
  .cdp-paper[data-paper="sheet"] { width: auto !important; aspect-ratio: auto !important; padding: 0 !important; display: flex; justify-content: center; gap: .25in !important; break-inside: avoid; }
  .cdp-paper[data-paper="sheet"][data-size="5x7"] .tc { width: 5in; margin: 0; }
  .cdp-paper[data-paper="sheet"][data-size="4x6"] .tc { width: 4in; }
  .cdp-paper[data-paper="sheet"] .cf { outline: .5pt dashed #9AA0B3; }
}

/* the print page reads best as one column, even on a wide screen */
.cdp { max-width: 720px; margin: 0 auto; }
