/* ==========================================================================
   WritePadPro.com — Print Stylesheet (linked with media="print")

   • Homepage editor and /editor: print ONLY the document (#tm-editor /
     #ed-editor) in black on white. "Export as PDF" uses this too
     (window.print() → "Save as PDF").
   • Every other page (blog posts, tools, info pages): print the main content
     without the site header, navigation, footer, buttons or ads.

   Note: rules that use :has() are kept on their own so a browser without
   :has() support only drops that one rule, not the whole selector list.
   ========================================================================== */

@page {
  margin: 18mm 16mm;
}

@media print {

  /* ------------------------------------------------------------------------
     Base: black on white
     ------------------------------------------------------------------------ */
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    animation: none !important;
    transition: none !important;
  }

  html,
  body {
    background: #fff !important;
  }

  body {
    margin: 0;
    padding: 0;
    min-height: 0 !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.5;
  }

  main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  /* ------------------------------------------------------------------------
     Site chrome & interactive controls (all pages)
     ------------------------------------------------------------------------ */
  .skip-to-content,
  .wpp-header,
  header[role="banner"],
  nav,
  footer,
  .site-footer,
  .breadcrumbs,
  .toast,
  #wpp-toast,
  .tm-toast,
  button,
  .btn,
  .btn-primary,
  .btn-secondary,
  form,
  dialog,
  .modal,
  .modal-backdrop,
  .ads,
  .ad,
  .advertisement,
  .share-section,
  .social-share,
  .cookie-banner,
  .mobile-menu,
  .mobile-nav,
  .mobile-toggle,
  .sidebar,
  .pagination,
  .hero-actions,
  .cta-section,
  .tools-tabs,
  .tools-search,
  .post-related-posts,
  .post-related-tools,
  .hp-tools-section,
  a.tm-tool-btn {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     Content containers
     ------------------------------------------------------------------------ */
  .container,
  .post-content,
  .post-body,
  .section {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ------------------------------------------------------------------------
     Links — show external URLs after the text (not inside the editors)
     ------------------------------------------------------------------------ */
  a {
    color: #000 !important;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9.5pt;
    color: #444 !important;
    -webkit-text-fill-color: #444 !important;
    word-break: break-all;
  }

  #tm-editor a::after,
  #ed-editor a::after {
    content: "" !important;
  }

  /* ------------------------------------------------------------------------
     Typography & page breaks
     ------------------------------------------------------------------------ */
  h1, h2, h3, h4, h5, h6 {
    break-after: avoid;
    page-break-after: avoid;
    break-inside: avoid;
    page-break-inside: avoid;
    letter-spacing: normal !important;
  }

  h1 { font-size: 20pt; line-height: 1.25; }
  h2 { font-size: 16pt; line-height: 1.3; }
  h3 { font-size: 14pt; line-height: 1.3; }
  h4 { font-size: 12pt; }

  p,
  li,
  blockquote {
    orphans: 3;
    widows: 3;
  }

  img,
  svg,
  figure,
  table,
  tr,
  pre,
  blockquote {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  img {
    max-width: 100% !important;
  }

  table {
    border-collapse: collapse;
  }

  th,
  td {
    border: 1px solid #999 !important;
    padding: 4pt 6pt;
    text-align: left;
  }

  blockquote {
    border-left: 2pt solid #999 !important;
    padding-left: 12pt;
    margin-left: 0;
    font-style: italic;
  }

  pre,
  code {
    font-family: "Courier New", Courier, monospace;
    font-size: 10pt;
  }

  pre {
    border: 1px solid #ccc !important;
    padding: 8pt;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  hr {
    border: 0 !important;
    border-top: 1px solid #999 !important;
  }

  textarea,
  input,
  select {
    border: 1px solid #999 !important;
  }

  .tool-results {
    border: 1px solid #ccc;
    break-inside: avoid;
    padding: 12pt;
    margin: 12pt 0;
  }

  /* ========================================================================
     EDITOR PAGES — print only the document
     ======================================================================== */

  /* Homepage (#tm-editor): hide the SEO article, FAQ and tools grid … */
  .app-container ~ * {
    display: none !important;
  }

  main:has(> .app-container) > :not(.app-container) {
    display: none !important;
  }

  /* … and everything in the app except the editor itself */
  .tm-app > :not(.tm-main),
  .tm-main > :not(.tm-editor-wrap) {
    display: none !important;
  }

  /* /editor (#ed-editor): toolbars, sheets, sidebars, tool panels, results, dialogs */
  .ed ~ * {
    display: none !important;
  }

  main:has(> .ed) > :not(.ed) {
    display: none !important;
  }

  .ed > :not(.ed-main),
  .ed-main > :not(.ed-center) {
    display: none !important;
  }

  /* Flatten the layout wrappers around the document */
  .app-container,
  .tm-app,
  .tm-main,
  .tm-editor-wrap,
  .ed,
  .ed-main,
  .ed-center {
    display: block !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  /* The document */
  #tm-editor,
  #ed-editor {
    display: block !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: none !important;
    resize: none !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: 12pt !important;
    line-height: 1.6 !important;
    overflow-wrap: break-word;
  }

  #tm-editor::before,
  #ed-editor::before {
    content: none !important;
    display: none !important;
  }

  #tm-editor h1, #ed-editor h1 { margin: 0 0 8pt; }
  #tm-editor h2, #ed-editor h2,
  #tm-editor h3, #ed-editor h3,
  #tm-editor h4, #ed-editor h4 { margin: 14pt 0 6pt; }
  #tm-editor p, #ed-editor p { margin: 0 0 8pt; }

  #tm-editor ul, #ed-editor ul { list-style: disc !important; padding-left: 18pt; }
  #tm-editor ol, #ed-editor ol { list-style: decimal !important; padding-left: 18pt; }

  #tm-editor blockquote,
  #ed-editor blockquote {
    border-left: 2pt solid #999 !important;
  }
}
