/* HCP Home: the Prayer Keepsake miniature.
 * A scale copy of the printed sheet (uploads/prayer-certificate-template.html as rendered by
 * the certificate generator): A4, 595 x 842 points, same fonts, sizes, margins and the same
 * text rules (line breaks, long words), so the lines break where they break on paper.
 * The prayer's size and line height are set by hcph-keepsake.js, which fits it the way the
 * certificate generator fits it (14px / 1.7 down to 10px / 1.5); the values below are the first step.
 * Every size is in points times --u, and --u is the sheet's width / 595, so the whole sheet
 * scales with its box. */
.kp {
  container-type: inline-size;
  position: relative;
  width: 100%;
  aspect-ratio: 595 / 842;
  background: #fff;
  color: #000;
  overflow: hidden;
  text-align: center;
  font-family: "Times New Roman", Times, "Liberation Serif", "Nimbus Roman", serif;
  -webkit-font-smoothing: antialiased;
}
.kp * { box-sizing: border-box; }
.kp [hidden] { display: none !important; }
.kp-in {
  --u: calc(100cqi / 595);
  position: absolute;
  inset: 0;
  padding: calc(50 * var(--u)) calc(100 * var(--u)) 0;
}
.kp-logo { display: block; width: calc(240 * var(--u)); height: auto; margin: 0 auto; }
.kp-sub { margin: calc(25 * var(--u)) 0 0; font-size: calc(13.5 * var(--u)); line-height: 1.15; }
.kp-name {
  margin: 0 auto;
  max-width: calc(337.5 * var(--u));
  font-style: italic;
  font-weight: bold;
  font-size: calc(33.75 * var(--u));
  line-height: 1.2;
  color: #E6AF3F;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}
.kp-div { display: block; width: calc(225 * var(--u)); height: auto; margin: calc(12 * var(--u)) auto calc(25 * var(--u)); }
.kp-prayer {
  margin: 0 auto;
  max-width: calc(395 * var(--u));
  font-size: calc(10.5 * var(--u));
  line-height: 1.7;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.kp-prayer.is-empty { color: #8a8a8a; }
.kp-foot {
  position: absolute;
  left: calc(100 * var(--u));
  right: calc(100 * var(--u));
  bottom: calc(101.05 * var(--u));
  font-size: calc(10.5 * var(--u));
  line-height: 1.15;
}
.kp-foot-h { margin: 0 0 calc(9.6 * var(--u)); font-weight: bold; }
.kp-foot:has(.kp-adds[hidden]) .kp-foot-h { margin-bottom: calc(12 * var(--u)); }
.kp-places { margin: 0 0 calc(9 * var(--u)); line-height: 1.2; }
.kp-adds { display: table; margin: calc(-0.85 * var(--u)) auto 0; }
.kp-adds span { display: table-cell; padding: 0 calc(9 * var(--u)); white-space: nowrap; font-style: italic; font-size: calc(9.75 * var(--u)); color: #333; vertical-align: middle; }
.kp-adds img { display: inline-block; width: calc(12 * var(--u)); height: calc(12 * var(--u)); margin-right: calc(4.5 * var(--u)); vertical-align: calc(-2.25 * var(--u)); }
.kp-num { display: block; margin-top: calc(7.85 * var(--u)); }
.kp-adds[hidden] + .kp-num { margin-top: 0; }
.kp-row { display: flex; margin-top: calc(12.95 * var(--u)); }
.kp-row > div { flex: 1 1 50%; }
.kp-row b { display: block; font-style: italic; font-size: calc(12 * var(--u)); }
.kp-row small { display: block; font-size: calc(8.25 * var(--u)); color: #E6AF3F; }
.kp-qr { position: absolute; left: 0; right: 0; bottom: calc(64 * var(--u)); text-align: center; }
.kp-qr img { display: inline-block; width: calc(52.5 * var(--u)); height: auto; image-rendering: pixelated; }

/* "View full size" button and the full-size view */
.kp-zoom {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 0; border-radius: 999px; background: oklch(23.1% 0.056 250.3 / 0.86); color: #fff;
  font: 600 12px/1 "Hanken Grotesk", system-ui, sans-serif; cursor: pointer;
}
@container (max-width: 300px) {
  .kp-zoom { right: 6px; bottom: 6px; min-height: 28px; width: 28px; padding: 0; justify-content: center; }
  .kp-zoom span { display: none; }
}
.kp-zoom:hover { background: oklch(23.1% 0.056 250.3); }
.kp-zoom:focus-visible { outline: 2px solid oklch(78.8% 0.139 82); outline-offset: 2px; }
.kp-dlg { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; overflow: visible; }
.kp-dlg::backdrop { background: oklch(17% 0.045 252 / 0.78); }
.kp-dlg-in { position: relative; width: min(92vw, calc(84vh * 595 / 842), 720px); }
.kp-dlg-in .kp { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); }
.kp-dlg-x {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #051e36; color: #fff; font: 600 20px/1 system-ui, sans-serif; cursor: pointer;
}
.kp-dlg-note { margin: 10px 0 0; text-align: center; font: 400 13px/1.4 "Hanken Grotesk", system-ui, sans-serif; color: #fff; opacity: 0.85; }
