/* CV builder */
.cv-page {
  padding-top: 3rem;
}

.cv-head {
  max-width: 44rem;
  margin-bottom: 1.5rem;
}

.cv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.cv-toolbar [hidden] {
  display: none;
}

.cv-status {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mint);
}

.btn-sm {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 0.65rem;
}

.cv-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1000px) {
  .cv-layout {
    grid-template-columns: minmax(0, 25rem) minmax(0, 1fr);
  }

  .cv-output {
    position: sticky;
    top: 5.5rem;
  }
}

/* Editor */
.cv-editor {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.cv-card {
  margin: 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.6);
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}

.cv-card legend {
  padding: 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.cv-editor label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  min-width: 0;
}

.cv-editor input:not([type="checkbox"]):not([type="color"]),
.cv-editor select,
.cv-editor textarea {
  width: 100%;
  font: inherit;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.5rem 0.65rem;
}

.cv-editor textarea {
  resize: vertical;
  line-height: 1.45;
}

.cv-editor :focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 1px;
}

.cv-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.7rem;
}

.cv-color input {
  width: 100%;
  height: 2.3rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #fff;
}

.cv-hint {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.cv-exp {
  display: grid;
  gap: 0.6rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed var(--line);
}

.cv-remove {
  justify-self: start;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  color: var(--coral-deep);
  cursor: pointer;
}

.cv-count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.cv-app-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
}

.cv-editor .cv-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cv-apps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
  max-height: 22rem;
  overflow-y: auto;
}

