@media print {
  @page {
    margin: 1.5cm 2cm;
  }

  /* Reset layout to single column */
  .no-print { display: none !important; }

  body {
    font-size: 10pt;
    color: #000 !important;
    background: #fff !important;
  }

  .dark body {
    background: #fff !important;
    color: #000 !important;
  }

  main {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* Force single-column: collapse the grid */
  .grid {
    display: block !important;
    grid-template-columns: none !important;
  }

  .lg\:col-span-2,
  .lg\:col-span-1,
  aside,
  .space-y-10,
  .space-y-8 {
    display: block !important;
    width: 100% !important;
  }

  /* Remove all shadows and rounded borders */
  .shadow-lg, .shadow-md, .shadow-sm {
    box-shadow: none !important;
  }

  .rounded-xl, .rounded-full, .rounded-lg, .rounded-md {
    border-radius: 0 !important;
  }

  /* Force all text colors to black for print */
  .text-blue-600, .text-blue-500, .text-blue-400, .text-blue-300, .text-blue-700 {
    color: #000 !important;
  }

  .text-gray-700, .text-gray-600, .text-gray-500, .text-gray-400, .text-gray-300 {
    color: #333 !important;
  }

  /* Section headings: page-break-friendly */
  h2 {
    break-after: avoid;
    break-inside: avoid;
    font-size: 13pt !important;
    margin-top: 0;
  }

  /* Each article/job/project stays together, but can break between them */
  article, .print-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Allow large sections to break between articles */
  section {
    break-inside: auto;
    page-break-inside: auto;
  }

  /* Project cards: simplify for print */
  article.rounded-xl {
    border: 1px solid #ccc !important;
    padding: 8pt !important;
    margin-bottom: 10pt !important;
  }

  /* Header: compact for print */
  header {
    margin-bottom: 14pt !important;
  }

  h1 {
    font-size: 20pt !important;
  }

  /* Section spacing: tighter for print */
  section {
    margin-bottom: 14pt !important;
  }

  /* Links: no decoration, black text */
  a {
    text-decoration: none !important;
    color: #000 !important;
  }

  /* Skill badges: subtle for print */
  .bg-blue-50, .bg-blue-950, .bg-gray-100, .bg-gray-800 {
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
  }

  /* Borders: lighten for print */
  .border-gray-200, .border-gray-800 {
    border-color: #ccc !important;
  }

  /* Lists: tighter spacing */
  ul {
    margin-top: 4pt !important;
  }

  li {
    margin-bottom: 2pt !important;
  }

  /* Avoid orphan headings at page bottom */
  h2, h3 {
    break-after: avoid;
  }

  /* Sidebar sections: add top border to separate from main content */
  aside section {
    border-top: 1px solid #ccc !important;
    padding-top: 10pt !important;
  }

  aside section:first-child {
    border-top: none !important;
  }
}

/* ===== Compact print (2026-09-24): CV a 1-2 hojas ===== */
@media print {
  @page { margin: 1.2cm 1.5cm; }

  /* rem de Tailwind escala con html: 11pt => text-sm ~9.6pt, text-xs ~8.3pt */
  html { font-size: 11pt; }
  body { font-size: 11pt; line-height: 1.3; }

  /* BUG: .print-block (clase) ganaba a `section` (etiqueta) y hacia cada seccion
     irrompible -> saltos de pagina y huecos. Las secciones pueden partirse;
     cada empleo/proyecto (article) sigue completo. */
  section.print-block, header.print-block {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }
  article.print-block { break-inside: avoid !important; page-break-inside: avoid !important; }

  /* Espaciados de Tailwind (space-y-*) que seguian activos al imprimir */
  .space-y-10 > * + *, .space-y-8 > * + * { margin-top: 0 !important; }
  .space-y-6 > * + * { margin-top: 9pt !important; }
  .space-y-4 > * + * { margin-top: 5pt !important; }
  .space-y-3 > * + *, .space-y-2 > * + * { margin-top: 3pt !important; }
  .space-y-1\.5 > * + * { margin-top: 0 !important; }

  section { margin-bottom: 9pt !important; }
  aside section { padding-top: 6pt !important; }
  header { margin-bottom: 8pt !important; }
  h2 { padding-bottom: 2pt !important; margin-bottom: 5pt !important; font-size: 11.5pt !important; }
  h3 { line-height: 1.25 !important; }
  ul { margin-top: 3pt !important; }
  li { margin-bottom: 1pt !important; line-height: 1.3 !important; }
  .leading-relaxed { line-height: 1.35 !important; }
  p { margin-top: 0 !important; }
}

/* Secciones laterales cortas (habilidades, educacion, idiomas, certificaciones): enteras */
@media print {
  aside section.print-block { break-inside: avoid !important; page-break-inside: avoid !important; }
}
