/* ==========================================================================
   v4 T: resume templates, template picker, print to US Letter.
   Each template is .resume-paper.tpl.tpl-<id>. Print sizes here are the ones
   the template `metrics` in public/js/templates/*.js were measured against,
   so change both together.
   ========================================================================== */

/* ---------- shared template structure (screen and print) ---------- */
.resume-paper.tpl { color: #111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 1.3; }
.tpl h1, .tpl h2, .tpl p, .tpl ul { margin: 0; }
.tpl .r-head { margin-bottom: .9em; }
.tpl h1 { color: #000; font-weight: 700; letter-spacing: 0; line-height: 1.15; }
.tpl .r-headline { margin-top: .2em; font-weight: 600; color: #222; font-size: 1em; }
.tpl .r-contact { display: block; margin-top: .3em; font-size: .95em; color: #333; word-break: break-word; }
.tpl .r-sep { color: #777; }
.tpl .r-sec { margin-bottom: .8em; }
.tpl h2 { color: #000; font-weight: 700; text-transform: none; letter-spacing: 0; border-bottom: 0; padding-bottom: 0; line-height: 1.3; }
.tpl .r-item { margin-bottom: .5em; break-inside: avoid; }
.tpl .r-item:last-child { margin-bottom: 0; }
.tpl .r-row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.tpl .r-row strong { color: #000; font-weight: 700; }
.tpl .r-org { color: #222; }
.tpl .r-org::before { content: none; } /* the comma is real text now, so copied and parsed text keeps it */
.tpl .r-date { font-size: 1em; color: #333; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tpl .r-desc { margin-top: .1em; }
.tpl ul { margin-top: .15em; padding-left: 1.25em; }
.tpl li { margin: 0 0 .1em; padding-left: .1em; }
.tpl .r-gpa { font-size: 1em; color: #222; }
.tpl .r-skills { color: #111; }

/* ---------- classic ---------- */
.tpl-classic .r-head { border-bottom: 2px solid #111; padding-bottom: .6em; }
.tpl-classic h1 { font-size: 1.9em; }
.tpl-classic h2 { font-size: .9em; text-transform: uppercase; letter-spacing: .1em; border-bottom: 1px solid #bbb; padding-bottom: .2em; margin-bottom: .4em; }

/* ---------- modern ---------- */
.resume-paper.tpl-modern { font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; }
.tpl-modern .r-head { border-bottom: 3px solid #1f4e79; padding-bottom: .55em; }
.tpl-modern h1 { font-size: 2.1em; }
.tpl-modern .r-headline { color: #1f4e79; }
.tpl-modern h2 { font-size: 1.05em; color: #1f4e79; margin-bottom: .25em; }

/* ---------- compact ---------- */
.resume-paper.tpl-compact { font-size: 12.5px; line-height: 1.2; }
.tpl-compact .r-head { border-bottom: 1px solid #111; padding-bottom: .4em; margin-bottom: .6em; }
.tpl-compact h1 { font-size: 1.7em; }
.tpl-compact .r-sec { margin-bottom: .55em; }
.tpl-compact h2 { font-size: .9em; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #bbb; padding-bottom: .1em; margin-bottom: .3em; }
.tpl-compact .r-item { margin-bottom: .35em; }
.tpl-compact ul { margin-top: .05em; }
.tpl-compact li { margin-bottom: 0; }

/* ---------- neeley (docs/templates/neeley-spec.md) ----------
   Times New Roman 11pt single spaced, centered header, bold caps headings over
   a thin rule, one blank line between sections and between entries. */
.resume-paper.tpl-neeley { font-family: 'Times New Roman', Times, serif; font-size: 14.5px; line-height: 1.15; }
.tpl-neeley .r-head { text-align: center; border: 0; padding: 0; margin: 0; }
.tpl-neeley h1 { font-size: 1.273em; line-height: 1.15; } /* 14pt over 11pt */
.tpl-neeley .r-contact { margin: 0; font-size: 1em; color: #000; }
.tpl-neeley .r-sec { margin: 0; padding-top: 1.15em; } /* one empty line before each section */
.tpl-neeley h2 { font-size: 1em; line-height: 1.15; border-bottom: .5pt solid #000; margin: 0; padding: 0 0 1pt; }
.tpl-neeley .r-item { margin: 0; }
.tpl-neeley .r-item + .r-item { margin-top: 1.15em; } /* one empty line between entries */
.tpl-neeley .r-row { flex-wrap: nowrap; gap: 12px; }
.tpl-neeley .r-row strong, .tpl-neeley .r-org, .tpl-neeley .r-date, .tpl-neeley em { color: #000; }
.tpl-neeley .r-date { font-variant-numeric: normal; }
.tpl-neeley ul { margin: 0; padding-left: .25in; list-style: disc; }
.tpl-neeley li { margin: 0; padding-left: 0; }

/* ---------- picker (app UI, dark theme) ---------- */
.tpl-picker { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.tpl-picker legend { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; padding: 0; }
.tpl-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.tpl-opt { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: var(--r-sm); background: var(--surface2); border: 1px solid var(--line2); cursor: pointer; transition: border-color .15s, background .15s; }
.tpl-opt:hover { border-color: var(--accent-hi); }
.tpl-opt.on { border-color: var(--accent-hi); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-hi); }
.tpl-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tpl-opt:has(input:focus-visible) { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.tpl-name { font-size: 14px; font-weight: 700; color: var(--text); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tpl-sug { font-size: 11px; font-weight: 700; color: var(--brand-ink); background: var(--brand); border-radius: 999px; padding: 1px 7px; }
.tpl-desc { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.tpl-note { font-size: 12.5px; color: var(--dim); margin-top: 4px; line-height: 1.45; }
.tpl-note[hidden] { display: none; }
.tpl-swatch-neeley { align-items: center; }
.tpl-swatch-neeley i:first-child { width: 45%; }
.tpl-swatch-neeley i:nth-child(2) { width: 60%; }
.tpl-swatch-neeley i:nth-child(3) { width: 100%; border-top: 1px solid #222; }
/* tiny page sketches so the options read as layouts at a glance */
.tpl-swatch { display: flex; flex-direction: column; gap: 3px; height: 34px; padding: 6px 7px; border-radius: 6px; background: #fff; }
.tpl-swatch i { display: block; height: 3px; border-radius: 2px; background: #c9c9d3; }
.tpl-swatch i:first-child { width: 55%; height: 5px; background: #222; }
.tpl-swatch-classic i:nth-child(2) { border-top: 1px solid #222; }
.tpl-swatch-modern i:first-child { box-shadow: 0 4px 0 -1px #1f4e79; }
.tpl-swatch-modern i:nth-child(2) { background: #1f4e79; width: 40%; margin-top: 2px; }
.tpl-swatch-compact { gap: 2px; }
.tpl-swatch-compact i { height: 2px; }
.tpl-swatch-compact i:first-child { height: 4px; }

/* Resumes tab card with a live mini preview */
.tpl-card { display: grid; gap: 16px; margin-top: 14px; }
.tpl-card h3 { margin-bottom: 4px; }
.tpl-card .muted { font-size: 14px; margin-bottom: 14px; line-height: 1.5; }
.tpl-card .tpl-picker { margin-bottom: 0; }
.tpl-mini { display: block; position: relative; height: 230px; overflow: hidden; border-radius: 10px; background: #fff; border: 1px solid var(--line2); }
.tpl-mini::after { content: ''; position: absolute; inset: auto 0 0; height: 48px; background: linear-gradient(transparent, #fff); }
.tpl-mini:hover { border-color: var(--accent-hi); }
.tpl-mini-inner { width: 200%; transform: scale(.5); transform-origin: 0 0; pointer-events: none; }
.tpl-mini-inner .resume-paper { box-shadow: none; border-radius: 0; }
@media (min-width: 760px) {
  .tpl-card { grid-template-columns: 1fr 260px; align-items: start; }
  .tpl-mini { height: 300px; }
}

/* ---------- print: US Letter, real margins, no app chrome ---------- */
@media print {
  @page { size: letter; margin: 0.6in; }
  @page compact { size: letter; margin: 0.5in; }
  @page neeley { size: letter; margin: 0.5in; } /* neeley spec 1 default */

  .tpl-picker, .tpl-card { display: none !important; }
  /* The app shell's 100vh min heights would push a blank second page. */
  html:has(.resume-paper.tpl), body:has(.resume-paper.tpl), body:has(.resume-paper.tpl) #app,
  body:has(.resume-paper.tpl) .shell, body:has(.resume-paper.tpl) .main {
    min-height: 0 !important; height: auto !important; padding: 0 !important; margin: 0 !important;
  }
  body:has(.resume-paper.tpl) #sr-live, body:has(.resume-paper.tpl) #overlay-root { display: none !important; }
  /* styles.css pulls the paper out with position:absolute. Templates flow
     normally instead, so multi page resumes break cleanly. */
  .resume-paper.tpl {
    position: static !important; width: auto !important; margin: 0 !important; padding: 0 !important;
    box-shadow: none !important; border-radius: 0 !important; background: #fff !important; color: #000 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .resume-paper.tpl-classic, .resume-paper.tpl-modern { font-size: 10.5pt !important; line-height: 1.3; }
  .resume-paper.tpl-compact { font-size: 9.5pt !important; line-height: 1.2; page: compact; }
  .resume-paper.tpl-classic h1 { font-size: 20pt; }
  .resume-paper.tpl-modern h1 { font-size: 22pt; }
  .resume-paper.tpl-compact h1 { font-size: 16pt; }
  .resume-paper.tpl-neeley { font-size: 11pt !important; line-height: 1.15; page: neeley; }
  .resume-paper.tpl-neeley h1 { font-size: 14pt; }
  .tpl h2 { break-after: avoid; page-break-after: avoid; }
  .tpl li, .tpl .r-row { break-inside: avoid; }
  .tpl .r-item { break-inside: auto; } /* long roles may split, but never mid bullet */
  .tpl a { color: inherit; text-decoration: none; }
}
