/*
 * The CV at /cv (src/views/Cv.tsx). Read on screen as a sheet of paper, printed
 * on A4. The PDF at /cv.pdf is printed from this same stylesheet, with the font
 * files below inlined (src/lib/cv-pdf.tsx), so keep every url() pointing at
 * /fonts/.
 */

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-400-italic.woff2) format('woff2');
}

:root {
  --ink: #1b1b1b;
  --ink-2: #3d3d3d;
  --muted: #555;
  --rule: #d9d9d3;
  --accent: #8a5a00;
  --paper: #fff;
  --desk: #e9e8e3;
  --label: 112px;
  --gutter: 28px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 14.5px/1.55 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #b9b9b2;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- the bar */

.cv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  max-width: 794px;
  margin: 0 auto;
  padding: 18px 4px 14px;
  font-size: 14px;
}

.cv-bar__gap {
  flex: 1;
}

.cv-bar a {
  color: var(--ink-2);
}

/* ------------------------------------------------------------ the sheet */

.cv {
  max-width: 794px;
  margin: 0 auto 48px;
  padding: 72px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 16px rgb(0 0 0 / 0.06);
}

.cv-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}

.cv-head h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.cv-sub {
  margin: 0;
  font-size: 17px;
  color: var(--ink-2);
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--ink-2);
}

/* Each section: its heading in a narrow column on the left. */
.cv-sec {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: var(--gutter);
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.cv-sec:last-of-type {
  border-bottom: 0;
}

.cv-sec h2 {
  margin: 2px 0 0;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.cv-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cv-entry__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 16px;
}

.cv-entry h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
}

.cv-dates {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cv-detail {
  margin: 2px 0 6px;
  color: var(--ink-2);
}

.cv-text > :first-child {
  margin-top: 0;
}

.cv-text > :last-child {
  margin-bottom: 0;
}

.cv-text p {
  margin: 0 0 8px;
  text-wrap: pretty;
}

.cv-text ul,
.cv-text ol {
  margin: 4px 0 8px;
  padding-left: 18px;
}

.cv-text li {
  margin: 0 0 4px;
}

.cv-text h1,
.cv-text h2,
.cv-text h3,
.cv-text h4 {
  margin: 12px 0 4px;
  font-size: 1em;
  font-weight: 600;
}

.cv-text strong {
  font-weight: 600;
}

.cv-skills p {
  margin: 0 0 6px;
}

.cv-projects {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cv-projects__name {
  font-weight: 600;
}

.cv-projects__link {
  font-size: 13px;
  color: var(--muted);
}

.cv-foot {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: #5c5c5c;
}

/* ------------------------------------------------- the desktop's viewer */

/*
 * The desktop's CV window frames /desktop/cv, whose body has .is-paper: one
 * A4-wide sheet on grey, which the window scales with `zoom` on <html>. On a
 * phone the window takes .is-paper away, and the page reflows like /cv.
 */
@media screen {
  .is-paper {
    background: #7d7f79;
  }

  .is-paper .cv {
    width: 794px;
    max-width: none;
    margin: 22px auto;
    box-shadow: 3px 3px 0 #3c3d39;
  }
}

/* ------------------------------------------------------------ narrower */

/* Screens only: a printed A4 page is narrower than this too. */
@media screen and (max-width: 720px) {
  body:not(.is-paper) {
    background: var(--paper);
  }

  .cv-bar {
    padding: 14px 20px 0;
  }

  body:not(.is-paper) .cv {
    margin: 0;
    padding: 24px 20px 40px;
    box-shadow: none;
  }

  body:not(.is-paper) .cv-head h1 {
    font-size: 28px;
  }

  body:not(.is-paper) .cv-sec {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 10px;
  }
}

/* ------------------------------------------------------------- printed */

@page {
  size: A4;
  margin: 16mm 18mm 18mm;
}

@media print {
  /* Printed from the desktop's viewer: its zoom is for the screen only. */
  html {
    zoom: 1 !important;
  }

  body {
    background: var(--paper);
    font-size: 10.5pt;
  }

  .cv-bar {
    display: none;
  }

  .cv {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  a {
    text-decoration: none;
  }

  .cv-sec h2,
  .cv-entry__head,
  .cv-detail {
    break-after: avoid;
  }

  .cv-entry__head,
  .cv-projects li,
  .cv-text li {
    break-inside: avoid;
  }
}
