/* =========================================================
   Blog listing + blog post.
   Loaded only on blog pages, after styles.css (uses its tokens).
   ========================================================= */

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Current page in the navigation */
.nav-desktop ul a[aria-current] { color: var(--text-1); border-bottom-color: var(--azure); }
.nav-mobile nav a[aria-current] { box-shadow: inset 3px 0 0 var(--azure); padding-left: 14px; }

/* ---------- Shared post bits ---------- */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  color: var(--text-3);
  font-size: .875rem;
}
.post-cat { color: var(--text-1); font-weight: 600; }
.post-cat::before {                 /* short azure bar, as under section headings */
  content: "";
  display: inline-block;
  width: 12px;
  height: 2px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--azure);
}

/* Generated cover for posts without a featured image: the azure field from the site */
.post-cover,
.article-cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--azure);
  text-decoration: none;
}
.post-cover img,
.article-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-cover-label {
  position: relative;
  padding: clamp(20px, 3vw, 36px);
  max-width: 9ch;
  color: #fff;
  font: 600 clamp(2rem, 4.4vw, 3.5rem)/1 var(--font-display);
  letter-spacing: -0.03em;
}

/* ---------- Listing: page heading ---------- */
.page-head {
  padding-block: clamp(40px, 7vw, 96px) clamp(32px, 5vw, 64px);
  border-bottom: 1px solid var(--ink-700);
}
.page-head-grid { display: grid; gap: 20px; align-items: end; }
.page-title {
  font-size: clamp(4rem, 20vw, 9rem);
  line-height: .9;
  letter-spacing: -0.04em;
}
.page-lede { max-width: 36ch; color: var(--text-3); font-size: 1.125rem; }
@media (min-width: 880px) {
  .page-head-grid { grid-template-columns: minmax(0, 1fr) auto; column-gap: 64px; }
  .page-lede { padding-bottom: 12px; }
}

.blog-index { padding-block: clamp(40px, 6vw, 72px) var(--section-y); }

/* Category filter */
.post-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(36px, 5vw, 56px); }
.post-filter button,
.share a,
.share-copy {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 500 .9375rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.post-filter button:hover,
.share a:hover,
.share-copy:hover { border-color: var(--azure); color: var(--text-1); }
.post-filter button[aria-pressed="true"] { background: var(--azure-deep); border-color: var(--azure-deep); color: #fff; }

/* Featured (latest) post */
.post-featured {
  display: grid;
  gap: 28px;
  margin-bottom: clamp(56px, 8vw, 96px);
}
.post-featured .post-cover { aspect-ratio: 4 / 3; }
.post-featured-title {
  margin: 14px 0 16px;
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.post-featured-title a,
.post-row h3 a { text-decoration: none; }
.post-featured-title a:hover,
.post-row h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--azure); }
.post-excerpt { max-width: 54ch; margin-bottom: 28px; }

@media (min-width: 880px) {
  .post-featured {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    column-gap: clamp(40px, 5vw, 72px);
    align-items: center;
  }
}

/* Post list rows */
.post-list { border-top: 1px solid var(--line); }
.post-list > li { border-bottom: 1px solid var(--line); }
.post-row {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 28px 0;
}
.post-row h3 { font-size: clamp(1.1875rem, 2vw, 1.375rem); line-height: 1.3; letter-spacing: -0.01em; }
.post-row h3 a::after {              /* whole row is clickable */
  content: "";
  position: absolute;
  inset: 0;
}
.post-row-main p { margin-top: 8px; max-width: 62ch; color: var(--text-3); }
.post-row-date {
  color: var(--text-3);
  font: 600 .875rem/1.6 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.post-row-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--text-3); font-size: .875rem; }
.post-row:hover .post-row-date { color: var(--text-1); }

@media (min-width: 820px) {
  .post-row {
    grid-template-columns: 8.5rem minmax(0, 1fr) 12rem;
    column-gap: clamp(24px, 4vw, 56px);
    padding: 36px 0;
    align-items: baseline;
  }
  .post-row-meta { flex-direction: column; align-items: flex-end; text-align: right; }
}

