/* The day pack: the print dialog, and the sheets that come out of it.
 *
 * Two halves.
 *
 * 1. The dialog (.dp-form and friends) is ordinary app UI, in the app's tokens.
 *
 * 2. The sheets (.dp-sheet and what is inside one) are paper. Plain on purpose: black on white, no
 *    background fills (they waste ink and disappear on a photocopy), serif headings, fonts every
 *    computer has, and one thin rule in the couple's accent. The colours are still tokens: while
 *    printing, css/print.css puts the text, border and background tokens back to black and white
 *    whatever the theme, and js/ui/daypack.js puts the light theme on for the printing so the
 *    accent is its light, dark-enough value.
 *
 *    The sheet rules apply on screen too, because the sheets are measured off screen (in
 *    #daypack-measure) at exactly the width they print at, and a measurement taken with other
 *    rules would not be the page count that comes out. So: sizes and spacing here are the same on
 *    screen and on paper; only what hides the rest of the page is inside @media print.
 *
 *    Spacing inside a sheet is padding, never margin. A margin is not part of an element's
 *    measured height and would put the page count out by a row or two.
 */

/* ---------------------------------------------------------- the dialog ---- */

.dp-form { display: grid; gap: var(--space-field); }
.dp-opts { border: 0; margin: 0; padding: 0; min-width: 0; }
.dp-opt {
  display: flex; align-items: flex-start; gap: var(--space-16); min-height: 44px; padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.dp-opt:last-child { border-bottom: 0; }
.dp-opt input { width: 20px; height: 20px; margin: var(--space-4) 0 0; accent-color: var(--accent); flex: none; }
.dp-opt-text { display: grid; gap: 0; min-width: 0; }
.dp-opt-name { font-weight: 700; font-size: 14.5px; }
.dp-opt-meta { color: var(--muted); font-size: 13px; line-height: 1.45; }
.dp-opt.is-off { cursor: default; }
.dp-opt.is-off .dp-opt-name { color: var(--muted); }

.dp-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dp-coming { padding: var(--space-8) 0 var(--space-4); }
.dp-audience { display: grid; gap: var(--space-8); justify-items: start; padding: var(--space-16) 0 var(--space-8); }
.dp-label { font-weight: 700; font-size: 13.5px; }
.dp-empty { margin: 0 0 var(--space-4); color: var(--muted); font-size: 14.5px; line-height: 1.55; }

/* A switch. The knob's side and the word On or Off say which way it is set, so the accent fill
   is a second cue and not the only one. The whole row is the control, so it is a thumb tall. */
.dp-switch {
  display: flex; align-items: center; gap: var(--space-16); width: 100%; min-height: 56px; padding: var(--space-16) 0;
  border: 0; border-top: 1px solid var(--border); background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.dp-switch-text { display: grid; gap: var(--space-4); flex: 1; min-width: 0; font-size: 14.5px; }
.dp-switch-text b { font-weight: 700; }
.dp-switch-state { font-size: 13px; font-weight: 700; min-width: 2.2em; text-align: right; }
.dp-switch-track {
  position: relative; flex: none; width: 48px; height: 28px; border-radius: var(--radius-pill);
  border: 2px solid var(--control); background: transparent;
}
.dp-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--control); transition: transform .15s ease;
}
.dp-switch[aria-checked="true"] .dp-switch-track { background: var(--accent); border-color: var(--accent); }
.dp-switch[aria-checked="true"] .dp-switch-track::after { transform: translateX(20px); background: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { .dp-switch-track::after { transition: none; } }

/* ------------------------------------------------------------ the sheets ---- */

/* Drawn into the page ahead of printing, and never seen on screen. */
#daypack-print { display: none; }

/* Where the sheets are measured: off screen, invisible, but laid out at the real width. */
#daypack-measure {
  position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none;
}

.dp-body, .dp-head, .dp-sheet, #daypack-measure {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px; line-height: 1.4; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 210mm less 18mm either side. */
.dp-body { width: 174mm; }

.dp-sheet {
  position: relative; box-sizing: border-box; width: 210mm; height: 296mm; padding: 15mm 18mm 0;
}
.dp-sheet-cards { padding: 12mm 15mm 0; }

.dp-sheet h1, .dp-sheet h2, .dp-sheet h3, .dp-head h2, .dp-body h3 {
  font-family: Georgia, 'Times New Roman', serif; font-weight: 400; margin: 0; color: var(--text);
}
.dp-sheet p, .dp-body p { margin: 0; }

/* A sheet's title, with the thin rule in the accent. The outer box carries the space below it. */
.dp-head { width: 174mm; padding-bottom: var(--space-16); }
.dp-head-in { border-bottom: 2px solid var(--accent); padding-bottom: var(--space-16); }
.dp-head h2 { font-size: 30px; line-height: 1.1; }
.dp-subtitle { min-height: 1.4em; padding-top: var(--space-4); font-size: 13.5px; color: var(--muted); }

.dp-foot {
  position: absolute; left: 18mm; right: 18mm; bottom: 12mm;
  display: flex; justify-content: space-between; gap: var(--space-16);
  border-top: 1px solid var(--border); padding-top: var(--space-8); font-size: 12px; line-height: 1.4; color: var(--muted);
}
.dp-sheet-cards .dp-foot { left: 15mm; right: 15mm; }

