/* ==========================================================================
   SYH Group blog: loaded after styles.css on /blog/ pages only.
   Reuses the site's tokens, type scale and components.
   1. Blog landing   2. Post cards   3. Article header   4. Article layout
   5. Article typography   6. Contents   7. Sharing   8. Sources, CTA, related
   ========================================================================== */

/* Blog pages sit on the light paper background, so use dark text by default
   (header and footer set their own colours). */
.page-blog main,
.page-article main { color: var(--on-light); }
.page-blog :focus-visible,
.page-article :focus-visible { outline-color: var(--accent-ink); }
.page-blog .site-header :focus-visible,
.page-article .site-header :focus-visible,
.page-blog .site-footer :focus-visible,
.page-article .site-footer :focus-visible { outline-color: var(--accent); }
.page-article .eyebrow-num,
.page-blog .eyebrow-num { color: var(--accent-ink); }

/* 1. Blog landing -------------------------------------------------------- */

.blog-hero {
  padding-top: clamp(3.5rem, 8vw, 7rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}
.blog-hero .display-1 { max-width: 16ch; margin-bottom: 1.75rem; }
.blog-hero .display-1 em { color: var(--on-light-muted); }

/* Current section in the main navigation */
.nav-list a[aria-current="page"]::after { transform: scaleX(1); }
.blog-hero .lead { max-width: 40rem; color: var(--on-light-muted); }

.blog-list { padding-bottom: var(--section-y); }

.blog-note {
  margin-top: clamp(3.5rem, 7vw, 5.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line-light);
  display: grid;
  gap: 1.5rem;
  justify-items: start;
  color: var(--on-light-muted);
  font-size: 1rem;
  max-width: 44rem;
}

/* 2. Post cards ---------------------------------------------------------- */

.post-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.9rem;
}
.post-card-media {
  overflow: hidden;
  background: var(--paper-2);
}
.post-card-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.post-card:hover .post-card-media img { transform: scale(1.03); }

.post-topic {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.post-card-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.625rem, 2.2vw, 2.125rem);
  line-height: 1.1;
  text-wrap: balance;
}
.post-card-title a { text-decoration: none; }
/* The title link covers the whole card, so the card has one tab stop */
.post-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.post-card-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.post-card:focus-within { outline: 2px solid var(--accent-ink); outline-offset: 6px; }
.post-card-title a:focus-visible { outline: none; }

.post-excerpt { color: var(--on-light-muted); font-size: 1rem; line-height: 1.6; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.875rem;
  color: var(--on-light-muted);
}
.post-meta > * + *::before { content: "·"; margin-right: 0.75rem; }

/* Featured article */
.post-featured {
  row-gap: 1.5rem;
  padding-bottom: clamp(3rem, 6vw, 5rem);
  margin-bottom: clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--line-light);
}
.post-featured .post-card-title { font-size: clamp(2.125rem, 3.8vw, 3.5rem); line-height: 1.02; }
.post-featured .post-excerpt { font-size: 1.0625rem; max-width: 36rem; }
.post-featured .post-card-read {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--on-light);
}
@media (min-width: 56.25em) {
  .post-featured {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    align-items: center;
  }
  .post-featured .post-card-media { grid-column: 1 / 8; grid-row: 1 / 8; }
  .post-featured > :not(.post-card-media) { grid-column: 8 / 13; }
}

/* Remaining articles: 2 + 3 on wide screens */
.post-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(3rem, 5vw, 4rem) var(--col-gap);
}
@media (min-width: 37.5em) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 63.99em) {
  .post-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .post-grid > .post-card { grid-column: span 2; }
  .post-grid > .post-card:nth-child(-n + 2) { grid-column: span 3; }
}

/* 3. Article header ------------------------------------------------------ */

.article-header {
  padding-top: clamp(2.5rem, 6vw, 5rem);
  padding-bottom: clamp(2rem, 4vw, 3rem);
}
.article-header .breadcrumb ol { margin-bottom: clamp(2rem, 4vw, 3rem); }
.article-header .post-topic { margin-bottom: 1.25rem; display: block; }
.article-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 5.4vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  max-width: 20ch;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.article-standfirst {
  margin-top: 1.75rem;
  max-width: 44rem;
  font-size: clamp(1.1875rem, 1.6vw, 1.4375rem);
  line-height: 1.55;
  color: var(--on-light-muted);
}
.article-meta {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-light);
  font-size: 0.9375rem;
  color: var(--on-light-muted);
  max-width: 44rem;
}
.article-meta strong { color: var(--on-light); font-weight: 600; }

.article-hero { margin: 0; }
.article-hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--paper-2);
}
@media (max-width: 37.49em) {
  .article-hero img { aspect-ratio: 3 / 2; }
}
.article-hero figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--on-light-muted);
}

/* 4. Article layout ------------------------------------------------------ */

.article-main { padding-top: clamp(2.5rem, 5vw, 4rem); padding-bottom: var(--section-y); }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}
@media (min-width: 63.99em) {
  .article-layout {
    grid-template-columns: minmax(13rem, 17rem) minmax(0, 44rem);
    column-gap: clamp(3rem, 6vw, 6rem);
    justify-content: start;
  }
  .article-aside {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 4rem);
    overflow-y: auto;
  }
}

