/*
  Print stylesheet — absolutely hide header & sidebar, full page width.
*/

/*
  Define page size and margins for printing.  In addition to the standard
  margin, use the CSS Paged Media margin box spec to insert footer
  content into the bottom centre of every page.  This ensures the
  attribution always appears at the bottom without impacting the flow
  of worksheet content.
*/
@page {
  size: 8.5in 11in;
  margin: 0.6in;
  /* The @bottom-center margin box inserts the footer text at the
     bottom of each printed page.  The font matches the site’s
     handwriting aesthetic and the content matches the required credit. */
  @bottom-center {
    content: "Created with James Roberts Mental Wellness • For free use when credited · jamesrobertsmentalwellness.com";
    font-family: 'Gloria Hallelujah', sans-serif;
    font-size: 9pt;
    /* Use a dark grey for the footer text to save ink while maintaining
       readability. */
    color: #333333;
  }
}

html, body {
  background: #fff !important;
  /* Use a dark grey for all body text to reduce ink usage while
     maintaining strong contrast. */
  color: #333333 !important;
  font-family: 'Georgia','Times New Roman',serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  /* Remove the screen offset reserved for the fixed site header.  On
     screen the body has padding-top equal to the header height so
     content begins below the fixed header.  When printing the header
     disappears, leaving a large blank band at the top of the page.
     Reset padding-top to zero so worksheets utilize the vertical space
     immediately below the page margin. */
  padding-top: 0 !important;
}

/* Kill interactive/site chrome (header/sidebar/buttons) */
#jr-header,
header#jr-header,
.no-print,
#sidebar,
.buttons-container,
.disclaimer {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* Print footer */
.print-footer {
  /* Allow the footer to flow naturally at the end of the document.  A fixed
     footer can force an extra blank page when combined with large margins.
     Use margin-top to separate it from the last module instead. */
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  margin-top: 0.3in;
  text-align: center;
  color: #333333;
  font-family: 'Gloria Hallelujah', sans-serif;
  font-size: 9pt;
  display: block !important;
}
.print-footer .page::after { content: counter(page); }

/* Workspace should use full width on paper */
#workspace {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 7.3in !important;
  margin-right: auto !important;
  margin-left: auto !important;
  padding: 0 !important;
  /* No bottom padding required now that the footer flows in the normal document flow. */
  padding-bottom: 0 !important;
  background: #fff !important;
  /* Override the screen min-height to prevent a trailing blank page.  When
     printing, the workspace should shrink to fit its contents rather than
     forcing a full viewport height.  Without this override Chrome will
     allocate an entire extra page because min-height:100vh expands beyond
     the content. */
  min-height: auto !important;
  height: auto !important;
}

/* Modules: crisp print look */
.module {
  page-break-inside: avoid; break-inside: avoid;
  background: #fff !important;
  /* Lighten the module border to a dark grey to save ink. */
  border: 2px solid #333333 !important;
  border-radius: 0 !important;
  padding: 0.25in !important;
  margin-bottom: 0.25in !important;
  /* Establish a positioning context for the tape label so it can overlap
     the module’s border without affecting document flow. */
  position: relative !important;
}

/* Remove bottom margin on the last module to prevent an extra blank page
   from being generated due to combined margins and padding. */
#workspace .module:last-child {
  margin-bottom: 0 !important;
}

/*
  Customize the appearance of the tape labels when printing.  Rather than
  solid ochre shapes used on screen, print the tape outlines as if they
  were hand‑drawn.  Remove the fill and drop shadow, add a dark green
  stroke, and use a dashed pattern to suggest a sketch.  The text
  remains dark for readability.
*/
/*
  Heading tape styling: print the tape as a solid black bar with white
  text.  The dashed outline from earlier has been removed.  Fill the
  shape entirely in black and draw no stroke.  This creates a clean
  block heading that stands out against the white page.  The text is
  rendered in white for contrast.
*/
.tape-bg {
  /* Fill the tape with a dark grey instead of pure black to reduce ink use. */
  fill: #333333 !important;
  stroke: none !important;
  stroke-width: 0 !important;
  stroke-linejoin: miter !important;
  stroke-linecap: butt !important;
  stroke-dasharray: none !important;
  filter: none !important;
}
.tape-text {
  fill: #ffffff !important;
  font-weight: 900 !important;
}

