/* ===== RESET ===== */
.cv,
.cv *::before,
.cv *::after {
  box-sizing: border-box;
}

.cv * {
  margin: 0;
  padding: 0;
}

/* ===== VARIABLES ===== */
:root {
  --black:      #0d0d0d;
  --dark:       #2a2a2a;
  --mid:        #5a5a5a;
  --light:      #9a9a9a;
  --rule:       #0d0d0d;
  --rule-light: #d0d0d0;
  --accent:     #fbbf24;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

/* ===== PRINT ===== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
}

/* ===== PAGE ===== */
.cv {
  --page-pad-edge: 12.5mm;
  --page-pad-top: var(--page-pad-edge);
  --page-pad-x: var(--page-pad-edge);
  --page-pad-bottom: 9.6mm;
  --base-font-size: 8.45pt;
  --base-line-height: 1.44;
  --header-name-size: 26.2pt;
  --role-size: 10.8pt;
  --location-size: 9.4pt;
  --section-title-size: 7.6pt;
  --section-title-mt: 4.8mm;
  --section-title-mb: 2.9mm;
  --section-title-pb: 1mm;
  --profile-size: 8.3pt;
  --profile-line-height: 1.5;
  --body-gap: 8.2mm;
  --body-footer-reserve: 7mm;
  --column-bottom-gap: 2.6mm;
  --item-gap: 3.2mm;
  --divider-gap: 2.8mm;
  --bullet-gap: 1mm;
  --footer-gap: 3.5mm;
  --flow-section-fill: 0px;
  --flow-item-fill: 0px;
  --flow-list-fill: 0px;
  --left-balance-section-fill: 0px;
  --left-balance-item-fill: 0px;
  --left-balance-divider-fill: 0px;
  width: 210mm;
  height: 297mm;
  padding: var(--page-pad-top) var(--page-pad-x) var(--page-pad-bottom);
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: var(--base-font-size);
  line-height: var(--base-line-height);
  color: var(--black);
  background: white;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== HEADER ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8mm;
  padding-bottom: 4.8mm;
  border-bottom: 1.8px solid var(--rule);
  margin-bottom: 5.8mm;
}

.header-left h1 {
  font-size: var(--header-name-size);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  color: var(--black);
}

.header-left .role {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1mm 1.8mm;
  font-size: var(--role-size);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  margin-top: 2mm;
  color: var(--black);
}

.role-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55mm;
}

.role-item::before,
.role-item::after {
  color: var(--accent);
  font-size: 1.08em;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.role-item::before {
  content: '{';
}

.role-item::after {
  content: '}';
}

.header-left .location {
  font-size: calc(var(--location-size) + 0.3pt);
  line-height: 1.22;
  color: var(--mid);
  margin-top: 1.35mm;
  padding-left: 1.9mm;
  letter-spacing: 0;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-mark-shell {
  width: 16mm;
  height: 16mm;
  display: grid;
  place-items: center;
}

.brand-mark {
  display: block;
  width: 15.2mm;
  height: 15.2mm;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 2.1mm;
  font-size: 8pt;
  color: var(--dark);
  text-decoration: none;
  letter-spacing: 0;
}

.contact-item svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== BODY ===== */
.body {
  display: grid;
  grid-template-columns: 58% 1fr;
  column-gap: var(--body-gap);
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: var(--body-footer-reserve);
}

.col-left,
.col-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  padding-bottom: var(--column-bottom-gap);
}

/* ===== SECTION ===== */
.section {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 1.35mm;
  font-size: var(--section-title-size);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--black);
  border-bottom: none;
  padding-bottom: var(--section-title-pb);
  margin-bottom: var(--section-title-mb);
  margin-top: var(--section-title-mt);
}

.section-title::before,
.section-title::after {
  color: var(--accent);
  font-size: 1.35em;
  font-weight: 800;
  line-height: 1;
  transform: translateY(0.04em);
}

.section-title::before {
  content: '{';
}

.section-title::after {
  content: '}';
}

.col-left .section:first-child .section-title,
.col-right .section:first-child .section-title {
  margin-top: 0;
}

.col-left .section + .section .section-title {
  margin-top: calc(var(--section-title-mt) + var(--flow-section-fill) + var(--left-balance-section-fill));
}

.col-right .section + .section .section-title {
  margin-top: calc(var(--section-title-mt) + var(--flow-section-fill));
}

