/* Document page + templates. Used for the live preview and for printing to PDF. */

.page {
  --m: 0.7in;
  --ink: #1b1b1b;
  --muted: #555;
  --accent: #1f3a5f;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  position: relative;
  box-sizing: border-box;
  width: 8.5in;
  min-height: 11in;
  padding: var(--m);
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 10.5pt;
  line-height: 1.35;
  transform-origin: top left;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 10px 30px rgba(0, 0, 0, .08);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.page[data-paper="a4"] { width: 210mm; min-height: 297mm; }

/* Red hairlines where the printed pages will break (editor preview only). */
#page .doc {
  --content-h: 9.6in;
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(var(--content-h) - 1px),
    rgba(220, 38, 38, .45) calc(var(--content-h) - 1px), rgba(220, 38, 38, .45) var(--content-h));
}

.page p { margin: 0 0 .55em; }
.page ul { margin: .2em 0 0; padding-left: 1.15em; }
.page li { margin: .1em 0; }

/* ---- shared structure ---- */
.d-name { margin: 0; font-size: 22pt; line-height: 1.1; font-weight: 700; }
.d-headline { margin-top: .2em; color: var(--muted); font-size: 11pt; }
.d-contact { margin-top: .45em; display: flex; flex-wrap: wrap; gap: 0 .2em; color: var(--muted); font-size: 9.5pt; }
.d-contact span + span::before { content: "·"; margin: 0 .45em 0 .25em; }
.d-head { margin-bottom: 1em; }

.d-sec { margin-top: .9em; }
.d-h { margin: 0 0 .4em; font-size: 10.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.d-entry { margin-bottom: .6em; break-inside: avoid; }
.d-entry:last-child { margin-bottom: 0; }
.d-row { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; }
.d-title { font-weight: 600; }
.d-dates, .d-loc, .d-ldate { white-space: nowrap; color: var(--muted); font-size: .95em; }
.d-sub { font-style: italic; color: #333; }
.d-list { list-style: none; padding-left: 0; margin: 0; }
.d-list li { display: flex; justify-content: space-between; gap: 1.2em; margin: 0 0 .35em; break-inside: avoid; }
.d-skill { margin-bottom: .2em; }
.d-skl { font-weight: 600; }
.d-skl::after { content: ":"; margin-right: .35em; }

.d-letter { margin-top: 1.2em; font-size: 11pt; line-height: 1.5; }
.d-letter p { margin: 0 0 .9em; }
.d-date { margin-bottom: 1.2em !important; }
.d-closing { margin-top: 1.4em !important; margin-bottom: 2.2em !important; }

/* ---- Classic: serif, centred header, ruled headings ---- */
.tpl-classic { font-family: var(--serif); --accent: #1b1b1b; }
.tpl-classic .d-head { text-align: center; }
.tpl-classic .d-contact { justify-content: center; }
.tpl-classic .d-name { font-variant: small-caps; letter-spacing: .04em; font-weight: 600; }
.tpl-classic .d-h { border-bottom: 1px solid #333; padding-bottom: .15em; letter-spacing: .12em; }

/* ---- Modern: sans, coloured name and headings ---- */
.tpl-modern { --accent: #0f5e9c; }
.tpl-modern .d-name { color: var(--accent); font-size: 24pt; letter-spacing: -.01em; }
.tpl-modern .d-head { padding-bottom: .7em; border-bottom: 2px solid var(--accent); }
.tpl-modern .d-h { font-size: 10pt; letter-spacing: .12em; }

/* ---- Compact: dense one-pager ---- */
.tpl-compact { font-size: 9.5pt; line-height: 1.28; --accent: #222; }
.tpl-compact .d-name { font-size: 18pt; }
.tpl-compact .d-head { margin-bottom: .6em; }
.tpl-compact .d-sec { margin-top: .6em; }
.tpl-compact .d-h { border-bottom: 1px solid #999; font-size: 9.5pt; margin-bottom: .3em; }
.tpl-compact .d-entry { margin-bottom: .4em; }

/* ---- Scholar (pass): headings in a left gutter, academic serif ---- */
.tpl-scholar { font-family: var(--serif); --accent: #7a1f2b; }
.tpl-scholar .d-head { border-bottom: 1px solid var(--accent); padding-bottom: .6em; }
.tpl-scholar .d-name { font-weight: 600; font-size: 24pt; }
.tpl-scholar .d-sec { display: grid; grid-template-columns: 1.25in 1fr; gap: 1.2em; margin-top: 1em; }
.tpl-scholar .d-h { text-align: right; font-variant: small-caps; text-transform: none; letter-spacing: .04em; font-size: 11.5pt; font-weight: 600; margin: 0; }
.tpl-scholar .d-letter { margin-left: 0; }

/* ---- Banner (pass): dark header band, accent bars ---- */
.tpl-band { --accent: #1e3a5f; }
.tpl-band .d-head { background: #1e293b; color: #fff; padding: .9em 1.1em; border-radius: 4px; }
.tpl-band .d-headline, .tpl-band .d-contact { color: #cbd5e1; }
.tpl-band .d-h { border-left: 4px solid #3b82f6; padding-left: .5em; color: #1e293b; }

/* ---- Terminal (pass): technical, monospace accents ---- */
.tpl-mono { --accent: #0a7d4f; }
.tpl-mono .d-name { font-family: var(--mono); font-size: 20pt; font-weight: 700; }
.tpl-mono .d-name::before { content: "> "; color: var(--accent); }
.tpl-mono .d-contact { font-family: var(--mono); font-size: 8.5pt; }
.tpl-mono .d-h { font-family: var(--mono); text-transform: none; letter-spacing: 0; font-size: 11pt; }
.tpl-mono .d-h::before { content: "## "; color: #999; }
.tpl-mono .d-skl, .tpl-mono .d-dates { font-family: var(--mono); font-size: .9em; }

/* ---- Preview watermark for locked pass templates ---- */
.page.locked::after {
  content: "PREVIEW · PASS TEMPLATE";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font: 700 34pt var(--sans); letter-spacing: .1em;
  color: rgba(185, 28, 28, .12);
  transform: rotate(-28deg);
  pointer-events: none;
}

@media print {
  .page {
    width: auto !important; min-height: 0 !important; padding: 0 !important;
    box-shadow: none !important; transform: none !important;
  }
  .doc { background: none !important; }
}
