@import url("/css-v2/tokens.css");
@import url("/css-v2/reset.css");
@import url("/css-v2/base.css");
@import url("/css-v2/components/badge.css");
@import url("/css-v2/components/toast.css");

/* =====================================================================
   Page chrome (dark) — frame in which the white CV sheet floats.
   ===================================================================== */

html, body {
  height: 100%;
  margin: 0;
  background: var(--pm-black);
  color: var(--pm-white);
}

body {
  min-height: 100svh;
  font-family: var(--ff-body);
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(115, 0, 139, 0.18), transparent 60%),
    var(--pm-black);
  background-attachment: fixed;
}

/* Mobile / narrow viewports: lock scroll while the drawer covers the page. */
body.cv-drawer-open { overflow: hidden; }

/* Desktop: the drawer becomes a side panel — content stays scrollable
   and the stage shifts left so the live preview is fully visible. */
@media (min-width: 960px) {
  body { transition: padding-right var(--dur-base) var(--ease-out-expo); }
  body.cv-drawer-open {
    overflow: auto;
    padding-right: 460px;
  }
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Topbar ---------- */

.cv-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 14px clamp(16px, 3vw, 24px);
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color-subtle);
}

.cv-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color-subtle);
  color: var(--pm-gray-100);
  background: var(--pm-ink);
  transition: border-color var(--dur-base) var(--ease-out-expo), color var(--dur-base) var(--ease-out-expo);
}
.cv-topbar__brand:hover { border-color: var(--pm-purple-400); color: var(--pm-white); }
.cv-topbar__brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pm-black);
  border: 1px solid var(--border-color-subtle);
}
.cv-topbar__brand-text { font-size: var(--fs-200); font-weight: 500; letter-spacing: 0.01em; }
.cv-topbar__brand-arrow { color: var(--pm-gray-400); transition: transform var(--dur-base) var(--ease-out-expo); }
.cv-topbar__brand:hover .cv-topbar__brand-arrow { transform: translateX(-3px); color: var(--pm-purple-300); }

.cv-topbar__title {
  font-family: var(--ff-display);
  font-size: var(--fs-500);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  color: var(--pm-white);
}

.cv-topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: var(--fs-200);
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color-subtle);
  background: var(--pm-ink);
  color: var(--pm-gray-100);
  transition: color var(--dur-fast) var(--ease-out-expo),
              border-color var(--dur-fast) var(--ease-out-expo),
              background var(--dur-fast) var(--ease-out-expo);
}
.cv-btn:hover { color: var(--pm-white); border-color: var(--pm-purple-400); }
.cv-btn--primary {
  background: var(--pm-purple-700);
  border-color: var(--pm-purple-600);
  color: var(--pm-white);
}
.cv-btn--primary:hover { background: var(--pm-purple-600); border-color: var(--pm-purple-400); color: var(--pm-white); }

.cv-btn--ghost { background: transparent; }
.cv-btn--icon-only { padding: 9px; width: 36px; justify-content: center; }
.cv-btn svg { width: 14px; height: 14px; }

@media (max-width: 560px) {
  .cv-topbar__title { display: none; }
  .cv-topbar__brand-text { display: none; }
  .cv-btn span { display: none; }
  .cv-btn { padding: 9px; width: 36px; justify-content: center; }
}

/* ---------- Viewer banner (when arriving from a share link) ---------- */
.cv-viewer-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-5);
  background: linear-gradient(180deg, rgba(115, 0, 139, 0.18), rgba(115, 0, 139, 0.06));
  color: var(--pm-purple-100);
  font-size: var(--fs-200);
  border-bottom: 1px solid rgba(196, 0, 173, 0.25);
}

/* ---------- Stage that hosts the CV sheet ---------- */
.cv-stage {
  padding: clamp(20px, 5vw, 64px) clamp(12px, 4vw, 48px) clamp(48px, 8vw, 96px);
  display: flex;
  justify-content: center;
}

/* =====================================================================
   .cv-doc — the white printable sheet (light skin scoped here).
   ===================================================================== */