/* Position the tape label so it overlaps the module’s top border
   instead of sitting entirely inside the module.  The label is
   absolutely positioned relative to the module, aligned with the
   module’s internal left padding, and shifted upward by half of its
   height so it straddles the border.  Removing margins prevents
   extra whitespace. */
.module .tape-label {
  position: absolute !important;
  top: 0 !important;
  left: 0.25in !important;
  transform: translateY(-50%) !important;
  margin: 0 !important;
}

/* Adjust the worksheet header margin for print.  By default the
   worksheet header sits slightly down the page to align nicely with the
   on‑screen layout.  In print the site header is hidden and the page
   margin is already generous, so remove any implicit top margin on
   worksheet headers to bring titles and logos closer to the top of
   the page. */
.worksheet-header {
  margin-top: 0 !important;
}

/* Tape aesthetics are fine in print; remove if you want super minimal:
.tape-label { display:none !important; }
*/

/* Drag-drop: collapse to summaries */
.drag-drop-module .drag-items,
.drag-drop-module .draggable { display: none !important; }
.drag-drop-module .dropzone-container { display: block !important; }
.drag-drop-module .dropzone { border: none !important; margin-bottom: 0.15in !important; }
.drag-drop-module .dropzone::before {
  content: attr(data-label);
  display: block;
  font-weight: bold;
  font-family: 'Gloria Hallelujah', sans-serif;
  margin-bottom: 0.05in;
}
.drop-summary {
  display: block;
  /* Lighten drop summary border to dark grey */
  border: 1.5px solid #333333;
  padding: 0.15in;
  margin-bottom: 0.1in;
  font-family: 'Georgia','Times New Roman',serif;
  font-size: 12pt;
  line-height: 1.2;
}

/* Hide interactive controls (timestamp and add-row) when printing */
.timestamp-btn,
.date-btn,
.add-row-btn {
  display: none !important;
}

/* Hide range sliders and display their values via data attribute */
input[type="range"] {
  display: none !important;
}
.range-output::after {
  content: attr(data-val);
}

/*
  Print all headings, descriptions and helper text in black.  On the
  screen these elements use branded colours but for printing we
  eliminate colour entirely. */
.worksheet-title,
.worksheet-description,
.module-info,
.drag-drop-module .dropzone::before {
  /* Print headings and helper text in dark grey for better ink economy. */
  color: #333333 !important;
}

/* Tables */
table { width:100%; border-collapse: collapse; margin-bottom: 0.15in; }
table tr { page-break-inside: avoid; break-inside: avoid; }
table th {
  /* Use a dark grey background for table headers to save ink while keeping the
     text legible.  Text remains white for contrast. */
  background: #333333 !important; color: #ffffff !important;
  padding: .1in .05in; font-size: 12pt; font-family: 'Gloria Hallelujah', sans-serif; text-align:left;
}
table td { border: 1px solid #333333 !important; padding: 0 !important; }
table input[type="text"] {
  border: none !important; padding: .08in !important; font-size: 12pt !important;
  font-family: 'Georgia','Times New Roman',serif !important; width: 100% !important; box-sizing: border-box !important;
}

/* Replace live text areas / contenteditable with static clones */
.print-value {
  display: block !important;
  font-family: 'Georgia','Times New Roman',serif !important;
  font-size: 12pt !important;
  line-height: 24px !important;
  white-space: pre-wrap !important;
  min-height: 0 !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}
textarea { display: none !important; }
.lines[contenteditable="true"] { display: none !important; }

/* Inputs appearance */
input[type="number"], input[type="text"], textarea {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
