/* The Kept Letter · the printed A5 sheet.
   Shared by the live preview and the print export, so both lay the letter out identically.
   The page inside is always laid out at its true printed size (148 x 210 mm) and then scaled, as one
   picture, to whatever width the sheet has on screen (--tkl-scale, set by a ResizeObserver; 1 in print).
   That way every line breaks in exactly the same place at every screen size and on the printed page.
   The millimetre values come from LAYOUT in letter-core.js (written on the sheet as CSS variables). */
@font-face{font-family:"Cormorant Garamond";src:url(/assets/fonts/cg.woff2) format("woff2");font-weight:300 700;font-style:normal;font-display:swap}
@font-face{font-family:"Cormorant Garamond";src:url(/assets/fonts/cg-italic.woff2) format("woff2");font-weight:300 700;font-style:italic;font-display:swap}
@font-face{font-family:"Pinyon Script";src:url(/assets/fonts/pinyon.woff2) format("woff2");font-weight:400;font-display:swap}

:root{
  --tkl-oxblood:#6B1A1A; --tkl-forest:#1E3A2B; --tkl-terracotta:#8C4A2E; --tkl-ivory:#F4EDE0; --tkl-espresso:#1A1410;
  --tkl-letter-face:"Cormorant Garamond",Garamond,"Times New Roman",serif;
  --tkl-script-face:"Pinyon Script","Snell Roundhand",cursive;
}

.tkl-sheet{
  position:relative; width:100%; aspect-ratio:148 / 210; overflow:hidden;
  background-color:var(--tkl-ivory);
  /* cotton-paper grain and a soft fall of light, no image files */
  background-image:
    linear-gradient(135deg,rgba(255,255,255,.34),rgba(255,255,255,0) 42%,rgba(120,86,48,.07)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .31 0 0 0 0 .2 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  box-shadow:0 .3px .8px rgba(20,8,4,.34),0 3px 6px rgba(20,8,4,.2),0 14px 28px rgba(20,8,4,.26),0 34px 60px rgba(20,8,4,.22);
}
.tkl-page{
  --mm:1mm;
  position:absolute; left:0; top:0; width:148mm; height:210mm; overflow:hidden;
  transform-origin:0 0; transform:scale(var(--tkl-scale,1));
  color:var(--tkl-espresso); font-family:var(--tkl-letter-face); font-weight:400; font-style:normal;
  font-size:calc(var(--tkl-body-size) * var(--mm)); line-height:var(--tkl-line-height);
  text-align:left; letter-spacing:0; word-spacing:0; text-transform:none; hyphens:none; overflow-wrap:break-word;
  font-kerning:normal; font-variant-ligatures:common-ligatures; font-synthesis:none;
  text-rendering:geometricPrecision; -webkit-font-smoothing:antialiased; -webkit-text-size-adjust:100%; text-size-adjust:100%;
}
.tkl-frame{position:absolute; inset:0; width:100%; height:100%; pointer-events:none}
.tkl-flow{position:absolute; top:calc(var(--tkl-text-top) * var(--mm)); left:calc(var(--tkl-margin-side) * var(--mm)); right:calc(var(--tkl-margin-side) * var(--mm))}
.tkl-block{margin:0; padding:0}
.tkl-block + .tkl-block{margin-top:calc(var(--tkl-para-gap) * var(--mm))}
.tkl-flow .tkl-signature{
  margin-top:calc(var(--tkl-closing-gap) * var(--mm));
  font-family:var(--tkl-script-face); font-size:calc(var(--tkl-name-size) * var(--mm)); line-height:var(--tkl-name-line-height);
  font-variant-ligatures:normal; text-indent:calc(var(--tkl-name-indent) * var(--mm));
}
.tkl-flow .tkl-signature--blank{height:calc(var(--tkl-blank-signature) * var(--mm))}
.tkl-flow .tkl-postscript{margin-top:calc(var(--tkl-ps-gap) * var(--mm)); font-style:italic}
.tkl-monogram{
  position:absolute; left:50%; top:calc(var(--tkl-monogram-centre) * var(--mm)); width:calc(var(--tkl-monogram-width) * var(--mm)); height:auto;
  transform:translate(-50%,-50%); pointer-events:none; user-select:none;
}
/* example wording shown until the buyer types their own */
.tkl-run.is-ghost{color:var(--tkl-terracotta); font-style:italic}
.tkl-signature .tkl-run.is-ghost{font-style:normal; opacity:.75}

/* ---------- print export: one true-size A5 page, no screen effects ---------- */
@page{size:148mm 210mm; margin:0}
.tkl-print-body{margin:0; background:#fff}
.tkl-print-body .tkl-sheet{--tkl-scale:1; width:148mm; height:210mm; box-shadow:none; background:none}
@media print{
  .tkl-sheet{box-shadow:none !important; background:none !important; break-inside:avoid; overflow:visible}
  .tkl-run.is-ghost{color:inherit; font-style:inherit}
}
