/*
  One stylesheet for the whole site.

  The pages are set like the first pages of a paper, to sit next to the CV:
  one serif family, a centred title block, one framed block for the Sinkmates
  app, a narrower summary, and a contents list with dot leaders. Text is set
  ragged-right: browsers do not hyphenate reliably, and justified lines without
  hyphenation leave wide gaps. Colours: black ink on white paper, cyanotype
  blue for links. In dark mode the page becomes the blue print itself.
*/

/* STIX Two Text, SIL Open Font License 1.1 (see fonts/OFL.txt). */
@font-face {
  font-family: "STIX Two Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-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: "STIX Two Text";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-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;
}
/* Extended Latin: only downloaded when a page uses one of these letters, such as the "ō" in manifōld. */
@font-face {
  font-family: "STIX Two Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-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+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: "STIX Two Text";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-wght-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}

:root {
  --paper: #ffffff;
  --ink: #000000;
  --quiet: #595959; /* dates and one-line descriptions */
  --link: #1b4f9c; /* cyanotype blue */
  --leader: #8c8c8c;
  --measure: 40rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c2340;
    --ink: #f3f5f7;
    --quiet: #aebbd0;
    --link: #a9cdf6;
    --leader: #62799a;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "STIX Two Text", Cambria, "Libertinus Serif", Georgia, serif;
  font-size: 1.1875rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1,
h2,
p,
ul {
  margin: 0;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

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

.page {
  max-width: var(--measure);
  margin-inline: auto;
  padding: clamp(3rem, 12vh, 7.5rem) 1.5rem 6rem;
}

/* ---------- Home: title block ---------- */

.title {
  text-align: center;
}

.title h1 {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.title-role {
  margin-top: 0.75rem;
  font-size: 1.3125rem;
  font-style: italic;
}

.title-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 2rem;
  margin-top: 1.75rem;
  font-size: 1.0625rem;
}

/* ---------- Home: the Sinkmates app, the one framed block on the site ---------- */

.feature {
  margin-top: 3.25rem;
  padding: 1.5rem 1.75rem 1.6rem;
  border: 1px solid var(--ink);
}

.feature-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.feature-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.feature-when {
  color: var(--quiet);
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feature-text {
  margin-top: 0.6rem;
  text-wrap: pretty;
}

.feature-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 2rem;
  margin-top: 1rem;
}

.feature-open {
  font-size: 1.3125rem;
  font-weight: 700;
}

/* ---------- Home: summary, set narrower like an abstract ---------- */

.abstract {
  margin-top: 3rem;
  padding-inline: 2.5rem;
  font-size: 1.0625rem;
  text-wrap: pretty;
}

/* ---------- Home: project list with dot leaders ---------- */

.section-title {
  margin-top: 3.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.contents {
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
}

.contents-item + .contents-item {
  margin-top: 1.25rem;
}

.contents-line {
  display: flex;
  align-items: baseline;
}

/* An empty flex item sits with its bottom edge on the text baseline, so the dots line up with the words. */
.contents-leader {
  flex: 1;
  min-width: 1.5rem;
  height: 4px;
  margin-inline: 0.6rem;
  background-image: radial-gradient(circle at 50% calc(100% - 1px), var(--leader) 1px, transparent 1.4px);
  background-size: 0.5em 4px;
  background-repeat: repeat-x;
}

.contents-when {
  color: var(--quiet);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.contents-what {
  margin-top: 0.15rem;
  color: var(--quiet);
  font-size: 1.0625rem;
  text-wrap: balance;
}

/* ---------- Inner pages: running head ---------- */

.running-head {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 1.5rem 1.5rem 0;
}

.running-head-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--ink);
  font-size: 1rem;
  font-style: italic;
}

.running-head-line a {
  color: inherit;
  text-decoration: none;
}

.running-head-line a:hover {
  text-decoration: underline;
}

.page.page-inner {
  padding-top: 3.5rem;
}

.page-title {
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* ---------- Projects page: one entry per project, like a CV entry ---------- */

.entry {
  margin-top: 3.25rem;
  scroll-margin-top: 2rem;
}

.entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.entry-title {
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}

.entry-when {
  color: var(--quiet);
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry-context {
  font-style: italic;
}

.entry-text {
  margin-top: 0.75rem;
  text-wrap: pretty;
}

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  margin-top: 0.75rem;
}

.closing {
  margin-top: 4.5rem;
}

/* ---------- Not-found page ---------- */

.notice {
  margin-top: 1.25rem;
}

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

@media (max-width: 34rem) {
  body {
    font-size: 1.125rem;
  }

  .feature {
    padding: 1.25rem 1.25rem 1.35rem;
  }

  .feature-head {
    display: block;
  }

  .abstract {
    padding-inline: 0;
  }

  .contents-line {
    display: block;
  }

  .contents-leader {
    display: none;
  }

  .contents-when {
    display: block;
    font-size: 1rem;
  }

  .entry-head {
    display: block;
  }

  .entry-when {
    display: block;
  }
}
