/* CV page base + 14 templates */

.cv-page {
  --cv-text: #1a1a1a;
  --cv-muted: #555;
  --cv-line: #ddd;
  --cv-bg: #fff;
  --cv-side: #f4f4f4;
  --cv-accent: #1f4b7a;
  --cv-font: "DM Sans", system-ui, sans-serif;
  --cv-display: "DM Sans", system-ui, sans-serif;
  --pad: 14mm;
  --fs-name: 22pt;
  --fs-body: 9.5pt;
  --fs-h: 10.5pt;
  --gap: 10px;

  width: 210mm;
  min-height: 297mm;
  background: var(--cv-bg);
  color: var(--cv-text);
  font-family: var(--cv-font);
  font-size: var(--fs-body);
  line-height: 1.35;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.cv-page.density-comfortable {
  --fs-body: 10pt;
  --fs-name: 24pt;
  --gap: 12px;
  --pad: 16mm;
}
.cv-page.density-compact {
  --fs-body: 9.5pt;
  --fs-name: 22pt;
  --gap: 9px;
  --pad: 13mm;
}
.cv-page.density-dense {
  --fs-body: 8.6pt;
  --fs-name: 18pt;
  --fs-h: 9.2pt;
  --gap: 6px;
  --pad: 10mm;
}

.cv-page h1,
.cv-page h2,
.cv-page h3,
.cv-page p,
.cv-page ul {
  margin: 0;
}

.cv-page a {
  color: inherit;
  text-decoration: none;
}

.cv-sec {
  margin-top: var(--gap);
}

.cv-sec h2 {
  font-family: var(--cv-display);
  font-size: var(--fs-h);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cv-accent);
  border-bottom: 1.5px solid var(--cv-accent);
  padding-bottom: 3px;
  margin-bottom: 6px;
}

.cv-item { margin-bottom: 7px; }
.cv-item:last-child { margin-bottom: 0; }

.cv-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.cv-item-head strong { font-weight: 700; }
.cv-item-head .role { font-weight: 600; }
.cv-item-head .meta {
  color: var(--cv-muted);
  font-size: 0.92em;
  white-space: nowrap;
}

.cv-sub {
  color: var(--cv-muted);
  font-size: 0.95em;
  margin-bottom: 2px;
}

.cv-bullets {
  padding-left: 1.1em;
  margin-top: 2px;
}
.cv-bullets li { margin-bottom: 1px; }

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--cv-muted);
  font-size: 0.92em;
}

.cv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cv-chips span {
  border: 1px solid var(--cv-line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.9em;
}

.cv-keywords {
  font-size: 0.85em;
  color: var(--cv-muted);
  margin-top: 4px;
}

.cv-summary { color: var(--cv-text); }

/* ---------- Optional header photo (non-sidebar templates) ---------- */
.cv-photo {
  width: 22mm;
  height: 22mm;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--cv-accent);
  background: #eee;
}
/* Stacked-left templates: photo beside the text block */
.cv-header.has-photo {
  display: flex;
  align-items: center;
  gap: 5mm;
  text-align: left;
}
.cv-header.has-photo .cv-head-text { min-width: 0; }
/* Split templates keep name group (with photo) left, contacts right */
.cv-head-id {
  display: flex;
  align-items: center;
  gap: 4mm;
  min-width: 0;
}
/* Centered templates: photo stacked and centered above the text */
.tpl-classic .cv-header.has-photo,
.tpl-academic .cv-header.has-photo,
.tpl-elegant .cv-header.has-photo {
  display: block;
  text-align: center;
}
.tpl-classic .cv-header.has-photo .cv-photo,
.tpl-academic .cv-header.has-photo .cv-photo,
.tpl-elegant .cv-header.has-photo .cv-photo {
  display: block;
  margin: 0 auto 8px;
}

