/* ==========================================================================
   Technical memorandum stylesheet — shared by every page (00–05).
   Model: a letter-size lab memo set in Computer Modern. One column, numbered
   sections, captioned figures and tables, references, page footer.
   Ink on paper. Print-to-PDF is a first-class target.
   Type: CMU Serif (OFL) for everything; JetBrains Mono only for identifiers
   that would be typeset in \texttt{} — pin names, file names, registers.
   ========================================================================== */

@font-face {
  font-family: "CMU Serif";
  src: url("fonts/cmu-serif-500-roman.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "CMU Serif";
  src: url("fonts/cmu-serif-500-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "CMU Serif";
  src: url("fonts/cmu-serif-700-roman.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "CMU Serif";
  src: url("fonts/cmu-serif-700-italic.woff2") format("woff2");
  font-weight: 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --desk: #e4e3df;       /* screen only: the surface the sheet sits on */
  --paper: #ffffff;
  --ink: #111111;
  --ink-soft: #4a4a46;   /* running head, captions' secondary text */
  --rule: #111111;
  --link: #1f3f8f;       /* hyperref-style dark blue, the one colour on the page */
  --slot: #f7f7f4;       /* reserved figure slot fill */
  --serif: "CMU Serif", "Latin Modern Roman", "Times New Roman", Times, serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.42;
  color: var(--ink);
  background: var(--desk);
}

/* The sheet: one letter page, on screen and in print. */
.memo {
  max-width: 8.5in;
  margin: 36px auto 64px;
  padding: 0.85in 1in 0.9in;
  background: var(--paper);
  box-shadow: 0 1px 0 #c9c8c3, 0 14px 32px rgba(0, 0, 0, 0.13);
}

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

code, .tt { font-family: var(--mono); font-size: 0.86em; }

/* --------------------------------------------------------------------------
   Site navigation (screen only) and running head
   -------------------------------------------------------------------------- */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

.runhead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  border-bottom: 0.5pt solid var(--rule);
  padding-bottom: 4px;
  margin-bottom: 28px;
}

/* --------------------------------------------------------------------------
   Title block: kind, title, subtitle, author, abstract, keywords
   -------------------------------------------------------------------------- */

.kind {
  font-size: 13.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

h1 {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  margin: 8px 0 6px;
}

.sub {
  text-align: center;
  font-size: 17px;
  font-style: italic;
  margin-bottom: 14px;
}

.authors { text-align: center; font-size: 16px; }
.authors small { display: block; font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }

.abstract {
  margin: 24px 0.45in 26px;
  font-size: 15px;
  line-height: 1.4;
  text-align: justify;
  hyphens: auto;
}
.abstract b { font-variant: small-caps; letter-spacing: 0.06em; margin-right: 6px; }


/* --------------------------------------------------------------------------
   Body text: numbered sections
   -------------------------------------------------------------------------- */

section { margin-top: 22px; }

h2 { font-size: 17.5px; font-weight: 700; margin: 0 0 7px; }
h2 .n { display: inline-block; min-width: 1.6em; }

p { margin: 0 0 10px; text-align: justify; hyphens: auto; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 10px 1.5em; }
li { margin-bottom: 4px; }

em { font-style: italic; }
strong { font-weight: 700; }

/* Figures. `.pending` marks a reserved slot awaiting a photo, plot, or CAD
   view. Pending figures are hidden everywhere: the markup stays so a real
   image can be dropped in, but no reader ever sees an empty frame. */
.fig { margin: 16px 0 18px; }
.fig.pending { display: none; }
.fig .box {
  border: 0.5pt solid var(--ink-soft);
  background: var(--slot);
  width: 100%;
  aspect-ratio: 16 / 8;
  display: grid;
  place-items: center;
  padding: 12px;
  font-size: 13.5px;
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
}
.fig img, .fig svg { width: 100%; height: auto; display: block; }
.fig img { border: 0.5pt solid var(--ink-soft); }
/* Two photographs side by side, for portrait frames. */
.fig.pair .frames { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.fig.pair .frames img { aspect-ratio: 3 / 4; object-fit: cover; }
.fig .cap { font-size: 13.5px; line-height: 1.35; margin-top: 7px; }
.fig .cap b { font-weight: 700; }

/* Tables: booktabs rules only, no vertical lines, no shading. */
.tabwrap { margin: 10px 0 16px; overflow-x: auto; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
caption { caption-side: top; text-align: left; font-size: 13.5px; margin-bottom: 6px; }
caption b { font-weight: 700; }
th, td { padding: 4px 8px; text-align: left; vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { border-top: 1pt solid var(--rule); border-bottom: 0.5pt solid var(--rule); font-weight: 700; }
tbody tr:last-child td { border-bottom: 1pt solid var(--rule); }

/* References */
ol.refs { font-size: 14.5px; margin-left: 1.7em; }
ol.refs li { margin-bottom: 5px; }

/* Page footer */
.pgfoot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-top: 0.5pt solid var(--rule);
  padding-top: 4px;
  margin-top: 36px;
}

/* --------------------------------------------------------------------------
   Landing page: one-page CV skeleton. Same paper and face as the memos,
   different bones: left-aligned name with a rule, label column on the left,
   content on the right. No kind label, no abstract, no running head.
   -------------------------------------------------------------------------- */

.cv-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px 24px;
  border-bottom: 1pt solid var(--rule);
  padding-bottom: 8px;
  margin-bottom: 6px;
}
.cv-head h1 { font-size: 30px; text-align: left; margin: 0; line-height: 1.1; }
.cv-head .contact { font-size: 14.5px; text-align: right; line-height: 1.45; }
.cv-head .contact a { display: block; }
.cv-tagline { font-size: 15.5px; font-style: italic; color: var(--ink-soft); margin-bottom: 22px; }

.cv-sec { margin-top: 20px; }
.cv-sec h2 {
  font-size: 15.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 0.5pt solid var(--rule);
  padding-bottom: 3px;
  margin-bottom: 10px;
}
.cv-row {
  display: grid;
  grid-template-columns: 1.55in 1fr;
  gap: 2px 18px;
  margin-bottom: 9px;
}
.cv-row:last-child { margin-bottom: 0; }
.cv-row .lbl { font-size: 14.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cv-row .lbl b { color: var(--ink); font-weight: 700; }
.cv-row .lbl img.thumb {
  display: block;
  width: 100%;
  max-width: 1.55in;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
  margin-top: 6px;
  border: 0.5pt solid var(--rule);
}
.cv-row .body { min-width: 0; }
.cv-row .body p { text-align: left; hyphens: manual; margin-bottom: 3px; }
.cv-row .body .role { font-weight: 700; }
.cv-row .body .meta { font-size: 14.5px; color: var(--ink-soft); }
.cv-sec p.lead { text-align: left; hyphens: manual; margin-bottom: 0; }

@media (max-width: 720px) {
  .cv-head { align-items: flex-start; }
  .cv-head .contact { text-align: left; }
  .cv-row { grid-template-columns: 1fr; gap: 0; margin-bottom: 12px; }
}

@media print {
  /* The CV must fit one letter page. */
  .cv { font-size: 9.6pt; line-height: 1.28; }
  .cv-head { padding-bottom: 4px; margin-bottom: 3px; }
  .cv-head h1 { font-size: 20pt; }
  .cv-tagline { font-size: 10pt; margin-bottom: 10px; }
  .cv-sec { margin-top: 8px; break-inside: avoid; }
  .cv-sec h2 { font-size: 10pt; margin-bottom: 5px; padding-bottom: 2px; }
  .cv-row { margin-bottom: 3px; grid-template-columns: 1.25in 1fr; }
  .cv-row .lbl img.thumb { display: none; }
  .cv-row .body p { margin-bottom: 0; }
  .cv-row .lbl, .cv-row .body .meta, .cv-head .contact { font-size: 8.7pt; }
  .cv .pgfoot { margin-top: 14px; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .memo { margin: 0 0 32px; padding: 22px 18px 32px; box-shadow: none; }
  .abstract, .kw { margin-left: 0; margin-right: 0; }
  p, .abstract { text-align: left; hyphens: manual; }
  h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: no-preference) {
  a { transition: color 120ms ease; }
}

/* --------------------------------------------------------------------------
   Print — hard requirement. The memo is the page.
   -------------------------------------------------------------------------- */

@page { size: letter; margin: 0.75in 0.85in; }

@media print {
  body { background: #fff; font-size: 11pt; line-height: 1.38; }
  .memo { max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .site-nav { display: none; }
  .fig.pending { display: none; }
  h1 { font-size: 18pt; }
  .sub { font-size: 12pt; }
  h2 { font-size: 12pt; }
  .abstract { font-size: 10pt; }
  .fig .cap, caption, .runhead, .pgfoot, ol.refs, table { font-size: 9.5pt; }
  section, .fig, .tabwrap { break-inside: avoid; }
  h2 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
}
