/* leoduncan.dev: premium but understated. White page, ink text, generous space.
   Instrument Serif for headings and the few big moments; Instrument Sans for everything else
   (both self-hosted, OFL). Layout: each section is a row, its label in a narrow left column and
   its content on the right, so nothing floats beside an empty half. */

@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --tile: #f3f4f6;
  --ink: #121418;
  --ink-2: #4a4f58;
  --ink-3: #737985;
  --rule: #e6e8eb;
  --accent: #1d3fb8;
  --ok: #1f8f5c;
  --sans: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --max: 1120px;
  --label: 200px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --tile: #17191d;
    --ink: #ededee;
    --ink-2: #b4b8c0;
    --ink-3: #8a909a;
    --rule: #25282d;
    --accent: #9db4ff;
    --ok: #4cc28a;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p,
h1,
h2,
h3,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--accent);
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * 32px);
  margin: 0 auto;
  padding-left: max(32px, env(safe-area-inset-left, 0px));
  padding-right: max(32px, env(safe-area-inset-right, 0px));
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 24px;
  top: 12px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--bg);
}

.muted {
  color: var(--ink-3);
}

/* ---------- Header and footer ---------- */

.site-head {
  padding-block: 28px;
}

.site-head .wrap,
.site-foot .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 28px;
  font-size: 15px;
}

.nav a {
  text-decoration: none;
  color: var(--ink-2);
}

.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--ink);
  text-decoration: underline;
}

.site-foot {
  margin-top: 40px;
  padding-block: 28px 44px;
  font-size: 14px;
  color: var(--ink-3);
}

.site-foot .wrap > div {
  display: flex;
  gap: 24px;
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(72px, 14vh, 152px) clamp(64px, 11vh, 120px);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 7.4vw, 100px);
  line-height: 1.02;
  letter-spacing: -0.012em;
  max-width: 12em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: italic;
}

.hero p {
  margin-top: 28px;
  max-width: 33em;
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  font-size: 15px;
  color: var(--ink-2);
}

.availability::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent);
}

/* ---------- Rows: a label on the left, the content on the right ---------- */

.row {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  gap: 24px 48px;
  padding-block: clamp(56px, 9vh, 88px);
  border-top: 1px solid var(--rule);
}

.row > h2 {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink-3);
  padding-top: 4px;
}

/* ---------- Work ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px 40px;
}

.project {
  display: grid;
  gap: 20px;
  align-content: start;
}

.project .tile {
  display: block;
  padding: clamp(18px, 2.4vw, 28px);
  border-radius: 14px;
  background: var(--tile);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project .tile img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  box-shadow:
    0 1px 2px rgba(18, 20, 24, 0.08),
    0 12px 32px rgba(18, 20, 24, 0.12);
}

.project .tile:hover {
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  .project .tile {
    transition: none;
  }

  .project .tile:hover {
    transform: none;
  }
}

.project .text {
  display: grid;
  gap: 8px;
}

.project .kind {
  font-size: 14px;
  color: var(--ink-3);
}

.project h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 2.6vw, 34px);
  line-height: 1.1;
}

.project p {
  color: var(--ink-2);
  font-size: 16px;
}

.project .link {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  width: fit-content;
}

/* ---------- Clients ---------- */

.clients-intro {
  max-width: 36em;
  color: var(--ink-2);
}

.names {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 32px;
  margin-top: 32px;
  font-size: 16px;
}

/* ---------- About and contact ---------- */

.prose {
  display: grid;
  gap: 18px;
  max-width: 34em;
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-2);
}

.mail {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.1;
  text-decoration-thickness: 1px;
  word-break: break-word;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 24px;
  font-size: 16px;
  font-weight: 500;
}

/* ---------- CV ---------- */

.cv {
  padding-top: clamp(32px, 6vh, 64px);
}

.cv-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.cv-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 40px;
  align-items: end;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--ink);
}

.cv-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.01em;
}

.cv-role {
  margin-top: 14px;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--ink-2);
}

.cv-contact {
  display: grid;
  gap: 2px;
  font-size: 15px;
  text-align: right;
}

.cv-block {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  gap: 16px 48px;
  padding-block: 32px;
  border-bottom: 1px solid var(--rule);
}

.cv-block:last-child {
  border-bottom: 0;
}

.cv-block > h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  line-height: 1.7;
}

.cv-profile {
  display: grid;
  gap: 12px;
  max-width: 44em;
  color: var(--ink-2);
}

.h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.skills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 32px;
}

.skills h3 {
  margin-bottom: 6px;
}

.skills li,
.role li {
  position: relative;
  padding-left: 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}

.skills li + li,
.role li + li {
  margin-top: 4px;
}

.skills li::before,
.role li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 1px;
  background: var(--ink-3);
}

.roles {
  display: grid;
  gap: 26px;
}

.role {
  display: grid;
  gap: 4px;
  break-inside: avoid;
}

.role-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 24px;
  flex-wrap: wrap;
}

.role-head .when {
  font-size: 15px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.role .where {
  font-size: 15px;
  color: var(--ink-2);
}

.role ul {
  margin-top: 6px;
}

.cv-clients {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 48em;
}

.edu {
  display: grid;
  gap: 14px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
  .row,
  .cv-block {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .projects {
    grid-template-columns: minmax(0, 1fr);
  }

  .names {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cv-top {
    grid-template-columns: minmax(0, 1fr);
  }

  .cv-contact {
    text-align: left;
  }

  .skills {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .wrap {
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
  }

  .nav {
    gap: 18px;
  }
}

/* ---------- Print: the CV's PDF is printed from its page ---------- */

@page {
  size: A4;
  margin: 14mm 15mm;
}

@media print {
  :root {
    --bg: #ffffff;
    --ink: #121418;
    --ink-2: #33373e;
    --ink-3: #5b616b;
    --rule: #dcdfe3;
    color-scheme: light;
  }

  body {
    font-size: 10pt;
    line-height: 1.42;
  }

  .site-head,
  .site-foot,
  .cv-tools,
  .skip {
    display: none !important;
  }

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

  .cv {
    padding: 0;
  }

  /* A4's printable width counts as a narrow screen: put the wide layout back */
  .cv-top {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-bottom: 14pt;
  }

  .cv-contact {
    text-align: right;
  }

  .cv-name {
    font-size: 34pt;
  }

  .cv-role {
    margin-top: 6pt;
    font-size: 12pt;
  }

  .cv-block {
    grid-template-columns: 26mm minmax(0, 1fr);
    gap: 6pt 14pt;
    padding-block: 9pt;
  }

  .cv-block > h2 {
    font-size: 9.5pt;
  }

  .skills {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9pt 16pt;
  }

  .skills h3 {
    margin-bottom: 3pt;
  }

  .h3 {
    font-size: 10.5pt;
  }

  .roles {
    gap: 8pt;
  }

  .skills li + li,
  .role li + li {
    margin-top: 1pt;
  }

  .cv-contact,
  .role-head .when,
  .role .where,
  .role li,
  .skills li,
  .cv-clients,
  .cv-profile {
    font-size: 9pt;
  }

  a {
    text-decoration: none;
  }
}
