/* eddylab.org style sheet
 *
 * Styles plain HTML elements, so the pages need almost no classes.
 * The only classes are .people (people page photo list), .pubs
 * (publication lists, made by selab.tt), and .cover and .contents
 * (book page).
 */


/* Colors. The second set is used when the visitor's system is in dark mode. */

:root {
  --text:       #1f2328;
  --muted:      #5f6b76;   /* secondary text: authors' notes, nav, footer */
  --background: #ffffff;
  --shade:      #f6f7f9;   /* code blocks */
  --line:       #e4e7eb;   /* rules and borders */
  --link:       #1f6fa8;
  --link-hover: #154d75;
  --accent:     #a51c30;   /* Harvard crimson: marks the current page in the nav */
}

@media (prefers-color-scheme: dark) {
  :root {
    --text:       #e6e8eb;
    --muted:      #9aa4ae;
    --background: #0f1115;
    --shade:      #171a21;
    --line:       #2a2f38;
    --link:       #6cb4ec;
    --link-hover: #a5d2f5;
    --accent:     #e5606f;
  }
}


/* Page */

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.5rem;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-y: scroll;   /* stops the page shifting sideways between short and long pages */
}

header, main, footer {
  max-width: 61rem;
  margin: 0 auto;
}

main { padding: 2.5rem 0 4rem; }


/* Text */

h1, h2, h3, h4 { line-height: 1.3; font-weight: 650; }

h1 { font-size: clamp(1.5rem, 2.5vw, 2rem); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 2rem; }
h2 { font-size: 1.3rem; margin: 3rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.4rem; }

main > h1:first-child, main > h2:first-child { margin-top: 0; }

h2 a, h3 a { color: inherit; }   /* headings that link somewhere */
h2 a:hover, h3 a:hover { color: var(--link); }

p, ul, pre, table, address { margin: 0 0 1rem; }
p, ul { max-width: 42rem; }   /* keeps lines of text to a readable length */
ul { padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }
address { font-style: normal; }
img { max-width: 100%; height: auto; }   /* big images shrink to fit narrow windows */

a { color: var(--link); text-decoration: none; }   /* links are blue, never underlined */
a:hover { color: var(--link-hover); }

code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.875em; }
code { background: var(--shade); padding: 0.1em 0.35em; border-radius: 4px; }
pre  { background: var(--shade); padding: 1rem 1.25rem; border-radius: 8px; overflow-x: auto; }

table { border-collapse: collapse; font-size: 0.95rem; margin-bottom: 1.5rem; }
th { text-align: left; font-weight: 600; color: var(--muted); }
th, td { padding: 0.4rem 1.5rem 0.4rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }


/* Header: lab name on the left, navigation on the right */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

header > a {   /* the lab name */
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; font-size: 0.95rem; font-weight: 500; }
nav a { color: var(--muted); padding: 0.25rem 0; }
nav a:hover { color: var(--text); }
nav a[aria-current] { color: var(--text); border-bottom: 2px solid var(--accent); }   /* the page you're on */


/* Footer: email and department, the same on every page */

footer {
  padding: 1.25rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}


/* Home page: software and databases, to the right of the text */

aside {
  float: right;
  width: 19rem;
  margin: 0 0 2rem 3rem;
  padding-left: 2rem;
  border-left: 1px solid var(--line);
}
aside h2 { clear: left; margin-top: 0; }
aside h2 + h3 { margin-top: 1rem; }
aside * + h2 { margin-top: 2.5rem; }
aside h3, aside p { padding-left: 6rem; }
aside img {            /* logos, to the left of each name and description */
  float: left;
  width: 5rem;
  margin: 0.2rem 0 0.5rem -6rem;
}
aside h3 { clear: left; margin: 1.5rem 0 0.2rem; }
aside p { font-size: 0.95rem; color: var(--muted); }
aside p::after { content: ""; display: block; clear: left; }   /* each description ends below its logo */
aside + h2 { margin-top: 0; }   /* the first heading beside it */
aside ~ .pubs li { display: block; }                        /* home page: recent papers, links below */
aside ~ .pubs p + p { margin-top: 0.2rem; }


/* People page: photo, name, email and role, two people to a row */

.people {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: none;
  padding: 0;
  margin-bottom: 3rem;
  list-style: none;
}
.people li { display: flow-root; margin: 0; font-size: 0.95rem; }
.people img {
  float: left;
  width: 10rem;
  height: 10rem;
  margin-right: 1.25rem;
  border-radius: 50%;
  object-fit: cover;
}


/* Software page: one section per package, with its logo (if any) on the left */

section {
  position: relative;
  min-height: 6rem;
  padding-left: 8rem;
  margin-bottom: 2.5rem;
}
section > img {
  position: absolute;
  left: 0;
  top: 0.2rem;
  max-width: 6rem;
  max-height: 6rem;
}
section h2 {
  margin: 0 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}
section h2 a {          /* the "website" or "download" link, at the right end of the name */
  float: right;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--link);
}
section p { margin-bottom: 0.6rem; }


/* Publication lists (made by selab.tt): citation on the left, abstract/reprint links on the right */

.pubs { max-width: none; padding: 0; list-style: none; }
.pubs li {
  display: grid;
  grid-template-columns: 1fr 10rem;
  gap: 0 2.5rem;
  margin-bottom: 1.25rem;
}
.pubs p { margin: 0; }
.pubs p + p a { margin-right: 1rem; white-space: nowrap; }   /* abstract, reprint */
.pubs li { line-height: 1.55; }


/* Book pages */

img.cover { float: left; width: 10rem; margin: 0.3rem 2rem 1.5rem 0; }
img.cover ~ h2 { clear: left; }   /* headings below the cover start under it */

.contents td { padding: 0.15rem 1rem 0.15rem 0; border: 0; }
.contents td:last-child { text-align: right; color: var(--muted); }   /* page numbers */
.contents td:first-child { width: 1.5rem; }


/* Phones and narrow windows */

@media (max-width: 760px) {
  body { font-size: 1rem; }
  main { padding-top: 1.5rem; }
  aside { float: none; width: auto; margin: 2rem 0 0; padding: 0; border: 0; }
  main:has(aside) { display: flex; flex-direction: column; }   /* home page: move software and databases */
  main:has(aside) > aside { order: 1; }                         /* below the text */
  aside + h2 { margin-top: 0; }
  main:has(aside) > h2 { margin-top: 1.5rem; }                 /* flex doesn't collapse margins */
  .people { grid-template-columns: 1fr; }
  .people img { width: 7rem; height: 7rem; }
  section { padding-left: 0; }
  section > img { position: static; max-height: 4rem; margin-bottom: 0.5rem; }
  section h2 a { float: none; margin-left: 0.75rem; }
  .pubs li { grid-template-columns: 1fr; }
  .pubs p + p { margin-top: 0.2rem; }
  th, td { padding-right: 0.75rem; }
}
