/* One stylesheet for both outputs: the screen rules shape the web page,
   @page and @media print shape the PDF that WeasyPrint renders.
   Fonts are served from fonts/ (built from nixpkgs geist-font, see devenv.nix).

   Deliberately small type system — keep it that way:
     one family (Geist), two weights (400, 600), no italics,
     two colours (--fg, --muted), three sizes (name, body, --small).
   Bold is reserved for the name, section headings and role lines.

   Layout: a left rail (--rail) holds dates and skill labels, everything else
   sits in the content column to its right, like a read.cv timeline. */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --fg: #18191c;
  --muted: #6b7079;
  --rule: #e2e4e8;
  --bg: #ffffff;
  --small: 0.875rem;
  --rail: 8.5rem;
  font-family:
    "Geist",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

@media screen and (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e7ea;
    --muted: #8e939c;
    --rule: #2b2e34;
    --bg: #111215;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
}

.resume {
  max-width: 50rem;
  margin: 0 auto;
  padding: 4rem 1rem 3rem;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}

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

/* Header */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 2rem;
}

.who {
  flex: 1 1 20rem;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

.headline {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.contacts {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--small);
  color: var(--muted);
}

.download {
  font-size: var(--small);
  color: var(--muted);
}

/* Sections. Plain text headings: no tracking or small caps, which also keeps
   the PDF text clean for applicant-tracking systems. */

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 2.25rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

/* Everything below a section heading lives in the content column. */
.resume > p,
.resume > ul,
.resume > h3 {
  margin-left: var(--rail);
}

/* Entry line: "Role · Company"; its dates hang in the rail to the left. */
h3 {
  position: relative;
  margin: 1.5rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

h2 + h3 {
  margin-top: 0;
}

h3 a {
  text-decoration: none;
}

h3 a:hover {
  text-decoration: underline;
}

/* Dates may wrap at the dash: "2024-06 –" over "2026-02". */
.when {
  position: absolute;
  top: 0;
  left: calc(-1 * var(--rail));
  width: calc(var(--rail) - 1rem);
  font-weight: 400;
  color: var(--muted);
}

/* One line of company context under the entry line. */
.about {
  display: block;
  font-size: var(--small);
  color: var(--muted);
}

p {
  margin: 0 0 0.6rem;
}

h3 + p {
  margin: 0;
}

/* Role intro sentence after the grey context line. */
h3 + p + p {
  margin: 0.3rem 0 0;
}

/* Hanging dashes: the marker sits in the gutter, so bullet text lines up
   with the role line above it. */
ul {
  margin: 0.5rem 0 0;
  padding-left: 0;
}

li {
  margin: 0.25rem 0;
}

li::marker {
  content: "–  ";
  color: var(--muted);
}

.contacts li {
  margin: 0;
  padding: 0;
}

.contacts li::marker {
  content: none;
}

/* Definition lists (Skills, Other): the term goes in the rail. */
dl {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  gap: 0.35rem 0;
  margin: 0;
}

dt {
  padding-right: 1rem;
  color: var(--muted);
}

dd {
  margin: 0;
}

footer {
  margin-top: 3rem;
  font-size: var(--small);
  color: var(--muted);
}

@media screen and (max-width: 600px) {
  .resume {
    padding-top: 2.5rem;
  }

  .contacts {
    flex-direction: column;
  }

  /* No gutter for hanging dashes on a phone screen. */
  ul {
    padding-left: 1rem;
  }

  /* No rail on phones: dates drop under the role line. */
  .resume > p,
  .resume > ul,
  .resume > h3 {
    margin-left: 0;
  }

  .when {
    position: static;
    display: block;
    width: auto;
    font-size: var(--small);
  }

  dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  dd {
    margin-bottom: 0.6rem;
  }
}

/* PDF */

@page {
  size: A4;
  margin: 16mm 20mm 16mm;

  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-family: "Geist", sans-serif;
    font-size: 7.5pt;
    color: #9a9ea6;
  }
}

@media print {
  html {
    font-size: 9.8pt;
    line-height: 1.45;
  }

  .resume {
    max-width: none;
    padding: 0;
  }

  .no-print,
  footer {
    display: none;
  }

  header {
    margin-bottom: 1.25rem;
  }

  a {
    text-decoration: none;
  }

  h2 {
    margin-top: 1.6rem;
  }

  h3 {
    margin-top: 1.1rem;
  }

  h2,
  h3,
  .about {
    break-after: avoid;
  }

  li,
  dt,
  dd {
    break-inside: avoid;
  }
}
