/* =========================================================
   Client view — microsite presentation of the proposal
   ========================================================= */

body.client-view {
  background: var(--jr-gray-100);
  overflow: auto;
}
body.client-view .app {
  display: block;
  height: auto;
  width: 100%;
  overflow: visible;
}

/* Hide builder chrome in client view */
body.client-view .topbar,
body.client-view .form-panel,
body.client-view .preview-controls,
body.client-view .page-label {
  display: none !important;
}
body.client-view .preview-panel {
  display: none;
}

/* ---------- Microsite shell ---------- */
.cv-shell {
  min-height: 100vh;
  background: var(--jr-gray-100);
  display: flex;
  flex-direction: column;
}

/* Header */
.cv-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--jr-blue-900);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 2px 12px rgba(15,58,90,.18);
}
.cv-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.cv-header .brand {
  display: flex; align-items: center; gap: 14px;
  margin-right: auto;
  min-width: 0;
}
.cv-header .brand img { height: 30px; display: block; flex-shrink: 0; }
.cv-header .brand .sep {
  width: 1px; height: 26px;
  background: rgba(255,255,255,.18);
  flex-shrink: 0;
}
.cv-header .brand .for-block {
  min-width: 0;
  display: flex; flex-direction: column;
  line-height: 1.15;
}
.cv-header .brand .for-block .eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--jr-blue-300);
}
.cv-header .brand .for-block .client {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
  margin-top: 2px;
}
.cv-header .brand .for-block .dates {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  margin-top: 2px;
  letter-spacing: .04em;
}

.cv-header .actions { display: flex; align-items: center; gap: 8px; }
.cv-header button {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  padding: 9px 16px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}
.cv-header button:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.38);
}
.cv-header button.primary {
  background: #fff;
  color: var(--jr-blue-900);
  border-color: #fff;
}
.cv-header button.primary:hover {
  background: var(--jr-blue-50);
  border-color: var(--jr-blue-50);
}
.cv-header button.ghost-back {
  border-color: rgba(255,255,255,.14);
  color: rgba(255,255,255,.75);
}

/* ---------- Layout: TOC + slides ---------- */
.cv-body {
  display: grid;
  grid-template-columns: 232px 1fr;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 24px 80px;
  gap: 32px;
  width: 100%;
}

@media (max-width: 1024px) {
  .cv-body {
    grid-template-columns: 1fr;
    padding: 24px 16px 60px;
  }
  .cv-toc:not(.is-mobile) { display: none; }
}

/* ============== Mobile TOC drawer ============== */
.cv-mobile-toc-toggle {
  display: none;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 12px;
  transition: background var(--dur-fast);
}
.cv-mobile-toc-toggle:hover { background: rgba(255,255,255,.18); }
@media (max-width: 1024px) {
  .cv-mobile-toc-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

.cv-mobile-toc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 40, 80, .55);
  backdrop-filter: blur(3px);
  z-index: 220;
  display: flex;
  animation: cv-toc-fade .15s ease-out;
}
@keyframes cv-toc-fade { from { opacity: 0; } to { opacity: 1; } }

.cv-mobile-toc-drawer {
  width: min(360px, 88vw);
  background: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(8,30,60,.3);
  animation: cv-toc-slide .22s var(--ease-out);
}
@keyframes cv-toc-slide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
.cv-mobile-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--jr-gray-200);
  background: linear-gradient(180deg, var(--jr-blue-900) 0%, #143b59 100%);
  color: #fff;
}
.cv-mobile-toc-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.005em;
}
.cv-mobile-toc-close {
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.cv-mobile-toc-close:hover { background: rgba(255,255,255,.2); }

.cv-toc.is-mobile {
  position: static;
  flex: 1;
  display: block !important;
  overflow-y: auto;
  padding: 18px 0 28px;
  border: none;
  height: auto;
  max-height: none;
  background: transparent;
}
.cv-toc.is-mobile .toc-eyebrow { display: none; }
.cv-toc.is-mobile ol { padding: 0; }
.cv-toc.is-mobile a {
  padding: 14px 20px;
  font-size: 15px;
  border-left-width: 3px;
  border-radius: 0;
}
.cv-toc.is-mobile a.is-active {
  background: var(--jr-blue-50);
  border-left-color: var(--jr-blue);
}
.cv-toc.is-mobile a .num { font-size: 11px; }

/* TOC */
.cv-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: 8px;
}
.cv-toc .toc-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--jr-gray-500);
  margin: 0 0 12px 12px;
}
.cv-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cv-toc a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--jr-gray-700);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  transition: background var(--dur-fast) var(--ease-std), color var(--dur-fast) var(--ease-std);
  border-left: 2px solid transparent;
}
.cv-toc a:hover {
  background: var(--jr-blue-50);
  color: var(--jr-blue-900);
}
.cv-toc a.is-active {
  background: var(--jr-blue-50);
  color: var(--jr-blue-900);
  border-left-color: var(--jr-blue-700);
}
.cv-toc a .num {
  font-size: 10px;
  font-weight: 700;
  color: var(--jr-gray-500);
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  letter-spacing: .04em;
}
.cv-toc a.is-active .num {
  color: var(--jr-blue-700);
}

