/* cv.css: section names in a left column, entries on the right, dates at the far right.
 * One column on a phone, with the later sections folded (js/cv.js). A clean A4 sheet in print. */

/* the two columns, shared by the head and every section */
.cv-top, .cv-sec {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0 var(--space-10); align-items: start;
}
.cv-top { padding-block: var(--space-10) var(--space-16); }
.cv-title { padding: 0; }
.cv-print-head, .print-url, .cv-doi { display: none; }
.cv-top-body { display: grid; gap: var(--space-4); min-width: 0; padding-top: calc(clamp(46px, 7.4vw, 88px) * .84 - 22px); } /* the lead sits on the title's baseline */
.cv-count { max-width: none; }
.cv-ids { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-6); }
.cv-print { min-height: 40px; display: inline-flex; align-items: center; padding-block: 0; }
html:not(.js) .cv-print-li { display: none; }
.cv-top .figure-cap { margin-top: 0; }

.cv { padding-bottom: var(--space-16); }
.cv-sec { margin-top: var(--space-16); }
.cv-sec:first-child { margin-top: 0; }
.cv-head { position: sticky; top: var(--space-6); align-self: start; }
.cv-h { font-size: 20px; line-height: 27px; font-weight: var(--w-display-small); letter-spacing: .05em; }
.cv-body { min-width: 0; }
.cv-sub { margin: 0 0 var(--space-6); max-width: none; }
.cv-h3 { color: var(--ink-muted); margin: 0 0 var(--space-4); padding-top: 6px; }
.cv-list + .cv-h3 { margin-top: var(--space-10); }

/* the break in the page: the publications are what the rest is for, so they take the whole width of the head */
#publications { margin-block: 120px var(--space-16); }
#publications .cv-head { grid-column: 1 / -1; position: static; margin-bottom: var(--space-10); }
#publications .cv-h { font-size: clamp(30px, 4.6vw, 40px); line-height: 1.1; font-weight: var(--w-display); letter-spacing: .03em; }
#publications .cv-body { grid-column: 2; }
/* and the page's one photographic move: frames 8 and 9 edge to edge, their keylines one seam (on screen only) */
.cv-hinge { display: flex; }
.cv-hinge .ph { flex: none; width: calc(50% + .5px); }
.cv-hinge .ph + .ph { margin-left: -1px; }
@media screen and (min-width: 761px) {
  /* beside the heading, ending on the line the dates end on. Each frame is min(316px, (head - 330px) / 2), so 316
   * (4 of 12 columns, as on Home) from about 1070px. The head is a flex row because a flex item's padding resolves against
   * the whole head: PUBLICATIONS drops until its baseline (.9em under its box top) meets frame 8's horizon, 54.3%
   * down, and the wall line carries the baseline across the seam and down frame 9's wedge. */
  #publications .cv-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 48px; }
  #publications .cv-h { flex: 1 1 auto; min-width: 0; padding-top: calc(min(632px, 100% - 330px) * .2715 - .9em); }
  .cv-hinge { flex: none; width: min(631px, 100% - 331px); }
}
#preprints { margin-top: var(--space-16); }
#service, #other { margin-top: var(--space-10); }

/* entries */
.cv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-6); }
.cv-list.cv-tight { gap: var(--space-2); }
.cv-pubs { gap: 28px; }
.cv-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-6);
  align-items: baseline; position: relative; scroll-margin-top: var(--space-6);
}
.cv-main { min-width: 0; }
.cv-main p { max-width: 68ch; }
.cv-t { color: var(--ink); }
.cv-s, .cv-d, .cv-src, .cv-notes { font-size: 15px; line-height: 24px; color: var(--ink-muted); }
.cv-t .cv-d { line-height: inherit; }
.cv-role { font-style: italic; }
.cv-notes { margin: var(--space-1) 0 0; padding-left: 1.1em; list-style: square; max-width: 68ch; }
.cv-notes li::marker { color: var(--line); }
.cv-notes li + li { margin-top: 2px; }
.cv-when {
  font-size: 14px; line-height: 27px; font-variant-numeric: tabular-nums; color: var(--ink);
  text-align: right; white-space: nowrap; margin: 0;
}
.cv-nodate .cv-row { grid-template-columns: minmax(0, 1fr); }
.cv-nodate .cv-when { display: none; }

