/* Ben Sapirstein, personal academic page.
   One column, no scripts. Tune the values in :root. */

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/inter-tight-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-tight-latin-600-normal.woff2") format("woff2");
}

:root {
  --measure: 40rem;          /* column width */
  --gutter: 1.25rem;         /* side padding on small screens */
  --space: 1rem;             /* base rhythm */
  --font-body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --font-head: "Inter Tight", "Helvetica Neue", Arial, sans-serif;

  --bg: #fbfaf7;
  --fg: #1c1b19;
  --muted: #5d5a54;
  --rule: #e2dfd8;
  --accent: #8a4b2a;         /* link colour, warm brown */
  --accent-hover: #5f3119;
  --focus: #2d6cdf;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --fg: #ebe8e1;
    --muted: #a39f96;
    --rule: #33312d;
    --accent: #e0a37d;
    --accent-hover: #f2c6a9;
    --focus: #8fb4ff;
  }
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  padding: clamp(2rem, 6vw, 5rem) var(--gutter) 4rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

.masthead, main, footer {
  max-width: var(--measure);
  margin-inline: auto;
}

/* Skip link */
.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: .5rem .75rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: .25rem;
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* Links */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: .06em;
  text-underline-offset: .14em;
}
a:hover { color: var(--accent-hover); }
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Masthead */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem 2rem;
  align-items: start;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.portrait { margin: 0; }
.portrait img {
  display: block;
  width: 11rem;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: .5rem;
}
.identity { min-width: 0; }

h1 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 .5rem;
}
.tagline {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--muted);
  margin: 0 0 .75rem;
}

.links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.1rem;
}
.links a {
  font-family: var(--font-head);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: .05em;
}
.links a:hover { border-bottom-width: 2px; }
.links a.icon {
  display: inline-flex;
  border-bottom: 0;
  padding: 0;
}
.links a.icon svg { display: block; }
.links a.icon:hover { opacity: .65; }

@media (max-width: 40rem) {
  .masthead {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .portrait img { width: 7.5rem; }
}

/* Sections */
section {
  padding-block: 2.5rem 0;
}
h2 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .9375rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
p { margin: 0 0 1rem; }
section > p:last-child { margin-bottom: 0; }

/* Research */
.research { margin: 0; }
.research div + div { margin-top: 1.1rem; }
.research dt {
  font-weight: 600;
  margin: 0 0 .15rem;
}
.research dd { margin: 0; color: var(--fg); }

/* Publications */
.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pubs li {
  display: grid;
  gap: .15rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.pubs li:last-child { border-bottom: 1px solid var(--rule); }
.pubs .title { font-weight: 600; }
.pubs .authors { }
.pubs .venue { color: var(--muted); font-size: 1rem; }
.pubs .pub-links { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .25rem; }
.pubs .pub-links a {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: .9375rem;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

/* Projects, teaching */
.projects, .plain {
  list-style: none;
  margin: 0;
  padding: 0;
}
.projects li + li, .plain li + li { margin-top: .75rem; }
.projects li a { font-weight: 600; }
.projects li span { display: block; }

/* Footer */
footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 1rem;
}
footer p { margin: 0 0 .25rem; }

@media print {
  body { padding: 0; background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .skip, .links a::after { display: none; }
}
