/* Resume — paper-optimized stylesheet.
   Loaded with media="print" so it only applies when printing or
   "Save as PDF" is invoked from the browser print dialog.

   Target: a dense, ATS-friendly 2-3 page Letter PDF. Sections that
   are list-shaped on paper (skills, affiliations, awards) flow into
   multiple columns so they don't eat full pages. Experience and
   education stay tabular but with aggressively tight padding. */

@page {
  size: Letter;
  margin: 0.45in 0.5in;
}

@media print {
  :root {
    --ink:    #000;
    --paper:  #fff;
    --muted:  #333;
    --rule:   #999;
    --accent: #660000;
  }

  html { font-size: 88%; }

  body {
    background: #fff;
    color: #000;
    padding: 0;
    margin: 0;
    line-height: 1.3;
    -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
    orphans: 3;
    widows: 3;
  }

  /* Chrome/UI not on paper */
  nav.site-nav,
  .pdf-export,
  .no-print { display: none !important; }

  main, .h-resume { max-width: none; margin: 0; padding: 0; }

  a {
    color: #000;
    text-decoration: none;
    background: transparent !important;
  }
  /* Expose external URLs after the link text (skip mailto/internal) */
  a[href^="http"]::after {
    content: " \003C" attr(href) "\003E";
    font-size: 0.72em;
    color: #555;
    word-break: break-all;
  }
  address a::after,
  a[href^="mailto:"]::after { content: ""; }

  /* ---------- Header ---------- */
  #person {
    font-size: 1.7em;
    margin: 0 0 0.05em;
    text-align: left;
    letter-spacing: -0.01em;
    page-break-after: avoid;
    break-after: avoid;
  }

  h2 {
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0.6em 0 0.2em;
    padding-bottom: 0.05em;
    border-bottom: 0.06em solid #000;
    page-break-after: avoid;
    break-after: avoid;
  }
  h3, h4 { page-break-after: avoid; break-after: avoid; }

  .h-resume section { margin: 0.45em 0 0.3em; }

  /* ---------- Contact: inline single line ---------- */
  #contact table, #contact thead, #contact tbody, #contact tr, #contact td {
    display: inline;
    border: none;
    padding: 0;
    background: transparent !important;
  }
  #contact thead { display: none; }
  #contact td + td::before { content: ": "; }
  #contact tr + tr::before { content: " · "; color: #666; }
  #contact h2 { display: inline; border: none; margin: 0 0.5em 0 0; font-size: 0.85em; }

  /* ---------- Summary ---------- */
  #summary p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.35;
  }

  /* ---------- Experience / Education tables ---------- */
  .h-resume table {
    width: 100%;
    margin: 0.1em 0 0.4em;
    font-size: 0.82em;
    border-collapse: collapse;
  }
  .h-resume th, .h-resume td {
    padding: 0.18em 0.4em;
    border-bottom: 0.04em dotted #bbb;
    vertical-align: top;
    background: #fff !important;
  }
  .h-resume thead { display: none; }   /* headers are obvious from context on paper */

  /* Experience: keep dates narrow, achievements wide */
  #experience td:nth-child(1) { width: 16%; font-weight: 700; }   /* org */
  #experience td:nth-child(2) { width: 14%; font-style: italic; } /* role */
  #experience td:nth-child(3),
  #experience td:nth-child(4) { width: 8%; white-space: nowrap; color: #555; font-variant-numeric: tabular-nums; }
  #experience td:nth-child(5) { width: 54%; }                    /* achievements */
  #experience td ul { margin: 0; padding-left: 1em; }
  #experience td li { margin-bottom: 0.15em; line-height: 1.28; }

  /* Education: tighter, no width specifics needed */
  #education td:nth-child(2),
  #education td:nth-child(3) { white-space: nowrap; color: #555; font-variant-numeric: tabular-nums; }

  /* Break behavior: don't force whole experience rows together (too greedy),
     just discourage splitting within a single bullet list item. */
  .h-resume tr, .h-event { page-break-inside: auto; break-inside: auto; }
  .h-resume td li { page-break-inside: avoid; break-inside: avoid; }

  /* Manual page breaks: any row tagged .print-break-after starts a new page
     after itself, so the next row begins clean on a fresh page. */
  tr.print-break-after td {
    page-break-after: always;
    break-after: page;
  }

  /* ---------- Skills: start on a fresh page, flow as 3 columns ---------- */
  #skills {
    page-break-before: always;
    break-before: page;
  }

  #skills table,
  #skills tbody { display: block; }
  #skills thead { display: none; }
  #skills tr {
    display: inline;
    border: none;
    padding: 0;
    break-inside: avoid;
  }
  #skills tr::after { content: " · "; color: #888; }
  #skills tr:last-child::after { content: ""; }
  #skills td {
    display: inline;
    border: none !important;
    padding: 0;
    background: transparent !important;
  }
  #skills td:first-child { font-weight: 600; }
  #skills td:last-child { color: #666; font-size: 0.85em; }
  #skills td:last-child::before { content: " ("; }
  #skills td:last-child::after  { content: ")"; }
  #skills tbody {
    column-count: 3;
    column-gap: 1em;
    column-rule: 0.04em solid #ddd;
    font-size: 0.78em;
    line-height: 1.45;
  }

  /* ---------- Affiliations + Awards: 3 columns ---------- */
  #affiliations ul,
  #awards ul {
    column-count: 3;
    column-gap: 1em;
    column-rule: 0.04em solid #ddd;
    padding-left: 1em;
    font-size: 0.78em;
    line-height: 1.4;
    list-style-position: outside;
  }
  #affiliations li,
  #awards li {
    break-inside: avoid;
    margin: 0 0 0.15em;
  }
}
