/* CV builder page ----------------------------------------------- */
.cvb-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.cvb-backdrop img {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 50%;
  object-fit: cover;
  opacity: 0.32;
}
.cvb-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px var(--m);
  --lg-fill: color-mix(in srgb, var(--ground) 55%, transparent);
  box-shadow: none;
}
.cvb-bar .theme {
  justify-self: end;
  color: var(--ink);
}
.cvb-bar > .lg-btn {
  justify-self: start;
}
.cvb-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
}
.cvb-intro {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: clamp(32px, 5vw, 72px) var(--m) 28px;
}
.cvb-lead {
  max-width: 34em;
  font-size: clamp(19px, 1.5vw, 22px);
  font-weight: 500;
  line-height: 1.45;
}
.cvb-mode {
  display: none;
}
.cvb {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 32px 4vw;
  align-items: start;
  padding: 0 var(--m) 80px;
}
.cvb-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}
.ed-sec,
.ed-grid,
.ed-items,
.ed-stack {
  min-width: 0;
}
.ed-grid > * {
  min-width: 0;
}
.ed-sec {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 22px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--ground-2) 86%, transparent);
}
.ed-h {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ed-help {
  font-size: 15px;
  color: var(--ink-2);
}
.ed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}
.ed-row--col {
  flex-direction: column;
  align-items: stretch;
}
.ed-label {
  font-size: 15px;
  font-weight: 600;
}
.ed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ed-full {
  grid-column: 1 / -1;
}
.ed-items,
.ed-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.ed-item,
.ed-items > *,
.ed-stack > * {
  min-width: 0;
}
.ed-grid > :first-child:nth-last-child(odd) {
  grid-column: 1 / -1;
}
.swatches {
  display: flex;
  gap: 10px;
}
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  transition: transform 0.3s var(--lg-spring);
}
.swatch:hover {
  transform: scale(1.1);
}
.swatch.is-on {
  box-shadow:
    0 0 0 3px var(--ground-2),
    0 0 0 5px var(--ink);
}
.toggles li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-weight: 500;
}
.ed-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.ed-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ed-item__name {
  font-weight: 700;
  font-size: 17px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-tools {
  display: flex;
  gap: 6px;
  flex: none;
}
.cvb-editor > .ed-sec > .lg-btn {
  justify-self: start;
}

.cvb-preview {
  position: sticky;
  top: 72px;
}
.cvb-tools {
  position: sticky;
  top: 72px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.paper-wrap {
  position: relative;
  width: 100%;
  max-width: 794px;
}
.paper-scale {
  width: 794px;
  transform-origin: top left;
}
.cvb-note {
  margin-top: 14px;
  font-size: 15px;
  color: var(--ink-2);
}
.cvb-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 32px var(--m) 40px;
  font-size: 16px;
  font-weight: 600;
  background: var(--accent);
  color: var(--on-accent);
}
.confirm {
  display: grid;
  gap: 14px;
  padding: 4px 4px 8px;
}
.confirm__h {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
}
.confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

/* The paper ----------------------------------------------------- */
.paper {
  width: 794px;
  min-height: 1123px;
  background: #fff;
  color: #1a1a1a;
  font-family: var(--f-text);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
}
.cvp {
  --cv-accent: #b82a19;
  --cv-scale: 1;
  font-size: calc(13.2px * var(--cv-scale));
  line-height: 1.5;
  padding: 56px 60px;
}
.cvp p,
.cvp ul,
.cvp h1,
.cvp h2 {
  margin: 0;
}
.cvp ul {
  list-style: none;
  padding: 0;
}
.cvp-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 26px;
}
.cvp-photo {
  width: 96px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
}
.cvp-name {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: calc(44px * var(--cv-scale));
  line-height: 0.95;
  color: #111;
}
.cvp-title {
  margin-top: 6px;
  font-size: 1.25em;
  font-weight: 600;
  color: var(--cv-accent);
}
.cvp-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin-top: 10px;
  color: #444;
}
.cvp-sec {
  margin-top: 22px;
  break-inside: avoid-page;
}
.cvp-h {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--cv-accent);
  color: #fff;
  font-size: 0.92em;
  font-weight: 700;
}
.cvp-summary {
  max-width: 62em;
}
.cvp-items {
  display: grid;
  gap: 14px;
}
.cvp-item {
  break-inside: avoid;
}
.cvp-item__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.cvp-item__title {
  font-weight: 700;
  font-size: 1.08em;
}
.cvp-item__org {
  font-weight: 500;
}
.cvp-item__date {
  flex: none;
  color: #555;
  font-variant-numeric: tabular-nums;
}
.cvp-item__place {
  color: #555;
}
.cvp-bullets {
  margin-top: 4px !important;
}
.cvp-bullets li {
  position: relative;
  padding-left: 14px;
}
.cvp-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cv-accent);
}
.cvp-list li + li {
  margin-top: 2px;
}
.cvp-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 24px;
}