.cv-doc {
  --doc-bg: #FFFFFF;
  --doc-fg: #15141A;
  --doc-fg-muted: #6F6F78;
  --doc-rule: #C9C2B6;
  --doc-rule-soft: #E5E2DD;
  --doc-accent: var(--pm-purple-700);
  --doc-link: var(--pm-purple-700);
  --doc-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.16);

  position: relative;
  width: 100%;
  max-width: 820px;
  background: var(--doc-bg);
  color: var(--doc-fg);
  border-radius: var(--radius-md);
  box-shadow: var(--doc-shadow);
  padding: clamp(2rem, 5vw, 3.6rem) clamp(2rem, 5.5vw, 4rem);
  font-family: var(--ff-body);
  font-size: var(--fs-300);
  line-height: 1.55;
}

/* ---------- Decorative corners (placed outside flow) ---------- */
.cv-corner {
  position: absolute;
  width: 88px;
  height: 88px;
  pointer-events: none;
  line-height: 0;
  display: block;
}
.cv-corner svg { display: block; width: 100%; height: 100%; }
.cv-corner--tl { top: 14px; left: 14px; }
.cv-corner--tr { top: 14px; right: 14px; transform: rotate(90deg); }
.cv-corner--br { bottom: 14px; right: 14px; transform: rotate(180deg); }
.cv-corner--bl { bottom: 14px; left: 14px; transform: rotate(270deg); }
.cv-corner:empty { display: none; }

/* ---------- Divider ---------- */
.cv-doc__divider {
  margin: 0 auto var(--sp-4);
  text-align: center;
  line-height: 0;
}
.cv-doc__divider:empty { display: none; }
.cv-doc__divider svg { display: inline-block; max-width: 70%; height: auto; }

/* ---------- Brand strip (only on the example) ---------- */
.cv-doc__brandstrip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--doc-fg-muted);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-5);
  border-bottom: 1px dashed var(--doc-rule-soft);
}
.cv-doc__brandstrip img { width: 18px; height: 18px; }
.cv-doc__brandstrip-mark { font-weight: 600; color: var(--doc-fg); letter-spacing: 0.06em; text-transform: none; font-size: 12px; }
.cv-doc__brandstrip-tag { color: var(--doc-fg-muted); }
.cv-doc__brandstrip-spacer { flex: 1; }

/* ---------- Photo (printed before the H1) ---------- */
.cv-doc__photo {
  margin: 0 auto var(--sp-4);
  text-align: center;
}
.cv-doc__photo img {
  display: block;
  margin: 0 auto;
  width: 130px;
  height: auto;
  max-height: 170px;
  object-fit: cover;
  border: 1px solid var(--doc-rule);
  padding: 4px;
  background: #fff;
}
.cv-doc__photo[hidden] { display: none; }

/* ---------- Markdown-rendered CV typography ---------- */
.cv-doc__body { color: var(--doc-fg); }

.cv-doc__body h1,
.cv-doc__body h2,
.cv-doc__body h3,
.cv-doc__body h4 {
  font-family: var(--ff-display);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  color: var(--doc-fg);
  font-variation-settings: "opsz" 96, "SOFT" 50, "wght" 500;
  margin: 0;
  line-height: 1.1;
}

/* H1: large display, centered letterhead */
.cv-doc__body h1 {
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  text-align: center;
  letter-spacing: 0.02em;
  margin: 0 0 var(--sp-2);
}

/* The 5 paragraphs immediately after the H1 form the centered letterhead. */
.cv-doc__body > p:nth-of-type(-n+5) {
  text-align: center;
  margin: 2px 0;
  color: var(--doc-fg);
}
.cv-doc__body > p:nth-of-type(1) {
  font-family: var(--ff-display);
  font-size: var(--fs-500);
  color: var(--doc-accent);
  font-weight: 500;
  margin-top: 4px;
  margin-bottom: 8px;
}

