.voucher-editor,
.voucher-preview,
.voucher-help {
  max-width: 42rem;
  margin: 0 0 2rem;
}

.voucher-editor {
  display: grid;
  gap: 12px;
  padding: clamp(1rem, 3vw, 2rem);
  background: #fff9ed;
  border: 1px solid var(--ink);
}

.voucher-editor[hidden] { display: none; }
.voucher-editor h2, .voucher-editor p { margin: 0; }
.voucher-editor label { display: block; font-weight: 700; }

.voucher-editor :is(select, input, textarea) {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 4px 0 0;
  padding: .55rem .65rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: white;
  color: var(--ink);
  font: inherit;
}

.voucher-editor select { margin: 0; }
.voucher-editor textarea { resize: vertical; }
.voucher-editor button { justify-self: start; cursor: pointer; font: inherit; font-weight: 700; }
.voucher-editor p { color: #53594e; }

.voucher-names,
.voucher-preview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.voucher-preview {
  box-sizing: border-box;
  padding: clamp(1rem, 4vw, 2.5rem);
  border: 4px double var(--ink);
  background: #fff9ed;
  overflow-wrap: anywhere;
}

.voucher-preview h2 {
  margin: 0 0 1.25rem;
  font: 700 clamp(1.75rem, 6vw, 3rem)/1.05 var(--serif);
}

.voucher-gift { font: 700 1.25rem/1.2 var(--serif); }
.voucher-message { min-height: 3em; white-space: pre-wrap; }
.voucher-preview dt { font-size: .9rem; }
.voucher-preview dd { margin: .35rem 0 0; }
.voucher-preview :is(dd, .voucher-gift):empty { min-height: 1.4em; border-bottom: 1px solid currentColor; }
.voucher-message:empty { border-bottom: 1px solid currentColor; }
.voucher-help a { color: #232db5; text-underline-offset: 4px; }

@media screen and (min-width: 860px) {
  .voucher-page .guide-main {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    column-gap: 24px;
    align-items: start;
  }

  .voucher-page .guide-main > * { grid-column: 1 / -1; }
  .voucher-page .guide-main > .voucher-editor { grid-column: 1; }
  .voucher-editor:not([hidden]) ~ .voucher-preview { grid-column: 2; }
}

@media screen and (max-width: 430px) {
  .voucher-names { grid-template-columns: minmax(0, 1fr); }
}

@page { size: A4 portrait; margin: 18mm; }

@media print {
  .voucher-page,
  .voucher-page .voucher-preview { background: #fff; color: #000; }
  .voucher-page > :not(main),
  .voucher-page main > :not(.voucher-preview) { display: none !important; }
  .voucher-page main { box-sizing: border-box; width: 100%; max-width: none; margin: 0; padding: 0; }
  .voucher-page .voucher-preview { width: 100%; max-width: none; margin: 0; padding: 10mm; break-inside: avoid; }
  .voucher-page .voucher-preview h2 { font-size: 26pt; }
}