/* ========== 1. CLASSIC CHRONOLOGICAL ========== */
.tpl-classic {
  padding: var(--pad);
  --cv-display: "Source Serif 4", Georgia, serif;
}
.tpl-classic .cv-header {
  text-align: center;
  border-bottom: 2px solid var(--cv-text);
  padding-bottom: 10px;
  margin-bottom: 4px;
}
.tpl-classic .cv-header h1 {
  font-family: var(--cv-display);
  font-size: var(--fs-name);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tpl-classic .cv-header .title {
  font-size: 11pt;
  color: var(--cv-accent);
  margin: 3px 0 6px;
}
.tpl-classic .cv-contact { justify-content: center; }

/* ========== 2. MODERN MINIMAL ========== */
.tpl-modern {
  padding: var(--pad);
  --cv-font: "DM Sans", system-ui, sans-serif;
}
.tpl-modern .cv-header h1 {
  font-size: calc(var(--fs-name) + 2pt);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.tpl-modern .cv-header .title {
  color: var(--cv-accent);
  font-weight: 600;
  margin: 4px 0 8px;
  font-size: 11pt;
}
.tpl-modern .cv-sec h2 {
  border: none;
  letter-spacing: 0.12em;
  font-size: 8.5pt;
  color: var(--cv-muted);
  margin-bottom: 8px;
}
.tpl-modern .cv-rule {
  height: 3px;
  width: 48px;
  background: var(--cv-accent);
  margin: 10px 0 2px;
}

/* ========== 3. ATS CLEAN ========== */
.tpl-ats {
  padding: 12mm 14mm;
  --cv-font: Arial, Helvetica, sans-serif;
  --cv-display: Arial, Helvetica, sans-serif;
  --cv-accent: #000;
  --fs-body: 10.5pt;
}
.tpl-ats .cv-header h1 {
  font-size: 18pt;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tpl-ats .cv-header .title {
  font-weight: 700;
  margin: 2px 0 4px;
}
.tpl-ats .cv-sec h2 {
  color: #000;
  border-bottom: 1px solid #000;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 11pt;
}
.tpl-ats .cv-chips span {
  border: none;
  padding: 0;
  border-radius: 0;
}
.tpl-ats .cv-chips span::after { content: " · "; }
.tpl-ats .cv-chips span:last-child::after { content: ""; }
.tpl-ats .cv-keywords {
  color: #333;
  margin-top: 6px;
}

/* ========== 4. TWO COLUMN ========== */
.tpl-twocol {
  display: grid;
  grid-template-columns: 68mm 1fr;
  min-height: 297mm;
  --pad: 0;
}
.tpl-twocol .cv-side {
  background: var(--cv-accent);
  color: #fff;
  padding: 14mm 8mm;
}
.tpl-twocol .avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 12px;
  border: 3px solid rgba(255, 255, 255, 0.55);
  overflow: hidden;
}
.tpl-twocol .cv-side > h1,
.tpl-twocol .cv-side > .title { text-align: center; }
.tpl-twocol .cv-side h1 {
  font-size: 16pt;
  line-height: 1.15;
  margin-bottom: 4px;
}
.tpl-twocol .cv-side .title {
  opacity: 0.9;
  font-size: 9.5pt;
  margin-bottom: 12px;
}
.tpl-twocol .cv-side .cv-sec h2 {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.35);
  font-size: 9pt;
}
.tpl-twocol .cv-side .cv-contact {
  flex-direction: column;
  gap: 4px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 8.5pt;
}
.tpl-twocol .cv-side .cv-chips span {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.tpl-twocol .cv-main {
  padding: 14mm 10mm 14mm 9mm;
}
.tpl-twocol .cv-main .cv-sec h2 {
  border-bottom-width: 2px;
}

/* ========== 5. CREATIVE SIDEBAR ========== */
.tpl-creative {
  display: grid;
  grid-template-columns: 62mm 1fr;
  min-height: 297mm;
}
.tpl-creative .cv-side {
  background: linear-gradient(165deg, var(--cv-accent), color-mix(in srgb, var(--cv-accent) 70%, #000));
  color: #fff;
  padding: 12mm 7mm;
  position: relative;
}
.tpl-creative .cv-side::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 40px;
  width: 36px;
  height: 36px;
  background: var(--cv-accent);
  transform: rotate(45deg);
}
.tpl-creative .avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  font-size: 30pt;
  font-weight: 700;
  margin: 0 auto 12px;
  overflow: hidden;
}
.tpl-creative .cv-side > h1,
.tpl-creative .cv-side > .title { text-align: center; }
.tpl-creative .cv-side h1 { font-size: 15pt; line-height: 1.1; }
.tpl-creative .cv-side .title { font-size: 9pt; opacity: 0.9; margin: 4px 0 10px; }
.tpl-creative .cv-side .cv-sec h2 {
  color: #fff;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 8pt;
}
.tpl-creative .cv-side .cv-contact { flex-direction: column; color: #fff; gap: 5px; font-size: 8pt; }
.tpl-creative .cv-main { padding: 12mm 10mm; }
.tpl-creative .cv-main .cv-sec h2 {
  border: none;
  border-left: 4px solid var(--cv-accent);
  padding-left: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12pt;
}

/* Uploaded profile photo — shared across sidebar templates */
.cv-side .avatar.has-photo {
  background: none;
  padding: 0;
}
.cv-side .avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ========== 6. EXECUTIVE ========== */
.tpl-executive {
  padding: var(--pad);
  --cv-display: "Libre Baskerville", Georgia, serif;
  --cv-font: "Source Serif 4", Georgia, serif;
}
.tpl-executive .cv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  border-bottom: 3px double var(--cv-text);
  padding-bottom: 8px;
}
.tpl-executive .cv-header h1 {
  font-family: var(--cv-display);
  font-size: var(--fs-name);
}
.tpl-executive .cv-header .title {
  font-style: italic;
  color: var(--cv-muted);
  margin-top: 2px;
}
.tpl-executive .cv-header .cv-contact {
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 2px;
}
.tpl-executive .cv-sec h2 {
  font-family: var(--cv-display);
  text-transform: none;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--cv-line);
  color: var(--cv-text);
}

/* ========== 7. TECH DEVELOPER ========== */
.tpl-tech {
  padding: var(--pad);
  --cv-font: "DM Sans", system-ui, sans-serif;
  --cv-display: "IBM Plex Mono", ui-monospace, monospace;
  background: #0d1117;
  color: #e6edf3;
  --cv-text: #e6edf3;
  --cv-muted: #8b949e;
  --cv-line: #30363d;
  --cv-accent: #58a6ff;
}
.tpl-tech .cv-header h1 {
  font-family: var(--cv-display);
  font-size: 18pt;
  color: #fff;
}
.tpl-tech .cv-header .title {
  color: #3fb950;
  font-family: var(--cv-display);
  font-size: 9.5pt;
  margin: 4px 0 8px;
}
.tpl-tech .cv-header .title::before { content: "> "; opacity: 0.7; }
.tpl-tech .cv-sec h2 {
  font-family: var(--cv-display);
  color: var(--cv-accent);
  border-bottom-color: var(--cv-line);
  font-size: 9pt;
}
.tpl-tech .cv-chips span {
  background: #161b22;
  border-color: #30363d;
  color: #79c0ff;
  font-family: var(--cv-display);
  font-size: 8pt;
}
.tpl-tech .cv-item-head .meta { color: #8b949e; }

/* ========== 8. FUNCTIONAL SKILLS ========== */
.tpl-functional {
  padding: var(--pad);
}
.tpl-functional .cv-header {
  background: color-mix(in srgb, var(--cv-accent) 10%, #fff);
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 8px;
  padding: 12mm var(--pad) 8mm;
  border-bottom: 4px solid var(--cv-accent);
}
.tpl-functional .cv-header h1 {
  font-size: var(--fs-name);
  font-weight: 800;
}
.tpl-functional .cv-header .title {
  color: var(--cv-accent);
  font-weight: 700;
  margin-top: 2px;
}
.tpl-functional .skills-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.tpl-functional .skills-block .cv-item {
  background: #fafafa;
  border-left: 3px solid var(--cv-accent);
  padding: 6px 8px;
}
.tpl-functional .cv-sec.exp-compact .cv-item-head {
  font-size: 0.95em;
}

/* ========== 9. ACADEMIC ========== */
.tpl-academic {
  padding: var(--pad);
  --cv-display: "Libre Baskerville", Georgia, serif;
  --cv-font: "Source Serif 4", Georgia, serif;
}
.tpl-academic .cv-header {
  text-align: center;
  margin-bottom: 8px;
}
.tpl-academic .cv-header h1 {
  font-family: var(--cv-display);
  font-size: 18pt;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}
.tpl-academic .cv-header .title {
  font-style: italic;
  margin: 4px 0;
}
.tpl-academic .cv-contact {
  justify-content: center;
  font-size: 9pt;
}
.tpl-academic .cv-sec h2 {
  font-family: var(--cv-display);
  color: var(--cv-text);
  border-bottom: 1px solid var(--cv-text);
  text-transform: none;
  letter-spacing: 0.03em;
}

/* ========== 10. EUROPASS-INSPIRED ========== */
.tpl-europass {
  display: grid;
  grid-template-columns: 55mm 1fr;
  min-height: 297mm;
  --cv-accent: #003399;
}
.tpl-europass .cv-side {
  background: #f0f3f8;
  border-right: 3px solid var(--cv-accent);
  padding: 12mm 7mm;
}
.tpl-europass .avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 12px;
  border: 3px solid var(--cv-accent);
  overflow: hidden;
}
.tpl-europass .cv-side > h1,
.tpl-europass .cv-side > .title { text-align: center; }
.tpl-europass .cv-side h1 {
  font-size: 13pt;
  color: var(--cv-accent);
  line-height: 1.15;
}
.tpl-europass .cv-side .title {
  font-size: 9pt;
  margin: 4px 0 10px;
  color: var(--cv-muted);
}
.tpl-europass .cv-side .cv-sec h2 {
  color: var(--cv-accent);
  border-bottom-color: #99a;
  font-size: 8.5pt;
}
.tpl-europass .cv-side .cv-contact {
  flex-direction: column;
  gap: 3px;
  font-size: 8pt;
}
.tpl-europass .cv-main {
  padding: 12mm 10mm;
}
.tpl-europass .cv-main .cv-sec h2 {
  background: color-mix(in srgb, var(--cv-accent) 8%, #fff);
  border: none;
  padding: 3px 6px;
  color: var(--cv-accent);
}

/* ========== 11. ELEGANT SERIF ========== */
.tpl-elegant {
  padding: var(--pad);
  --cv-font: "Source Serif 4", Georgia, serif;
  --cv-display: "Fraunces", Georgia, serif;
}
.tpl-elegant .cv-header {
  text-align: center;
  padding-bottom: 10px;
  margin-bottom: 6px;
  position: relative;
}
.tpl-elegant .cv-header::after {
  content: "✦";
  display: block;
  color: var(--cv-accent);
  margin-top: 6px;
  letter-spacing: 0.4em;
}
.tpl-elegant .cv-header h1 {
  font-family: var(--cv-display);
  font-size: calc(var(--fs-name) + 2pt);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.tpl-elegant .cv-header .title {
  font-style: italic;
  color: var(--cv-muted);
  margin-top: 4px;
}
.tpl-elegant .cv-contact { justify-content: center; }
.tpl-elegant .cv-sec h2 {
  text-align: center;
  border: none;
  font-family: var(--cv-display);
  font-weight: 500;
  letter-spacing: 0.18em;
  font-size: 9pt;
}
.tpl-elegant .cv-sec h2::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--cv-accent);
  margin: 4px auto 0;
}

/* ========== 12. STARTUP BOLD ========== */
.tpl-startup {
  padding: var(--pad);
  --cv-font: "DM Sans", system-ui, sans-serif;
}
.tpl-startup .cv-header h1 {
  font-size: calc(var(--fs-name) + 4pt);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.tpl-startup .cv-header .title {
  display: inline-block;
  background: var(--cv-accent);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 9pt;
  font-weight: 700;
  margin: 8px 0;
}
.tpl-startup .cv-sec h2 {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 8pt;
  border-bottom: none;
  color: var(--cv-muted);
}
.tpl-startup .cv-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--cv-line);
}
.tpl-startup .cv-chips span {
  background: color-mix(in srgb, var(--cv-accent) 12%, #fff);
  border-color: transparent;
  font-weight: 600;
}

/* ========== 13. SWISS GRID ========== */
.tpl-swiss {
  padding: var(--pad);
  --cv-font: "DM Sans", Helvetica, Arial, sans-serif;
}
.tpl-swiss .cv-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-top: 8px solid var(--cv-accent);
  padding-top: 10px;
  margin-bottom: 4px;
}
.tpl-swiss .cv-header h1 {
  font-size: var(--fs-name);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1;
}
.tpl-swiss .cv-header .title {
  font-weight: 500;
  margin-top: 4px;
  max-width: 28ch;
}
.tpl-swiss .cv-header .cv-contact {
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  font-size: 8pt;
  gap: 2px;
}
.tpl-swiss .cv-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.tpl-swiss .cv-sec h2 {
  border-bottom: 2px solid var(--cv-text);
  color: var(--cv-text);
  letter-spacing: 0.08em;
  font-size: 8.5pt;
}
.tpl-swiss .span-full { grid-column: 1 / -1; }

/* ========== 14. TIMELINE ========== */
.tpl-timeline {
  padding: var(--pad);
}
.tpl-timeline .cv-header h1 {
  font-size: var(--fs-name);
  font-weight: 800;
}
.tpl-timeline .cv-header .title {
  color: var(--cv-accent);
  font-weight: 600;
  margin: 2px 0 8px;
}
.tpl-timeline .timeline {
  position: relative;
  padding-left: 16px;
  border-left: 2px solid color-mix(in srgb, var(--cv-accent) 40%, #ddd);
  margin-top: 4px;
}
.tpl-timeline .timeline .cv-item {
  position: relative;
  padding-left: 8px;
  margin-bottom: 10px;
}
.tpl-timeline .timeline .cv-item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cv-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--cv-accent);
}
.tpl-timeline .cv-sec h2 {
  border-bottom-style: dashed;
}

/* Shared fallbacks for layouts without special structure */
.cv-page .hidden { display: none !important; }

@media print {
  .cv-page {
    box-shadow: none !important;
    width: 210mm !important;
    min-height: 297mm !important;
  }
}
