/* ==========================================================
   CV page (cv.html): one A4 sheet.
   On screen it is shown as a paper sheet on the grey page;
   when printed / saved as PDF it fills exactly one A4 page.
   Sizes are in pt and mm so screen and PDF match.
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }

@page { size: A4; margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 8.3pt;
  line-height: 1.48;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; }
strong { font-weight: 500; color: var(--color-ink); }
em { font-style: normal; color: var(--color-accent); }
img { display: block; max-width: 100%; }

:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }

.icon { flex: none; width: 1.25em; height: 1.25em; fill: currentColor; }

/* ----- Screen toolbar ----- */
.cv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  max-width: 210mm;
  margin: 0 auto;
  padding: 24px 0 16px;
  font-size: 1rem;
}
.cv-toolbar__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.cv-toolbar__back:hover { color: var(--color-accent); }
.cv-toolbar__print {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font: 500 1rem var(--font-body);
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.cv-toolbar__print:hover { background: var(--color-ink); }
.cv-toolbar__print[hidden] { display: none; }

/* ----- The sheet ----- */
.sheet {
  display: flex;
  flex-direction: column;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 48px;
  padding: 11mm 14mm 10mm;
  background: var(--color-surface);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 32, .06), 0 16px 48px rgba(15, 23, 32, .1);
}

/* Small mono label */
.cv-label {
  font-family: var(--font-mono);
  font-size: 6.6pt;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-ink-muted);
}
.cv-date {
  flex: none;
  font-family: var(--font-mono);
  font-size: 7.2pt;
  color: var(--color-ink-muted);
}
.cv-accent { color: var(--color-accent); }

/* ----- Header ----- */
.cv-head { display: flex; gap: 8mm; justify-content: space-between; align-items: flex-start; }
.cv-head__text { display: flex; flex-direction: column; gap: 1.6mm; }
.cv-name {
  margin-top: 1mm;
  font-family: var(--font-display);
  font-size: 30pt;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}
.cv-role { margin-top: 1.5mm; font-family: var(--font-display); font-size: 11.5pt; font-weight: 500; letter-spacing: -0.01em; }
.cv-tagline { font-size: 9pt; color: var(--color-ink-soft); }
.cv-photo {
  flex: none;
  width: 30mm;
  height: 30mm;
  object-fit: cover;
  border-radius: 5mm;
  background: var(--color-placeholder);
}

/* ----- Contact strip: cells split by 1px lines (site pattern).
   Uses borders, not the 1px-gap trick, because print engines drop it. ----- */
.cv-contacts {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr 1.2fr;
  margin-top: 5mm;
  border: 1px solid var(--color-line);
  border-radius: 3mm;
}
.cv-contacts li { display: flex; flex-direction: column; gap: .6mm; padding: 2.2mm 3.2mm; }
.cv-contacts li + li { border-left: 1px solid var(--color-line); }
.cv-contacts a { font-weight: 500; font-size: 8.2pt; overflow-wrap: anywhere; }
.cv-contacts a:hover { color: var(--color-accent); }

/* ----- Stats (2px line on top, site pattern) ----- */
.cv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5mm; margin-top: 5mm; }
.cv-stats li { display: flex; flex-direction: column; gap: 1mm; padding-top: 2.2mm; border-top: 2px solid var(--color-ink); }
.cv-stats__value { font-family: var(--font-display); font-size: 20pt; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }

/* ----- Sections: label left, content right (Experience page pattern) ----- */
.cv-section {
  display: grid;
  grid-template-columns: 30mm minmax(0, 1fr);
  gap: 4mm;
  margin-top: 3mm;
  padding-top: 2.8mm;
  border-top: 1px solid var(--color-line);
  break-inside: avoid;
}
.cv-section:first-of-type { margin-top: 5mm; }
.cv-section__title {
  font-family: var(--font-mono);
  font-size: 6.8pt;
  font-weight: 500;
  line-height: 1.9;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cv-section__title span { color: var(--color-accent); margin-right: 1mm; }
.cv-section__body { display: flex; flex-direction: column; gap: 2.8mm; color: var(--color-ink-soft); }

/* Experience */
.cv-job { display: flex; flex-direction: column; gap: 1mm; break-inside: avoid; }
.cv-job__head { display: flex; gap: 4mm; justify-content: space-between; align-items: baseline; }
.cv-job__company { font-family: var(--font-display); font-size: 12pt; font-weight: 700; line-height: 1.2; color: var(--color-ink); }
.cv-job__role { font-weight: 500; color: var(--color-ink); }
.cv-points { display: flex; flex-direction: column; gap: .8mm; margin-top: .4mm; }
.cv-points li { position: relative; padding-left: 4mm; }
.cv-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: 2.2mm;
  height: 1.5px;
  background: var(--color-accent);
}
.cv-tags { display: flex; flex-wrap: wrap; gap: 1.4mm; margin-top: 1.4mm; }
.cv-tags li {
  padding: .5mm 2.4mm;
  border: 1px solid var(--color-tag-line);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 6.4pt;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-ink-soft);
}
.cv-jobs-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
.cv-jobs-pair .cv-job__company { font-size: 10.5pt; }

