/* =====================================================================
   Printable A4 documents: resume templates and biodata templates.
   The .paper element is exactly A4 on screen (scaled to fit by JS)
   and prints at real size with the site UI hidden.
   ===================================================================== */

@page { size: A4; margin: 12mm; }
@page biodata { size: A4; margin: 0; }

.paper {
  --accent: #4338ca;
  --pad: 15mm;
  --fs: 10.5pt;
  width: 210mm;
  min-height: 297mm;
  padding: var(--pad);
  background: #fff;
  color: #1f2937;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Nirmala UI", "Noto Sans Devanagari", Arial, sans-serif;
  font-size: var(--fs);
  line-height: 1.45;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .08), 0 18px 40px -18px rgba(15, 23, 42, .35);
  overflow-wrap: anywhere;
  word-break: normal;
  color-scheme: light;
}
.paper.font-serif { font-family: Georgia, "Times New Roman", "Noto Serif Devanagari", "Nirmala UI", serif; }
.paper a { color: inherit; text-decoration: none; }
.paper h1, .paper h2, .paper h3 { color: inherit; letter-spacing: 0; margin: 0; }
.paper p { margin: 0; }
.paper ul { margin: 0; padding-left: 1.1em; }
.paper .ph { color: #9ca3af; }

/* ---------------- Resume: shared ---------------- */
.resume header { margin-bottom: 5mm; }
.resume .r-name { font-size: 2.15em; font-weight: 700; line-height: 1.15; color: #111827; }
.resume .r-title { font-size: 1.12em; color: var(--accent); font-weight: 600; margin-top: 1mm; }
.resume .r-contact { display: flex; flex-wrap: wrap; gap: 1mm 4mm; margin-top: 2.5mm; font-size: .92em; color: #374151; list-style: none; padding: 0; }
.resume .r-contact li { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.resume section { margin-top: 4.5mm; break-inside: auto; }
.resume .r-h { font-size: .95em; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); padding-bottom: 1mm; border-bottom: .3mm solid #d1d5db; margin-bottom: 2.5mm; break-after: avoid; }
.resume .r-item { margin-bottom: 3mm; break-inside: avoid; }
.resume .r-item:last-child { margin-bottom: 0; }
.resume .r-row { display: flex; justify-content: space-between; gap: 4mm; align-items: baseline; }
.resume .r-role { font-weight: 700; color: #111827; }
.resume .r-org { color: #374151; }
.resume .r-date { color: #6b7280; font-size: .9em; white-space: nowrap; flex: none; }
.resume .r-link { color: #6b7280; font-size: .9em; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.resume .r-row > :first-child { min-width: 0; }
.resume .r-meta { color: #6b7280; font-size: .92em; }
.resume .r-item ul { margin-top: 1mm; }
.resume .r-item li { margin-bottom: .6mm; }
.resume .r-desc { margin-top: 1mm; white-space: pre-line; }
.resume .r-inline { line-height: 1.6; }
.resume .r-empty { margin-top: 30mm; text-align: center; color: #9ca3af; font-size: 1.05em; }

/* Classic: centred serif header, ruled sections */
.resume.tpl-classic header { text-align: center; border-bottom: .6mm solid #111827; padding-bottom: 4mm; }
.resume.tpl-classic .r-name { font-family: Georgia, "Times New Roman", "Noto Serif Devanagari", serif; font-size: 2.3em; letter-spacing: .02em; }
.resume.tpl-classic .r-title { color: #374151; }
.resume.tpl-classic .r-contact { justify-content: center; }
.resume.tpl-classic .r-contact li + li::before { content: "|"; color: #9ca3af; margin-right: 4mm; }
.resume.tpl-classic .r-contact { gap: 1mm 4mm; }
.resume.tpl-classic .r-h { color: #111827; border-bottom-color: #111827; font-family: Georgia, "Times New Roman", serif; letter-spacing: .12em; }
.resume.tpl-classic .r-role { color: #111827; }

/* Modern: coloured header band, accent headings */
.resume.tpl-modern header { margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 6mm; padding: 11mm var(--pad) 8mm; background: var(--accent); color: #fff; }
.resume.tpl-modern .r-name { color: #fff; }
.resume.tpl-modern .r-title { color: rgba(255, 255, 255, .88); }
.resume.tpl-modern .r-contact { color: rgba(255, 255, 255, .92); }
.resume.tpl-modern .r-h { border-bottom: 0; padding-left: 3mm; border-left: 1.2mm solid var(--accent); padding-bottom: 0; line-height: 1.2; }

/* Sidebar: two columns, tinted side panel */
.resume.tpl-sidebar { padding: 0; display: grid; grid-template-columns: 64mm 1fr; }
.resume.tpl-sidebar .r-side { background: color-mix(in srgb, var(--accent) 9%, #fff); padding: var(--pad) 7mm var(--pad) var(--pad); border-right: .3mm solid color-mix(in srgb, var(--accent) 22%, #fff); }
.resume.tpl-sidebar .r-main { padding: var(--pad) var(--pad) var(--pad) 8mm; min-width: 0; }
.resume.tpl-sidebar .r-contact { flex-direction: column; gap: 1.5mm; font-size: .86em; }
.resume.tpl-sidebar .r-contact li { white-space: normal; overflow-wrap: anywhere; }
.resume.tpl-sidebar .r-contact b { display: block; font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; font-weight: 700; }
.resume.tpl-sidebar .r-side section:first-child { margin-top: 0; }
.resume.tpl-sidebar .r-side .r-h { border-bottom-color: color-mix(in srgb, var(--accent) 30%, #fff); }
.resume.tpl-sidebar .r-side ul.r-list { list-style: none; padding: 0; }
.resume.tpl-sidebar .r-side ul.r-list li { margin-bottom: 1.2mm; }
.resume.tpl-sidebar header { margin-bottom: 2mm; }
.resume.tpl-sidebar .r-name { font-size: 2.2em; }

/* ---------------- Biodata: shared ---------------- */
.biodata {
  --accent: #9f1239;
  --gold: #b7791f;
  position: relative;
  font-size: var(--fs);
  line-height: 1.4;
}
.biodata .b-frame { min-height: calc(297mm - var(--pad) * 2); position: relative; padding: 8mm 10mm; }
.biodata .b-invocation { text-align: center; color: var(--accent); font-weight: 600; font-size: 1.05em; margin-bottom: 1.5mm; }
.biodata .b-title { text-align: center; font-size: 1.55em; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.biodata .b-top { display: flex; gap: 7mm; align-items: flex-start; margin: 5mm 0 1mm; }
.biodata .b-top-text { flex: 1; min-width: 0; }
.biodata .b-name { font-size: 1.9em; font-weight: 700; line-height: 1.2; color: #111827; }
.biodata .b-sub { color: #4b5563; margin-top: 1mm; }
.biodata .b-photo { flex: none; width: 38mm; height: 46mm; border-radius: 2mm; overflow: hidden; border: .6mm solid var(--gold); background: #f3f4f6; }
.biodata .b-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.biodata section { margin-top: 4mm; break-inside: avoid; }
.biodata .b-h { font-size: 1.08em; font-weight: 700; color: var(--accent); margin-bottom: 1.5mm; }
.biodata .b-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8mm; grid-auto-flow: row dense; margin: 0; }
.biodata .b-row { display: flex; gap: 2mm; padding: .5mm 0; min-width: 0; break-inside: avoid; }
.biodata .b-row.wide { grid-column: 1 / -1; }
.biodata dt { flex: 0 0 40%; font-weight: 600; color: #374151; position: relative; padding-right: 2.5mm; }
.biodata .b-row.wide dt { flex-basis: calc(20% - 1.6mm); }
.biodata dt::after { content: ":"; position: absolute; top: 0; right: 0; color: #9ca3af; }
.biodata dd { margin: 0; flex: 1; min-width: 0; color: #111827; white-space: pre-line; }
.biodata .b-empty { text-align: center; color: #9ca3af; margin-top: 30mm; }

/* Traditional: cream paper, double maroon & gold border, serif */
.biodata.tpl-traditional { background: #fffaf0; font-family: Georgia, "Times New Roman", "Noto Serif Devanagari", "Nirmala UI", serif; }
.biodata.tpl-traditional .b-frame { border: 1.4mm double var(--accent); outline: .5mm solid var(--gold); outline-offset: -3.2mm; }
.biodata.tpl-traditional .b-title { font-family: Georgia, serif; }
.biodata.tpl-traditional .b-title::before, .biodata.tpl-traditional .b-title::after { content: "❖"; color: var(--gold); margin: 0 4mm; font-size: .7em; vertical-align: middle; }
.biodata.tpl-traditional .b-h { text-align: center; text-transform: uppercase; letter-spacing: .12em; font-size: 1em; display: flex; align-items: center; gap: 3mm; }
.biodata.tpl-traditional .b-h::before, .biodata.tpl-traditional .b-h::after { content: ""; flex: 1; height: .3mm; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* Modern: clean white, accent band, rounded photo */
.biodata.tpl-modern .b-frame { padding: 0; }
.biodata.tpl-modern .b-band { background: var(--accent); color: #fff; margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0; padding: 7mm var(--pad); }
.biodata.tpl-modern .b-band .b-invocation, .biodata.tpl-modern .b-band .b-title { color: #fff; text-align: left; }
.biodata.tpl-modern .b-band .b-invocation { opacity: .9; }
.biodata.tpl-modern .b-photo { border-radius: 50%; width: 40mm; height: 40mm; border: 1mm solid color-mix(in srgb, var(--accent) 25%, #fff); }
.biodata.tpl-modern .b-h { text-transform: uppercase; letter-spacing: .1em; font-size: .92em; border-bottom: .4mm solid color-mix(in srgb, var(--accent) 30%, #fff); padding-bottom: 1mm; }
.biodata.tpl-modern dt::after { content: ""; }

/* Elegant: soft tinted background, ornamental corners, centred photo */
.biodata.tpl-elegant { background: color-mix(in srgb, var(--accent) 5%, #fff); }
.biodata.tpl-elegant .b-frame { border: .5mm solid color-mix(in srgb, var(--accent) 45%, #fff); border-radius: 4mm; background: #fff; }
.biodata.tpl-elegant .b-frame::before, .biodata.tpl-elegant .b-frame::after { content: "✿"; position: absolute; top: 2.5mm; color: var(--gold); font-size: 1.4em; line-height: 1; }
.biodata.tpl-elegant .b-frame::before { left: 3.5mm; }
.biodata.tpl-elegant .b-frame::after { right: 3.5mm; }
.biodata.tpl-elegant .b-title { font-family: Georgia, "Noto Serif Devanagari", serif; text-transform: none; letter-spacing: .04em; font-style: italic; font-size: 1.7em; }
.biodata.tpl-elegant .b-top { flex-direction: column; align-items: center; text-align: center; }
.biodata.tpl-elegant .b-photo { border-radius: 50%; width: 36mm; height: 36mm; border-width: .8mm; }
.biodata.tpl-elegant .b-name { font-family: Georgia, "Noto Serif Devanagari", serif; }
.biodata.tpl-elegant .b-h { font-family: Georgia, "Noto Serif Devanagari", serif; font-style: italic; font-size: 1.15em; border-bottom: .3mm dashed color-mix(in srgb, var(--accent) 40%, #fff); padding-bottom: 1mm; }

/* ---------------- Print ---------------- */
@media print {
  .paper { box-shadow: none !important; }
  .paper.resume { width: auto; min-height: 0; padding: 0; --pad: 0mm; }
  .resume.tpl-modern header { margin: 0 0 6mm; padding: 7mm 8mm 6mm; border-radius: 2mm; }
  .resume.tpl-sidebar { --pad: 0mm; }
  .resume.tpl-sidebar .r-side { padding: 6mm; border-radius: 2mm; }
  .resume.tpl-sidebar .r-main { padding: 0 0 0 8mm; }

  /* Browsers with named-page support print the biodata edge to edge on one
     full A4 sheet; others fall back to the normal 12 mm page margins. */
  .paper.biodata { page: biodata; width: auto; min-height: 0; }
  .biodata .b-frame { min-height: 0; }
  @supports (page: biodata) {
    .paper.biodata { width: 210mm; }
    .biodata .b-frame { min-height: calc(296mm - var(--pad) * 2); }
  }
}

/* Bilingual labels: Hindi on a second, smaller line */
.biodata dt .b-hi { display: block; font-weight: 500; font-size: .9em; color: #6b7280; }

/* =====================================================================
   v5 — five more resume templates, named fonts, picker thumbnails
   All new templates are single-column with real text and standard
   headings, so they stay in a logical reading order for ATS software.
   ===================================================================== */
.paper.resume.font-named,
.paper.resume.font-named .r-name,
.paper.resume.font-named .r-h { font-family: var(--rfont) !important; }

/* Modern Professional: left-aligned, accent name rule, accent headings */
.resume.tpl-pro header { padding-bottom: 4mm; border-bottom: .8mm solid var(--accent); }
.resume.tpl-pro .r-name { font-size: 2.3em; letter-spacing: -.01em; }
.resume.tpl-pro .r-title { color: #374151; font-weight: 600; }
.resume.tpl-pro .r-contact li + li::before { content: "•"; color: var(--accent); margin-right: 4mm; }
.resume.tpl-pro .r-h { border-bottom: 0; padding-bottom: 0; color: var(--accent); letter-spacing: .1em; display: flex; align-items: center; gap: 3mm; }
.resume.tpl-pro .r-h::after { content: ""; flex: 1; height: .3mm; background: #d1d5db; }
.resume.tpl-pro .r-org { color: var(--accent); }

/* Minimal ATS: black text only, plain rules, no colour */
.resume.tpl-ats { --accent: #111827; color: #111; }
.resume.tpl-ats header { margin-bottom: 4mm; }
.resume.tpl-ats .r-name { font-size: 1.9em; color: #000; }
.resume.tpl-ats .r-title { color: #111; font-weight: 600; }
.resume.tpl-ats .r-contact { color: #111; }
.resume.tpl-ats .r-contact li + li::before { content: "|"; margin-right: 4mm; color: #444; }
.resume.tpl-ats .r-h { color: #000; border-bottom: .3mm solid #000; letter-spacing: .04em; }
.resume.tpl-ats .r-role, .resume.tpl-ats .r-org { color: #000; }
.resume.tpl-ats .r-date, .resume.tpl-ats .r-meta, .resume.tpl-ats .r-link { color: #333; }

/* Corporate Classic: double rule header, shaded headings */
.resume.tpl-corporate header { text-align: left; border-top: 1.4mm double var(--accent); padding-top: 4mm; }
.resume.tpl-corporate .r-name { text-transform: uppercase; letter-spacing: .06em; font-size: 2em; color: var(--accent); }
.resume.tpl-corporate .r-title { color: #374151; text-transform: uppercase; letter-spacing: .08em; font-size: .95em; }
.resume.tpl-corporate .r-contact li + li::before { content: "|"; color: #9ca3af; margin-right: 4mm; }
.resume.tpl-corporate .r-h { background: color-mix(in srgb, var(--accent) 10%, #fff); color: #111827; border-bottom: 0; border-left: 1mm solid var(--accent); padding: 1.2mm 3mm; letter-spacing: .1em; }

/* Executive Professional: bold name, accent side rule in header, small-caps title */
.resume.tpl-executive header { border-left: 2mm solid var(--accent); padding: 1mm 0 1mm 5mm; margin-bottom: 6mm; }
.resume.tpl-executive .r-name { font-size: 2.5em; font-weight: 800; letter-spacing: -.015em; }
.resume.tpl-executive .r-title { font-variant: small-caps; letter-spacing: .06em; font-size: 1.2em; color: var(--accent); }
.resume.tpl-executive .r-contact li + li::before { content: "·"; color: var(--accent); margin-right: 4mm; font-weight: 700; }
.resume.tpl-executive .r-h { color: #111827; font-size: 1em; letter-spacing: .14em; border-bottom: .5mm solid var(--accent); }
.resume.tpl-executive section:first-of-type .r-desc { font-size: 1.04em; }

/* Fresh Graduate: centred header, accent headings with short underline */
.resume.tpl-fresher header { text-align: center; padding-bottom: 3mm; }
.resume.tpl-fresher .r-name { color: var(--accent); }
.resume.tpl-fresher .r-title { color: #374151; }
.resume.tpl-fresher .r-contact { justify-content: center; }
.resume.tpl-fresher .r-contact li + li::before { content: "•"; color: var(--accent); margin-right: 4mm; }
.resume.tpl-fresher .r-h { color: var(--accent); border-bottom: 0; padding-bottom: 1mm; position: relative; }
.resume.tpl-fresher .r-h::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: .3mm; background: color-mix(in srgb, var(--accent) 35%, #fff); }

@media print {
  .resume.tpl-executive header { padding-left: 4mm; }
}

/* Picker thumbnails + badge */
.template-picker .tp-badge { font-style: normal; font-size: .66rem; font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, #059669 14%, transparent); color: #047857; }
[data-theme="dark"] .template-picker .tp-badge { color: #6ee7b7; }
.tp-pro { background: linear-gradient(#334155, #334155) 12% 14% / 44% 7% no-repeat, linear-gradient(var(--c), var(--c)) 50% 30% / 84% 3% no-repeat, linear-gradient(var(--c), var(--c)) 10% 42% / 22% 4% no-repeat, repeating-linear-gradient(#fff 0 6px, #cbd5e1 6px 8px) 50% 84% / 84% 38% no-repeat, #fff !important; }
.tp-ats { background: linear-gradient(#111, #111) 12% 14% / 40% 7% no-repeat, linear-gradient(#111, #111) 50% 32% / 84% 2% no-repeat, repeating-linear-gradient(#fff 0 6px, #9ca3af 6px 8px) 50% 80% / 84% 46% no-repeat, #fff !important; }
.tp-corporate { background: linear-gradient(var(--c), var(--c)) 50% 6% / 84% 4% no-repeat, linear-gradient(var(--c), var(--c)) 14% 20% / 48% 7% no-repeat, linear-gradient(color-mix(in srgb, var(--c) 18%, #fff), color-mix(in srgb, var(--c) 18%, #fff)) 50% 40% / 84% 9% no-repeat, repeating-linear-gradient(#fff 0 6px, #cbd5e1 6px 8px) 50% 84% / 84% 34% no-repeat, #fff !important; }
.tp-executive { background: linear-gradient(var(--c), var(--c)) 8% 18% / 3% 22% no-repeat, linear-gradient(#111827, #111827) 30% 14% / 46% 9% no-repeat, linear-gradient(var(--c), var(--c)) 26% 28% / 30% 4% no-repeat, repeating-linear-gradient(#fff 0 6px, #cbd5e1 6px 8px) 50% 84% / 84% 40% no-repeat, #fff !important; }
.tp-fresher { background: linear-gradient(var(--c), var(--c)) 50% 14% / 46% 7% no-repeat, linear-gradient(#94a3b8, #94a3b8) 50% 26% / 60% 4% no-repeat, linear-gradient(var(--c), var(--c)) 50% 40% / 84% 2% no-repeat, repeating-linear-gradient(#fff 0 6px, #cbd5e1 6px 8px) 50% 82% / 84% 40% no-repeat, #fff !important; }
.font-tip { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm, 8px); background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; line-height: 1.5; color: var(--text-2); }
.font-tip .muted { display: block; margin-top: 4px; font-size: .8rem; }
.tpl-note { margin: -6px 0 14px; }