/* publications: the number hangs in the gutter, so every title starts on the same line as the others */
.cv-num {
  position: absolute; right: calc(100% + 14px); top: 0;
  font-family: var(--font-mono); font-size: 12px; line-height: 27px;
  font-variant-numeric: tabular-nums; color: var(--ink-muted);
}
.cv-src i { color: var(--ink); }
.cv-main .cv-au { font-size: 14px; line-height: 22px; color: var(--ink-muted); margin-top: 2px; max-width: 84ch; }
.cv-dag { font-size: .8em; line-height: 0; margin-left: 1px; }
.cv-au .me { color: var(--ink); }
.cv-main .cv-links { font-size: 14px; line-height: 22px; margin-top: 2px; overflow-wrap: anywhere; }
.cv-links a + a { margin-left: var(--space-4); }

/* the heading of a folded section on a phone (the button exists only at that width) */
.cv-fold {
  display: flex; align-items: baseline; gap: var(--space-2); width: 100%; padding: 0;
  background: none; border: 0; text-align: left; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink);
}
.cv-fold svg { flex: none; width: 8px; height: 10px; fill: currentColor; }
.cv-fold[aria-expanded="true"] svg { transform: rotate(90deg); }

/* arriving from a link elsewhere (cv.html#pub-nature-2023): the title is underlined */
.cv-row:target .cv-t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.cv-row:target .cv-num { color: var(--ink); }

.cv-plate { width: 460px; max-width: 100%; margin: 120px 0 0 240px; }
.cv-met { margin: 96px 0 0 240px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6) var(--space-4); max-width: 760px; }
.cv-met .met-fig { margin: 0; }
.cv-met .met-ph { border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 2; box-shadow: 0 0 0 1px var(--line); }
.cv-met .met-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cv-met .met-fig.queen img { object-position: 50% 30%; }
.cv-met .met-fig.hawking img { object-position: 50% 12%; }
.cv-met figcaption { margin-top: var(--space-2); font-family: var(--font-sans); font-size: 14px; line-height: 20px; color: var(--ink-muted); }

/* narrower: the left column tightens */
@media screen and (max-width: 1000px) {
  .cv-top, .cv-sec { grid-template-columns: 168px minmax(0, 1fr); gap: 0 var(--space-6); }
  .cv-plate { margin-left: 192px; }
  .cv-met { margin-left: 192px; }
}

