/* Print rules.
 *
 * Two tabs are genuinely worth putting on paper: the ceremony running order, which the celebrant
 * or registrar will want in their hand, and the table plan, which someone will carry around the
 * room. Everything else prints acceptably by falling out of these same rules rather than being
 * styled individually.
 *
 * Loaded with media="print" so none of it costs anything on screen.
 */

@page {
  margin: 16mm;
}

/* Paper is white and ink is black whatever the theme or the accent: the cream page, the soft
   surfaces and the charcoal dark mode are screen looks. Printing from dark mode must not print
   a black page, so the colour tokens are put back to their light, neutral values here. */
:root, :root[data-theme="dark"] {
  --bg: #fff; --surface: #f2f2f2; --card: #fff; --text: #000; --muted: #333;
  --border: #bbb; --border-strong: #888; --control: #666;
}

body {
  background: #fff;
  color: #000;
}

/* The brand mark in the header is screen furniture. */
.brand-mark,
.countdown-watermark { display: none !important; }

/* Chrome, controls and anything that only makes sense when you can click it. */
#topbar,
#bottom-nav,
#offline-banner,
.search-root,
#boot,
#toasts,
.modal,
.table-toolbar,
.btn,
.icon-btn,
.picker-btn,
.filter-group,
.search-bar,
.empty-state {
  display: none !important;
}

/* An inactive tab panel stays display:none, so printing gives you the tab you are looking at
   rather than eleven of them stacked. That is deliberate: "print this" means the thing on
   screen. */
main {
  padding: 0;
  max-width: none;
}

.card,
.card.soft,
.card.hero {
  background: none !important;
  border: 0;
  border-top: 1px solid #888;
  border-radius: 0;
  padding: 4mm 0 0;
  box-shadow: none;
  /* A ceremony item or a table should not be split down the middle by a page break. */
  break-inside: avoid;
  page-break-inside: avoid;
}

.section-head h2 {
  font-size: 18pt;
}

.section-head h3 {
  font-size: 12pt;
}

table.data {
  font-size: 9pt;
  border-collapse: collapse;
}

table.data th {
  background: #f2f2f2 !important;
  border-bottom: 1px solid #888;
  color: #000;
  /* Repeat the header on every page of a long guest list. */
  position: static;
}

table.data thead {
  display: table-header-group;
}

table.data tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.table-wrap {
  overflow: visible;
  border: none;
}

/* Chips and badges lose their fills, which cost a great deal of ink and read as grey mush on a
   mono printer. The text they carry is the information, so the text is what survives. */
.chip,
.badge {
  background: none !important;
  color: #000 !important;
  border: 1px solid #999 !important;
  border-radius: 999px;
}

.dot {
  border: 1px solid #666;
}

/* The table plan prints as a grid of tables with their guests, at a size you can read across a
   room rather than at screen density. */
#panel-tables .tableplan-layout {
  display: block !important;
}

#panel-tables .card {
  margin-bottom: 8mm;
}

/* The unseated panel is a working list, not part of the plan, so it does not print. */
#panel-tables .tableplan-layout > .card:last-child {
  display: none !important;
}

/* Ceremony readings are the reason the ceremony sheet exists, so they print at a readable size
   rather than at the compact size the screen uses. */
#panel-ceremony .card {
  font-size: 11pt;
}

/* Collapsible sections are opened for printing by printSectionsOpen() in js/main.js, not here.
   CSS cannot do it: what hides a closed <details> is the ::details-content pseudo-element the
   browser wraps its contents in, so a rule aimed at the body inside overrides nothing. All that
   is left for this file is the chevron, which is an affordance and has no meaning on paper. */
.disclosure-chevron { display: none !important; }

/* A custom field marked "show on printed sheets" is rendered with this class and is hidden on
   screen, so ticking that box adds it to the paper without cluttering the tab it came from. */
.print-only {
  display: inline !important;
  font-size: 9pt;
  color: #333;
}
