/* ================================================================
   print.css — keidan.it
   
   Print stylesheet. Strips decorative/interactive elements,
   forces black-on-white, linearises layout for paper/PDF output.
   
   Load via:  <link rel="stylesheet" href="css/print.css" media="print">
   or append to styles.css inside @media print { … }
   ================================================================ */

@media print {

  /* ── Reset colours to black-on-white ── */
  *,
  *::before,
  *::after {
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-color: transparent !important;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    font-family: "Noto Serif", Georgia, "Times New Roman", serif;
    font-size: 11pt;
    line-height: 1.55;
    padding: 0;
    margin: 0;
  }


  /* ── Hide everything non-content ── */
  #letters-background,
  .skip-link,
  .nav-wrapper,
  .visual-settings,
  .controls-wrapper,
  .filter-toggle-button,
  .filters-body,
  .sort-button,
  .icon-button,
  .pub-expand-indicator,
  .photo-flipcard,
  .photo-face-back,
  .photo-back-pattern,
  footer::before,
  .blog-loading,
  .blog-error,
  .nav-settings,
  .vs-reset,
  [aria-hidden="true"] {
    display: none !important;
  }


  /* ── Layout: remove max-width, let content fill the page ── */
  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  header {
    max-width: 100%;
    padding: 0 0 12pt;
    margin: 0 0 12pt;
    border-bottom: none;
    border-radius: 0;
    text-align: left;
  }
  header::after { display: none; }

  .header-with-photo {
    gap: 16pt;
  }

  .profile-photo img {
    width: 100pt;
    height: 100pt;
    border-radius: 0;
  }


  /* ── Sections: remove decorative panels ── */
  .section {
    padding: 6pt 0;
    margin-bottom: 8pt;
    border: none;
    border-radius: 0;
    page-break-inside: avoid;
  }
  .section.collapsed,
  .section.hidden {
    display: none !important;
  }

  /* Force visible sections to show (override JS-driven opacity) */
  .section:not(.collapsed):not(.hidden) {
    opacity: 1 !important;
    visibility: visible !important;
    max-height: none !important;
    overflow: visible !important;
    animation: none !important;
  }

  /* Always show these four sections regardless of JS state */
  #cv,
  #research,
  #contact,
  #publications {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    max-height: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
    padding-top: 6pt !important;
    padding-bottom: 6pt !important;
    margin-bottom: 8pt !important;
    border: none !important;
  }


  /* ── Typography ── */
  h1 {
    font-size: 18pt;
    margin: 0 0 4pt;
  }
  h2 {
    font-size: 10pt;
    margin: 14pt 0 6pt;
    padding-bottom: 3pt;
    page-break-after: avoid;
  }
  h2::after { display: none; }
  h3 {
    font-size: 11pt;
    margin: 10pt 0 4pt;
    page-break-after: avoid;
  }
  h4 {
    font-size: 10.5pt;
    page-break-after: avoid;
  }

  p, li, .cv-entry {
    orphans: 3;
    widows: 3;
  }


  /* ── Links: show URL for external links ── */
  a {
    text-decoration: underline;
    text-decoration-thickness: 0.5pt;
  }
  a[href^="http"]::after {
    content: " [" attr(href) "]";
    font-size: 8pt;
    font-style: italic;
    word-break: break-all;
  }
  /* Suppress URL display for internal anchors and nav links */
  a[href^="#"]::after,
  nav a::after,
  .publication-link::after,
  .contact-info a::after {
    content: none;
  }


  /* ── CV entries ── */
  .cv-entry {
    padding-left: 8pt;
    margin-bottom: 8pt;
    page-break-inside: avoid;
  }


  /* ── Publications / Talks / Blog: plain list style ── */
  .publications-list,
  .blog-posts {
    margin-top: 8pt;
    padding-left: 0;
    counter-reset: pub-print;
    list-style: none;
  }

  .publication,
  .blog-post {
    display: block;
    padding: 0 0 4pt 24pt;
    margin-bottom: 6pt;
    border: none !important;
    border-radius: 0;
    cursor: default;
    page-break-inside: avoid;
    text-align: left;
    position: relative;
    counter-increment: pub-print;
    content-visibility: visible !important;
    contain-intrinsic-size: auto !important;
  }
  .publication::before,
  .blog-post::before {
    content: counter(pub-print) ".";
    position: absolute;
    left: 0;
    font-weight: 700;
    font-size: 0.9em;
  }

  .publication-citation {
    padding-right: 0;
  }

  /* Show abstracts of expanded items */
  .publication.expanded .publication-abstract,
  .blog-post.expanded .publication-abstract {
    opacity: 1;
    grid-template-rows: 1fr;
    margin-top: 4pt;
    padding-top: 4pt;
  }

  /* Pills & metadata row: hide entirely in print */
  .publication-meta-row,
  .blog-meta-row,
  .publication-type-badge,
  .publication-language-badge,
  .publication-tag,
  .publication-link,
  .publication-pill,
  .publication-forthcoming-badge,
  .publication-likes,
  .filter-chip {
    display: none !important;
  }


  /* ── Blog content images ── */
  .blog-full-content img {
    max-width: 60%;
    page-break-inside: avoid;
  }


  /* ── Contact ── */
  .academic-profiles {
    columns: 1;
  }


  /* ── Footer ── */
  footer {
    margin-top: 12pt;
    padding: 8pt 0 0;
    border-top: none;
    font-size: 9pt;
  }


  /* ── Prevent page breaks after headings ── */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  /* Prevent blank pages from collapsed sections */
  .section[style*="max-height: 0"] {
    display: none !important;
  }
}