/* 5. Article typography -------------------------------------------------- */

.article-body {
  max-width: 44rem; /* about 70 characters per line at this size */
  font-size: 1.125rem;
  line-height: 1.75;
  color: #26241f;
}
.article-body > * + * { margin-top: 1.35rem; }
.article-body h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.875rem, 3vw, 2.5rem);
  line-height: 1.1;
  color: var(--on-light);
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-light);
  scroll-margin-top: 1.5rem; /* html already reserves the header height */
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--on-light);
  margin-top: 2.25rem;
  scroll-margin-top: 1.5rem; /* html already reserves the header height */
}
.article-body h2 + *,
.article-body h3 + * { margin-top: 0.85rem; }
.article-body a { color: var(--accent-ink); text-decoration-thickness: 1px; }
.article-body a:hover { color: var(--on-light); }
.article-body ul,
.article-body ol { padding-left: 1.4rem; }
.article-body li + li { margin-top: 0.5rem; }
.article-body li::marker { color: var(--accent-ink); }
.article-body strong { font-weight: 650; color: var(--on-light); }

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--on-light);
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9875rem;
  line-height: 1.55;
}
.article-body caption {
  caption-side: bottom;
  text-align: left;
  padding-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--on-light-muted);
}
.article-body th,
.article-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1rem 0.85rem 0;
  border-bottom: 1px solid var(--line-light);
}
.article-body th { font-weight: 650; color: var(--on-light); }
.article-body thead th {
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.callout {
  padding: 1.25rem 1.4rem;
  border-left: 3px solid var(--accent-ink);
  background: var(--paper-2);
  font-size: 1.03rem;
  line-height: 1.65;
}
.callout-title {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.callout > * + * { margin-top: 0.75rem; }

.article-disclaimer {
  margin-top: 3rem;
  font-size: 0.9375rem;
  color: var(--on-light-muted);
  font-style: italic;
}

/* 6. Contents ------------------------------------------------------------ */

.toc {
  border-top: 1px solid var(--on-light);
  border-bottom: 1px solid var(--line-light);
}
.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s var(--ease);
}
.toc[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc ol {
  list-style: none;
  padding: 0 0 1rem;
  counter-reset: toc;
}
.toc li { counter-increment: toc; }
.toc a {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: 0.45rem 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
  color: var(--on-light-muted);
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent-ink);
}
.toc a:hover,
.toc a[aria-current="true"] { color: var(--on-light); }
.toc a[aria-current="true"] { font-weight: 600; }

/* 7. Sharing ------------------------------------------------------------- */

.share { margin-top: 2rem; }
.share-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.share-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.share-list li { margin: 0; }
.share-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--field-border);
  background: transparent;
  color: var(--on-light);
  font: 500 0.9375rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.share-btn:hover { border-color: var(--on-light); background: var(--paper-2); }
.share-btn[hidden] { display: none; }
.share-status {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  color: var(--on-light);
}
.share-status:empty { display: none; }
.share-fallback {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9375rem;
}
.share-fallback[hidden] { display: none; }
.share-fallback input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--field-border);
  background: var(--white);
  font: 400 0.9375rem/1.3 var(--sans);
  color: var(--on-light);
}
.article-aside .share { margin-top: 2rem; }
.article-aside .share-list { flex-direction: column; align-items: stretch; }
.article-aside .share-btn { width: 100%; }
@media (max-width: 63.98em) {
  .article-aside .share { display: none; } /* shown once, after the article, on smaller screens */
}
.share-end { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line-light); }
@media (min-width: 63.99em) {
  .share-end { display: none; }
}
.no-js .share-btn[data-share-copy],
.no-js .share-btn[data-share-native] { display: none; }

/* 8. Sources, CTA, related ---------------------------------------------- */

.article-sources {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--on-light);
}
.article-sources h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.625rem, 2.4vw, 2rem);
  margin-bottom: 1rem;
  scroll-margin-top: 1.5rem; /* html already reserves the header height */
}
.article-sources ol {
  padding-left: 1.4rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--on-light-muted);
}
.article-sources li + li { margin-top: 0.6rem; }
.article-sources li::marker { color: var(--accent-ink); }
.article-sources a { color: var(--on-light); overflow-wrap: anywhere; }
.article-sources p { font-size: 0.9375rem; color: var(--on-light-muted); margin-top: 1rem; }

.article-cta {
  margin-top: 3rem;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--ink);
  color: var(--on-dark);
  display: grid;
  gap: 1.25rem;
  justify-items: start;
}
.article-cta h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.625rem, 2.4vw, 2.125rem);
  line-height: 1.1;
}
.article-cta p { color: var(--on-dark-muted); font-size: 1rem; max-width: 36rem; }
.article-cta :focus-visible { outline-color: var(--accent); }

.related {
  padding-block: clamp(4rem, 8vw, 6.5rem);
  border-top: 1px solid var(--line-light);
}
.related-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 3.4vw, 3rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.related-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem var(--col-gap);
}
@media (min-width: 37.5em) {
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 63.99em) {
  .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.related .post-card-title { font-size: clamp(1.5rem, 2vw, 1.875rem); }

@media print {
  .article-aside, .share-end, .related, .article-cta { display: none !important; }
}