/* ---------- Slide stack ---------- */
.cv-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.cv-section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--jr-gray-500);
  margin: 8px 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cv-section-label::after {
  content: "";
  flex: 1; height: 1px;
  background: var(--jr-gray-300);
}

/* Slide wrapper — handles the scale-to-fit */
.cv-slide-wrap {
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15,58,90,.06), 0 10px 30px rgba(15,58,90,.10);
  background: #fff;
  scroll-margin-top: 92px;
}
.cv-slide-wrap .slide {
  box-shadow: none !important;
  border-radius: 0 !important;
  transform-origin: top left;
}

/* ---------- Floating download CTA (mobile / when sticky button hidden) ---------- */
.cv-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  background: var(--jr-blue-700);
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  padding: 14px 22px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(15,58,90,.32);
  transition: background var(--dur-fast) var(--ease-std), transform var(--dur-fast) var(--ease-std);
}
.cv-fab:hover {
  background: var(--jr-blue-900);
  transform: translateY(-1px);
}
@media (min-width: 1025px) {
  /* Header has a Download button on desktop; suppress redundant FAB */
  .cv-fab { display: none; }
}

/* ---------- Closing CTA card ---------- */
.cv-cta {
  margin-top: 28px;
  background: var(--jr-blue-900);
  color: #fff;
  border-radius: 6px;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(15,58,90,.18);
  position: relative;
  overflow: hidden;
}
.cv-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 90% 110%, rgba(141,177,203,.28), transparent 55%),
    radial-gradient(ellipse at 10% -20%, rgba(255,255,255,.08), transparent 50%);
  pointer-events: none;
}
.cv-cta > * { position: relative; }
.cv-cta .eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--jr-blue-300);
}
.cv-cta h2 {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: .005em;
  margin: 0;
  text-wrap: balance;
}
.cv-cta h2 .accent { color: var(--jr-blue-300); }
.cv-cta p {
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255,255,255,.82);
  margin: 0;
  max-width: 60ch;
}
.cv-cta .row {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 4px;
}
.cv-cta button, .cv-cta a.btn-link {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  padding: 12px 22px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}
.cv-cta button.primary, .cv-cta a.primary {
  background: #fff;
  color: var(--jr-blue-900);
}
.cv-cta button.primary:hover, .cv-cta a.primary:hover { background: var(--jr-blue-50); }
.cv-cta button.ghost, .cv-cta a.ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.32);
}
.cv-cta button.ghost:hover, .cv-cta a.ghost:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.55);
}

.cv-cta .contact-row {
  margin-top: 14px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex; flex-wrap: wrap; gap: 22px;
  font-size: 13px;
  color: rgba(255,255,255,.7);
}
.cv-cta .contact-row .contact-item {
  display: inline-flex; align-items: center; gap: 8px;
}
.cv-cta .contact-row strong { color: #fff; font-weight: 700; }

/* ---------- Footer ---------- */
.cv-footer {
  margin-top: 16px;
  padding: 20px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--jr-gray-500);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.cv-footer .right { color: var(--jr-gray-400); }

/* ---------- Empty state ---------- */
.cv-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--jr-gray-600);
  font-size: 14px;
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--shadow-2);
}
.cv-empty strong { display: block; font-size: 16px; color: var(--jr-gray-900); margin-bottom: 8px; }

/* ---------- PDF generation progress overlay ---------- */
.cv-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 58, 90, 0.62);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: grid;
  place-items: center;
  animation: cvFadeIn 0.2s var(--ease-out);
}
@keyframes cvFadeIn { from { opacity: 0; } to { opacity: 1; } }
.cv-progress-card {
  background: #fff;
  border-radius: 8px;
  padding: 36px 44px;
  width: min(420px, 88vw);
  box-shadow: 0 24px 60px rgba(15, 58, 90, 0.32);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.cv-progress-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--jr-blue-100);
  border-top-color: var(--jr-blue-700);
  animation: cvSpin 0.9s linear infinite;
  margin-bottom: 4px;
}
@keyframes cvSpin { to { transform: rotate(360deg); } }
.cv-progress-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .02em;
  color: var(--jr-gray-900);
}
.cv-progress-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--jr-gray-600);
  line-height: 1.4;
  min-height: 18px;
}
.cv-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--jr-gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.cv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--jr-blue-500), var(--jr-blue-700));
  transition: width 0.25s var(--ease-out);
  border-radius: 999px;
}
.cv-progress-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--jr-gray-500);
  font-variant-numeric: tabular-nums;
}

