/* ==========================================================================
   CV documents: /cv/resume/ and /cv/academic/ (generated by scripts/sync_cv.py)

   The same <article class="cv-doc"> is used in two places:
   1. the standalone CV pages (body.cv-standalone), which load only this file;
   2. inside a dark card on the home page, where main.js injects the article
      and styles.css is already loaded.
   So every document rule is scoped under .cv-doc (nothing leaks into the home
   page) and every page-chrome rule under body.cv-standalone. Colours and fonts
   come from the main site's tokens, with fallbacks for the standalone page.
   Black and white only.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Standalone page: tokens (same values as styles.css) and chrome
   -------------------------------------------------------------------------- */
body.cv-standalone {
  --ink: #000000;
  --paper: #ffffff;
  --body: #e4e4e4;
  --ash: #a6a6a6;
  --stone: #8c8c8c;
  --line: #262626;
  --lift: #111111;
  --serif: "Playfair Display", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --gutter: clamp(1rem, 5vw, 2.5rem);
  --measure: 44rem;

  color-scheme: dark;
  page: cv;
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.cv-standalone *,
body.cv-standalone *::before,
body.cv-standalone *::after { box-sizing: border-box; }

body.cv-standalone :focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Slim sticky bar: back to the home page, download the PDF */
body.cv-standalone .cv-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

body.cv-standalone .cv-bar-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.7rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.4;
}

body.cv-standalone .cv-bar a {
  color: var(--ash);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

body.cv-standalone .cv-bar a:hover,
body.cv-standalone .cv-bar a:focus-visible { color: var(--paper); }

body.cv-standalone .cv-bar-home { min-width: 0; overflow-wrap: anywhere; }

body.cv-standalone .cv-bar-pdf {
  flex: none;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

body.cv-standalone .cv-bar-pdf:hover,
body.cv-standalone .cv-bar-pdf:focus-visible { border-color: var(--paper); }

body.cv-standalone .cv-main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.25rem var(--gutter) 1rem;
}

body.cv-standalone .cv-foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem var(--gutter) calc(2.5rem + env(safe-area-inset-bottom, 0px));
  color: var(--stone);
  font-size: 0.8125rem;
}

