:root {
  --bg: #fff;
  --pane-bg: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --link: #1772d0;
  --link-hover: #0d4f94;
  --border: #e6e6e6;
  --chip: #f2f2f2;
  --spine: 40px;
  --pane-width: min(620px, 92vw);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Lato", system-ui, sans-serif;
}

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

a.internal { color: #0b3d75; font-weight: 700; }
a.internal:hover { color: var(--link); }

#stack {
  display: flex;
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
}

.pane {
  position: sticky;
  left: calc(var(--i) * var(--spine));
  flex: 0 0 var(--pane-width);
  height: 100vh;
  padding: 40px 36px 80px;
  overflow-y: auto;
  background: var(--pane-bg);
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.08);
}

.pane:first-child { border-left: none; }
.pane:only-child {
  flex-basis: 100%;
  padding-inline: max(36px, calc(50% - 310px));
  box-shadow: none;
}

.pane h1 { font-weight: 400; font-size: 30px; margin: 0 0 20px; }
.pane:first-child h1 { text-align: center; }
.pane h2 { font-weight: 400; font-size: 21px; margin: 32px 0 6px; }
.pane img { width: 100%; border-radius: 6px; }
.pane ul { padding-left: 20px; }

.pane .avatar {
  float: right;
  width: 150px;
  height: 150px;
  margin: 0 0 12px 20px;
  object-fit: cover;
  object-position: 50% 55%;
  border-radius: 50% !important;
}

.links { text-align: center; clear: both; }

.entry { margin: 0 0 12px; }

.entry-head,
.role {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.entry-head a { font-weight: 700; }
.dates, .role { color: var(--muted); }
.dates, .location { white-space: nowrap; }
.location { color: #9a9a9a; font-size: 14px; }

.project {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 16px 10px;
}

.project.featured { background: #ffffd0; }
.project p { margin: 6px 0 0; }
.project-title { font-weight: 700; margin-right: 6px; }
.project-links { margin-top: 4px; }

.icon-link {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 8px;
  color: var(--muted);
}

.project-title + .icon-link { margin-left: 2px; }

.icon-link:hover { color: var(--text); }

.pane .badge-link img {
  display: block;
  width: auto;
  height: 40px;
  border-radius: 0;
}
.icon-link svg { width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag:hover { border-color: currentColor; }

.thumb { flex: 0 0 160px; }

.article {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px;
}

.article-thumb { flex: 0 0 96px; }

.pane .article-thumb img {
  display: block;
  width: 96px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
}

.source { color: var(--muted); font-size: 13px; }

.credit {
  margin-top: 48px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.gallery figure {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.pane .gallery img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.gallery figure.wide { grid-column: 1 / -1; }
.gallery figure.tall { grid-row: span 2; }

.pane .gallery figure.tall img {
  aspect-ratio: auto;
  flex: 1 1 0;
  min-height: 0;
}

.pane .gallery figure.wide img,
.pane .gallery.certs img { aspect-ratio: auto; }

.deck { margin: 16px 0; }

.deck figcaption,
.gallery figcaption {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.thumb img,
.thumb-empty {
  display: block;
  width: 160px;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--chip);
}

.tag {
  display: inline-block;
  vertical-align: middle;
  padding: 1px 9px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

code {
  display: inline-block;
  padding: 0 7px;
  font: 12px/1.7 "Lato", sans-serif;
  background: var(--chip);
  border-radius: 4px;
}

.spine {
  display: none;
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--spine);
  padding: 46px 0 0;
  line-height: var(--spine);
  writing-mode: vertical-rl;
  font-size: 17px;
  color: var(--text);
  background: var(--pane-bg);
  cursor: pointer;
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.close:hover { color: var(--text); background: var(--chip); }

.pane.collapsed { overflow: hidden; }
.pane.collapsed .close { display: none; }
.pane.collapsed .spine { display: block; }
.pane.collapsed > :not(.spine) { visibility: hidden; }

@media (max-width: 760px) {
  #stack { display: block; height: auto; overflow: visible; }

  .pane {
    display: none;
    position: static;
    height: auto;
    overflow: visible;
    flex-basis: 100%;
    padding: 28px 16px 64px;
    border-left: none;
    box-shadow: none;
  }

  .pane:last-child { display: block; }
  .pane.collapsed .spine { display: none; }
  .pane .avatar { width: 110px; height: 110px; }

  .project, .article { gap: 14px; padding: 12px 0; }
  .project { align-items: flex-start; }
  .thumb { flex-basis: 96px; }

  .thumb img,
  .thumb-empty { width: 96px; height: 72px; }
  .project > div { min-width: 0; }

  .tag {
    max-width: calc(100% - 30px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: middle;
  }
}
