:root {
  --paper: #FCFCFA;
  --ink: #1B1E24;
  --muted: #5B616E;
  --rule: #E3E3DF;
  --accent: #2D4A7A;
  --accent-strong: #1C3358;
  --measure: 38rem;
  --margin-col: 10.5rem;
  --gap: 2.5rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15171B;
    --ink: #E6E5E0;
    --muted: #A3A7AF;
    --rule: #2C2F35;
    --accent: #A8BCE8;
    --accent-strong: #C9D6F2;
  }
}
:root[data-theme="dark"] {
  --paper: #15171B;
  --ink: #E6E5E0;
  --muted: #A3A7AF;
  --rule: #2C2F35;
  --accent: #A8BCE8;
  --accent-strong: #C9D6F2;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Literata", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--paper); }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -3rem;
  padding: 0.4rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}
.skip:focus { top: 0.75rem; }

.page {
  max-width: calc(var(--margin-col) + var(--gap) + var(--measure) + 4rem);
  margin: 0 auto;
  padding: 0 16px;
}

/* Masthead */
.masthead {
  padding: 3.5rem 0 2.25rem;
  border-bottom: 1px solid var(--rule);
}
.name {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 4.25rem);
  font-weight: 340;
  line-height: 1.04;
  letter-spacing: -0.018em;
}
.name a { color: inherit; text-decoration: none; }
.descriptor {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1.0625rem;
}
.masthead nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  margin: 1.9rem 0 0;
  padding: 0;
}
.masthead nav a {
  color: var(--ink);
  text-decoration-color: transparent;
}
.masthead nav a:hover { color: var(--ink); text-decoration-color: var(--accent); }
.masthead nav a[aria-current="page"] { text-decoration-color: var(--ink); }

/* Subpages: a smaller name so the content starts higher */
.masthead.compact { padding: 2.25rem 0 1.75rem; }
.masthead.compact .name {
  font-size: clamp(1.7rem, 5.5vw, 2.1rem);
  font-weight: 380;
  letter-spacing: -0.01em;
}
.masthead.compact nav ul { margin-top: 1.1rem; }

/* Sections: heading in the margin, text in the measure */
section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 0.5rem;
}
.sec-title {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
}
.text { max-width: var(--measure); }
.text > :first-child { margin-top: 0; }
.text > :last-child { margin-bottom: 0; }
p { margin: 0 0 1em; }

.text h2 {
  margin: 2.1rem 0 0.6rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Publications */
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entries li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  column-gap: 0.85rem;
  padding: 0.55rem 0;
}
.year {
  color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.gloss {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.92em;
}
.note { color: var(--muted); }

/* Teaching */
.courses {
  list-style: none;
  margin: 0;
  padding: 0;
}
.courses li { padding: 0.35rem 0; }
.where {
  display: block;
  color: var(--muted);
  font-size: 0.92em;
}

/* Contact */
.contact { margin: 0; }
.contact div { padding: 0.3rem 0; }
.contact dt { color: var(--muted); font-size: 0.92em; }
.contact dd { margin: 0; overflow-wrap: anywhere; }

footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (min-width: 900px) {
  body { font-size: 1.125rem; }
  .page { padding: 0 2rem; }
  .masthead { padding: 5rem 0 2.75rem; }
  .masthead.compact { padding: 3rem 0 2rem; }
  section {
    grid-template-columns: var(--margin-col) minmax(0, var(--measure));
    column-gap: var(--gap);
    padding: 3.25rem 0;
  }
  .sec-title {
    position: sticky;
    top: 1.75rem;
    align-self: start;
    margin: 0;
    padding-top: 0.1rem;
  }
  .contact div {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    column-gap: 1rem;
  }
  .contact dt { font-size: 1em; }
}
