/* ==========================================================================
   blog.css — the only styles main.css does not already provide for /blog and
   /blog/:slug. Loaded after main.css, so every :root token is available.

   Scope rule (same as gallery.css): if a rule here would be useful on a second
   page, it belongs in main.css instead. main.css §16 already styles .prose for
   h2, h3, p, ul, ol, li, blockquote, figure, figcaption and pre — this file
   only adds what markdown output needs beyond that set (tables, inline code,
   hr, links, task lists) plus the three blog-specific blocks: the index list,
   the post header/cover, and the {{photo:}} embedded figure.

   Also loaded by public/admin.html for the side-by-side draft preview, which
   is why nothing here is scoped to body.page-post — the preview pane renders
   the same .prose markup outside that body class.
   ========================================================================== */

/* ---------------------------------------------------------- 1. blog index */

.post-index__head { margin-bottom: var(--space-lg); }

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list__item {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
}

.post-list__item:last-child { border-bottom: 1px solid var(--border); }

.post-list__media {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  aspect-ratio: 16 / 10;
}

.post-list__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.post-list__media:hover .post-list__img,
.post-list__media:focus-visible .post-list__img { transform: scale(1.03); }

/* No cover photo: hold the column so the text edge stays aligned down the
   list rather than jumping row to row. */
.post-list__media--empty {
  background:
    radial-gradient(circle at 30% 30%, var(--accent-soft), transparent 60%),
    var(--surface-2);
}

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

.post-list__title {
  margin: 0;
  font-size: var(--step-3);
  line-height: 1.25;
}

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

.post-list__title a:hover,
.post-list__title a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.post-list__meta {
  margin: var(--space-3xs) 0 0;
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.post-list__text {
  margin: var(--space-2xs) 0 0;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .post-list__item { grid-template-columns: minmax(0, 1fr); }
}

/* ----------------------------------------------------- 2. post header/cover */

.post-head { margin-bottom: var(--space-md); }

.post-head__date {
  margin: 0 0 var(--space-2xs);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.post-head__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  margin: var(--space-xs) 0 0;
}

.post-cover {
  margin: 0 0 var(--space-lg);
}

.post-cover__img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.post-cover__caption {
  margin-top: var(--space-2xs);
  font-size: var(--step--1);
  color: var(--text-dim);
}

/* The body column is wider than main.css's 40rem .prose default: post figures
   carry real captures and 40rem shrinks them past usefulness. The container is
   already .container--narrow, so this only removes the second constraint. */
.post-body { max-width: none; }

/* ------------------------------------------- 3. markdown output extras */
/* Everything below styles output lib/markdown.js can emit that main.css §16
   does not already cover. Raw HTML never reaches here — it is dropped at the
   tokenizer — so this list is closed by what marked can produce. */

.prose a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

.prose h4 {
  margin-top: var(--space-md);
  font-size: var(--step-1);
  color: var(--text);
}

.prose hr {
  margin: var(--space-lg) 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Inline code. main.css styles `pre` but not a bare `code`, so a codespan
   would otherwise render as unstyled body text. */
.prose :not(pre) > code {
  padding: 0.12em 0.36em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--text);
  word-break: break-word;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

/* GFM tables — filter / subs / exposure breakdowns are the reason gfm is on.
   The wrapper scrolls rather than the page: a wide acquisition table must not
   make the whole document scroll sideways on a phone. */
.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--step-0);
}

.prose th,
.prose td {
  padding: var(--space-2xs) var(--space-xs);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  border-bottom-color: var(--border-strong);
}

.prose tbody tr:last-child td { border-bottom: 0; }

/* GFM task lists. */
.prose li input[type='checkbox'] {
  margin-right: var(--space-3xs);
  accent-color: var(--accent);
}

/* An inline notice inside the body — an unknown {{photo:}} slug, the embed cap,
   or the plain-text fallback. Deliberately loud: a silently missing embed is
   how a post ships with a hole in it. */
.post-notice {
  margin: var(--space-md) 0;
  font-size: var(--step-0);
}

/* -------------------------------------------- 4. {{photo:slug}} embeds */

.post-figure {
  margin: var(--space-lg) 0;
}

.post-figure__link {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.post-figure__img {
  display: block;
  width: 100%;
  height: auto;
}

.post-figure__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3xs) var(--space-2xs);
  margin-top: var(--space-2xs);
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-dim);
}

.post-figure__title {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.post-figure__title:hover,
.post-figure__title:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.post-figure__designation {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text-dim);
}

.post-figure__text {
  flex: 1 1 16rem;
  min-width: 0;
  color: var(--text-muted);
}

/* --------------------------------------------------- 5. prev / next nav */

.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.post-nav__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}

.post-nav__link:hover,
.post-nav__link:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.post-nav__link--next { text-align: right; }

.post-nav__label {
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.post-nav__title {
  color: var(--text);
  font-weight: 600;
}
