@import url('/styles/fonts.css');
@import url('/styles/tokens.css');

/* ==========================================================================
   CV document
   One column, real text, no graphics — readable by a recruiter in thirty
   seconds and by an ATS parser without heuristics. The same markup is used
   for the on-screen A4 preview and for the generated PDF; @page rules below
   control the printed document.
   ========================================================================== */

:root {
  --cv-page-w: 210mm;
  --cv-page-pad-x: 15mm;
  --cv-page-pad-y: 13mm;
  --cv-rule: #d8d4cc;
  --cv-rule-strong: #1c1d22;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.cv-body {
  margin: 0;
  background: #e9e7e2;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.15;
}

p {
  margin: 0;
}

ul,
dl,
dd {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  transform: translateY(-120%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* ---------- Screen chrome ------------------------------------------------ */

.cv-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, #e9e7e2 90%, transparent);
  backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid #d3d0c9;
}

.cv-bar__inner {
  max-width: calc(var(--cv-page-w) + 6rem);
  margin-inline: auto;
  padding: 0.75rem clamp(0.75rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cv-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color var(--fast) var(--ease);
}

.cv-bar__back:hover {
  color: var(--accent);
}

.cv-bar__title {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.cv-bar__actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: #c4c0b8;
}

.btn--ghost:hover {
  border-color: var(--ink);
  color: var(--accent);
}

.btn__icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.cv-stage {
  padding: clamp(0.75rem, 3vw, 2.5rem) clamp(0.5rem, 3vw, 2rem);
  display: flex;
  justify-content: center;
}

.cv-foot {
  padding: 0 1.5rem 3rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
}

.link {
  background-image: linear-gradient(var(--line-strong), var(--line-strong));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: color var(--fast) var(--ease), background-image var(--fast) var(--ease);
}

.link:hover {
  color: var(--accent);
  background-image: linear-gradient(var(--accent), var(--accent));
}

/* ---------- The document ------------------------------------------------- */

.cv {
  width: 100%;
  max-width: var(--cv-page-w);
  padding: var(--cv-page-pad-y) var(--cv-page-pad-x);
  background: #fff;
  color: #1c1d22;
  box-shadow: 0 1px 2px rgba(20, 21, 26, 0.08), 0 18px 40px rgba(20, 21, 26, 0.12);
  font-size: 9.7pt;
  line-height: 1.45;
  /* Ligatures are a trap in a CV. Chrome maps "fi" to a single glyph whose
     ToUnicode entry does not always round-trip, so a PDF text extractor — and
     therefore an ATS — reads "Certified" as "Certi ed". Turning them off costs
     nothing visually at this size and keeps every word machine-readable. */
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'clig' 0;
}

/* ---------- Header ------------------------------------------------------- */

.cv-header {
  padding-bottom: 9pt;
  border-bottom: 1.5pt solid var(--cv-rule-strong);
}

.cv-name {
  font-size: 25pt;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.cv-role {
  margin-top: 4pt;
  font-family: var(--mono);
  font-size: 8.4pt;
  font-weight: 500;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--accent);
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 2pt 0;
  margin-top: 8pt;
  font-size: 9pt;
  color: #3a3d45;
}

.cv-contact li {
  display: inline-flex;
  align-items: center;
}

.cv-contact li:not(:last-child)::after {
  content: '';
  display: inline-block;
  width: 2.5pt;
  height: 2.5pt;
  border-radius: 50%;
  background: #b9b5ad;
  margin-inline: 7pt;
}

.cv-contact a {
  border-bottom: 0.5pt solid #cfcbc3;
  padding-bottom: 0.5pt;
}

/* ---------- Sections ----------------------------------------------------- */

.cv-section {
  margin-top: 8pt;
  break-inside: auto;
}

.cv-section__title {
  display: flex;
  align-items: center;
  gap: 8pt;
  font-family: var(--mono);
  font-size: 8pt;
  font-weight: 600;
  /* Keep tracking below the point where PDF text extractors start inserting a
     space between every glyph — an ATS must read "PROFESSIONAL EXPERIENCE",
     not "P R O F E S S I O N A L". */
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1c1d22;
  margin-bottom: 7pt;
  break-after: avoid;
}

.cv-section__title::after {
  content: '';
  flex: 1;
  height: 0.75pt;
  background: var(--cv-rule);
}

.cv-summary {
  font-size: 9.5pt;
  line-height: 1.45;
  color: #2b2d34;
  text-wrap: pretty;
}

/* ---------- Entries ------------------------------------------------------ */

.cv-entry {
  margin-bottom: 5.5pt;
  break-inside: avoid;
}

.cv-entry:last-child {
  margin-bottom: 0;
}

.cv-entry--tight {
  margin-bottom: 6pt;
}

.cv-entry__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10pt;
}

.cv-entry__role {
  font-size: 10.4pt;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.cv-entry__at {
  font-weight: 400;
}

.cv-entry__org {
  font-weight: 500;
  color: #2b2d34;
}

.cv-entry__meta {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 8.2pt;
  letter-spacing: 0.01em;
  color: #5c5f67;
  white-space: nowrap;
}

.cv-entry__place {
  margin-top: 1.5pt;
  font-size: 8.8pt;
  color: #62656d;
}

.cv-bullets {
  margin-top: 3pt;
  display: grid;
  gap: 1.8pt;
}

.cv-bullets li {
  position: relative;
  padding-left: 10pt;
  font-size: 9.25pt;
  line-height: 1.38;
  color: #2b2d34;
  text-wrap: pretty;
}

.cv-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6pt;
  width: 5pt;
  height: 0.75pt;
  background: var(--accent);
}

.cv-entry__tech {
  margin-top: 3pt;
  font-size: 8.6pt;
  line-height: 1.4;
  color: #5c5f67;
}

.cv-entry__tech span {
  font-family: var(--mono);
  font-size: 7.4pt;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a8d94;
  margin-right: 5pt;
}

/* ---------- Skills / definition rows ------------------------------------- */

.cv-skills {
  display: grid;
  gap: 0;
  border-top: 0.5pt solid var(--cv-rule);
}

.cv-skills > div {
  display: grid;
  grid-template-columns: 34mm minmax(0, 1fr);
  gap: 8pt;
  padding: 3.4pt 0;
  border-bottom: 0.5pt solid var(--cv-rule);
  break-inside: avoid;
}

.cv-skills dt {
  font-family: var(--mono);
  font-size: 7.8pt;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #1c1d22;
  padding-top: 0.6pt;
}

.cv-skills dd {
  font-size: 9.2pt;
  line-height: 1.4;
  color: #2b2d34;
}

/* ---------- Certifications ----------------------------------------------- */

/* Certification names are proper nouns, so unlike the category labels above
   they stay in sentence case — for readability and for ATS keyword matching. */
.cv-certs {
  display: grid;
  gap: 0;
  border-top: 0.5pt solid var(--cv-rule);
}

.cv-certs li {
  display: grid;
  grid-template-columns: 62mm minmax(0, 1fr);
  gap: 8pt;
  padding: 3.4pt 0;
  border-bottom: 0.5pt solid var(--cv-rule);
  break-inside: avoid;
}

.cv-certs b {
  font-size: 9.3pt;
  font-weight: 600;
  color: #1c1d22;
}

.cv-certs span {
  font-size: 9pt;
  line-height: 1.4;
  color: #4a4d55;
}

/* ---------- Projects ----------------------------------------------------- */

.cv-project__text {
  margin-top: 2pt;
  font-size: 9.15pt;
  line-height: 1.38;
  color: #2b2d34;
  text-wrap: pretty;
}

.cv-project__link {
  margin-top: 1.5pt;
  font-family: var(--mono);
  font-size: 8pt;
  color: var(--accent);
}

/* ==========================================================================
   Mobile — the document reflows instead of scaling down to unreadable type
   ========================================================================== */

/* `screen` matters here: Chrome lays the PDF out at the printable width
   (180mm ≈ 680px), which would otherwise match this breakpoint and print the
   phone layout at A4 size. */
@media screen and (max-width: 46rem) {
  .cv {
    padding: 1.25rem 1.15rem;
    font-size: 10.5pt;
    box-shadow: 0 1px 2px rgba(20, 21, 26, 0.08), 0 10px 24px rgba(20, 21, 26, 0.1);
  }

  .cv-name {
    font-size: 1.85rem;
  }

  .cv-role {
    font-size: 0.6875rem;
  }

  .cv-contact {
    display: grid;
    gap: 0.3rem;
    font-size: 0.875rem;
  }

  .cv-contact li:not(:last-child)::after {
    display: none;
  }

  .cv-entry__head {
    flex-direction: column;
    gap: 0.15rem;
  }

  .cv-entry__role {
    font-size: 1rem;
  }

  .cv-entry__meta,
  .cv-entry__place {
    font-size: 0.8125rem;
  }

  .cv-bullets li,
  .cv-summary,
  .cv-project__text {
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  .cv-skills > div,
  .cv-certs li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
    padding-block: 0.5rem;
  }

  .cv-skills dd,
  .cv-certs b,
  .cv-certs span {
    font-size: 0.9375rem;
  }

  .cv-bar__title {
    display: none;
  }

  .cv-bar__inner {
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 24rem) {
  .cv-bar__back span {
    display: none;
  }
}

/* ==========================================================================
   Print / PDF
   ========================================================================== */

@page {
  size: A4;
  margin: 13mm 15mm;
}

@media print {
  body.cv-body {
    background: #fff;
  }

  [data-print-hide],
  .skip-link,
  .cv-foot {
    display: none !important;
  }

  .cv-stage {
    padding: 0;
    display: block;
  }

  .cv {
    max-width: none;
    width: auto;
    padding: 0;
    box-shadow: none;
    font-size: 9.7pt;
  }

  /* Page-break policy. Forbidding breaks inside whole sections or whole roles
     wastes most of a page whenever the next block is too tall for the gap, and
     that alone can add a page. Instead let long blocks flow, and pin the parts
     that must not be separated: a heading never ends a page, and no single
     bullet is split in two. */
  .cv-section,
  .cv-entry {
    break-inside: auto;
  }

  .cv-section__title,
  .cv-entry__head,
  .cv-entry__place {
    break-after: avoid;
  }

  .cv-bullets li,
  .cv-skills > div,
  .cv-certs li,
  .cv-summary {
    break-inside: avoid;
  }


  .cv-bullets,
  .cv-summary {
    orphans: 2;
    widows: 2;
  }

  .cv-contact a,
  .cv-project__link a {
    border-bottom: 0;
  }

  a {
    color: inherit;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