.cv-apps li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.cv-apps label {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.4rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.cv-apps label:hover {
  background: rgba(255, 255, 255, 0.8);
}

.cv-apps img {
  width: 28px;
  height: 28px;
  border-radius: 0.45rem;
}

.cv-apps span {
  display: grid;
  min-width: 0;
}

.cv-apps strong {
  color: var(--ink);
  font-size: 0.88rem;
}

.cv-apps small {
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cv-star {
  flex: none;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.cv-star[aria-pressed="true"] {
  color: #e8a400;
}

.cv-star:hover {
  background: rgba(255, 255, 255, 0.8);
}

.cv-standard-only,
.cv-editor.is-standard .cv-modern-only,
.cv-editor.is-standard .cv-accent-field,
.cv-editor:not(.is-standard) .cv-star {
  display: none;
}

.cv-editor.is-standard .cv-standard-only {
  display: block;
}

.cv-editor:not(.is-standard) .cv-standard-only-inline {
  display: none;
}

.cv-editor:not(.is-standard) .cv-projects-card {
  display: none;
}

.cv-project-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 700;
}

.cv-project-name img {
  width: 22px;
  height: 22px;
  border-radius: 0.35rem;
}

.cv-exp:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.cv-data-tools .cv-hint {
  flex-basis: 100%;
}

.cv-data-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cv-editor .cv-data-tools label {
  display: inline-flex;
  font-size: 0.85rem;
  color: var(--ink);
}

/* Output */
.cv-output {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.cv-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.4rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.cv-tabs button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.cv-tabs button[aria-selected="true"] {
  background: var(--ink);
  color: #fff;
}

.cv-tabs {
  align-items: center;
}

.cv-pages {
  margin-left: auto;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1f7a4d;
  background: rgba(63, 174, 116, 0.14);
  white-space: nowrap;
}

.cv-pages.is-over {
  color: #a3123d;
  background: rgba(255, 61, 110, 0.14);
}

.cv-pages:empty {
  display: none;
}

.cv-paper.cv-measure {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 210mm;
  min-height: 0;
  visibility: hidden;
  pointer-events: none;
}

.cv-paper-wrap {
  padding: 1.25rem;
  max-height: calc(100vh - 11rem);
  overflow: auto;
}

.cv-code {
  margin: 0;
  padding: 1.1rem 1.25rem;
  max-height: calc(100vh - 11rem);
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.5;
  background: #12181c;
  color: #e6efe9;
  white-space: pre;
}

.cv-pdf-hint {
  padding: 0.8rem 1.1rem 0;
}

.cv-pdf {
  display: block;
  width: 100%;
  height: calc(100vh - 13rem);
  min-height: 32rem;
  border: 0;
  margin-top: 0.6rem;
  background: #fff;
}

/* The CV sheet (A4 proportions) */
/* The sheet is always laid out at A4 width; cv.js zooms it down to fit the panel,
   so the preview wraps exactly like the printed PDF. */
.cv-paper {
  --cv-accent: #ff3d6e;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 16mm;
  background: #fff;
  color: #1b1f22;
  box-shadow: var(--shadow);
  font-family: var(--cv-font, "Source Sans 3", Arial, sans-serif);
  font-size: 10.5pt;
  line-height: 1.42;
}

.cv-paper a {
  color: inherit;
}

.cv-paper h2 {
  margin: 0;
  font-family: inherit;
  font-size: 24pt;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.cv-paper .cvp-title {
  margin: 0.2rem 0 0.35rem;
  font-size: 13pt;
  color: var(--cv-accent);
}

.cv-paper .cvp-contacts {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  font-size: 9pt;
  color: #5c6b75;
}

.cv-paper .cvp-contacts i {
  font-style: normal;
  padding: 0 0.6em;
}

.cv-paper h3 {
  margin: 1.1rem 0 0.4rem;
  padding-bottom: 0.15rem;
  font-size: 12.5pt;
  color: var(--cv-accent);
  border-bottom: 1px solid color-mix(in srgb, var(--cv-accent) 30%, transparent);
}

.cv-paper p {
  margin: 0;
}

.cv-paper ul {
  margin: 0.2rem 0 0.4rem;
  padding-left: 1.15rem;
}

.cv-paper li {
  margin: 0.05rem 0;
}

.cvp-role {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.cvp-role span,
.cvp-links {
  color: #5c6b75;
  font-size: 9pt;
}

.cvp-company {
  font-style: italic;
}

.cv-paper .cvp-group {
  margin-top: 0.35rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--cv-accent) 70%, black);
}

.cv-paper-compact {
  padding: 13mm;
  font-size: 9.5pt;
}

.cv-paper-compact .cvp-head {
  text-align: center;
}

.cv-paper-compact .cvp-contacts {
  justify-content: center;
}

.cv-paper-compact h3 {
  font-size: 10.5pt;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  margin-top: 0.8rem;
}

.cv-paper-compact .cvp-apps {
  columns: 2;
  column-gap: 1.5rem;
}

.cv-paper-compact .cvp-apps li {
  break-inside: avoid;
}

/* Where print starts a new page (drawn by cv.js when the preview is A4-wide) */
.cv-paper {
  position: relative;
}

.cvp-break {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1.5px dashed #e02558;
  pointer-events: none;
}

.cvp-break {
  font: 600 10px/1 var(--font-body);
  color: #e02558;
  text-align: right;
  padding: 3px 6px 0 0;
}

/* Standard: classic single-column résumé, serif, black rules */
.cv-paper-standard {
  padding: 13mm 15mm;
  font-size: calc(11pt * var(--cv-font-scale, 1));
  line-height: 1.3;
  color: #111;
}

.cv-paper-standard .cvp-head {
  text-align: center;
  margin-bottom: 0.2rem;
}

.cv-paper-standard h2 {
  font-family: inherit;
  font-weight: 400;
  font-variant: small-caps;
  font-size: 24pt;
  letter-spacing: 0;
}

.cv-paper-standard .cvp-title {
  margin: 0.15rem 0;
  font-size: 11pt;
  color: inherit;
}

.cv-paper-standard .cvp-contacts {
  justify-content: center;
  color: inherit;
  font-size: 10pt;
}

.cv-paper-standard .cvp-contacts i {
  padding: 0 0.45em;
}

.cv-paper-standard h3 {
  margin: 0.75rem 0 0.35rem;
  padding-bottom: 0.1rem;
  font-size: 13pt;
  font-weight: 400;
  font-variant: small-caps;
  color: inherit;
  border-bottom: 0.8px solid #111;
}

.cv-paper-standard ul {
  margin: 0.1rem 0 0.25rem;
  padding-left: 1.3rem;
}

.cv-paper-standard .cvp-extra {
  font-size: 10pt;
}

.cvp-entry + .cvp-entry {
  margin-top: 0.3rem;
}

.cvp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.cvp-row > :last-child {
  text-align: right;
  white-space: nowrap;
}

.cvp-sub {
  font-size: 10pt;
}

.cv-paper-standard .cvp-row small {
  font-size: 10pt;
}

.cv-paper-standard .cvp-line + .cvp-line {
  margin-top: 0.1rem;
}

@media (max-width: 640px) {
  .cv-paper-wrap {
    padding: 0.5rem;
  }
}

/* Print → only the CV sheet.
   @page has no margin, so the browser has no room to print its date/title/URL header and footer.
   The sheet's own padding is the margin, and box-decoration-break: clone repeats it on every
   page, so page 2 gets its top margin too. */
@page {
  size: A4;
  margin: 0;
}

@media print {
  body {
    background: #fff;
  }

  body::before,
  .site-header,
  .site-footer,
  .cv-head,
  .cv-toolbar,
  .cv-editor,
  .cv-tabs,
  .cv-measure,
  .cvp-break,
  .cv-panel:not([data-panel="preview"]) {
    display: none !important;
  }

  .cv-page,
  .cv-page .container,
  .cv-layout,
  .cv-output,
  .cv-paper-wrap {
    display: block;
    padding: 0;
    margin: 0;
    width: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    background: none;
    position: static;
  }

  .cv-paper,
  .cv-paper-standard,
  .cv-paper-compact {
    zoom: 1 !important;
    width: auto;
    box-shadow: none;
    max-width: none;
    min-height: 0;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Keep an entry together and never leave a heading at the bottom of a page */
  .cvp-entry,
  .cvp-head,
  .cv-paper li {
    break-inside: avoid;
  }

  .cv-paper h3,
  .cvp-role,
  .cvp-company,
  .cvp-group {
    break-after: avoid;
  }

  .cv-paper a {
    text-decoration: none;
  }
}
