/**
 * Print Profile: Math
 * V7.2 Multi-Site Platform
 *
 * Specialized print styles for arithmetic/math sites.
 * Optimized for 20-problem worksheets in 2-column layout on US Letter paper.
 * Target: 20 problems fit on one page with large, readable text.
 *
 * Supports both traditional templates and Detail Atom rendering.
 */

/* Math problems grid - 2 columns for typical 20-problem sets */
.problems-grid[data-profile="arithmetic"],
.problems-grid[data-profile="math"],
.form-exercise-container {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 4mm 6mm !important; /* Increased gaps for better page fill */
  margin-top: 2mm !important;
}

/* Individual math problem */
.problems-grid[data-profile="arithmetic"] .problem-item,
.problems-grid[data-profile="math"] .problem-item,
.form-problem {
  display: grid !important;
  grid-template-columns: 10mm max-content 22mm !important; /* Larger answer space for better fill */
  align-items: center !important;
  column-gap: 4mm !important; /* Increased for better spacing */
  min-height: 18mm !important; /* Increased from 10mm to fill page better (20 problems × 18mm = 360mm / 2 cols = 180mm per col) */
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  justify-content: start !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.problem-number,
.problem-label {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  font-weight: 700 !important;
  font-size: 13pt !important; /* Increased for larger layout */
  line-height: 1 !important;
  text-align: left !important;
}

.problem-number::after {
  content: "." !important;
  margin-left: 0.5mm !important;
}

.problem-content.problem-expression,
.problem-expression,
.form-expression {
  font-size: 22pt !important; /* Increased for better page fill and readability */
  font-weight: 700 !important;
  font-family: Arial, sans-serif !important;
  letter-spacing: 0.4px !important;
  white-space: nowrap !important;
}

.problem-equals {
  font-weight: 700 !important;
  margin-left: 1mm !important;
}

/* Answer space (worksheet mode) */
.problem-answer-space,
.form-answer-space {
  width: 22mm !important; /* Increased to match grid column width */
  height: 11mm !important; /* Increased for larger layout */
  border-bottom: 1.8px solid #111 !important;
}

/* Answer filled (answer-key mode) */
.problem-answer-filled,
.form-answer-filled {
  width: 22mm !important; /* Increased to match answer space */
  min-height: 10mm !important;
  border: 1.5px solid #111 !important;
  border-radius: 1.2mm !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18pt !important; /* Increased for larger layout */
  font-weight: 700 !important;
  line-height: 1 !important;
}

/* Ensure proper spacing for larger problem sets */
@media print {
  .problems-grid[data-profile="arithmetic"],
  .problems-grid[data-profile="math"] {
    orphans: 2;
    widows: 2;
  }
}
