/* leoduncan.dev: premium but understated. White page, ink text, generous space, one typeface
   (Instrument Sans, self-hosted, OFL) in a few deliberate sizes. One left edge for everything:
   each section's title sits above its content, and images run the full width of their card so
   text and pictures line up. (Tried: a serif display face, read as handwritten; a label column,
   left titles floating beside the content.) */

@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;
}

: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;
  --max: 1120px;
  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-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  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(56px, 11vh, 120px) clamp(24px, 4vh, 48px);
}

.hero h1 {
  font-weight: 500;
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.032em;
  max-width: 17em;
  text-wrap: balance;
}

.hero p {
  margin-top: 24px;
  max-width: 34em;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  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);
  animation: available 2.4s ease-in-out infinite;
}

@keyframes available {
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 8%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .availability::before {
    animation: none;
  }

  .project .shot img {
    transition: none;
  }

  .project .shot:hover img {
    transform: none;
  }
}

/* ---------- Sections: a title above the content, on the same left edge ---------- */

.section {
  padding-top: clamp(48px, 7vh, 72px);
  margin-top: clamp(48px, 7vh, 72px);
  border-top: 1px solid var(--rule);
}

.section-title {
  margin-bottom: 36px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

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

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

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

.project .shot {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--rule),
    0 10px 30px rgba(18, 20, 24, 0.08);
  transition:
    transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.35s;
}

.project .shot img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project .shot:hover img {
  transform: scale(1.025);
}

/* "Live demo": these are playable, not pictures */
.live {
  position: absolute;
  left: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgba(18, 20, 24, 0.12);
  font-size: 13px;
  font-weight: 600;
  color: #121418;
}

.live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.pill:hover {
  background: var(--ink-2);
  color: var(--bg);
}

.project .shot:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px var(--rule),
    0 18px 40px rgba(18, 20, 24, 0.12);
}

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

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

.project .text {
  display: grid;
  gap: 8px;
  max-width: 34em;
}

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

.project h3 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.012em;
}

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

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

.project .links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 8px;
}

.project .link.quiet {
  font-weight: 500;
  color: var(--ink-2);
}

.nda {
  margin-top: 18px;
  font-size: 15px;
  color: var(--ink-3);
}

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

.clients-intro {
  max-width: 40em;
  font-size: 17px;
  color: var(--ink-2);
}

.names {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 32px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
}

.names li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 20px 16px;
  background: var(--bg);
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-2);
}

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

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

.mail {
  font-size: clamp(20px, 5.2vw, 30px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  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: 500;
  text-decoration: none;
}

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

.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.button.primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: var(--bg);
}

/* About: a short paragraph beside a scannable list of roles */
.about {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px clamp(32px, 5vw, 72px);
  align-items: start;
}

.timeline {
  border-top: 1px solid var(--rule);
}

.timeline li {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 16px;
  padding-block: 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.45;
}

.timeline .when {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.timeline .what {
  display: grid;
}

.timeline .what span {
  color: var(--ink-2);
}

.timeline strong {
  font-weight: 500;
}

.contact-actions {
  margin-top: 28px;
}

.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-weight: 500;
  font-size: clamp(36px, 4.6vw, 54px);
  line-height: 1;
  letter-spacing: -0.035em;
}

.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: 180px 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: 15px;
  font-weight: 600;
  line-height: 1.55;
}

.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) {
  .cv-block {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

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

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

  .projects {
    gap: 56px;
  }

  .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: 30pt;
  }

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

  /* Print as blocks, label floated beside: a grid section won't split across pages */
  .cv-block {
    display: block;
    padding-block: 9pt;
  }

  .cv-block::after {
    content: '';
    display: block;
    clear: both;
  }

  .cv-block > h2 {
    float: left;
    width: 26mm;
  }

  .cv-block > :not(h2) {
    margin-left: 30mm;
  }

  .roles {
    display: block;
  }

  .role + .role {
    margin-top: 8pt;
  }

  .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;
  }
}
