:root {
  --textw: 50rem;
  --marginw: 18rem;
  --gutter: 2.5rem;
  --maxw: calc(var(--textw) + var(--marginw) + var(--gutter));
  --bg: #fdfdfd;
  --ink: #111111;
  --muted: #828282;
  --rule: #e8e8e8;
  --accent: #2a7ae2;
  --panel: #f8f8f8;
  --note: #f5f5f5;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font: 400 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  text-align: justify;
  text-justify: inter-word;
  letter-spacing: normal;
  word-spacing: normal;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:visited { color: #1756a9; }

a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(253, 253, 253, 0.95);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  margin-bottom: -1px;
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
}

.brand {
  font-weight: 600;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.brand:visited,
.brand:hover,
.brand:active,
.brand:focus { color: var(--ink); }

.brand::before {
  content: "";
  display: inline-block;
  width:  54px;
  height: 54px;
  margin-right: 0.45rem;
  background: url("/assets/images/snr-lab-logo.svg") no-repeat center/contain;
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.links a {
  font-size: 0.95rem;
  color: inherit;
}

.commentary-global {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem 1.5rem 3.5rem;
}

.container > *:not(details.commentary) {
  max-width: var(--maxw);
  margin-right: auto;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  line-height: 1.2;
  margin: 1.6rem 0 0.9rem;
}

h1 { font-size: 38px; }
@media screen and (max-width: 800px) { h1 { font-size: 34px; } }

.container > :first-child { margin-top: 0.6rem; }

h2 { font-size: 1.9rem; }
h3 { font-size: 1.4rem; }

p { margin: 0 0 1.2rem; }

ul, ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
li { margin-bottom: 0.4rem; }

blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 1rem;
  border-left: 4px solid var(--rule);
  color: var(--muted);
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

pre, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--panel);
}

code {
  padding: 0.1rem 0.25rem;
  background: #eef;
  border-radius: 4px;
}

figure { margin: 1.5rem 0; }
figcaption { color: var(--muted); font-size: 0.95rem; }

.people-page h1 {
  font-size: 1.6rem;
  margin: 1.1rem 0 0.5rem;
}

.people-page figure {
  margin: 0.7rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.people-page figcaption {
  margin: 0;
  line-height: 1.45;
}

.people-page .no-border td {
  padding: 0 1.5rem 0.8rem 0;
}

.people-page table.no-border {
  margin: 0.6rem 0 1rem;
}

.table-wrap { overflow-x: auto; }

table {
  border-collapse: collapse;
  margin: 1.5rem 0;
  width: 100%;
}

td, th {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.75rem;
}

.no-border, .no-border th, .no-border td {
  border: none;
  background-color: transparent;
  vertical-align: top;
}

.no-border { border-collapse: collapse; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1rem 0 0.9rem;
  color: var(--muted);
  background: var(--bg);
}

.footer-wrapper {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-heading {
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
  color: var(--ink);
}

.footer-col-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  align-items: flex-start;
}

.footer-col {
  flex: 1 1 220px;
}

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

.contact-list li,
.social-list li { margin-bottom: 0.2rem; }

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: inherit;
}

.social-link:hover { color: var(--ink); }

.social-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  fill: currentColor;
}

.details-note { color: var(--muted); }

.not-found {
  max-width: 600px;
  margin: 3rem auto;
  text-align: center;
}

.not-found h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
}

/* Image grid (home page) */
.row {
  display: flex;
  flex-wrap: wrap;
  padding: 0 4px;
}

.column {
  flex: 24%;
  max-width: 24%;
  padding: 0 4px;
}

.column img {
  display: block;
  margin-top: 8px;
  vertical-align: middle;
  width: 100%;
}

.column p { margin: 0; }

.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

@media screen and (max-width: 800px) {
  .column { flex: 50%; max-width: 50%; }
}

@media screen and (max-width: 600px) {
  .column { flex: 100%; max-width: 100%; }
}

/* Commentary / marginalia */
details.commentary {
  float: right;
  clear: right;
  width: var(--marginw);
  margin: 0.2rem 0 1.6rem var(--gutter);
  padding: 0.85rem 0.9rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--note);
  font-size: 0.95rem;
  line-height: 1.55;
  box-shadow: 0 10px 20px rgba(17, 17, 17, 0.08);
}

details.commentary summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

details.commentary summary::-webkit-details-marker { display: none; }
details.commentary summary::marker { content: ""; }

.commentary-toggle {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  background: #fff;
}

.commentary-toggle::before { content: "+"; }

details.commentary[open] .commentary-toggle {
  background: var(--ink);
  color: #fff;
}

.commentary-global .commentary-toggle { box-shadow: none; }
.commentary-global[aria-pressed="true"] .commentary-toggle::before { content: "\2212"; }

details.commentary[open] .commentary-toggle::before { content: "\2212"; }

.commentary-body > :first-child { margin-top: 0; }
.commentary-body > :last-child { margin-bottom: 0; }

@media (max-width: 960px) {
  :root {
    --textw: 100%;
    --marginw: 100%;
    --gutter: 0;
    --maxw: 100%;
  }

  .nav-inner {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .links { width: 100%; justify-content: space-between; }
  .container { padding: 2rem 1rem 3rem; }

  details.commentary {
    float: none;
    width: auto;
    margin: 0 0 1.4rem 0;
    box-shadow: none;
  }
}
