/* ----------------------------------------------------------
   davidlitman.com
   Single stylesheet. No frameworks, no build step.
   Edit the variables below to retune the whole site.
---------------------------------------------------------- */

:root {
  --text:        #161616;
  --dim:         #66666a;
  --paper:       #f7f7f5;     /* neutral off-white, no yellow */
  --rule:        #dcdcd8;
  --mat:         #e6e6e2;     /* frame behind dark screenshots */
  /* Link colors come from the viridis colormap used in the research figures:
     its deep purple end for links, its teal middle on hover. */
  --accent:      #482878;     /* viridis purple, used only for links */
  --accent-soft: rgba(72, 40, 120, 0.3);
  --accent-hover:#21918c;     /* viridis teal */

  --serif:       "ET Book", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono:        "iA Writer Mono S", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure:     34rem;       /* readable column width */
  --lh:          1.55;
}

/* ET Book (Tufte's typeface), served from jsDelivr. */
@font-face {
  font-family: "ET Book";
  src: url("https://cdn.jsdelivr.net/gh/edwardtufte/tufte-css@gh-pages/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "ET Book";
  src: url("https://cdn.jsdelivr.net/gh/edwardtufte/tufte-css@gh-pages/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "ET Book";
  src: url("https://cdn.jsdelivr.net/gh/edwardtufte/tufte-css@gh-pages/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
}

/* --- Masthead ----------------------------------------- */

.masthead {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.masthead h1 {
  font-size: 2.4rem;
  font-weight: 400;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.affil {
  margin: 0 0 0.5rem;
  color: var(--dim);
  font-style: italic;
}

.contact {
  font-size: 0.9rem;
  color: var(--dim);
  margin: 0;
}

.contact a { color: var(--dim); }
.contact a:hover { color: var(--accent-hover); }

/* --- Sections ----------------------------------------- */

section {
  margin: 2.5rem 0;
}

h2 {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 1rem;
}

p {
  margin: 0 0 1rem;
}

.bio {
  font-size: 1.02rem;
}

/* --- Figures (photos, etc.) ----------------------------- */

.figure {
  margin: 2rem 0 2.25rem;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
}

.figure figcaption {
  font-size: 0.9rem;
  color: var(--dim);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Figures with a white background: multiply makes the white take on
   the page color, so the image sits directly on the page. */
.figure--blend img {
  mix-blend-mode: multiply;
  border: none;
}

/* Dark screenshots: a neutral mat eases the step from the light page
   into the dark image. */
.figure--mat img {
  padding: 0.6rem;
  background: var(--mat);
  border: none;
}

.figure--small {
  margin: 1.25rem 0 0;
  max-width: 15rem;
}

.figure--medium {
  margin: 1.5rem 0 2rem;
  max-width: 18rem;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.figure-grid .figure { margin: 0; }

@media (max-width: 600px) {
  .figure-grid { grid-template-columns: 1fr; }
}

.tips {
  margin-top: 3rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--dim);
}

.tips h2 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.tips .list li {
  margin-bottom: 0.45rem;
}

.tips strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Links -------------------------------------------- */

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: color 0.15s, border-color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

/* --- Lists -------------------------------------------- */

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  margin-bottom: 0.9rem;
  padding-left: 1rem;
  text-indent: -1rem;
}

.list li::before {
  content: "•  ";
  color: var(--dim);
}

/* Bibliography (books, etc.) */

.biblio {
  list-style: none;
  padding: 0;
  margin: 0;
}

.biblio li {
  margin-bottom: 0.65rem;
}

.biblio cite {
  font-style: italic;
}

.biblio .dim::before {
  content: " · ";
}

.dim {
  color: var(--dim);
}

/* --- Home: large section links ------------------------ */

.big-links {
  display: flex;
  flex-direction: column;
  margin: 2.5rem 0 3rem;
  border-top: 1px solid var(--rule);
}

.big-link {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.big-link:hover {
  color: var(--accent-hover);
}

/* --- Footer ------------------------------------------- */

footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--dim);
}

footer p { margin: 0; }

/* --- Sub-page styles (used in /math, /neuro, /blog) ---- */

.subpage h1 {
  font-size: 1.8rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.subpage .back {
  font-size: 0.9rem;
  color: var(--dim);
  display: inline-block;
  margin-bottom: 2rem;
}

article.entry {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

article.entry:last-child {
  border-bottom: none;
}

article.entry h3 {
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 0.25rem;
}

article.entry ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

article.entry ol li {
  margin-bottom: 0.4rem;
}

article.entry .meta {
  font-size: 0.9rem;
  color: var(--dim);
  margin-bottom: 0.75rem;
}

/* --- Blog posts --------------------------------------- */

.post h1 {
  margin-bottom: 1.5rem;
}

.post-body {
  margin-bottom: 2rem;
}

.post-body p {
  margin-bottom: 1rem;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

.post-body li {
  margin-bottom: 0.5rem;
}

.post-body li p {
  margin-bottom: 0.35rem;
}

/* --- Responsive --------------------------------------- */

@media (max-width: 600px) {
  html, body { font-size: 17px; }
  main { padding: 3rem 1.25rem 4rem; }
  .masthead h1 { font-size: 1.9rem; }
  .big-link { font-size: 1.3rem; }
}

/* --- Print -------------------------------------------- */

@media print {
  body { background: white; color: black; }
  a { color: black; border-bottom: none; }
  .contact, footer { display: none; }
}