.post-empty { padding: 32px 0; color: var(--text-3); }

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  color: var(--text-3);
  font-size: .9375rem;
}
.pagination ul { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination a {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-1);
  text-decoration: none;
  transition: border-color .2s ease;
}
.pagination a:hover { border-color: var(--azure); }
.pagination a[aria-current] { background: var(--azure-deep); border-color: var(--azure-deep); color: #fff; }

/* ---------- Post page ---------- */

/* Reading progress, driven by scroll position in CSS (no JavaScript).
   Browsers without scroll-driven animations simply don't show it. */
.read-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .read-progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: 3px;
    background: var(--azure);
    transform-origin: left;
    animation: read-progress linear both;
    animation-timeline: scroll(root);
  }
}
@keyframes read-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.article-head { padding-block: clamp(32px, 5vw, 72px) clamp(32px, 4vw, 48px); }

.breadcrumb ol { display: flex; flex-wrap: wrap; font-size: .875rem; }
.breadcrumb li + li::before { content: "/"; color: var(--azure); padding-inline: 10px; }
.breadcrumb a { color: var(--text-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-1); text-decoration: underline; text-decoration-color: var(--azure); }

.article-title {
  margin-top: 24px;
  max-width: 18ch;
  font-size: clamp(2.25rem, 5.6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.article-standfirst {
  margin-top: 24px;
  max-width: 58ch;
  font-size: clamp(1.125rem, 1.8vw, 1.3125rem);
  line-height: 1.55;
}

.article-byline { display: flex; align-items: center; gap: 14px; margin-top: 32px; }
.byline-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 48% 62%;          /* centres the face in the original 709x945 photo */
  background: var(--ink-700);
}
.byline-name { color: var(--text-1); font-weight: 600; line-height: 1.4; }

/* Cover runs out to the right edge of the screen, like the home page slab */
.article-cover {
  aspect-ratio: 16 / 9;
  margin-right: calc(var(--gutter) * -1);
  margin-bottom: clamp(48px, 7vw, 88px);
}
@media (min-width: 880px) {
  .article-cover {
    aspect-ratio: 21 / 8;
    margin-left: clamp(0px, 8vw, 120px);
    margin-right: calc((100vw - min(100vw, var(--wrap) + var(--gutter) * 2)) / -2 - var(--gutter));
  }
}

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
@media (min-width: 1080px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 240px; column-gap: clamp(56px, 7vw, 120px); }
  .article-aside { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; }
}

