/* CVCraftHub cover letter pages.
   Shared by the cover letter preview, print and the PDF export (which reads the rendered DOM). All values
   come from CSS variables set on .lt-page by letters/render.js.
   Rules (same as resume.css): opaque colors only, no ::before/::after content, no background images. */

.lt-measure { position: absolute; left: -99999px; top: 0; visibility: hidden; pointer-events: none; }

.lt-page {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--lt-pw, 816px);
  height: var(--lt-ph, 1056px);
  padding: 76px 88px;
  overflow: hidden;
  background: #fff;
  color: #1f2937;
  font-family: var(--lt-font, Arial, Helvetica, sans-serif);
  font-size: var(--lt-fs, 11pt);
  line-height: 1.5;
  font-variant-ligatures: none;
  font-kerning: normal;
  text-align: left;
  overflow-wrap: break-word;
  hyphens: manual;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.lt-page * { box-sizing: border-box; }
/* :where() keeps this reset at single-class specificity so the rules below can override it. */
.lt-page :where(h1, p) { margin: 0; font-size: inherit; font-weight: inherit; }
.lt-page strong { font-weight: 700; }
.lt-page em { font-style: italic; }
.lt-page a { color: inherit; text-decoration: none; }

.lt-body { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.lt-body > * { margin-top: 1em; }
.lt-body > :first-child { margin-top: 0; }

/* ---- Header ---- */
.lt-head { padding-bottom: 12px; border-bottom: 3px solid var(--lt-accent, #1f5fd6); }
.lt-name { color: var(--lt-accent, #1f5fd6); font-size: 2em; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.lt-headline { margin-top: 3px; color: #334155; font-size: 1.08em; font-weight: 600; }
.lt-contact { display: flex; flex-wrap: wrap; margin-top: 6px; color: #475569; font-size: 0.9em; line-height: 1.45; }
.lt-contact-item { white-space: nowrap; }
.lt-sep { margin: 0 7px; color: #94a3b8; }

.lt-head + * { margin-top: 1.9em; }
.lt-date { color: #334155; }
.lt-recipient { line-height: 1.4; }
.lt-recipient-name { font-weight: 700; }
.lt-subject { font-weight: 700; }
.lt-date + .lt-recipient, .lt-recipient + .lt-subject, .lt-recipient + .lt-greeting, .lt-date + .lt-greeting, .lt-date + .lt-subject { margin-top: 1.3em; }
.lt-greeting + .lt-p, .lt-greeting + .lt-li { margin-top: 0.9em; }

/* ---- Body ---- */
.lt-p { margin-top: 0.9em; }
.lt-li { display: flex; margin-top: 0.3em; padding-left: 4pt; }
.lt-p + .lt-li { margin-top: 0.6em; }
.lt-li-m { flex: none; width: 12pt; }
.lt-li-t { flex: 1 1 auto; min-width: 0; }
.lt-close { margin-top: 1.5em; }
.lt-signature { margin-top: 0.9em; font-weight: 700; }

/* ---- Classic: centered header with a thin rule, traditional spacing ---- */
.lt-t-classic .lt-head { padding-bottom: 14px; border-bottom-width: 1px; text-align: center; }
.lt-t-classic .lt-name { font-size: 1.85em; letter-spacing: 0.02em; }
.lt-t-classic .lt-headline { font-weight: 400; font-style: italic; }
.lt-t-classic .lt-contact { justify-content: center; }
.lt-t-classic .lt-signature { margin-top: 1.6em; }

/* ---- Minimal: compact header, no rule ---- */
.lt-t-minimal .lt-head { padding-bottom: 0; border-bottom: 0; }
.lt-t-minimal .lt-name { color: #111827; font-size: 1.35em; letter-spacing: 0; }
.lt-t-minimal .lt-headline { font-size: 1em; font-weight: 400; }
.lt-t-minimal .lt-contact { margin-top: 2px; }
.lt-t-minimal .lt-subject { color: var(--lt-accent, #334155); }
.lt-t-minimal .lt-signature { font-weight: 400; }

/* ---- Template choices in the editor (small static sketches, not rendered letters) ---- */
.lt-tpl-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.lt-tpl-list legend { padding: 0; margin: 0 0 6px; font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.lt-tpl { position: relative; display: block; cursor: pointer; }
.lt-tpl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lt-tpl-card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 8px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.lt-tpl input:checked + .lt-tpl-card { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft, #dbe7fb); }
.lt-tpl input:focus-visible + .lt-tpl-card { outline: 3px solid var(--focus, #1f5fd6); outline-offset: 2px; }
.lt-tpl-sketch { display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; aspect-ratio: 5 / 4; overflow: hidden; }
.lt-tpl-sketch i { display: block; height: 3px; border-radius: 2px; background: #cbd5e1; }
.lt-tpl-sketch .sk-name { width: 55%; height: 7px; background: var(--sk-accent, #1f5fd6); }
.lt-tpl-sketch .sk-rule { height: 2px; margin: 1px 0 4px; background: var(--sk-accent, #1f5fd6); }
.lt-tpl-sketch .sk-short { width: 40%; }
.lt-tpl-sketch .sk-mid { width: 72%; }
.lt-tpl-sketch.is-classic { align-items: center; }
.lt-tpl-sketch.is-classic .sk-rule { align-self: stretch; height: 1px; }
.lt-tpl-sketch.is-classic i:not(.sk-name) { align-self: stretch; }
.lt-tpl-sketch.is-classic .sk-short { align-self: flex-start; }
.lt-tpl-sketch.is-minimal .sk-name { width: 38%; height: 5px; background: #111827; }
.lt-tpl-name { font-weight: 700; font-size: 0.86rem; color: var(--ink); line-height: 1.2; }
.lt-tpl-desc { color: var(--muted); font-size: 0.74rem; line-height: 1.35; }
@media (max-width: 479.98px) {
  .lt-tpl-desc { display: none; }
  .lt-tpl-list { gap: 6px; }
  .lt-tpl-card { padding: 6px; }
}

.lt-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.lt-swatches legend { padding: 0; margin: 0 0 6px; font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.lt-swatch { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border: 1.5px solid var(--line); border-radius: 99px; background: #fff; font-size: 0.82rem; cursor: pointer; }
.lt-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lt-swatch-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--sw, #1f5fd6); border: 1px solid #cbd5e1; }
.lt-swatch.is-default .lt-swatch-dot { background: #fff; border: 2px dashed #94a3b8; }
.lt-swatch:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft, #dbe7fb); }
.lt-swatch:has(input:focus-visible) { outline: 3px solid var(--focus, #1f5fd6); outline-offset: 2px; }

.lt-guide { margin: 0 0 12px; padding: 10px 12px 10px 30px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--ink); font-size: 0.86rem; line-height: 1.5; }
.lt-guide li + li { margin-top: 4px; }
.lt-row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.lt-count { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }
.lt-count .is-warn { color: var(--warn-ink, #92400e); font-weight: 600; }

/* ---- Print ("Print / Save as PDF") ---- */
.print-root { display: none; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body.is-printing > :not(.print-root) { display: none !important; }
  body.is-printing .print-root { display: block !important; }
  .print-root .lt-page {
    break-after: page; page-break-after: always; margin: 0; box-shadow: none; border-radius: 0; overflow: hidden;
    /* A hair under the sheet height so rounding never spills onto an extra blank sheet. */
    height: calc(var(--lt-ph, 1056px) - 2px);
    transform: none;
  }
  .print-root .lt-page:last-child { break-after: auto; page-break-after: auto; }
}
