/*
 * Stylesheet for /blog/ only. Deliberately separate from the Tailwind output
 * baked into site.css — that file's utility classes were purged to whatever
 * the captured pages actually used, so new markup can't safely reach for
 * classes like `p-8` or `gap-6` and expect them to exist. This file writes
 * plain CSS instead, consuming the same --ploy-* custom properties site.css
 * defines (custom properties survive purging), so new pages inherit the
 * real palette without gambling on which utilities happen to be present.
 *
 * Type, colour and motion come from the --tf-* tokens in assets/theme.css,
 * which every page links after this file: Source Sans 3 for everything read, EB Garamond for titles,
 * small caps for labels, and the one green for links and marks.
 */

.blog-main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 5rem 1.25rem 6rem;
  color: var(--ploy-text-primary);
  font-family: var(--tf-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: 1.125rem;
  line-height: 1.6;
}
.blog-main a {
  color: var(--tf-accent, inherit);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color 0.16s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.blog-main a:hover {
  text-decoration-color: currentColor;
}

/* Every label on the blog — eyebrows, dates, source tags, topic tags — is the
   same letterspaced small caps, so they read as one voice. */
.blog-eyebrow,
.blog-post-list .blog-meta,
.blog-source-tag,
.blog-tags a,
.blog-note__meta,
.blog-note__link,
.blog-aside__all,
.blog-back-link {
  font-family: var(--tf-serif, Georgia, serif);
  font-variant-caps: all-small-caps;
  font-feature-settings: "kern", "smcp", "c2sc", "lnum";
  letter-spacing: 0.14em;
  font-weight: 500;
  text-transform: none;
}

.blog-eyebrow {
  font-size: 1.05rem;
  color: var(--tf-accent, var(--ploy-text-secondary));
  margin: 0 0 1.25rem;
}

.blog-main h1 {
  font-family: var(--tf-serif, Georgia, serif);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.012em;
  font-size: clamp(2.5rem, 1.6rem + 4vw, 4rem);
  text-wrap: balance;
  margin: 0 0 1.1rem;
}

.blog-lede {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ploy-text-secondary);
  max-width: 56ch;
  margin: 0 0 3rem;
}

.blog-post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--ploy-border-primary);
}
.blog-post-list li {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--ploy-border-primary);
}
.blog-post-list h2 {
  font-family: var(--tf-serif, Georgia, serif);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.18;
  text-wrap: balance;
  margin: 0 0 0.45rem;
}
.blog-post-list h2 a {
  color: var(--ploy-text-primary);
  text-decoration: none;
  transition: color 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.blog-post-list h2 a:hover {
  color: var(--tf-accent, inherit);
}
.blog-post-list .blog-meta {
  font-size: 1rem;
  color: var(--ploy-text-secondary);
  margin: 0 0 0.6rem;
}
.blog-source-tag {
  padding: 0 0 0 0.5rem;
  margin-left: 0.15rem;
  border-left: 1px solid var(--ploy-border-primary);
  font-size: inherit;
}
.blog-post-list p {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ploy-text-secondary);
}

.blog-post-body {
  font-size: 1.125rem;
  line-height: 1.65;
}
.blog-post-body p {
  margin: 0 0 1.25rem;
}
.blog-post-body h3 {
  font-family: var(--tf-serif, Georgia, serif);
  font-weight: 500;
  font-size: 1.7rem;
  line-height: 1.2;
  margin: 2.75rem 0 0.9rem;
}
.blog-post-body h2,
.blog-post-body h4 {
  font-family: var(--tf-serif, Georgia, serif);
  font-weight: 500;
  line-height: 1.2;
}
.blog-post-body blockquote {
  margin: 0 0 1.3rem;
  padding: 0 0 0 1.4rem;
  border-left: 1px solid var(--tf-accent, var(--ploy-border-primary));
  font-family: var(--tf-fell, inherit);
  font-size: 1.5rem;
  line-height: 1.38;
  font-style: italic;
}
.blog-post-body ol,
.blog-post-body ul {
  margin: 0 0 1.3rem;
  padding-left: 1.4rem;
  /* site.css's Tailwind reset zeroes list-style site-wide; restore it here
     rather than everywhere, since nothing else on the captured pages
     actually renders a real list. */
  list-style: revert;
}
.blog-post-body li {
  margin: 0 0 1rem;
}
.blog-post-body li p {
  margin: 0 0 0.3rem;
}
/* Code and screen-text blocks wrap rather than push the page sideways; the
   fiction pieces use them for the devices their characters read. */
