/* Blog pages and the About page share styles.css with the portfolio for
   the topbar, footer, type, colors, and the viewer. All of them use one
   format: a 720px column, a title at one size, section headings at one
   size, and the words at one size. The topbar stays put. Photographs are shown whole, as wide as the column allows or as tall
   as the screen, whichever binds first, and they sit on a mat like the
   viewer's. */

.blog-main {
  padding: calc(var(--topbar-h) + 40px) var(--gutter) 80px;
}

/* A page is one column: the title, the large photograph and its mat, the
   thumbnails, and the words all share its edges. The list of posts and the
   About page use it too. */
.post {
  max-width: 720px;
  margin: 0 auto;
}

.post-head {
  margin: 0 0 40px;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: 12px 0 0;
}

.post-title {
  font-size: var(--title-size);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0;
}

/* flow-root keeps the picture's mat margin inside the figure, so the space
   after a figure is measured from the edge of the mat. */
.post-photo {
  display: flow-root;
  margin: 0 auto 40px;
  text-align: center;
}

.post-photo img {
  display: block;
  margin: var(--mat) auto;
  width: auto;
  max-width: calc(100% - 2 * var(--mat));
  height: auto;
  max-height: calc(100vh - 160px - 2 * var(--mat));
  max-height: calc(100svh - 160px - 2 * var(--mat));
  box-shadow: var(--mat-shadow);
  user-select: none;
  -webkit-user-drag: none;
}

/* The first photograph opens the viewer too. */
.post-photo-link {
  display: block;
  cursor: zoom-in;
}

.post-photo-link:focus-visible,
.post-thumb:focus-visible {
  outline-offset: 4px;
}

/* The rest of a post's photographs: square thumbnails, as on a contact
   sheet, each on a mat and opening the viewer. The build picks how many go
   to a row (--per-row, --per-row-phone) so the rows come out full. */
.post-grid {
  --cols: var(--per-row, 5);
  --gap: var(--photo-gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
  margin: 0 0 48px;
}

.post-thumb {
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  display: block;
  box-sizing: border-box;
  aspect-ratio: 1;
  padding: var(--thumb-mat);
  background: var(--mat-color);
  box-shadow: 0 1px 2px var(--mat-drop), 0 8px 16px -10px var(--mat-drop);
  cursor: zoom-in;
}

.post-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-raised);
  box-shadow: 0 0 0 1px var(--mat-line);
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 200ms ease;
}

/* A thumbnail with a caption (photoGrid): the figure takes the place in
   the row, and the thumbnail fills it. */
.grid-photo {
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  margin: 0;
  min-width: 0;
}

.grid-photo .post-thumb {
  width: 100%;
}

.grid-photo .photo-credit {
  margin-top: 10px;
}

.post-thumb:hover img {
  opacity: 0.8;
}

/* Prose, the full width of the column. */
.post-body {
  font-size: var(--text-size);
  line-height: 1.75;
  color: var(--text);
}

.post-body p {
  margin: 0 0 18px;
}

.post-body h2,
.post-body h3 {
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg);
  margin: 40px 0 12px;
}

.post-body h2 {
  font-size: var(--heading-size);
}

.post-body h3 {
  font-size: 19px;
}

.post-body a {
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 200ms ease, color 200ms ease;
}

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

.post-body blockquote {
  margin: 0 0 18px;
  padding-left: 18px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
}

/* A photograph placed inside the prose with {% photo %} takes the same
   column as everything else. */
.post-body .post-photo {
  margin: 32px 0;
}

.post-nav {
  margin: 56px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* A photographer's credit, under a thumbnail. */
.photo-credit {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
}

.socials {
  display: flex;
  align-items: center;
  gap: 20px;
}

.post-body .social {
  display: inline-flex;
  color: var(--muted);
  border-bottom: none;
}

.post-body .social:hover,
.post-body .social:focus-visible {
  color: var(--fg);
}

/* The list of posts */
.post-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.post-card:last-of-type {
  border-bottom: 1px solid var(--line);
}

/* A post's thumbnail in the list, on a narrow mat like the grid's. */
.post-card-thumb {
  width: 120px;
  height: 84px;
  object-fit: cover;
  display: block;
  padding: var(--thumb-mat);
  background: var(--mat-color);
  box-shadow: 0 1px 2px var(--mat-drop), 0 8px 16px -10px var(--mat-drop);
  transition: opacity 200ms ease;
}

.post-card:hover .post-card-thumb {
  opacity: 0.85;
}

.post-card-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.post-card-text .post-date {
  margin: 0;
}

/* A post's name in the list: the size of a heading in a post. */
.post-card-title {
  font-size: var(--heading-size);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.post-empty,
.post-feed {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin: 32px 0 0;
}


/* Phones held upright: narrower mats, as on the front page. */
@media (max-width: 620px) {
  .post-grid {
    --cols: var(--per-row-phone, 3);
  }
}