/* H2: uppercase section heading with bottom rule */
.cv-doc__body h2 {
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--doc-accent);
  margin: var(--sp-7) 0 var(--sp-3);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--doc-rule);
  break-after: avoid;
  page-break-after: avoid;
}

/* H3: job / qualification title */
.cv-doc__body h3 {
  font-family: var(--ff-body);
  font-size: var(--fs-400);
  font-weight: 600;
  letter-spacing: 0.005em;
  margin: var(--sp-5) 0 4px;
  color: var(--doc-fg);
  break-after: avoid;
  page-break-after: avoid;
}

/* H3 + P (the meta line — italic, muted) */
.cv-doc__body h3 + p {
  margin: 0 0 var(--sp-3);
  color: var(--doc-fg-muted);
  font-size: var(--fs-200);
  font-style: italic;
}

/* Paragraphs and lists */
.cv-doc__body p {
  max-width: none;
  margin: 0 0 var(--sp-3);
  color: var(--doc-fg);
}

.cv-doc__body ul {
  margin: 6px 0 var(--sp-4);
  padding-left: 22px;
  list-style: none;
}
.cv-doc__body ul li {
  position: relative;
  padding: 0;
  margin: 4px 0;
  color: #2A2A30;
}
.cv-doc__body ul li::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--doc-accent);
  opacity: 0.55;
}

.cv-doc__body strong { font-weight: 600; color: var(--doc-fg); }
.cv-doc__body em { font-style: italic; }

.cv-doc__body a {
  color: var(--doc-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.cv-doc__body a:hover { color: var(--pm-purple-500); }

.cv-doc__body hr {
  border: 0;
  height: 1px;
  background: var(--doc-rule-soft);
  margin: var(--sp-5) 0;
}

/* Avoid orphan headings */
.cv-doc__body h3 + p,
.cv-doc__body h3 + p + p,
.cv-doc__body h3 + p + ul,
.cv-doc__body h3 + ul { break-inside: avoid; page-break-inside: avoid; }

/* =====================================================================
   Edit drawer (dark) — slides in from the right.
   ===================================================================== */

.cv-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 11, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: calc(var(--z-overlay) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base);
}
.cv-drawer-backdrop[data-open="true"] { opacity: 1; pointer-events: auto; }

/* Desktop: backdrop steps out of the way so the preview stays clear. */
@media (min-width: 960px) {
  .cv-drawer-backdrop,
  .cv-drawer-backdrop[data-open="true"] {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 0;
    pointer-events: none;
  }
}

.cv-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100svh;
  width: min(460px, 100vw);
  background: var(--pm-ink);
  border-left: 1px solid var(--border-color-base);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-overlay);
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease-out-expo);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cv-drawer[data-open="true"] { transform: translateX(0); }

.cv-edit__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-color-subtle);
}
.cv-edit__title {
  font-family: var(--ff-display);
  font-size: var(--fs-500);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  color: var(--pm-white);
  margin: 0;
}
.cv-edit__close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color-subtle);
  background: transparent;
  color: var(--pm-gray-300);
}
.cv-edit__close:hover { color: var(--pm-white); border-color: var(--pm-purple-400); }

.cv-edit__body {
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-5) var(--sp-7);
  display: grid;
  gap: var(--sp-5);
  scrollbar-gutter: stable;
}

.cv-edit__section {
  border: 1px solid var(--border-color-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  background: rgba(255, 255, 255, 0.015);
  display: grid;
  gap: var(--sp-3);
}
.cv-edit__legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--pm-purple-200);
  font-weight: 600;
  padding: 0 6px;
  margin-left: -6px;
}

.cv-edit__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--pm-gray-400);
  font-weight: 500;
}

.cv-edit__input,
.cv-edit__textarea {
  background: var(--pm-gray-900);
  border: 1px solid var(--border-color-subtle);
  border-radius: 8px;
  color: var(--pm-white);
  font-family: var(--ff-body);
  font-size: var(--fs-200);
  padding: 10px 12px;
  width: 100%;
  resize: vertical;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out-expo);
}
.cv-edit__textarea { min-height: 70px; line-height: 1.5; }
.cv-edit__input:focus,
.cv-edit__textarea:focus { border-color: var(--pm-purple-400); }