/* Sidebar template */
.cvp--sidebar {
  display: grid;
  grid-template-columns: 236px 1fr;
  padding: 0;
}
.cvp-side {
  padding: 48px 26px;
  background: color-mix(in srgb, var(--cv-accent) 9%, #fff);
}
.cvp-side .cvp-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  margin-bottom: 6px;
}
.cvp-side .cvp-contact {
  display: grid;
  gap: 4px;
  margin: 0;
  overflow-wrap: anywhere;
}
.cvp-main {
  padding: 48px 44px;
}
.cvp--sidebar .cvp-head {
  margin-bottom: 8px;
}
.cvp--sidebar .cvp-name {
  font-size: calc(50px * var(--cv-scale));
}

/* Compact template */
.cvp--compact {
  font-size: calc(12px * var(--cv-scale));
  padding: 40px 48px;
}
.cvp--compact .cvp-head {
  margin-bottom: 14px;
}
.cvp--compact .cvp-photo {
  width: 72px;
  height: 90px;
}
.cvp--compact .cvp-name {
  font-size: calc(36px * var(--cv-scale));
}
.cvp--compact .cvp-sec {
  margin-top: 14px;
}
.cvp--compact .cvp-items {
  gap: 8px;
}
.cvp--compact .cvp-h {
  background: none;
  color: var(--cv-accent);
  padding: 0;
  font-size: 1.1em;
  margin-bottom: 6px;
}

/* Phone / tablet */
@media (max-width: 1024px) {
  .cvb {
    grid-template-columns: minmax(0, 1fr);
  }
  .cvb-editor,
  .cvb-preview {
    min-width: 0;
  }
  .cvb-mode {
    display: block;
  }
  .cvb.show-editor .cvb-preview,
  .cvb.show-preview .cvb-editor {
    display: none;
  }
  .cvb-preview {
    position: static;
  }
  .cvb-backdrop img {
    width: 100%;
    opacity: 0.22;
  }
}
@media (max-width: 520px) {
  .ed-grid {
    grid-template-columns: 1fr;
  }
  .cvb-bar {
    grid-template-columns: auto 1fr auto;
  }
  .cvb-title {
    font-size: 22px;
    text-align: center;
  }
  .ed-sec {
    padding: 16px;
  }
}

/* Print: only the paper */
@media print {
  @page {
    size: A4;
    margin: 0;
  }
  html,
  body {
    margin: 0;
    padding: 0;
    background: #fff !important;
  }
  body > *:not(.cvb) {
    display: none !important;
  }
  .cvb {
    display: block !important;
    padding: 0 !important;
  }
  .cvb-editor,
  .cvb-tools,
  .cvb-note {
    display: none !important;
  }
  .cvb-preview,
  .cvb.show-editor .cvb-preview {
    display: block !important;
    position: static !important;
  }
  .paper-wrap {
    height: auto !important;
    max-width: none;
  }
  .paper-scale {
    width: auto;
    transform: none !important;
  }
  .paper {
    width: 210mm;
    min-height: 297mm;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