/* ===== PROFILE ===== */
.profile p {
  font-size: var(--profile-size);
  line-height: 1.58;
  color: var(--dark);
  font-weight: 400;
}

/* Preserve manual line breaks coming from editor fields. */
.header-left .location,
.profile p,
.exp-role,
.exp-company,
.exp-dates,
.exp-bullets li,
.edu-degree,
.edu-institution,
.edu-dates,
.edu-desc,
.skill-label,
.skill-value,
.project-name,
.project-inline-sub,
.project-sub,
.project-desc,
.lang-name,
.lang-level {
  white-space: pre-line;
}

/* ===== EXPERIENCE ===== */
.exp-item {
  margin-bottom: calc(var(--item-gap) + var(--flow-item-fill) + var(--left-balance-item-fill) + 0.9mm);
}

.exp-item:last-child {
  margin-bottom: 0;
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2mm;
  flex-wrap: wrap;
}

.exp-role {
  font-size: 8.35pt;
  font-weight: 700;
  color: var(--black);
}

.exp-company {
  font-size: 8.1pt;
  font-weight: 400;
  color: var(--mid);
}

.exp-dates {
  font-size: 7.5pt;
  color: var(--light);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 400;
}

.exp-bullets {
  margin-top: 1.25mm;
  list-style: none;
  padding: 0;
}

.exp-bullets li {
  font-size: 8pt;
  line-height: 1.6;
  color: var(--dark);
  padding-left: 4.5mm;
  position: relative;
  margin-bottom: calc(var(--bullet-gap) + 0.35mm);
}

.exp-bullets li:last-child {
  margin-bottom: 0;
}

.exp-bullets li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--light);
  font-weight: 400;
}

/* ===== EDUCATION ===== */
.edu-item {
  margin-bottom: calc(var(--item-gap) + var(--flow-item-fill) + var(--left-balance-item-fill) + 0.9mm);
}

.edu-item:last-child {
  margin-bottom: 0;
}

.edu-degree {
  font-size: 8.2pt;
  font-weight: 600;
  color: var(--black);
  line-height: 1.4;
}

.edu-institution {
  font-size: 8pt;
  color: var(--mid);
  font-weight: 400;
  margin-top: 0.6mm;
}

.edu-dates {
  font-size: 7.5pt;
  color: var(--light);
  font-weight: 400;
  margin-top: 0.35mm;
}

.edu-desc {
  font-size: 7.8pt;
  color: var(--mid);
  margin-top: 1.15mm;
  line-height: 1.58;
}

/* ===== SKILLS ===== */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: calc(2.35mm + var(--flow-list-fill));
}

.skill-row {
  font-size: 7.8pt;
  line-height: 1.62;
}

.skill-label {
  font-weight: 700;
  color: var(--black);
}

.skill-sep {
  color: var(--light);
  margin: 0 1mm;
  font-weight: 300;
}

.skill-value {
  color: var(--mid);
}

/* ===== PROJECTS ===== */
.project-item {
  margin-bottom: calc(var(--item-gap) + var(--flow-item-fill) + 0.8mm);
}

.project-item:last-child {
  margin-bottom: 0;
}

.project-name {
  font-size: 8.2pt;
  font-weight: 700;
  color: var(--black);
}

.project-inline-sub {
  font-weight: 400;
  color: var(--light);
}

.project-sub {
  font-size: 7.5pt;
  color: var(--light);
  font-style: italic;
  margin-top: 0.65mm;
  line-height: 1.45;
}

.project-desc {
  font-size: 7.8pt;
  color: var(--mid);
  line-height: 1.62;
  margin-top: 1.25mm;
}

/* ===== LANGUAGES ===== */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: calc(2mm + var(--flow-list-fill));
}

.lang-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 8pt;
  line-height: 1.5;
}

.lang-name {
  font-weight: 600;
  color: var(--black);
}

.lang-level {
  font-size: 7.5pt;
  color: var(--light);
  font-weight: 400;
}

/* ===== DIVIDER ===== */
.exp-divider {
  border: none;
  border-top: 0.5px solid var(--rule-light);
  margin: calc(var(--divider-gap) + var(--left-balance-divider-fill) + 0.8mm) 0;
}

/* ===== FOOTER ===== */
.cv-footer {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  flex: 0 0 auto;
  padding-top: 3mm;
}

.footer-contacts {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--footer-gap);
}