.cv-edit__md {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 320px;
  white-space: pre;
  background: var(--pm-gray-900);
}

.cv-edit__hint {
  font-size: 11px;
  color: var(--pm-gray-500);
  line-height: 1.5;
}
.cv-edit__hint code {
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--pm-purple-200);
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.cv-edit__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: var(--fs-200);
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color-subtle);
  background: var(--pm-gray-900);
  color: var(--pm-gray-100);
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.cv-edit__btn svg { width: 14px; height: 14px; }
.cv-edit__btn:hover { color: var(--pm-white); border-color: var(--pm-purple-400); }
.cv-edit__btn--ghost { background: transparent; }
.cv-edit__btn--danger { color: #FF8593; }
.cv-edit__btn--danger:hover { border-color: rgba(255, 70, 90, 0.5); color: #FF8593; }

.cv-edit__icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border-color-subtle);
  background: transparent;
  color: var(--pm-gray-300);
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.cv-edit__icon-btn:hover { color: var(--pm-white); border-color: var(--pm-purple-400); }

.cv-edit__photo-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-3);
  align-items: start;
}
.cv-edit__photo-preview {
  width: 84px;
  height: 110px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--pm-gray-900);
  border: 1px solid var(--border-color-subtle);
  display: grid;
  place-items: center;
  color: var(--pm-gray-500);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.cv-edit__photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.cv-edit__photo-actions {
  display: grid;
  gap: 6px;
  align-content: start;
}

/* Ornaments controls */
.cv-edit__orn-styles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.cv-edit__orn-style {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  font-size: 12px;
  border: 1px solid var(--border-color-subtle);
  border-radius: 8px;
  color: var(--pm-gray-300);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  user-select: none;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.cv-edit__orn-style input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cv-edit__orn-style:has(input:checked) {
  color: var(--pm-purple-100);
  border-color: var(--pm-purple-400);
  background: rgba(115, 0, 139, 0.18);
}
.cv-edit__orn-style:hover { color: var(--pm-white); border-color: var(--pm-purple-300); }

.cv-edit__orn-seed-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: stretch;
}
.cv-edit__orn-seed-row .cv-edit__input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }

.cv-edit__orn-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--pm-gray-400);
}
.cv-edit__orn-chip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  flex: 0 0 auto;
}
.cv-edit__orn-meta-text { letter-spacing: 0.04em; }

/* Colour palette */
.cv-edit__orn-colors {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.cv-edit__tint {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  flex: 0 0 auto;
  display: block;
  transition: transform var(--dur-fast) var(--ease-out-expo), border-color var(--dur-fast) var(--ease-out-expo);
}
.cv-edit__tint:hover { transform: scale(1.06); border-color: var(--pm-purple-300); }
.cv-edit__tint-x {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pm-gray-900);
  border: 1px solid var(--border-color-base);
  color: var(--pm-gray-200);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out-expo), color var(--dur-fast), background var(--dur-fast);
  padding: 0;
}
.cv-edit__tint-x:hover { color: #FF8593; background: var(--pm-ink); }
.cv-edit__tint:hover .cv-edit__tint-x,
.cv-edit__tint:focus-within .cv-edit__tint-x { opacity: 1; }
.cv-edit__tint--add {
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.25);
  color: var(--pm-gray-300);
  display: grid;
  place-items: center;
}
.cv-edit__tint--add:hover { color: var(--pm-white); border-color: var(--pm-purple-300); }

.cv-edit__tint-named {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cv-edit__tint-named-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color-subtle);
  background: rgba(255,255,255,0.025);
  color: var(--pm-gray-300);
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.cv-edit__tint-named-btn:hover { color: var(--pm-white); border-color: var(--pm-purple-300); background: rgba(115, 0, 139, 0.12); }
.cv-edit__tint-named-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  flex: 0 0 auto;
}

