/* ---------------------------------------------------------------
   cv.css — /curriculum-vitae/, loaded after post.css

   The page is the post layout carrying one thing: the CV itself,
   drawn page by page by assets/js/cv-viewer.js into a scrolling
   box. Everything the old page listed as text (positions,
   education, affiliations, recognition, funding) is in the PDF and
   was taken off the page on 15 November 2026 at Joel's instruction.
   --------------------------------------------------------------- */

/* Wider than a post's 760px, because the measure here is a PDF page
   rather than a line of prose: at 760 a page draws at ~1.15x and the
   CV's 12pt Times lands at about 14px. */
.cv__inner { max-width: 940px; }

.cv__header { margin-bottom: 28px; }

.cv__links {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.cv__links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--poppy);
  padding-bottom: 1px;
  transition: color .18s ease;
}
.cv__links a:hover,
.cv__links a:focus-visible { color: var(--poppy); }

/* ---------- the viewer ---------- */

.cv-viewer {
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-card-lg);
  overflow: hidden;
  background: var(--paper-3);
}

.cv-viewer__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.cv-viewer__count {
  flex: 1 1 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.cv-viewer__zoom {
  display: flex;
  gap: 4px;
}
.cv-viewer__zoom[hidden] { display: none; }

.cv-viewer__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-card);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.cv-viewer__btn--fit {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cv-viewer__btn:hover:not(:disabled) { border-color: var(--ink); }
.cv-viewer__btn:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }
.cv-viewer__btn:disabled { cursor: default; opacity: 0.4; }

/* --petrol ground, --paper type: 9.01:1. */
.cv-viewer__download {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-card);
  background: var(--petrol);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.cv-viewer__download:hover { background: var(--ink); }
.cv-viewer__download:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* The scrolling box. A fixed height is what makes it a window onto
   the document rather than 24 pages stacked down the site. svh so a
   phone's collapsing toolbar does not resize it mid-scroll. */
.cv-viewer__pages {
  height: min(85vh, 1180px);
  height: min(85svh, 1180px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.cv-viewer__pages:focus-visible { outline: 2px solid var(--petrol); outline-offset: -2px; }

.cv-viewer__fallback {
  margin: 40px auto;
  max-width: 40ch;
  text-align: center;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.cv-viewer__fallback a {
  color: var(--ink);
  border-bottom: 1px solid var(--poppy);
  text-decoration: none;
}

/* One page. Block with auto margins rather than a centring flexbox:
   when zoomed past the box's width a flex-centred page overflows to
   BOTH sides and its left edge cannot be scrolled to. */
.cv-page {
  position: relative;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 21, 28, 0.18);
  --scale-round-x: 1px;
  --scale-round-y: 1px;
}
.cv-page + .cv-page { margin-top: var(--cv-gap, 12px); }
.is-zoomed .cv-page { margin-left: 0; }

.cv-page__canvas {
  display: block;
}

.cv-page__links {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.cv-page__link {
  position: absolute;
  pointer-events: auto;
}
.cv-page__link:hover { background: rgba(30, 66, 88, 0.12); }
.cv-page__link:focus-visible { outline: 2px solid var(--petrol); }

/* ---------- PDF.js text layer ----------
   Transparent, positioned text over the canvas, so the CV can be
   selected, found with the browser's find and read by a screen
   reader. Trimmed from PDF.js's own web/pdf_viewer.css (Apache-2.0,
   Mozilla) to the rules that apply with no highlighting or editing;
   the variables are the ones TextLayer writes and reads. Re-check
   against that file when PDF.js is upgraded. */
.textLayer {
  position: absolute;
  text-align: initial;
  inset: 0;
  overflow: clip;
  opacity: 1;
  line-height: 1;
  letter-spacing: normal;
  word-spacing: normal;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  caret-color: CanvasText;
  z-index: 0;
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer :is(span, br) {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  -webkit-user-select: text;
  user-select: text;
}
.textLayer > :not(.markedContent),
.textLayer .markedContent span:not(.markedContent) {
  z-index: 1;
  --font-height: 0;
  font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1;
  --rotate: 0deg;
  transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
.textLayer .markedContent { display: contents; }
.textLayer ::selection {
  background: rgba(30, 66, 88, 0.28);
  color: transparent;
}
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: 0;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- phone ---------- */

@media (max-width: 640px) {
  .cv-viewer__bar { padding: 8px 10px; gap: 8px; }
  .cv-viewer__count { font-size: 11px; letter-spacing: 0.02em; }
  .cv-viewer__download { padding: 0 10px; }
  .cv-viewer__pages { height: 78vh; height: 78svh; padding: 8px; }
}
