/* ==========================================================================
   pgaref.com
   One stylesheet, plain CSS, no build step, no framework.
   ========================================================================== */

:root {
  /* Warm neutrals. The ground is off-white with a little warmth in it so the
     page does not read as an unstyled browser default. */
  --bg:        #FBFAF8;
  --bg-raised: #FFFFFF;
  --text:      #23211E;
  --heading:   #14120F;
  --muted:     #6E675F;
  --faint:     #787168;
  --rule:      #E5E0D9;
  --rule-soft: #EFECE6;
  --accent:    #234677;
  --accent-lift: #2E5A97;
  --code-bg:   #F3F0EA;

  --sans: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --w: 50rem;
  --mark: 68px;   /* header monogram size */

  /* One spacing scale, used everywhere. */
  --s1: .25rem;
  --s2: .5rem;
  --s3: .75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #191817;
    --bg-raised: #201E1C;
    --text:      #E4E0D9;
    --heading:   #F8F5F0;
    --muted:     #9C948A;
    --faint:     #8C857B;
    --rule:      #2E2B27;
    --rule-soft: #242120;
    --accent:    #A6C0E8;
    --accent-lift: #C2D5F2;
    --code-bg:   #221F1D;
  }
}
:root[data-theme="dark"] {
  --bg:        #191817;
  --bg-raised: #201E1C;
  --text:      #E4E0D9;
  --heading:   #F8F5F0;
  --muted:     #9C948A;
  --faint:     #8C857B;
  --rule:      #2E2B27;
  --rule-soft: #242120;
  --accent:    #A6C0E8;
  --accent-lift: #C2D5F2;
  --code-bg:   #221F1D;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.66;
  font-weight: 400;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

::selection { background: var(--heading); color: var(--bg); }

.container {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 var(--s5);
}

/* --------------------------------------------------------- links
   Links take the text colour with a quiet underline, and pick up the accent
   on hover. Blue-by-default links are the single biggest thing that makes a
   page read as an unstyled document. */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--faint);
  transition: color .14s ease, text-decoration-color .14s ease;
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
  text-decoration: none;
}

/* --------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--rule);
  padding: var(--s5) 0;
  margin-bottom: var(--s7);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s5);
}
.site-header .wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--heading);
  text-decoration: none;
  line-height: 0;
}
.site-header .wordmark .mark {
  display: block;
  width: var(--mark);
  height: var(--mark);
  transition: color .14s ease;
}
.site-header .wordmark:hover { color: var(--accent); }

.site-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  font-size: .875rem;
  font-weight: 500;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--heading); }
.site-nav a[aria-current="page"] { color: var(--heading); }

/* --------------------------------------------------------- headings */

h1, h2, h3, h4 {
  color: var(--heading);
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.125rem, 1.75rem + 1.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -.023em;
  line-height: 1.1;
  margin-bottom: var(--s3);
}

/* Section labels. Small, tracked, quiet: they organise the page without
   competing with the content underneath them. */
h2 {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
  margin: var(--s8) 0 var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.011em;
  line-height: 1.35;
  margin: 0 0 var(--s1);
}

p { margin: 0 0 var(--s4); }
p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------- intro */

.intro { margin-bottom: var(--s2); }

.intro .role {
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 400;
  margin: 0 0 var(--s5);
}

.lead {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--text);
}


.meta-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  font-size: .9375rem;
  margin-top: var(--s5);
}
.meta-links a { text-decoration-color: var(--faint); }

/* Closing links at the foot of the home page: same treatment as the intro
   links, but set off from the section above it. */
.onward {
  margin-top: var(--s8);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
}

/* --------------------------------------------------------- row lists
   A date column plus content, used for experience, publications, talks and
   writing. Tabular figures keep the left column optically aligned. */

.rows { margin: 0; padding: 0; list-style: none; }
.rows.spaced { margin-top: var(--s6); }

.rows > li {
  display: flex;
  gap: 0 var(--s6);
  padding: var(--s4) 0;
  border-top: 1px solid var(--rule-soft);
}
.rows > li:first-child { border-top: 0; padding-top: 0; }

.rows .when {
  /* .3rem is an optical nudge: aligns the date baseline with the first
     line of .what, which sits on a larger line-height. Not on the scale. */
  flex: 0 0 9rem;
  color: var(--faint);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .012em;
  font-variant-numeric: tabular-nums;
  padding-top: .3rem;
}
.rows .what { flex: 1 1 auto; min-width: 0; }