.blog-post-body pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--tf-wash, #f3f4f5);
  border-left: 1px solid var(--tf-accent, var(--ploy-border-primary));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.55;
}
.blog-post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}
.blog-post-body figure {
  margin: 1.5rem 0;
}
.blog-post-body figure img {
  border: 1px solid var(--tf-hair, var(--ploy-border-primary));
}
.blog-post-body figcaption {
  font-family: var(--tf-sans, sans-serif);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ploy-text-secondary);
  text-align: center;
  margin-top: 0.7rem;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0;
  margin: 0 0 1.5rem;
}
.blog-tags a {
  font-size: 1.02rem;
  color: var(--ploy-text-secondary);
  text-decoration: none;
}
.blog-tags a:not(:last-child)::after {
  content: "·";
  margin: 0 0.6em;
  color: var(--ploy-text-secondary);
}
.blog-tags a:hover {
  color: var(--tf-accent, inherit);
}

.blog-original-note {
  font-family: var(--tf-fell, inherit);
  font-size: 1.15rem;
  color: var(--ploy-text-secondary);
  font-style: italic;
  margin: 0 0 2rem;
}

.blog-subscribe-cta {
  margin-top: 3rem;
  padding: 1.75rem 2rem;
  border: 1px solid var(--ploy-border-primary);
  background: var(--tf-wash, var(--ploy-background-secondary));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.blog-subscribe-cta p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}
.blog-subscribe-cta strong {
  display: block;
  font-family: var(--tf-serif, Georgia, serif);
  font-weight: 500;
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}

/* "Work with me" block. Kept separate from the subscribe CTA above it on
   purpose: one asks for an email address, the other asks for a project, and
   collapsing them into one box makes both easier to ignore. It's on every post
   and tag page because those are the pages search traffic actually lands on —
   the homepage footer used to be the only contact point on the whole site,
   which is no use to someone who arrived on an article from Google. */