/* The cover. */
.dp-cover-head { padding-bottom: var(--space-32); border-bottom: 2px solid var(--accent); }
.dp-brand { display: flex; align-items: center; gap: var(--space-8); font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.dp-mark { display: block; width: 34px; height: 34px; color: var(--accent); }
.dp-mark svg { display: block; width: 100%; height: 100%; }
.dp-names { padding-top: var(--space-48); font-size: 58px; line-height: 1.05; }
.dp-amp { font-style: italic; color: var(--accent-dark); }
.dp-cover-date { padding-top: var(--space-16); font-size: 18px; }
.dp-cover-venue { color: var(--muted); }

/* Blocks between tables. */
.dp-heading { padding-top: var(--space-24); padding-bottom: var(--space-8); }
.dp-heading h3 { font-size: 20px; line-height: 1.2; }
.dp-heading-sub { display: block; padding-top: var(--space-4); font-size: 13px; color: var(--muted); }
.dp-note { padding-top: var(--space-16); font-size: 13px; color: var(--muted); }
.dp-key { padding-top: var(--space-8); font-size: 12.5px; color: var(--muted); }
.dp-key b { color: var(--text); }
.dp-key span { margin-right: var(--space-16); }
.dp-notes { padding-top: var(--space-24); }
.dp-notes-box { box-sizing: border-box; height: 30mm; border: 1px solid var(--border); border-radius: 8px; padding: var(--space-16) var(--space-16); }

/* Tables. A fixed layout and fixed column widths, so a table that carries on to a second sheet is
   laid out exactly as it was measured. The separate-borders model makes row heights add up. */
.dp-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.dp-table th {
  padding: var(--space-8) var(--space-8) var(--space-8) 0; text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--text);
}
.dp-table td { padding: var(--space-8) var(--space-8) var(--space-8) 0; vertical-align: top; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.dp-table th:last-child, .dp-table td:last-child { padding-right: 0; }
.dp-strong { font-weight: 700; }
.dp-muted { color: var(--muted); }
.dp-nowrap { white-space: nowrap; }
.dp-sub { font-size: 12.5px; color: var(--muted); }

/* Seating: three tables across. Each table is one box and never split. */
.dp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 4mm; padding-bottom: 4mm; }
.dp-tcard { border: 1px solid var(--border); border-radius: 8px; padding: var(--space-8) var(--space-16); }
.dp-tcard-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-8);
  border-bottom: 1px solid var(--border); padding-bottom: var(--space-8); margin-bottom: var(--space-8);
}
.dp-tcard-head b { font-size: 15px; }
.dp-tcard-head span { font-size: 12px; color: var(--muted); text-align: right; }
.dp-guests { list-style: none; margin: 0; padding: 0; }
.dp-guests li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-8); font-size: 12.5px; line-height: 1.6; }
.dp-marks { display: inline-flex; gap: var(--space-4); flex: none; }
.dp-tag { font-size: 12px; font-weight: 700; line-height: 1.3; padding: 0 var(--space-4); border: 1px solid var(--text); border-radius: 4px; }
.dp-tcard .dp-muted { font-size: 12.5px; }
/* A long name with no spaces wraps inside its box instead of running off the sheet (Q3-005). The data also shortens
   very long text (js/shared/daypack-layout.js, clipText), so what wraps here is already of a sane length. */
.dp-tcard-head b, .dp-guests li > span:first-child, .dp-sub, .dp-heading h3, .dp-heading-sub, .dp-note, .dp-cover-venue { min-width: 0; overflow-wrap: anywhere; }

/* Place cards: eight to a sheet, with faint cut lines. */
.dp-pc-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 62mm; width: 180mm; box-sizing: border-box;
  border-top: .75pt dashed var(--border); border-left: .75pt dashed var(--border);
}
.dp-pc {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 6mm; border-right: .75pt dashed var(--border); border-bottom: .75pt dashed var(--border);
}
.dp-pc-name { font-family: Georgia, 'Times New Roman', serif; font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.dp-pc-table { padding-top: var(--space-8); font-size: 14px; color: var(--muted); }

/* ----------------------------------------------------------- printing ---- */

@media print {
  /* While a pack is printing, nothing but the pack. The class is on <html> only from the moment
     Print is pressed until the browser says it has finished, so every other print the app makes
     (the table plan, the ceremony) is left exactly as css/print.css has it. */
  html.dp-printing body > *:not(#daypack-print) { display: none !important; }
  html.dp-printing, html.dp-printing body {
    position: static !important; top: auto !important; left: auto !important; right: auto !important;
    width: auto !important; height: auto !important; margin: 0 !important; padding: 0 !important;
    overflow: visible !important;
  }
  #daypack-print { display: block; }
  #daypack-measure { display: none; }

  /* The @page rule that sets A4 and no margin is added by js/ui/daypack.js while printing. */
  .dp-sheet { break-after: page; page-break-after: always; }
  .dp-sheet:last-child { break-after: auto; page-break-after: auto; }
  .dp-table tr, .dp-tcard, .dp-pc, .dp-heading { break-inside: avoid; page-break-inside: avoid; }
}