/* phone: one column; the date sits above its entry; the later sections fold */
@media screen and (max-width: 760px) {
  .cv-top, .cv-sec { grid-template-columns: minmax(0, 1fr); }
  .cv-top { padding-block: var(--space-6) var(--space-10); gap: var(--space-4); }
  .cv-top-body { padding-top: 0; }
  .cv-head { position: static; margin-bottom: var(--space-4); }
  #publications { margin-block: var(--space-16) var(--space-10); }
  #publications .cv-head { margin-bottom: var(--space-10); }
  #publications .cv-body { grid-column: 1; }
  .cv-hinge { margin-top: var(--space-6); } /* the pair across the column, the seam at its centre */
  .cv-row { grid-template-columns: minmax(0, 1fr); }
  .cv-when { order: -1; text-align: left; line-height: 20px; color: var(--ink-muted); }
  .cv-when:empty { display: none; }
  .cv-pub { padding-left: 32px; }
  .cv-num { right: auto; left: 0; line-height: 20px; }
  .cv-list.cv-tight { gap: var(--space-4); }
  /* tap targets at least 40px tall: 16px of text and 12px above and below */
  .cv-main .cv-links { margin-top: -4px; }
  .cv-links a, .cv-ids a { display: inline-block; padding-block: 9px; }
  .cv-out { display: inline-block; padding-block: 8px; }

  /* folded sections sit close together, as a short list of what else there is */
  html.js .cv-sec[data-fold], html.js #preprints, html.js #service, html.js #other { margin-top: 0; }
  html.js .cv-sec[data-fold]:not(.is-open) .cv-body { display: none; }
  html.js .cv-sec[data-fold] .cv-head { margin-bottom: 0; }
  html.js .cv-sec[data-fold].is-open .cv-body { padding-block: var(--space-2) var(--space-6); }
  .cv-fold { min-height: 44px; padding: 8px 0; }
  .cv-plate { margin: var(--space-16) 0 0; width: 100%; }
  .cv-met { margin: var(--space-16) 0 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* print: a clean A4 CV */
@page {
  size: A4; margin: 15mm 16mm 16mm;
  @bottom-left { content: "Tomi K. Baikie, curriculum vitae"; font-family: "Archivo", Arial, sans-serif; font-size: 7.5pt; color: #5c5c5c; }
  @bottom-right { content: counter(page) " / " counter(pages); font-family: "Space Mono", ui-monospace, monospace; font-size: 7pt; color: #5c5c5c; }
}
@media print {
  .top, .site-foot, .skip, .cv-print-li, #tb-live, .cv-note, .cv-plate, .cv-met, .cv-fold svg { display: none !important; }
  body { font-size: 9.5pt; line-height: 1.4; }
  a { color: var(--ink); text-decoration: none; }
  .wrap { margin: 0; }
  .page-title { display: none; }
  .cv-print-head { display: block; }
  .cv-print-name { font-family: var(--font-display); font-weight: var(--w-display); font-size: 22pt; line-height: 1; letter-spacing: .03em; margin: 0; }
  .cv-print-role { font-size: 10pt; line-height: 1.4; margin-top: 2mm; color: var(--ink); max-width: none; }
  .cv-print-contact { font-size: 9.5pt; line-height: 1.4; margin-top: .6mm; color: var(--ink); max-width: none; }
  .print-url { display: inline; color: var(--ink-muted); }
  .cv-doi { display: inline; }

  /* on paper the section name sits above its entries, so it can never be stranded at the foot of a page */
  .cv-top, .cv-sec { display: block; }
  .cv-top { padding-block: 0 2mm; }
  .cv-top-body { gap: 1.5mm; padding-top: 2mm; }
  .cv-count { font-size: 10.5pt; line-height: 1.4; }
  .cv-interests { font-size: 9.5pt; line-height: 1.45; max-width: none; }
  .label, .cv-ids, .cv-when, .cv-num, .figure-cap { font-size: 7.5pt; line-height: 1.5; }
  .cv-sec, #publications, #preprints, #service, #other { margin: 0; padding-block: 3mm 1mm; }
  .cv-head { position: static; margin-bottom: 2mm; break-after: avoid; break-inside: avoid; }
  .cv-h, #publications .cv-h { font-size: 11.5pt; line-height: 1.15; font-weight: var(--w-display-small); letter-spacing: .05em; }
  #publications .cv-head { margin-bottom: 2mm; }
  .cv-sub { margin: -1mm 0 2mm; break-after: avoid; }
  .cv-h3 { margin-bottom: 1.5mm; padding: 0; break-after: avoid; }
  .cv-list + .cv-h3 { margin-top: 3mm; }
  .cv-list { display: block; }
  .cv-list > li + li { margin-top: 1.8mm; }
  .cv-list.cv-tight > li + li { margin-top: 0.8mm; }
  .cv-row { break-inside: avoid; column-gap: 5mm; }
  .cv-main p, .cv-notes { max-width: none; }
  .cv-t { font-size: 9.5pt; line-height: 1.4; }
  .cv-s, .cv-d, .cv-src, .cv-notes { font-size: 8.5pt; line-height: 1.4; }
  .cv-main .cv-au, .cv-main .cv-links { font-size: 8pt; line-height: 1.38; max-width: none; margin-top: 0; }
  .cv-pub .cv-au, .cv-pub .cv-links { display: inline; }
  .cv-links a + a { margin-left: 0; }
  .cv-pub .cv-links::before { content: " "; }
  .cv-when { line-height: 1.95; }
  .cv-pub { padding-left: 6mm; }
  .cv-num { right: auto; left: 0; line-height: 1.95; }
  .cv-row:target .cv-t { text-decoration: none; }
}
