/* ------------------------------------------------------------------
   Fonts: Inclusive Sans (SIL Open Font License, see fonts/LICENSE.txt).
   Self-hosted, so no requests to third parties.
   ------------------------------------------------------------------ */
@font-face {
  font-family: "Inclusive Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/inclusive-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inclusive Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/inclusive-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inclusive Sans";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/inclusive-sans-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------
   Tokens. Change colours here. Text pairs are checked for contrast:
   light  text 14.0:1, muted 6.2:1, accent 6.7:1
   dark   text 14.7:1, muted 8.3:1, accent 9.7:1
   ------------------------------------------------------------------ */
:root {
  color-scheme: light dark;

  --bg: #ead6da; 
  --text: #17292b;
  --muted: #4b6063;
  --accent: #17615c;
  --rule: #c8d5d1;
  --bar-color: #ff6600;

  --font: "Inclusive Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --measure: 66ch;
  --portrait-ratio: 4 / 5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1b1c;
    --text: #e3edea;
    --muted: #a3b6b3;
    --accent: #7fcfc4;
    --rule: #2b3d3e;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: var(--text);
    --rule: var(--text);
  }
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  right: clamp(0.75rem, 2.5vw, 2.5rem);
  width: 0.4rem;
  background-color: var(--bar-color);
  z-index: -1;
  pointer-events: none;
}

.site-header,
main,
.site-footer {
  width: min(100% - 2 * var(--gutter), 70rem);
  margin-inline: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Elements that only receive focus from script (headings, main) */
[tabindex="-1"]:focus {
  outline: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.no-js .status {
  display: none;
}

.skip-link {
  position: absolute;
  top: -5rem;
  left: var(--gutter);
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ------------------------------------------------------------------
   Header and footer
   ------------------------------------------------------------------ */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding-block: 1rem;
}

.wordmark {
  padding-block: 0.65rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.wordmark:hover {
  text-decoration: underline;
}

.site-header ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  display: inline-block;
  padding: 0.65rem 0;
  border-bottom: 2px solid transparent;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.site-header nav a:hover {
  border-bottom-color: var(--accent);
}

.site-footer {
  padding-block: 3rem 4rem;
  color: var(--muted);
  font-size: 1rem;
}

.site-footer p {
  margin: 0;
}

/* ------------------------------------------------------------------
   Home: the headline is the one loud thing on the page
   ------------------------------------------------------------------ */
.hero {
  padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(1.5rem, 4vw, 3rem);
}

/* Text on the left (two thirds), portrait on the right (one third).
   On narrow screens the portrait moves below the text. */
.hero-portrait {
  max-width: 18rem;
  margin-top: 2rem;
}

.hero-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--portrait-ratio);
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--text) 8%, var(--bg));
}

@media (min-width: 52rem) {
  .hero--with-image {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
  }

  .hero-portrait {
    max-width: none;
    margin-top: 0;
  }
}

.headline {
  max-width: 22ch;
  margin: 0 0 clamp(1.5rem, 4vw, 2.5rem);
  font-size: clamp(2.25rem, 1.1rem + 4vw, 4.25rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
}

.section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  scroll-margin-top: 1rem;
}

.section > h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 0 1.5rem;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section > h2::before,
.section > h2::after {
  content: "";
  flex: 1;
  border-bottom: 2px solid var(--bar-color);
  margin-inline: 1rem;
}

.section-body {
  display: block;
}

.section-aside {
  margin-top: 1.5rem;
}

.section-sticky-image img {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: auto;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--text) 5%, var(--bg));
}

@media (min-width: 52rem) {
  .section-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
  }

  .section-aside {
    margin-top: 0;
    height: 100%;
  }

  .section-sticky-image {
    position: sticky;
    top: 1.5rem;
  }

  .section-sticky-image img {
    max-width: none;
  }
}

/* ------------------------------------------------------------------
   Project list
   ------------------------------------------------------------------ */