/* Skills / tools: 3 columns */
.cv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8mm 5mm; }
.cv-grid strong { display: block; }

/* Education */
.cv-edu { flex-direction: row; gap: 4mm; justify-content: space-between; align-items: baseline; }

/* ----- Dark footer block (site's closing block, slim) ----- */
.cv-foot {
  display: flex;
  gap: 6mm;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding: 5mm 6mm;
  border-radius: 4mm;
  background: var(--color-ink);
  color: var(--color-on-dark);
  break-inside: avoid;
}
.cv-section:last-of-type { margin-bottom: 5mm; }
.cv-quote {
  margin: 0;
  font-family: var(--font-display);
  font-size: 9.6pt;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.cv-foot__link {
  flex: none;
  font-family: var(--font-mono);
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-on-dark-soft);
}
.cv-foot__link:hover { color: var(--color-on-dark); text-decoration: underline; }

/* ----- Narrow screens: reflow the sheet into a normal page ----- */
@media screen and (max-width: 840px) {
  body { font-size: 15px; }
  .cv-toolbar { padding: 16px 20px 12px; }
  .cv-toolbar__print { flex: 1 1 100%; justify-content: center; }
  .sheet { width: auto; min-height: 0; margin: 0 12px 32px; padding: 24px 20px; border-radius: var(--radius-card); }
  .cv-label { font-size: 11px; }
  .cv-date { font-size: 12px; }
  .cv-head { flex-direction: column-reverse; gap: 16px; }
  .cv-name { font-size: 40px; }
  .cv-role { font-size: 18px; }
  .cv-tagline { font-size: 15px; }
  .cv-photo { width: 88px; height: 88px; border-radius: 20px; }
  .cv-contacts { grid-template-columns: 1fr 1fr; border-radius: 14px; margin-top: 24px; }
  .cv-contacts li { padding: 12px 14px; }
  .cv-contacts li + li { border-left: 0; }
  .cv-contacts li:nth-child(even) { border-left: 1px solid var(--color-line); }
  .cv-contacts li:nth-child(n+3) { border-top: 1px solid var(--color-line); }
  .cv-contacts a { font-size: 14px; }
  .cv-stats { grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
  .cv-stats__value { font-size: 32px; }
  .cv-section { grid-template-columns: 1fr; gap: 10px; margin-top: 24px; padding-top: 16px; }
  .cv-section:first-of-type { margin-top: 24px; }
  .cv-section__title { font-size: 12px; }
  .cv-section__body { gap: 18px; }
  .cv-job__company { font-size: 20px; }
  .cv-jobs-pair .cv-job__company { font-size: 18px; }
  .cv-job__head { flex-wrap: wrap; gap: 2px 12px; }
  .cv-tags li { font-size: 11px; padding: 3px 10px; }
  .cv-grid { grid-template-columns: 1fr 1fr; gap: 12px 20px; }
  .cv-foot { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 32px; padding: 24px; border-radius: 16px; }
  .cv-quote { font-size: 18px; }
  .cv-foot__link { font-size: 12px; }
}
@media screen and (max-width: 520px) {
  .cv-contacts, .cv-jobs-pair, .cv-grid { grid-template-columns: 1fr; }
  .cv-contacts li:nth-child(even) { border-left: 0; }
  .cv-contacts li + li { border-top: 1px solid var(--color-line); }
  .cv-edu { flex-direction: column; gap: 4px; }
}

/* ----- Print / Save as PDF ----- */
@media print {
  body { background: #fff; }
  .cv-toolbar { display: none; }
  .sheet {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
  }
  a[href^="http"], a[href^="mailto"], a[href^="tel"] { color: inherit; }
}
