/* ==========================================================================
   ResumeCrafted — Multi-Page Universal Alignment
   Applies to all 25 templates: proper overflow, spacer rendering,
   sidebar stretching, and page-boundary section safety.
   ========================================================================== */

/* ── Grid layouts: stretch both columns to full page height ─────────────── */
.tpl-modern-executive,
.tpl-executive-gold,
.tpl-portfolio-plus,
.tpl-healthcare-pro,
.tpl-tech-stack,
.tpl-creative-agency,
.tpl-scholar-plus,
.tpl-startup-founder,
.tpl-corporate-elite,
.tpl-designer-canvas {
  align-items: stretch;
  height: auto;
  min-height: 297mm;
}

/* ── All grid column containers: natural overflow into page 2+ ───────────── */
.exec-sidebar, .exec-main,
.eg-sidebar,   .eg-main,
.pp-sidebar,   .pp-main,
.hp-sidebar,   .hp-main,
.ts-sidebar,   .ts-main,
.ca-sidebar,   .ca-main,
.sp-sidebar,   .sp-main,
.sf-bar,       .sf-body,
.ce-body,
.dc-body,
.dc-main,      .dc-sidebar {
  overflow: visible;
  box-sizing: border-box;
  align-self: stretch;
}

/* ── Single-column layouts: natural vertical overflow ──────────────────── */
.tpl-creative-spark,
.tpl-ats-minimalist,
.tpl-classic-pro,
.tpl-bold-modern,
.tpl-elegant-script,
.tpl-academic-scholar,
.tpl-digital-nomad,
.tpl-finance-expert,
.tpl-marketing-pro,
.tpl-nordic-clean,
.tpl-timeline-viz,
.tpl-gradient-pro,
.tpl-legal-brief,
.tpl-minimal-photo,
.tpl-creative-director {
  overflow: visible;
}

/* ── Spacers must render in any flex/grid parent ─────────────────────────── */
.page-shift-spacer,
.page-col-spacer {
  display: block !important;
  flex-shrink: 0 !important;
  grid-column: 1 / -1;    /* Span full grid width if inside a grid row */
  width: 100%;
  pointer-events: none;
  user-select: none;
}

/* ── Section titles: never orphan alone at bottom of page ──────────────── */
.resume-section-title {
  break-after: avoid;
  page-break-after: avoid;
}

/* ── Section blocks and timeline items: avoid page splits ────────────────── */
.section-block {
  break-inside: avoid;
  page-break-inside: avoid;
}
.timeline-item {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* ── Sidebar backgrounds: extend to fill full column height on page 2+ ────── */
/* These override existing per-template rules to ensure backgrounds stretch */
.exec-sidebar {
  background-color: #0f172a !important;
}
.eg-sidebar {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%) !important;
}
.hp-sidebar {
  background: #0d9488 !important;
}
.ts-sidebar {
  background: #0f172a !important;
}
.ca-sidebar {
  background: linear-gradient(160deg, #f43f5e 0%, #a855f7 100%) !important;
}
.sp-sidebar {
  background: #1e3a5f !important;
}

/* ── Paper container: no overflow clipping so multi-page content shows ────── */
.paper-container {
  overflow: visible !important;
  position: relative;
}

/* ── Resume paper: no height clipping ───────────────────────────────────── */
.resume-paper {
  overflow: visible !important;
  height: auto !important;
}
