/* Design borrows from Jon Barron's and Karim El-Refai's sites. */

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111;
  margin: 0 auto;
  box-sizing: border-box;
  line-height: 1.5em;
  font-size: 14px;
  font-weight: 350;
}

h1 {
  margin-top: 0;
  font-size: 2em;
  line-height: 1.5em;
  margin-bottom: 0.25em;
  font-weight: 400;
}

h2 {
  font-size: 1.375em;
  font-weight: 400;
}

h3 {
  font-size: 1.05em;
  font-weight: 500;
  margin: 2em 0 0.5em;
}

a:link,
a:visited {
  color: #18d;
  text-decoration: none;
}

a:hover {
  opacity: 0.7;
}

section {
  max-width: 55em;
  margin: 0 auto 2em auto;
  padding: 0 2em;
}

p {
  line-height: 1.5em;
  margin-left: auto;
  margin-right: auto;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.93em;
}

code {
  background: #f3f3f0;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: #f3f3f0;
  padding: 0.9em 1.1em;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.45em;
  font-size: 0.86em;
}

pre code {
  background: none;
  padding: 0;
}

/* Header block with photo */

.intro {
  display: flex;
  align-items: start;
  gap: 2em 1.5em;
  flex-wrap: wrap-reverse;
}

.intro .text {
  flex-grow: 1;
  flex-basis: 20em;
}

.intro img {
  width: 12em;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5%;
}

/* Item lists (posts, projects) */

.item-list {
  list-style-type: none;
  padding: 0;
  margin: 1em 0 0;
  display: flex;
  flex-direction: column;
}

.item-list > li {
  display: flex;
  padding: 1em;
  margin-left: -1em;
  margin-right: -1em;
  align-items: center;
  gap: 1em 1.5em;
  flex-wrap: wrap;
  line-height: 1.3em;
}

.item-list > li.highlighted {
  background: rgb(255, 255, 220);
}

.item-list h3 {
  font-size: inherit;
  font-weight: 500;
  color: #000;
  padding: 0;
  margin: 0;
}

.item-list .visual {
  width: 16em;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: contain;
  display: block;
  border-radius: 0.2em;
}

.item-list .visual.square {
  aspect-ratio: 1;
  width: 9em;
}

.item-list .textual {
  flex-grow: 1;
  flex-basis: 20em;
}

.item-list .textual p {
  margin: 0.4em 0;
}

.item-list .meta {
  color: #666;
}

.item-list .links a + a::before {
  content: " / ";
  color: #888;
}

/* Top nav */

nav.top {
  max-width: 55em;
  margin: 0 auto 2em;
  padding: 0 2em;
  color: #888;
}

nav.top a + a::before {
  content: " / ";
  color: #888;
}

/* Project grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
  gap: 1.5em;
  margin-top: 1.5em;
}

.grid a.card {
  color: inherit;
  display: block;
}

.grid a.card:hover {
  opacity: 1;
}

.grid a.card:hover .thumb {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.grid .thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 0.3em;
  background: #f3f3f0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.grid h3 {
  margin: 0.7em 0 0.15em;
  font-size: 1em;
  font-weight: 500;
  color: #18d;
}

.grid p {
  margin: 0;
  color: #555;
  font-size: 0.95em;
  line-height: 1.4em;
}

/* Post pages */

.post {
  max-width: 42em;
}

.post .subtitle {
  font-size: 1.2em;
  color: #444;
  margin-top: -0.6em;
  margin-bottom: 0.4em;
}

.post .date {
  color: #666;
  margin-top: -0.5em;
}

.post h2 {
  margin-top: 2em;
}

.post .pipeline {
  padding-left: 1.4em;
}

.post .pipeline li {
  margin: 0.3em 0;
}

.post figure {
  margin: 1.5em 0;
  text-align: center;
}

.post figure img {
  max-width: 22em;
  width: 100%;
}

.post figure.wide img {
  max-width: 100%;
  border: 1px solid #e4e4e0;
  border-radius: 4px;
}

.post pre.mermaid {
  background: none;
  padding: 0;
  margin: 1.5em 0;
  text-align: center;
  overflow-x: auto;
  /* let diagrams use more than the text column when the viewport allows */
  width: min(100vw - 4em, 64em);
  margin-left: calc(50% - min(100vw - 4em, 64em) / 2);
}

.post pre.mermaid svg {
  max-width: 100%;
  height: auto;
}

.post figcaption {
  color: #666;
  font-size: 0.93em;
  margin-top: 0.5em;
}

.post table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.post th,
.post td {
  text-align: left;
  padding: 0.4em 0.6em;
  border-bottom: 1px solid #e4e4e0;
  vertical-align: top;
}

.post th {
  font-weight: 500;
  color: #444;
}

.post td code {
  white-space: nowrap;
}

.post ul li {
  margin: 0.35em 0;
}

footer {
  max-width: 55em;
  margin: 3em auto 2em;
  padding: 0 2em;
  color: #777;
  font-size: 0.93em;
}

/* Mobile */

@media screen and (max-width: 768px) {
  .item-list > li {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .item-list .visual {
    width: 100%;
    max-width: 24em;
    margin: 0 auto;
  }

  .item-list .textual {
    width: 100%;
    text-align: left;
  }
}

/* Scrollbar */

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: #aaa;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #777;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #aaa #f1f1f1;
}