.cv-footer .contact-item {
  flex: 0 0 auto;
  color: var(--mid);
  font-size: 10.5pt;
  line-height: 1.34;
  white-space: nowrap;
}

.cv-footer .contact-item svg {
  width: 15.5px;
  height: 15.5px;
  color: var(--light);
  stroke-width: 1.75;
}

/* ===== AUTO FIT DENSITIES ===== */
.cv.fit-compact {
  --page-pad-edge: 11.7mm;
  --page-pad-bottom: 8.8mm;
  --base-font-size: 8.25pt;
  --base-line-height: 1.38;
  --header-name-size: 25.3pt;
  --role-size: 10.35pt;
  --location-size: 9.15pt;
  --section-title-mt: 4.1mm;
  --section-title-mb: 2.4mm;
  --profile-size: 8.15pt;
  --profile-line-height: 1.42;
  --body-gap: 7.8mm;
  --body-footer-reserve: 6.2mm;
  --item-gap: 2.65mm;
  --divider-gap: 2.25mm;
  --bullet-gap: 0.72mm;
  --footer-gap: 3.25mm;
}

.cv.fit-tight {
  --page-pad-edge: 10.8mm;
  --page-pad-bottom: 8mm;
  --base-font-size: 8pt;
  --base-line-height: 1.32;
  --header-name-size: 24.1pt;
  --role-size: 10pt;
  --location-size: 8.85pt;
  --section-title-size: 7.05pt;
  --section-title-mt: 3.3mm;
  --section-title-mb: 2mm;
  --section-title-pb: 0.8mm;
  --profile-size: 7.9pt;
  --profile-line-height: 1.35;
  --body-gap: 7.2mm;
  --body-footer-reserve: 5.4mm;
  --item-gap: 2.1mm;
  --divider-gap: 1.75mm;
  --bullet-gap: 0.45mm;
  --footer-gap: 3mm;
}

.cv.fit-strict {
  --page-pad-edge: 9.8mm;
  --page-pad-bottom: 7.2mm;
  --base-font-size: 7.75pt;
  --base-line-height: 1.26;
  --header-name-size: 22.9pt;
  --role-size: 9.55pt;
  --location-size: 8.55pt;
  --section-title-size: 6.75pt;
  --section-title-mt: 2.6mm;
  --section-title-mb: 1.65mm;
  --section-title-pb: 0.7mm;
  --profile-size: 7.65pt;
  --profile-line-height: 1.3;
  --body-gap: 6.6mm;
  --body-footer-reserve: 4.6mm;
  --item-gap: 1.65mm;
  --divider-gap: 1.35mm;
  --bullet-gap: 0.25mm;
  --footer-gap: 2.45mm;
}

.cv.fit-compact .header {
  padding-bottom: 4.1mm;
  margin-bottom: 4.8mm;
}

.cv.fit-tight .header {
  padding-bottom: 3.4mm;
  margin-bottom: 4mm;
}

.cv.fit-strict .header {
  padding-bottom: 2.8mm;
  margin-bottom: 3.3mm;
}

.cv.fit-compact .brand-mark-shell {
  width: 15mm;
  height: 15mm;
}

.cv.fit-compact .brand-mark {
  width: 14.2mm;
  height: 14.2mm;
}

.cv.fit-tight .brand-mark-shell,
.cv.fit-strict .brand-mark-shell {
  width: 13.6mm;
  height: 13.6mm;
}

.cv.fit-tight .brand-mark,
.cv.fit-strict .brand-mark {
  width: 13mm;
  height: 13mm;
}

.cv.fit-compact .exp-role,
.cv.fit-compact .exp-company,
.cv.fit-compact .edu-degree,
.cv.fit-compact .project-name {
  font-size: 98%;
}

.cv.fit-tight .exp-role,
.cv.fit-tight .exp-company,
.cv.fit-tight .edu-degree,
.cv.fit-tight .project-name,
.cv.fit-strict .exp-role,
.cv.fit-strict .exp-company,
.cv.fit-strict .edu-degree,
.cv.fit-strict .project-name {
  font-size: 96%;
}

.cv.fit-tight .exp-bullets li,
.cv.fit-tight .project-desc,
.cv.fit-tight .edu-desc,
.cv.fit-strict .exp-bullets li,
.cv.fit-strict .project-desc,
.cv.fit-strict .edu-desc {
  line-height: inherit;
}