/* Article typography */
.prose {
  max-width: 68ch;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-2);
}
.prose > * + * { margin-top: 1.25em; }
.prose h2 {
  margin-top: 2.2em;
  font-size: clamp(1.5rem, 2.6vw, 1.875rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.prose h3 { margin-top: 1.8em; font-size: 1.25rem; }
.prose h2 + *, .prose h3 + * { margin-top: .75em; }
.prose a { color: var(--text-1); text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { color: var(--text-1); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: .5em; }
.prose li::marker { color: var(--azure); font-weight: 600; }
.prose blockquote {
  margin-block: 2em;
  padding-left: 24px;
  border-left: 3px solid var(--azure);
  color: var(--text-1);
  font: 600 clamp(1.25rem, 2.2vw, 1.5rem)/1.45 var(--font-display);
  letter-spacing: -0.01em;
}
.prose code {
  padding: .15em .4em;
  border-radius: 4px;
  background: var(--ink-700);
  color: var(--text-1);
  font: .875em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.prose pre {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink-800);
  overflow-x: auto;
}
.prose pre code { padding: 0; background: none; font-size: .875rem; white-space: pre; }
.prose hr { height: 1px; margin-block: 2.5em; border: 0; background: var(--line); }
.prose table { width: 100%; border-collapse: collapse; font-size: .9688rem; line-height: 1.5; }
.prose caption { padding-bottom: 10px; color: var(--text-3); font-size: .875rem; text-align: left; caption-side: top; }
.prose th, .prose td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { color: var(--text-1); font-weight: 600; border-bottom-color: var(--text-3); }
.prose img { margin-block: 2em; }
.prose figcaption { margin-top: 10px; color: var(--text-3); font-size: .875rem; }

/* Sidebar */
.aside-title {
  margin-bottom: 14px;
  font-size: .9375rem;
  letter-spacing: 0;
}
.toc { display: none; }
.toc ol { border-left: 2px solid var(--line); }
.toc a {
  display: block;
  margin-left: -2px;
  padding: 7px 0 7px 16px;
  border-left: 2px solid transparent;
  color: var(--text-3);
  font-size: .9375rem;
  line-height: 1.45;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}
.toc a:hover { color: var(--text-1); border-left-color: var(--azure); }
.share ul { display: flex; flex-wrap: wrap; gap: 8px; }
.article-aside { border-top: 1px solid var(--line); padding-top: 32px; }
@media (min-width: 1080px) {
  .toc { display: block; }
  .share { margin-top: 40px; }
  .article-aside { border-top: 0; padding-top: 0; }
}

/* After the post */
.article-foot {
  display: grid;
  gap: 24px;
  margin-top: clamp(56px, 8vw, 96px);
  padding-bottom: var(--section-y);
}
.author-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid var(--line);
}
.author-card img {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 48% 62%;
  background: var(--ink-700);
}
.author-name { margin-bottom: 6px; color: var(--text-1); font: 600 1.125rem/1.3 var(--font-display); }
.author-card p { max-width: 52ch; }
.author-link { display: inline-block; margin-top: 12px; color: var(--text-1); font-weight: 600; }

.post-nav { display: grid; gap: 12px; }
.post-nav-link {
  display: grid;
  gap: 4px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color .2s ease;
}
.post-nav-link:hover { border-color: var(--azure); }
.post-nav-dir { color: var(--text-3); font-size: .875rem; }
.post-nav-title { color: var(--text-1); font: 600 1.0625rem/1.35 var(--font-display); }

@media (min-width: 880px) {
  .article-foot { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: stretch; }
}

.related {
  padding-block: var(--section-y);
  background: var(--ink-800);
  border-top: 1px solid var(--ink-700);
}

/* =========================================================
   WordPress additions (ms-custom theme)
   ========================================================= */

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Category filter as links to category archives */
.post-filter a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
  font-size: .9375rem;
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.post-filter a:hover { border-color: var(--azure); color: var(--text-1); }
.post-filter a[aria-current] { background: var(--azure-deep); border-color: var(--azure-deep); color: #fff; }

/* Long archive / search titles */
.page-title-long { font-size: clamp(2.5rem, 9vw, 5rem); line-height: 1; letter-spacing: -0.03em; }

/* paginate_links() markup */
.pagination .page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-1);
  text-decoration: none;
}
.pagination a.page-numbers:hover { border-color: var(--azure); }
.pagination .page-numbers.current { background: var(--azure-deep); border-color: var(--azure-deep); color: #fff; }
.pagination .page-numbers.dots { border-color: transparent; }

/* Plain pages */
.page-body { padding-bottom: var(--section-y); }

/* 404 */
.page-404-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* Multi-page posts */
.page-links { margin-top: 2em; color: var(--text-3); }

/* Block editor content inside articles */
.prose .alignleft { float: left; margin: .3em 1.5em 1em 0; max-width: 50%; }
.prose .alignright { float: right; margin: .3em 0 1em 1.5em; max-width: 50%; }
.prose .aligncenter { margin-inline: auto; }
.prose .alignwide, .prose .alignfull { max-width: none; }
.prose figure { margin-block: 2em; }
.prose figure img, .prose .wp-block-image img { margin-block: 0; height: auto; }
.prose .wp-element-caption, .prose .wp-caption-text { margin-top: 10px; color: var(--text-3); font-size: .875rem; }
.prose .wp-block-embed iframe, .prose iframe { max-width: 100%; }
.prose .wp-block-table { overflow-x: auto; }
.prose .wp-block-pullquote { border: 0; padding: 0; text-align: left; }
.prose .wp-block-pullquote blockquote { margin: 0; }
.prose .wp-block-separator { height: 1px; border: 0; background: var(--line); }
.prose .wp-block-button__link { display: inline-flex; padding: 12px 24px; border-radius: 999px; background: var(--azure-deep); color: #fff; text-decoration: none; font-weight: 600; }
.prose::after { content: ""; display: table; clear: both; }