.project-list {
  max-width: 48rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project {
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
}

.project:first-child {
  padding-top: 0;
  border-top: 0;
}

.project h3 {
  margin: 0 0 0.25rem;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
}

.meta {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 1rem;
}

.meta > * + * {
  margin-inline-start: 1rem;
}

.project-summary {
  max-width: var(--measure);
  margin: 0 0 0.75rem;
}

.read-more {
  margin: 0;
  font-weight: 600;
}

/* ------------------------------------------------------------------
   Project page
   ------------------------------------------------------------------ */
.project-page {
  padding-block: clamp(1.5rem, 5vw, 3.5rem) clamp(2.5rem, 6vw, 4.5rem);
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding-block: 0.65rem;
  font-weight: 600;
}

.project-page h1 {
  max-width: 24ch;
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 1.2rem + 3.5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.project-page .meta {
  margin-bottom: 2rem;
}

/* ------------------------------------------------------------------
   Markdown content
   ------------------------------------------------------------------ */
.prose {
  max-width: var(--measure);
}

.prose > * {
  margin-block: 0;
}

.prose > * + * {
  margin-top: 1em;
}

.prose h2 {
  margin-top: 2em;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.prose h3 {
  margin-top: 1.75em;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.prose h4,
.prose h5,
.prose h6 {
  margin-top: 1.5em;
  font-size: 1.125rem;
  font-weight: 700;
}

.prose ul,
.prose ol {
  padding-inline-start: 1.5rem;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose blockquote {
  margin-inline: 0;
  padding-inline-start: 1.25rem;
  border-inline-start: 3px solid var(--accent);
}

.prose img {
  max-width: 100%;
  height: auto;
}

.prose hr {
  margin-block: 2em;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--text) 8%, var(--bg));
  font-size: 0.95rem;
  line-height: 1.5;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: start;
}

/* ------------------------------------------------------------------
   CV
   ------------------------------------------------------------------ */
.cv-intro {
  max-width: var(--measure);
  margin: 0 0 1rem;
}

.cv-group {
  margin-top: 2.5rem;
}

.cv-group h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.cv-list {
  max-width: 48rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cv-item {
  display: grid;
  gap: 0.15rem 2rem;
  padding-block: 1rem;
  border-top: 1px solid var(--rule);
}

.cv-item:first-child {
  border-top: 0;
}

.cv-period {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.cv-title {
  margin: 0;
  font-weight: 700;
}

.cv-org {
  margin: 0;
}

.cv-text {
  max-width: var(--measure);
  margin: 0.5rem 0 0;
}

.cv-details {
  max-width: var(--measure);
  margin: 0.5rem 0 0;
  padding-inline-start: 1.25rem;
}

@media (min-width: 40rem) {
  .cv-item {
    grid-template-columns: 9rem 1fr;
  }

  .cv-period {
    grid-column: 1;
    grid-row: 1;
  }

  .cv-main {
    grid-column: 2;
    grid-row: 1;
  }
}

/* ------------------------------------------------------------------
   Status and error messages
   ------------------------------------------------------------------ */
.status {
  padding-block: 3rem;
  color: var(--muted);
}

.notice {
  max-width: var(--measure);
  margin-block: 2rem;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
}

.notice p {
  margin: 0;
}

.notice p + p {
  margin-top: 0.75rem;
}

.notice-title {
  font-weight: 700;
}

/* ------------------------------------------------------------------
   Print: handy for saving the page as a PDF
   ------------------------------------------------------------------ */
@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --text: #000;
    --muted: #333;
    --accent: #000;
    --rule: #999;
  }

  body {
    font-size: 11pt;
  }

  .skip-link,
  .site-header nav,
  body::before {
    display: none;
  }

  .hero {
    padding-block: 1rem;
  }

  .headline {
    font-size: 24pt;
  }

  .section {
    padding-block: 1.25rem;
  }

  .cv-item,
  .project {
    break-inside: avoid;
  }
}