.rows .what .title {
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -.009em;
}
/* Paper and talk titles run long and wrap. A persistent underline then
   renders once per line, which reads as a doubled rule rather than a link.
   These are unmistakably links from context, so underline on hover only. */
.rows .what .title { text-decoration: none; }
.rows .what .title:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent);
}
.rows .what .title-plain {
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -.009em;
}
.rows .what .org {
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -.009em;
}
.rows .what .sub {
  color: var(--muted);
  font-size: .9375rem;
}
.rows .what .note { margin: var(--s1) 0 0; }
.rows .what .refs { margin-top: var(--s2); }
.rows .what .authors {
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.5;
  margin: var(--s1) 0 0;
}

@media (max-width: 34rem) {
  .rows > li { flex-direction: column; gap: var(--s1); }
  .rows .when { flex: none; padding-top: 0; }
}

/* --------------------------------------------------------- work entries */

.entry {
  padding: var(--s5) 0;
  border-top: 1px solid var(--rule-soft);
}
/* The first .entry sits directly under an h2, which already draws a rule.
   :first-child never matched here (the intro section is the container's first
   child), so the two rules stacked into a double line. */
h2 + .entry { border-top: 0; padding-top: 0; }

.entry .head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s1) var(--s4);
  margin-bottom: var(--s2);
}
.entry .where {
  color: var(--faint);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .012em;
  font-variant-numeric: tabular-nums;
}
.entry p {
  margin: 0 0 var(--s3);
  color: var(--text);
}

/* --------------------------------------------------------- reference links */

.refs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  font-size: .8125rem;
  font-weight: 500;
  margin: 0;
  padding: 0;
  list-style: none;
}
.refs a { color: var(--muted); text-decoration-color: var(--faint); }
.refs a:hover { color: var(--accent); }

/* --------------------------------------------------------- plain lists */

.plain { margin: 0; padding: 0; list-style: none; }
.plain > li {
  padding: var(--s2) 0;
  font-size: .9375rem;
}
.plain > li a { font-weight: 600; color: var(--heading); letter-spacing: -.009em; }
.plain .role-tag { color: var(--muted); }

.two-col { columns: 2; column-gap: var(--s7); }
.two-col > li { break-inside: avoid; }
@media (max-width: 34rem) { .two-col { columns: 1; } }

/* --------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: var(--s8);
  padding: var(--s5) 0 var(--s7);
  color: var(--faint);
  font-size: .8125rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  justify-content: space-between;
}
.site-footer a { text-decoration-color: var(--faint); }

/* --------------------------------------------------------- blog posts */

.post-title {
  font-size: clamp(1.75rem, 1.5rem + 1vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -.026em;
  line-height: 1.14;
  margin-bottom: var(--s2);
}
.post-meta {
  color: var(--faint);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .012em;
  margin-bottom: var(--s7);
}

.post { max-width: none; }
.post h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.014em;
  text-transform: none;
  color: var(--heading);
  border-bottom: 0;
  padding-bottom: 0;
  margin: var(--s7) 0 var(--s3);
}
.post h3 {
  font-size: 1.0625rem;
  margin: var(--s6) 0 var(--s2);
}
.post img { max-width: 100%; height: auto; border-radius: 2px; }
.post blockquote {
  margin: var(--s5) 0;
  padding: 0 0 0 var(--s4);
  border-left: 2px solid var(--rule);
  color: var(--muted);
}
.post ul, .post ol { padding-left: 1.35rem; }
.post li { margin: var(--s1) 0; }

code, kbd, samp {
  font-family: var(--mono);
  font-size: .8125em;
  background: var(--code-bg);
  padding: .14em .36em;
  border-radius: 3px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: var(--s4);
  overflow-x: auto;
  font-size: .8125rem;
  line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: inherit; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
th, td {
  text-align: left;
  padding: var(--s2) var(--s4) var(--s2) 0;
  border-bottom: 1px solid var(--rule-soft);
}
th { color: var(--muted); font-weight: 600; font-size: .8125rem; letter-spacing: .02em; }

hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s7) 0; }

.post-comments {
  margin-top: var(--s7);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule-soft);
  color: var(--muted);
  font-size: .9375rem;
}

/* --------------------------------------------------------- utility */

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.stack-list {
  margin: var(--s2) 0 0;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
