/* Posts list and post pages; shared site styles stay in site.css. */

.post-years {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--accent);
}

.post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.post-categories[hidden],
.post-year[hidden] {
  display: none;
}

.post-categories button {
  padding: 4px 14px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: none;
  font: 13px/1.5 var(--f-body);
  color: var(--text);
  cursor: pointer;
}

.post-categories button:hover {
  border-color: var(--category, var(--accent));
  color: var(--category, var(--accent));
}

.post-categories button[aria-pressed="true"] {
  border-color: var(--category, var(--accent));
  background: var(--category, var(--accent));
  color: #fff;
}

/* keys are slugified category names */
[data-category="analysis"] {
  --category: #1d7348;
}
[data-category="cartography"] {
  --category: #6f3fa0;
}
[data-category="conferences"] {
  --category: #b3362b;
}
[data-category="lab-news"] {
  --category: #1e3765;
}
[data-category="publications"] {
  --category: #a2560f;
}

.post-year {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 24px;
  padding-top: 28px;
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 24px;
}

.post-year h2 {
  font-size: 24px;
}

.post-list {
  min-width: 0;
}

.post-list li:not([hidden]) ~ li:not([hidden]) {
  border-top: 1px solid var(--rule);
  margin-top: 24px;
  padding-top: 24px;
}

.post-list h3 {
  font-size: 20px;
  line-height: 1.45;
}

.post-list h3 a {
  color: var(--accent);
  text-decoration: none;
}

.post-list h3 a:hover {
  text-decoration: underline;
}

.post-category {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--category, var(--accent));
}

.post-category a {
  color: inherit;
  text-decoration: none;
}

.post-category a:hover {
  text-decoration: underline;
}

.post-meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.post-summary {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.7;
}

/* Post page */

.post-header {
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--rule);
}

.post-header h1 {
  margin-bottom: 8px;
}

.post-body {
  font-size: 16px;
  line-height: 1.8;
}

.post-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 48px;
}

/* the image runs off the right edge of the window */
body:has(.post-columns) {
  overflow-x: clip;
}

.post-aside {
  position: relative;
  margin: 0;
}

/* as tall as the text; width follows */
.post-aside img {
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  max-width: none;
  height: 100%;
  max-height: calc(100vh - 48px);
}

@media (max-width: 820px) {
  .post-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .post-aside {
    order: -1;
  }
  .post-aside img {
    position: static;
    width: 100%;
    height: auto;
  }
}

.post-body h2 {
  font-size: 22px;
  margin: 1.8em 0 0.6em;
}

.post-body a {
  color: var(--accent);
}

.post-body ul,
.post-body ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.post-body ul {
  list-style: disc;
}

.post-body li + li {
  margin-top: 0.3em;
}

.post-body blockquote {
  margin: 1.5em 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent-tint);
  color: #5d636c;
}

.post-body img {
  margin: 1.5em 0;
  border-radius: 2px;
}

.post-body figure {
  margin: 1.5em 0;
}

.post-body figure img {
  margin: 0;
}

.post-body figcaption {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.post-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 1.5em 0;
}

.post-gallery img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.post-body table {
  display: block;
  overflow-x: auto;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 14px;
}

.post-body th,
.post-body td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.post-body th {
  color: var(--ink);
  font-weight: 600;
}

.post-body code {
  font-size: 0.9em;
  padding: 1px 4px;
  background: var(--accent-tint);
  border-radius: 2px;
}

.post-body pre {
  overflow-x: auto;
  padding: 12px 16px;
  background: var(--accent-tint);
  font-size: 13px;
  line-height: 1.6;
}

.post-body pre code {
  padding: 0;
  background: none;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font: 15px/1.4 var(--f-display);
}

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

.post-nav a:hover {
  text-decoration: underline;
}

.post-nav span {
  display: block;
  margin-bottom: 4px;
  font: 12px var(--f-body);
  color: var(--muted);
}

.post-nav-newer {
  grid-column: 2;
  text-align: right;
}

@media (max-width: 600px) {
  .post-year {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}