.blog-contact-cta {
  margin-top: 1.25rem;
  padding: 1.75rem 2rem;
  border: 1px solid var(--ploy-border-primary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.blog-contact-cta p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  max-width: 34ch;
}
.blog-contact-cta strong {
  display: block;
  font-family: var(--tf-serif, Georgia, serif);
  font-weight: 500;
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}
/* The two service links sit inside a paragraph, where nothing else marks them
   as clickable — without this they read as plain text and never get clicked. */
.blog-contact-cta p a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.blog-contact-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.blog-btn {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 0.75rem 1.5rem 0.85rem;
  background: var(--ploy-button-primary-background);
  color: var(--ploy-button-primary-text);
  border: 1px solid var(--ploy-button-primary-border);
  font-family: var(--tf-serif, Georgia, serif);
  font-variant-caps: all-small-caps;
  font-feature-settings: "kern", "smcp", "c2sc";
  letter-spacing: 0.16em;
  font-weight: 500;
  font-size: 1.08rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.32s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.32s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* Buttons sit inside .blog-main, whose link colour would otherwise win. */
.blog-main a.blog-btn {
  color: var(--ploy-button-primary-text);
}
.blog-btn:hover,
.blog-main a.blog-btn:hover {
  background: var(--tf-accent, var(--ploy-button-primary-background));
  border-color: var(--tf-accent, var(--ploy-button-primary-border));
}
.blog-btn--ghost,
.blog-main a.blog-btn--ghost {
  background: transparent;
  color: var(--ploy-text-primary);
  border-color: var(--ploy-text-primary);
}
.blog-btn--ghost:hover,
.blog-main a.blog-btn--ghost:hover {
  background: var(--ploy-text-primary);
  border-color: var(--ploy-text-primary);
  color: var(--tf-paper, #fff);
}

/* Syndicated posts (Medium/Substack, pulled in via RSS): the full text
   isn't reproduced, only a snippet + a clear link back to the original. */
.blog-syndication-notice {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--ploy-border-primary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.blog-syndication-notice p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ploy-text-secondary);
  max-width: 40ch;
}
.blog-syndication-notice .blog-btn {
  padding: 0.55rem 1.1rem 0.65rem;
  font-size: 1rem;
}

.blog-back-link {
  display: inline-block;
  margin-top: 3rem;
  font-size: 1.05rem;
}

/* --- Notes: the microblog stream -----------------------------------------
 *
 * Two placements from one set of rules: the full feed at /blog/notes/, and a
 * narrow column beside the post list on /blog/ only.
 *
 * The sidebar is a grid track rather than a float so it cannot overlap the
 * list, and it collapses to a single column below 60rem — a quarter of a
 * phone screen is about 90px, which is not a column, it is a gutter. Below
 * that width the notes simply follow the posts.
 */
.blog-main--with-aside {
  max-width: 68rem;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  /* Column gap only. Every child is its own implicit row, so a row gap put
     3rem between the eyebrow, the title and the intro as well. */
  gap: 0 3rem;
  align-items: start;
}
/*
 * Placement is explicit, not automatic. Left to auto-flow, whichever element
 * happens to follow the post list in the DOM is dropped into column 2 — which
 * put the subscribe box in the sidebar slot and pushed the notes hundreds of
 * pixels down the page. Everything is pinned to column 1 except the aside.
 */
.blog-main--with-aside > * {
  grid-column: 1;
}
.blog-main--with-aside > .blog-aside {
  grid-column: 2;
  /*
   * Spans rather than sits in one row, so its height is distributed instead
   * of forcing a single row as tall as the whole sidebar — which pushed the
   * heading and the entire post list below the fold.
   *
   * "span 99" and not "1 / -1": negative row lines resolve against the
   * EXPLICIT grid, and this grid declares only columns, so -1 collapses back
   * to line 1 and silently spans nothing. Every row here is implicit, so the
   * span has to be counted.
   */
  grid-row: 1 / span 99;
}

.blog-aside {
  position: sticky;
  top: 4.5rem;
  border-left: 1px solid var(--ploy-border-primary);
  padding-left: 1.25rem;
}
.blog-aside__title {
  font-family: var(--tf-serif, Georgia, serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 0.2rem;
}
.blog-aside__sub {
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ploy-text-secondary);
  margin: 0 0 1.1rem;
}
.blog-aside__all {
  display: inline-block;
  margin-top: 1rem;
  font-size: 1rem;
}

.blog-note-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.blog-note {
  padding: 0 0 1.4rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--ploy-border-primary);
}
.blog-note:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}
.blog-note__meta {
  font-size: 0.98rem;
  color: var(--ploy-text-secondary);
  margin: 0 0 0.45rem;
}
.blog-note__src {
  color: var(--ploy-text-primary);
}
.blog-note__body p {
  margin: 0 0 0.6rem;
  font-size: 1.0625rem;
  line-height: 1.55;
  /* Notes arrive as typed — URLs and long Russian compounds included — and a
     fixed-width sidebar is exactly where an unbroken string escapes its box. */
  overflow-wrap: anywhere;
}
.blog-note__body p:last-child {
  margin-bottom: 0;
}
.blog-note__link,
.blog-main a.blog-note__link {
  font-size: 0.95rem;
  color: var(--ploy-text-secondary);
  text-decoration: none;
}
.blog-note__link:hover,
.blog-main a.blog-note__link:hover {
  color: var(--tf-accent, var(--ploy-text-primary));
}

.blog-note-list--compact .blog-note {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}
.blog-note-list--compact .blog-note__body p {
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (max-width: 60rem) {
  .blog-main--with-aside {
    display: block;
    max-width: 42rem;
  }
  .blog-aside {
    position: static;
    border-left: 0;
    padding-left: 0;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--ploy-border-primary);
  }
}
