/* Jigsaw Publisher — cards.css (engine v1): the greetings-card page. */
.cards-hero { padding-bottom: 6px; }
.card-maker { display: grid; grid-template-columns: 1.15fr 1fr 1.3fr; gap: 22px; padding: 10px 0 30px; }
/* Phones (owner R4-2): the panes stack, so the card is pinned at the top
   and an open gallery scrolls inside a bounded box -- the greeting is always
   one screen away and the card never leaves view. The maker becomes a block
   because a sticky grid item can only stick within its own cell. */
@media (max-width: 1000px) {
  .card-maker { display: block; }
  .card-maker > .maker-pane + .maker-pane { margin-top: 22px; }
  .preview-pin { position: sticky; top: 0; z-index: 3; padding: 8px 0 6px; margin: 0 0 16px; background: var(--paper); }
  .preview-pin #previewCanvas { width: auto; max-width: 100%; max-height: 32vh; margin: 0 auto; }
  .preview-pin #dragHint { text-align: center; margin-top: 6px; }
  .picker-gallery[open] .picker-grid { max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; padding: 6px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: inset 0 -14px 12px -12px rgba(0, 0, 0, .18); }
}
.pick-random { margin: 0 0 10px; }
/* Shown only when cards.js never ran (not uploaded / blocked): it spans the
   whole grid so the three panes below keep their columns, and init() hides it. */
.maker-fallback { grid-column: 1 / -1; margin: 0; color: var(--dim); font-size: .9rem; }
.maker-fallback[hidden] { display: none; }
.maker-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; box-shadow: var(--shadow); min-width: 0; }
.maker-pane h2 { font-family: var(--display-font); font-weight: 400; font-size: 1.25rem; margin: 0 0 12px; }
/* Reserve the first gallery's grid: the picker is built from catalog.json
   after first paint, and without this the arriving thumbnails shove the
   panes below them down (measured CLS 0.20 -> 0.00 on a 412px screen). */
.picker-galleries { min-height: 290px; }
.picker-gallery { border-top: 1px solid var(--line); }
.picker-gallery:first-child { border-top: 0; }
.picker-gallery summary { cursor: pointer; padding: 10px 2px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.picker-gallery summary::-webkit-details-marker { display: none; }
.picker-gallery summary::after { content: "+"; color: var(--dim); }
.picker-gallery[open] summary::after { content: "−"; }
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 2px 0 12px; }
.pick { padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); background: none; cursor: pointer; overflow: hidden; line-height: 0; }
.pick img { width: 100%; height: auto; display: block; border-radius: 4px; }
.pick:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.maker-field { display: block; margin-bottom: 12px; }
.maker-field span { display: block; font-size: .85rem; color: var(--dim); margin-bottom: 4px; }
.maker-field select, .maker-field input { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); }
.layout-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.layout-choice { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .9rem; cursor: pointer; }
.layout-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.layout-choice input { margin: 0 6px 0 0; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.maker-hint { font-size: .8rem; color: var(--dim); margin: 0; }
.maker-hint + .maker-hint { margin-top: 6px; }
#previewCanvas, #viewCanvas { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); box-shadow: var(--shadow-lift); background: #fbf7ef; }
/* item 1b: cards.js adds .draggable only when this layout really crops this
   picture -- so a card that cannot move offers no grab cursor, and the page
   still scrolls normally under a touch on it. touch-action: none is what
   keeps a drag on a phone from scrolling the page instead of the picture. */
#previewCanvas.draggable { touch-action: none; cursor: grab; }
#previewCanvas.dragging { cursor: grabbing; }
#dragHint { margin-top: 8px; }
.send-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.send-grid .btn { justify-content: center; text-align: center; }
.send-grid .btn:disabled { opacity: .5; cursor: default; }
/* gallery.css's .btn was only ever worn by <button>: an <a class="btn"> keeps
   the underline and link colour and reads as a link, not a button. */
.send-grid .btn, .card-view-actions .btn { text-decoration: none; color: var(--ink); }
.send-grid .btn-primary, .card-view-actions .btn-primary { color: var(--accent-ink); }
.send-grid .btn:hover, .card-view-actions .btn:hover { color: var(--accent-link); }
.send-grid .btn-primary:hover, .card-view-actions .btn-primary:hover { color: var(--accent-ink); }
.send-note { min-height: 1.3em; font-size: .9rem; color: var(--dim); margin: 10px 0 6px; }
.send-link { width: 100%; font: inherit; font-size: .8rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--dim); }
/* `.card-view` is ALSO gallery.css's per-card magnifier button (an absolutely
   positioned 34px circle at opacity 0, display:none in print), and that sheet
   is loaded here too — so the recipient section is addressed by id and every
   colliding declaration is undone. */
#cardView { position: static; display: block; width: auto; height: auto; opacity: 1; background: none; color: inherit; border-radius: 0; max-width: 1000px; margin: 0 auto; padding: 8px 0 30px; }
@media print {
  /* a 3:2 card fills a landscape sheet; zero margin drops the browser's
     header/footer. Two print modes share the rules: the recipient view
     (body.card-view-mode, #cardView already shown) and the maker's Print
     card button (body.card-print-mode, owner item 14), which paints the
     card into the hidden #viewCanvas and shows it for print only. @page is
     document-global -- CSS cannot scope it to a body class -- so a plain
     Ctrl+P of the maker page also prints landscape; accepted, the card is
     what people print. */
  @page { margin: 0; size: landscape; }
  body:is(.card-view-mode, .card-print-mode) { margin: 0; }
  body:is(.card-view-mode, .card-print-mode) :is(.site-header, .site-footer, .cards-hero, .card-view-actions, .card-view-note, .card-maker, .widget-zone, .ad-insert) { display: none !important; }
  body.card-view-mode #cardView:not([hidden]), body.card-print-mode #cardView { display: flex !important; flex-direction: column; align-items: center; justify-content: center; position: fixed; inset: 0; margin: 0; max-width: none; padding: 10mm; box-sizing: border-box; overflow: hidden; }
  body:is(.card-view-mode, .card-print-mode) #viewCanvas { width: auto; height: auto; max-width: 100%; max-height: 100%; box-shadow: none; border-radius: 0; }
}
.card-view-note { color: var(--dim); text-align: center; margin: 12px 0 0; }
.card-view-actions { justify-content: center; margin-top: 16px; }
/* `hidden` must beat the display declarations above (author rules outrank the
   UA's `[hidden]{display:none}` whatever their specificity). */
#cardView[hidden], .card-maker[hidden], #viewCanvas[hidden] { display: none; }
