/*
 * Print styles for nightdogs.xyz
 * Optimized for article printing with author branding preserved
 */

@media print {
  /* Reset and base styles */
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-family: "EB Garamond", serif !important;
    font-size: 12pt;
    line-height: 1.6;
    color: #000;
    background: #fff;
    margin: 0;
    padding: 0;
  }

  /* Hide elements that shouldn't print */
  nav,
  .header-nav,
  .theme-toggle,
  .search-overlay,
  [data-theme-toggle],
  [data-search-trigger],
  .newsletter-signup,
  .webmentions,
  .social-share,
  .post-navigation,
  .back-to-top,
  footer .newsletter,
  .skip-link,
  .service-worker-update,
  button,
  input[type="search"],
  .search-form {
    display: none !important;
  }

  /* Header simplification */
  .header {
    border-bottom: 2px solid #000;
    padding-bottom: 0.5cm;
    margin-bottom: 1cm;
  }

  .header h1 {
    font-size: 24pt;
    font-weight: bold;
    color: #000;
    margin: 0;
  }

  .header .tagline {
    font-size: 10pt;
    color: #666;
    margin-top: 0.2cm;
  }

  /* Article content */
  article,
  .post-content,
  main {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .post-header {
    margin-bottom: 1cm;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.5cm;
  }

  .post-title,
  h1 {
    font-size: 18pt;
    font-weight: bold;
    color: #000;
    margin: 0 0 0.5cm 0;
    line-height: 1.3;
    break-after: avoid;
  }

  .post-meta {
    font-size: 10pt;
    color: #666;
    margin-bottom: 0.5cm;
  }

  .post-author {
    font-weight: bold;
  }

  .post-date::before {
    content: " • ";
  }

  /* Typography for content */
  h2, h3, h4, h5, h6 {
    font-weight: bold;
    color: #000;
    margin-top: 1cm;
    margin-bottom: 0.3cm;
    break-after: avoid;
  }

  h2 { font-size: 16pt; }
  h3 { font-size: 14pt; }
  h4 { font-size: 12pt; }
  h5, h6 { font-size: 11pt; }

  p {
    margin: 0 0 0.5cm 0;
    orphans: 3;
    widows: 3;
  }

  p:last-child {
    margin-bottom: 0;
  }

  /* Lists */
  ul, ol {
    margin: 0.5cm 0;
    padding-left: 1cm;
  }

  li {
    margin-bottom: 0.2cm;
  }

  /* Blockquotes */
  blockquote {
    margin: 0.5cm 1cm;
    padding: 0 0 0 0.5cm;
    border-left: 3px solid #ccc;
    font-style: italic;
    color: #333;
  }

  /* Code */
  code {
    font-family: "Courier New", monospace;
    font-size: 10pt;
    background: #f5f5f5 !important;
    padding: 0.1cm 0.2cm;
    border: 1px solid #ddd;
  }

  pre {
    font-family: "Courier New", monospace;
    font-size: 9pt;
    background: #f8f8f8 !important;
    border: 1px solid #ddd;
    padding: 0.3cm;
    margin: 0.5cm 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    break-inside: avoid;
  }

  pre code {
    background: none !important;
    padding: 0;
    border: none;
  }

  /* Images */
  img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0.5cm auto;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  figure {
    margin: 0.5cm 0;
    break-inside: avoid;
  }

  figcaption {
    font-size: 9pt;
    color: #666;
    text-align: center;
    margin-top: 0.2cm;
    font-style: italic;
  }

  /* Links */
  a {
    color: #000;
    text-decoration: underline;
  }

  /* Print URLs after links for reference */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
    text-decoration: none;
  }

  /* Don't print URLs for internal links */
  a[href^="/"]:after,
  a[href^="#"]:after {
    content: "";
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5cm 0;
    font-size: 10pt;
    break-inside: avoid;
  }

  th, td {
    border: 1px solid #ccc;
    padding: 0.2cm;
    text-align: left;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  /* Author attribution at the end */
  .print-author-info {
    margin-top: 1cm;
    padding-top: 0.5cm;
    border-top: 1px solid #ccc;
    font-size: 10pt;
    color: #666;
  }

  /* Footer simplification */
  footer {
    margin-top: 1cm;
    padding-top: 0.5cm;
    border-top: 1px solid #ccc;
    font-size: 9pt;
    color: #666;
  }

  /* Page breaks */
  .page-break-before {
    break-before: page;
  }

  .page-break-after {
    break-after: page;
  }

  .no-break {
    break-inside: avoid;
  }

  /* Print-specific utilities */
  .print-only {
    display: block !important;
  }

  .no-print {
    display: none !important;
  }

  /* Author theme color preservation (subtle) */
  [data-author="jane"] .post-title::before,
  [data-author="orionlw"] .post-title::before,
  [data-author="adesse"] .post-title::before,
  [data-author="nic"] .post-title::before,
  [data-author="amelia"] .post-title::before {
    content: "●";
    font-size: 8pt;
    margin-right: 0.3cm;
    color: #666;
  }

  /* Specific adjustments for different post types */
  .post-tags {
    font-size: 9pt;
    color: #666;
    margin-top: 0.5cm;
  }

  .post-tags::before {
    content: "Tags: ";
    font-weight: bold;
  }

  .post-tags a {
    color: #666;
    text-decoration: none;
  }

  .post-tags a::after {
    content: "";
  }

  .post-tags a:not(:last-child)::after {
    content: ", ";
  }

  /* Reading time (if present) */
  .reading-time {
    font-size: 9pt;
    color: #666;
    font-style: italic;
  }

  /* Print URL at bottom for reference */
  body::after {
    content: "From: " attr(data-url);
    position: fixed;
    bottom: 0.5cm;
    right: 0.5cm;
    font-size: 8pt;
    color: #999;
  }
}

/* High-resolution print media */
@media print and (min-resolution: 150dpi) {
  body {
    font-size: 11pt;
  }

  h1 { font-size: 17pt; }
  h2 { font-size: 15pt; }
  h3 { font-size: 13pt; }
}