.cv-edit__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-color-subtle);
}

/* =====================================================================
   Share modal
   ===================================================================== */

.cv-share-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: rgba(10, 10, 11, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base);
}
.cv-share-modal[data-open="true"] { opacity: 1; pointer-events: auto; }

.cv-share-modal__panel {
  width: 100%;
  max-width: 580px;
  background: var(--pm-ink);
  border: 1px solid var(--border-color-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-6);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--dur-base) var(--ease-out-quart);
}
.cv-share-modal[data-open="true"] .cv-share-modal__panel {
  transform: translateY(0) scale(1);
}

.cv-share-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.cv-share-modal__title {
  font-family: var(--ff-display);
  font-size: var(--fs-600);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  margin: 0;
}
.cv-share-modal__close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--border-color-subtle);
  color: var(--pm-gray-300);
}
.cv-share-modal__close:hover { color: var(--pm-white); border-color: var(--pm-purple-400); }

.cv-share-modal__body { display: grid; gap: var(--sp-4); color: var(--pm-gray-200); }
.cv-share-modal__body p { max-width: none; font-size: var(--fs-200); color: var(--pm-gray-300); }

.cv-share-field {
  display: grid;
  gap: 6px;
}
.cv-share-field__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--pm-purple-200);
  font-weight: 600;
}
.cv-share-input {
  width: 100%;
  background: var(--pm-gray-900);
  border: 1px solid var(--border-color-subtle);
  border-radius: 10px;
  color: var(--pm-white);
  padding: 12px;
  font-family: var(--ff-body);
  font-size: var(--fs-200);
  outline: none;
  word-break: break-all;
}

.cv-share-passphrase {
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--fs-500);
  letter-spacing: 0.04em;
  color: var(--pm-purple-200);
  background: rgba(115, 0, 139, 0.1);
  border: 1px solid rgba(196, 0, 173, 0.3);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  font-weight: 500;
}

.cv-share-modal__row {
  display: flex;
  gap: 8px;
}
.cv-share-modal__row .cv-share-input { flex: 1; }
.cv-share-modal__row .cv-btn { flex-shrink: 0; }

.cv-share-modal__meta {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pm-gray-500);
}

.cv-share-modal__error {
  background: rgba(255, 70, 90, 0.08);
  border: 1px solid rgba(255, 70, 90, 0.4);
  border-radius: 10px;
  padding: 12px 14px;
  color: #FFA0AD;
  font-size: var(--fs-200);
}

/* Editable passphrase input — visually echoes the read-only `code` block
   it replaced (monospace, purple-tinted background) so the user can
   recognise it as the share secret. */
.cv-share-passphrase-input {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--fs-400);
  letter-spacing: 0.04em;
  color: var(--pm-purple-200);
  background: rgba(115, 0, 139, 0.1);
  border: 1px solid rgba(196, 0, 173, 0.3);
  text-align: center;
  font-weight: 500;
}
.cv-share-passphrase-input:focus {
  border-color: var(--pm-purple-400);
}

.cv-share-field__hint {
  font-size: 12px;
  color: var(--pm-gray-500);
  letter-spacing: 0.01em;
}

.cv-share-modal__row--actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.cv-share-modal__status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-200);
  color: var(--pm-gray-300);
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color-subtle);
}
.cv-share-modal__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pm-gray-500);
  flex-shrink: 0;
}
.cv-share-modal__status[data-state="connecting"] .cv-share-modal__status-dot {
  background: #E0B84A;
  box-shadow: 0 0 0 4px rgba(224, 184, 74, 0.18);
  animation: cv-share-pulse 1.4s ease-in-out infinite;
}
.cv-share-modal__status[data-state="sharing"] .cv-share-modal__status-dot {
  background: #6CD86C;
  box-shadow: 0 0 0 4px rgba(108, 216, 108, 0.18);
}
@keyframes cv-share-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Topbar Share button gets a small green dot when an active share is
   running, so it's obvious from the page chrome alone that the link is
   live even after the modal is closed. */
