/* artificialpathologist.com
   Palette taken from haematoxylin and eosin: violet ink on a clean glass-slide white,
   with eosin pink for hover and small accents. */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader.woff") format("woff");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-italic.woff") format("woff");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --slide: #f7f7fb;
  --ink: #241f45;
  --muted: #625d80;
  --hema: #4a3c92;
  --eosin: #b33a6c;
  --rule: #e3e1ee;
  --tint: #efecf6;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --measure: 40rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --slide: #17152a;
    --ink: #ebe8f6;
    --muted: #a6a1c2;
    --hema: #b9adf6;
    --eosin: #f29bbc;
    --rule: #2e2a47;
    --tint: #221f39;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --slide: #17152a;
  --ink: #ebe8f6;
  --muted: #a6a1c2;
  --hema: #b9adf6;
  --eosin: #f29bbc;
  --rule: #2e2a47;
  --tint: #221f39;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--slide);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.62;
  font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2.5rem);
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--ink);
  color: var(--slide);
  padding: 0.4rem 0.8rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.skip:focus { left: 0.5rem; z-index: 10; }

/* Header */
.site-header { padding: 1.4rem 0 1.2rem; }
.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 64rem;
}
.site-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.site-name:hover { color: var(--hema); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1.4rem; font-family: var(--sans); font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 0.2rem 0; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--eosin);
}
.theme-toggle {
  background: none;
  border: 0;
  padding: 0.25rem;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  border-radius: 50%;
}
.theme-toggle:hover { color: var(--ink); }

/* Home: the specimen strip */
.specimen {
  margin: 0 auto;
  width: calc(100% - 2.5rem);
  max-width: 61.5rem;
}
.specimen-frame {
  height: clamp(160px, 25vw, 246px);
  overflow: hidden;
  border-radius: 3px;
  background: var(--tint);
}
.specimen img { width: 100%; height: 100%; object-fit: cover; object-position: 18% 50%; display: block; }
:root[data-theme="dark"] .specimen img { filter: brightness(0.9); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .specimen img { filter: brightness(0.9); }
}
@media (max-width: 40rem) {
  .specimen { width: 100%; }
  .specimen-frame { border-radius: 0; }
}

.intro { margin: 2.2rem 0 0; }
.intro h1 {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 0.7rem;
}
.lede {
  font-size: 1.32rem;
  line-height: 1.4;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

/* Page headings */
.page-head { margin: 2.4rem 0 1.8rem; }
.page-head h1 {
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 0.6rem;
}
.post-meta, .post-list time, .cv-dates, .feed-note, .site-footer, .more, .download, .where {
  font-family: var(--sans);
  font-variant-numeric: lining-nums tabular-nums;
}
.post-meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.6rem; }

/* Prose */
.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre, .prose figure { margin: 0 0 1.15em; }
.prose h2 { font-size: 1.55rem; line-height: 1.25; font-weight: 600; margin: 2.2em 0 0.6em; letter-spacing: -0.01em; }
.prose h3 { font-size: 1.25rem; line-height: 1.3; font-weight: 600; margin: 1.8em 0 0.5em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--muted); }
.prose blockquote {
  margin-left: 0;
  padding-left: 1.1rem;
  border-left: 3px solid var(--eosin);
  color: var(--muted);
  font-style: italic;
}
.prose img { max-width: 100%; height: auto; display: block; border-radius: 3px; }
.prose img + em, .prose p > img + em { display: block; font-size: 0.95rem; color: var(--muted); margin-top: 0.5rem; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: var(--tint);
  padding: 0.12em 0.32em;
  border-radius: 3px;
}
.prose pre {
  background: var(--tint);
  padding: 1rem 1.1rem;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
}
.prose pre code { background: none; padding: 0; font-size: 0.82rem; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 0.95rem; font-variant-numeric: lining-nums tabular-nums; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.45rem 0.8rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 600; border-bottom-color: var(--muted); }
.prose .footnotes { font-size: 0.95rem; color: var(--muted); border-top: 1px solid var(--rule); margin-top: 3rem; padding-top: 1rem; }

/* Lists of posts and talks */
.index-section { margin: 3rem 0 0; max-width: var(--measure); }
.index-section h2, .cv .prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
  letter-spacing: -0.01em;
}
.post-list, .prose .post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.post-list li:last-child { border-bottom: 1px solid var(--rule); }
.post-list time { color: var(--muted); font-size: 0.88rem; }
.post-list a { text-decoration: none; color: var(--ink); }
.post-list a:hover { color: var(--eosin); }
.post-list .where { display: block; color: var(--muted); font-size: 0.88rem; }
.post-list-full li { padding: 0.9rem 0; }
.post-list-full a { font-size: 1.25rem; line-height: 1.3; }
.post-list-full p { margin: 0.25rem 0 0; color: var(--muted); font-size: 1.02rem; }
.more { font-size: 0.92rem; margin: 0.9rem 0 0; }
.empty { color: var(--muted); font-style: italic; }
.feed-note, .prose .feed-note { color: var(--muted); font-size: 0.9rem; margin-top: 2rem; }

/* Profile links */
.profile-links {
  list-style: none;
  padding: 0;
  margin: 1.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}

/* CV */
.cv .prose h2 { margin-top: 2.6rem; }
.download { font-size: 0.95rem; margin-top: 1rem; }
.cv-list, .prose .cv-list { list-style: none; margin: 0; padding: 0; }
.cv-list li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}
.cv-list p { margin: 0; }
.cv-dates { color: var(--muted); font-size: 0.88rem; padding-top: 0.2rem; }
.cv-title { font-weight: 600; }
.cv-org { color: var(--muted); }
.cv-details { margin-top: 0.3rem !important; font-size: 1.05rem; }
.pub-list { padding-left: 1.3em; }
.pub-list li { margin-bottom: 0.7rem; }
.skills { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.5rem 1rem; margin: 0; }
.skills dt { font-family: var(--sans); font-size: 0.88rem; color: var(--muted); padding-top: 0.2rem; }
.skills dd { margin: 0; }

/* Post navigation */
.post-nav {
  max-width: var(--measure);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 3.5rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}
.post-nav a { text-decoration: none; color: var(--ink); line-height: 1.35; }
.post-nav a:hover { color: var(--eosin); }
.post-nav span { display: block; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin-bottom: 0.2rem; }
.post-nav .next { grid-column: 2; text-align: right; }

/* Footer */
.site-footer { margin-top: 5rem; padding: 1.6rem 0 2.2rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.88rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 2rem; align-items: baseline; }
.footer-row p { margin: 0; }
.site-footer .profile-links { margin: 0; font-size: 0.88rem; gap: 0.4rem 1rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--eosin); }
.home .site-footer .profile-links { display: none; }
.site-footer .credit { flex-basis: 100%; font-size: 0.8rem; }

/* Syntax highlighting (Rouge) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc, .highlight .ow { color: var(--hema); font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sd, .highlight .se { color: var(--eosin); }
.highlight .m, .highlight .mi, .highlight .mf { color: var(--eosin); }
.highlight .nf, .highlight .nc, .highlight .nb { color: var(--hema); }

@media (max-width: 34rem) {
  body { font-size: 1.125rem; }
  .wrap { padding: 0 1rem; }
  .site-nav { gap: 1.1rem; }
  .post-list li, .cv-list li, .skills { grid-template-columns: 1fr; gap: 0.15rem; }
  .skills dd { margin-bottom: 0.6rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: 1; text-align: left; }
}

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

/* Home: align the name and footer with the banner edge */
.home main .wrap,
.home .site-footer .wrap { max-width: 64rem; }
