/* =============================================================================
   E2 — Blog styles (editorial, monochrome). Loaded AFTER global.css.
   Scope: /blog/ and /blog/<slug>/ only. May override global tokens for these pages.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   PAGE-LOCAL TOKENS — monochrome editorial palette (overrides global on /blog/)
   ----------------------------------------------------------------------------- */

main {
  --blog-ink: #111111;
  --blog-paper: #ffffff;
  --blog-muted: #555555;     /* on #fff → ~7.5:1 contrast */
  --blog-hairline: #d8d8d8;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono-label: "IBM Plex Mono", var(--font-mono);

  color: var(--blog-ink);
  background-color: var(--blog-paper);
}

main a {
  color: var(--blog-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

main a:hover {
  color: var(--blog-muted);
}

main a:focus-visible {
  outline: 2px solid var(--blog-ink);
  outline-offset: 2px;
  border-radius: 2px;
}

/* -----------------------------------------------------------------------------
   BLOG INDEX — reverse-chron list of posts
   ----------------------------------------------------------------------------- */

.blog-index {
  max-width: 70ch;
}

.blog-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.blog-list__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.blog-list__link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--font-size-xl);
  line-height: 1.2;
}

.blog-list__date {
  font-family: var(--font-mono-label);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blog-muted);
}

.blog-list__description {
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--blog-ink);
  margin: 0;
}

.blog-intro {
  font-size: var(--font-size-base);
  line-height: 1.7;
  margin-bottom: var(--space-8);
  max-width: 65ch;
  color: var(--blog-ink);
}

.blog-topics {
  margin-bottom: var(--space-12);
  border-top: 1px solid var(--blog-hairline);
  padding-top: var(--space-8);
}

.blog-topics dl {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.blog-topic dt {
  font-family: var(--font-mono-label);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blog-muted);
  margin-bottom: var(--space-2);
}

.blog-topic dd {
  font-size: var(--font-size-base);
  line-height: 1.7;
  margin: 0;
  max-width: 65ch;
}

.blog-post__back {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--blog-hairline);
}

.blog-post__back a {
  font-family: var(--font-mono-label);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--blog-muted);
  border-bottom: 1px solid var(--blog-hairline);
  transition: color 0.15s, border-bottom-color 0.15s;
}

.blog-post__back a:hover {
  color: var(--blog-ink);
  border-bottom-color: var(--blog-ink);
}

.blog-empty {
  color: var(--blog-muted);
  font-style: italic;
}

/* -----------------------------------------------------------------------------
   BLOG POST — individual post page
   ----------------------------------------------------------------------------- */

.blog-post {
  max-width: 72ch;
}

.blog-post h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.blog-post__date {
  font-family: var(--font-mono-label);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blog-muted);
  display: block;
  margin-bottom: var(--space-4);
}

.blog-post__description {
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--blog-ink);
  margin-top: 0;
  margin-bottom: var(--space-8);
  font-weight: 500;
}

/* Post body: readable measure for comfortable reading */
.blog-post p,
.blog-post li,
.blog-post blockquote {
  max-width: 72ch;
  line-height: 1.7;
  color: var(--blog-ink);
}

.blog-post h2,
.blog-post h3,
.blog-post h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.blog-post h2 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
}

.blog-post h3 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

.blog-post h4 {
  font-size: var(--font-size-lg);
}

.blog-post ul,
.blog-post ol {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.blog-post ul li,
.blog-post ol li {
  margin-bottom: var(--space-2);
}

.blog-post blockquote {
  border-left: 3px solid var(--blog-hairline);
  padding-left: var(--space-6);
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  color: var(--blog-muted);
}

.blog-post code {
  font-family: var(--font-mono-label);
  font-size: 0.9em;
  background-color: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 2px;
}

.blog-post pre {
  background-color: #f5f5f5;
  border: 1px solid var(--blog-hairline);
  padding: var(--space-4);
  overflow-x: auto;
  border-radius: 4px;
}

.blog-post pre code {
  background-color: transparent;
  padding: 0;
}

/* Post body images (figures, captions, gallery grid) */
.blog-post figure {
  margin: var(--space-8) 0;
}

.blog-post figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.blog-post figcaption {
  font-family: var(--font-mono-label), monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--blog-muted);
  margin-top: var(--space-2);
}

.blog-post figcaption a {
  color: var(--blog-muted);
  text-decoration-color: var(--blog-hairline);
}

.blog-post__gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin: var(--space-8) 0;
}

.blog-post__gallery figure {
  margin: 0;
}

@media (min-width: 640px) {
  .blog-post__gallery {
    grid-template-columns: 1fr 1fr;
  }
}

/* Maintain a11y: `:focus-visible` and `prefers-reduced-motion` from global.css */
@media (prefers-reduced-motion: reduce) {
  main a {
    transition: none;
  }
}

/* Related posts */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e8e8e8;
}

.related-posts__heading {
  font-family: var(--font-mono-label), monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #888;
  text-transform: uppercase;
  margin: 0 0 1rem;
}

.related-posts__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.related-posts__list a {
  font-family: var(--font-mono-label), monospace;
  font-size: 0.9375rem;
  color: var(--blog-ink);
  text-decoration: underline;
}

.related-posts__list a:hover {
  opacity: 0.55;
}