body.cv-standalone .cv-foot p {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

body.cv-standalone .cv-foot a {
  color: var(--ash);
  text-underline-offset: 3px;
}

body.cv-standalone .cv-foot a:hover { color: var(--paper); }

/* --------------------------------------------------------------------------
   The document (standalone page and home-page card)
   -------------------------------------------------------------------------- */
.cv-doc {
  color: var(--body, #e4e4e4);
  font-family: var(--sans, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  font-size: 0.95rem;              /* inside the home-page card */
  line-height: 1.6;
  text-align: left;
  overflow-wrap: anywhere;         /* long URLs and names never force a sideways scroll */
}

body.cv-standalone .cv-doc { font-size: 1rem; }

.cv-doc > :first-child { margin-top: 0; }
.cv-doc > :last-child { margin-bottom: 0; }

.cv-doc .cv-updated {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone, #8c8c8c);
}

/* Name, subtitle and contact line */
.cv-doc header.contact {
  margin: 0 0 0.5rem;
  padding-bottom: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--line, #262626);
}

.cv-doc header.contact .name {
  margin: 0;
  font-family: var(--serif, "Playfair Display", Georgia, "Times New Roman", serif);
  font-weight: 600;
  font-size: clamp(1.55rem, 6.2vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--paper, #ffffff);
  overflow-wrap: normal;
}

.cv-doc header.contact .name strong { font-weight: inherit; }

.cv-doc header.contact .sub {
  margin: 0.5rem 0 0.65rem;
  font-size: 0.95em;
  font-weight: 500;
  color: var(--body, #e4e4e4);
}

.cv-doc header.contact .cline {
  font-size: 0.85em;
  line-height: 1.7;
  color: var(--ash, #a6a6a6);
}

/* Section headings: small uppercase labels on a hairline */
.cv-doc h1,
.cv-doc h3.cv-h {
  margin: 2.25rem 0 0.9rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line, #262626);
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash, #a6a6a6);
}

.cv-doc h2,
.cv-doc h3,
.cv-doc h4 {
  margin: 1.5rem 0 0.5rem;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 1em;
  font-weight: 600;
  line-height: 1.4;
  color: var(--paper, #ffffff);
}

.cv-doc p { margin: 0.5rem 0 0.85rem; }

.cv-doc ul,
.cv-doc ol {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
}

.cv-doc li { margin: 0 0 0.55rem; padding-left: 0.15rem; }
.cv-doc li::marker { color: var(--stone, #8c8c8c); }
.cv-doc li ul,
.cv-doc li ol { margin: 0.4rem 0 0.2rem; }

.cv-doc strong { font-weight: 600; color: var(--paper, #ffffff); }

.cv-doc a {
  color: var(--paper, #ffffff);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.cv-doc a:hover,
.cv-doc a:focus-visible { text-decoration-color: currentColor; }

.cv-doc header.contact .cline a { color: var(--body, #e4e4e4); }

/* Role header: organisation / location, then title / dates.
   Wraps on phones so the location and dates drop under the title. */
.cv-doc .role {
  margin: 1.5rem 0 0.5rem;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-doc h1 + .role,
.cv-doc h3.cv-h + .role { margin-top: 0.9rem; }

.cv-doc .rrow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}

.cv-doc .rrow.org > span:first-child {
  font-weight: 600;
  color: var(--paper, #ffffff);
}

.cv-doc .rrow.pos > span:first-child { color: var(--body, #e4e4e4); }

.cv-doc .rrow .loc,
.cv-doc .rrow .date {
  font-size: 0.85em;
  color: var(--stone, #8c8c8c);
  white-space: nowrap;
}

.cv-doc .rrow .date em { font-style: normal; }

.cv-doc .role + ul,
.cv-doc .role + ol { margin-top: 0.35rem; }

/* Generator helpers */
.cv-doc .sc { font-variant: small-caps; }
.cv-doc .center { text-align: center; }
.cv-doc .updated { display: none; }   /* superseded by .cv-updated */

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body.cv-standalone .cv-bar a,
  .cv-doc a { transition: none; }
}

/* --------------------------------------------------------------------------
   Print: clean black on white, Letter, about 10pt. Named page so printing
   the home page is not affected when this file is loaded there.
   -------------------------------------------------------------------------- */
@page cv {
  size: Letter;
  margin: 0.5in;
}

@media print {
  body.cv-standalone {
    background: #ffffff;
    color: #000000;
    font-size: 10pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.cv-standalone .cv-bar,
  body.cv-standalone .cv-foot { display: none; }

  body.cv-standalone .cv-main { max-width: none; padding: 0; }

  .cv-doc,
  body.cv-standalone .cv-doc {
    color: #000000;
    font-size: 10pt;
    line-height: 1.35;
  }

  .cv-doc .cv-updated { margin-bottom: 6pt; font-size: 7.5pt; color: #444444; }
  .cv-doc header.contact { padding-bottom: 8pt; border-bottom-color: #999999; }
  .cv-doc header.contact .name { font-size: 20pt; color: #000000; }
  .cv-doc header.contact .sub { margin: 2pt 0 3pt; color: #222222; }
  .cv-doc header.contact .cline,
  .cv-doc header.contact .cline a { color: #222222; }

  .cv-doc h1,
.cv-doc h3.cv-h {
    margin: 12pt 0 5pt;
    padding-bottom: 2pt;
    border-bottom-color: #999999;
    font-size: 8.5pt;
    color: #000000;
    break-after: avoid;
    page-break-after: avoid;
  }

  .cv-doc h2,
  .cv-doc h3,
  .cv-doc h4 { color: #000000; break-after: avoid; page-break-after: avoid; }

  .cv-doc p { margin: 2pt 0 4pt; }
  .cv-doc ul,
  .cv-doc ol { margin: 2pt 0 5pt; }
  .cv-doc li { margin-bottom: 2pt; break-inside: avoid; page-break-inside: avoid; }
  .cv-doc li::marker { color: #000000; }

  .cv-doc strong,
  .cv-doc .rrow.org > span:first-child,
  .cv-doc .rrow.pos > span:first-child { color: #000000; }

  .cv-doc a { color: #000000; text-decoration: none; }

  .cv-doc .role { margin: 7pt 0 2pt; break-after: avoid; page-break-after: avoid; }
  .cv-doc .rrow .loc,
  .cv-doc .rrow .date { color: #444444; }
}