/* Disable FAB during generation */
.cv-fab[disabled] {
  opacity: 0.55;
  cursor: progress;
  pointer-events: none;
}

/* ---------- Print: client view prints the slides too ---------- */
@media print {
  body.client-view .cv-header,
  body.client-view .cv-toc,
  body.client-view .cv-fab,
  body.client-view .cv-cta,
  body.client-view .cv-footer,
  body.client-view .cv-section-label {
    display: none !important;
  }
  body.client-view .cv-body {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }
  body.client-view .cv-stack { gap: 0 !important; }
  body.client-view .cv-slide-wrap {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 1280px !important;
    height: 720px !important;
    page-break-after: always;
    overflow: visible !important;
  }
  body.client-view .cv-slide-wrap .slide { transform: none !important; }
  body.client-view .cv-slide-wrap:last-of-type { page-break-after: auto; }
}

/* ===========================================================
   Mobile responsiveness
   =========================================================== */

@media (max-width: 768px) {
  .cv-header-inner {
    padding: 12px 16px;
    gap: 12px;
  }
  .cv-header .brand { gap: 10px; }
  .cv-header .brand img { height: 24px; }
  .cv-header .brand .sep { height: 22px; }
  .cv-header .brand .for-block .eyebrow { font-size: 8.5px; letter-spacing: .18em; }
  .cv-header .brand .for-block .client {
    font-size: 13px;
    max-width: 100%;
  }
  .cv-header .brand .for-block .dates { font-size: 11px; }
  .cv-header .actions {
    flex-shrink: 0;
    gap: 6px;
  }
  /* Compact the buttons on mobile — collapse "Editor" to icon, hide "Download PDF" since FAB handles it */
  .cv-header button {
    padding: 8px 12px;
    font-size: 12px;
  }
  .cv-header button.primary {
    /* On small screens, prefer the FAB. Hide header download to reduce clutter. */
    display: none;
  }
  .cv-header button.ghost-back span,
  .cv-header button.ghost-back {
    /* Compact "Editor" to small */
    font-size: 11.5px;
    padding: 8px 12px;
  }

  .cv-body {
    padding: 16px 12px 80px;
    gap: 16px;
    grid-template-columns: 1fr;
  }
  .cv-toc:not(.is-mobile) { display: none; }

  .cv-section-label {
    font-size: 10px;
    margin: 6px 0 0;
    letter-spacing: .16em;
  }

  .cv-slide-wrap {
    border-radius: 4px;
    /* Slightly smaller shadow on mobile */
    box-shadow: 0 1px 2px rgba(15,58,90,.06), 0 6px 16px rgba(15,58,90,.10);
  }

  /* CTA card on mobile — tighter padding, smaller display type */
  .cv-cta {
    padding: 28px 22px;
    gap: 14px;
    border-radius: 4px;
    margin-top: 20px;
  }
  .cv-cta h2 { font-size: 26px; }
  .cv-cta p { font-size: 14px; line-height: 1.55; }
  .cv-cta .row { gap: 8px; }
  .cv-cta button, .cv-cta a.btn-link {
    padding: 10px 16px;
    font-size: 13px;
  }
  .cv-cta .contact-row {
    flex-direction: column;
    gap: 10px;
    font-size: 12.5px;
  }

  /* Floating download button on mobile */
  .cv-fab {
    right: 16px;
    bottom: 16px;
    padding: 12px 18px;
    font-size: 13px;
    border-radius: 999px;
  }

  /* Progress overlay tighter */
  .cv-progress-card {
    padding: 28px 24px;
    width: min(92vw, 360px);
  }
  .cv-progress-title { font-size: 15px; }
  .cv-progress-sub { font-size: 12.5px; }

  .cv-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 10px;
    padding: 16px 4px;
  }
}

/* Very small phones — make the sticky header even more compact */
@media (max-width: 420px) {
  .cv-header .brand .sep { display: none; }
  .cv-header .brand img { height: 22px; }
  .cv-header-inner { gap: 8px; }
  .cv-cta h2 { font-size: 22px; }
}