#btn-share[data-active="true"]::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: #6CD86C;
  box-shadow: 0 0 0 3px rgba(108, 216, 108, 0.18);
  vertical-align: middle;
}

/* =====================================================================
   Viewer connecting overlay — shown to the recipient while the host's
   tab is being located. Replaced by the rendered CV once the data
   channel delivers it.
   ===================================================================== */
.cv-connecting {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cv-connecting__panel {
  max-width: 440px;
  width: 100%;
  background: var(--pm-gray-900);
  border: 1px solid var(--border-color-subtle);
  border-radius: 16px;
  padding: 28px 28px 24px;
  text-align: center;
  display: grid;
  gap: var(--sp-3);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.cv-connecting__spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--pm-purple-300);
  animation: cv-connecting-spin 0.9s linear infinite;
}
@keyframes cv-connecting-spin {
  to { transform: rotate(360deg); }
}
.cv-connecting__title {
  font-family: var(--ff-display);
  font-size: var(--fs-500);
  margin: 0;
  color: var(--pm-white);
}
.cv-connecting__msg {
  margin: 0;
  color: var(--pm-gray-300);
  font-size: var(--fs-200);
  line-height: 1.5;
}
.cv-connecting__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

/* =====================================================================
   Toast region
   ===================================================================== */
.toast-region#cv-toast-region { z-index: calc(var(--z-overlay) + 5); }

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

@page { size: A4; margin: 12mm 14mm; }

/* Off-screen layout used by app.js#fitDocToFullPages — mirrors the print
   stylesheet so the measured doc height matches what the printer lays out.
   `visibility: hidden` keeps the brief reflow invisible to the user. */
body.cv-measuring-print { padding: 0 !important; }
body.cv-measuring-print .cv-stage {
  padding: 0 !important;
  visibility: hidden;
}
body.cv-measuring-print .cv-doc {
  padding: 0 !important;
  max-width: 182mm !important;
  margin: 0 auto !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

@media print {
  html, body {
    background: #FFFFFF !important;
  }
  body { background-image: none !important; }
  .cv-topbar,
  .cv-viewer-banner,
  .cv-drawer-backdrop,
  .cv-drawer,
  .cv-share-modal,
  .cv-connecting,
  .toast-region {
    display: none !important;
  }
  .cv-stage { padding: 0; }
  .cv-doc {
    box-shadow: none;
    border-radius: 0;
    max-width: 100%;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* All corners are absolute-positioned within .cv-doc. The top pair lands
     on page 1 (where the doc starts); the bottom pair lands on the last
     page IFF the doc fills a whole number of pages — which is what
     app.js#fitDocToFullPages arranges by padding the doc before printing. */
  .cv-corner {
    position: absolute;
    width: 22mm;
    height: 22mm;
    z-index: 1000;
  }
  .cv-corner--tl { top: 0;    left: 0;    bottom: auto; right: auto; }
  .cv-corner--tr { top: 0;    right: 0;   bottom: auto; left: auto;  }
  .cv-corner--bl { bottom: 0; left: 0;    top: auto;    right: auto; }
  .cv-corner--br { bottom: 0; right: 0;   top: auto;    left: auto;  }
  .cv-doc__brandstrip {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: var(--sp-3);
    color: #6F6F78;
  }
  .cv-doc__body a { color: var(--doc-link); text-decoration: underline; }
}

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .cv-drawer { transition: opacity var(--dur-base); transform: none; opacity: 0; pointer-events: none; }
  .cv-drawer[data-open="true"] { opacity: 1; pointer-events: auto; }
  .cv-share-modal__panel,
  .cv-share-modal { transition: opacity var(--dur-base); }
  .cv-share-modal__panel { transform: none !important; }
}

/* =====================================================================
   Focus
   ===================================================================== */
:focus-visible {
  outline: 2px solid var(--pm-accent);
  outline-offset: 2px;
  border-radius: 6px;
}
