/* ==========================================================================
   BLOG. Index, cards, article layout, quick answer, key takeaways, contents,
   author and share. Added 2026-11-30. Loaded only on /blog/, single articles
   and search (inc/blog.php). Every colour, radius, shadow and face is a token
   from style.css section 1; contrast pairs reuse ones already measured there.
   ========================================================================== */

/* ---- Author avatar ------------------------------------------------------ */
.mg-avatar {
  --s: 52px;
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--s); height: var(--s); border-radius: 50%; overflow: clip;
  background: var(--c-contrast); color: #fff;
  font-family: var(--f-head); font-weight: 800; font-size: calc(var(--s) * .36); letter-spacing: .02em; line-height: 1;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c-accent);
}
.mg-avatar--sm { --s: 42px; }
.mg-avatar--lg { --s: 92px; }
.mg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mg-authorline { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.mg-authorline p { margin: 0; font-size: 15px; line-height: 1.4; color: var(--c-text-muted); }
.mg-authorline strong { display: block; font-family: var(--f-head); font-weight: 700; color: var(--c-contrast); }
.mg-authorline a { color: inherit; text-decoration: none; }
.mg-authorline a:hover { color: var(--c-accent-text); }

/* ---- Shared small type -------------------------------------------------- */
.mg-kicker {
  display: block; margin: 0 0 10px;
  font-family: var(--f-head); font-size: 12px; font-weight: 700; line-height: 1.4;
  letter-spacing: .14em; text-transform: uppercase; color: var(--c-accent-text);
}
.mg-postmeta {
  display: flex; flex-wrap: wrap; gap: 2px 0; margin: 0;
  font-size: 14px; line-height: 1.5; color: var(--c-text-meta);
}
.mg-postmeta > span + span::before { content: "\00B7"; margin: 0 9px; color: var(--c-border-hover); }
.mg-postmeta time, .mg-postcard .mg-postmeta time { display: inline; margin: 0; font-size: inherit; color: inherit; }

/* ---- Index: topics ------------------------------------------------------ */
.mg-pagehead--blog h1 { max-width: 18ch; }
.mg-pagehead--blog .mg-lede { max-width: 64ch; }
.mg-topics { margin: 0 0 34px; }
.mg-topics__label { margin: 0 0 12px; font-family: var(--f-head); font-weight: 700; font-size: 14px; color: var(--c-contrast); }
.mg-chip.is-current, a.mg-chip.is-current:hover {
  background: var(--c-contrast); border-color: var(--c-contrast); color: #fff; transform: none;
}
.mg-chip__n { margin-left: 8px; font-size: 13px; opacity: .8; }

.mg-blog__h { font-size: 30px; margin: 0 0 24px; }
.mg-blog__filtered { margin: -12px 0 26px; color: var(--c-text-muted); }

/* ---- Index: featured article ------------------------------------------ */
.mg-featured {
  display: grid; grid-template-columns: 1.12fr 1fr;
  margin: 0 0 60px; background: #fff; color: inherit; text-decoration: none;
  border: 1px solid var(--c-border); border-radius: var(--r-panel); overflow: clip;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.mg-featured:hover { transform: translateY(-4px); box-shadow: var(--sh-card-lg); border-color: var(--c-border-hover); color: inherit; }
.mg-featured__media { position: relative; min-height: 360px; background: var(--c-contrast); }
.mg-featured__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.mg-featured:hover .mg-featured__media img { transform: scale(1.03); }
.mg-featured__badge {
  position: absolute; top: 18px; left: 18px;
  padding: 7px 13px; border-radius: var(--r-pill);
  background: var(--c-accent-strong); color: #fff; /* 4.81:1, measured in style.css */
  font-family: var(--f-head); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.mg-featured__body { display: flex; flex-direction: column; justify-content: center; padding: 46px 46px 42px; }
.mg-featured__body h2 { font-size: 34px; line-height: 1.1; margin-bottom: .45em; text-wrap: balance; transition: color .2s var(--ease); }
.mg-featured:hover h2 { color: var(--c-accent-text); }
.mg-featured__excerpt { font-size: 17px; line-height: 1.65; color: var(--c-text-muted); }
.mg-featured__by { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.mg-featured__name { margin: 0; font-family: var(--f-head); font-weight: 700; font-size: 15px; color: var(--c-contrast); }
.mg-featured .mg-card__more { margin-top: 22px; }
.mg-featured:hover .mg-card__more::after { transform: translateX(3px); }

/* ---- Cards -------------------------------------------------------------- */
.mg-postgrid-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.mg-postcard { margin: 0; min-width: 0; }
.mg-postcard__link {
  display: flex; flex-direction: column; height: 100%;
  background: #fff; color: inherit; text-decoration: none;
  border: 1px solid var(--c-border); border-radius: var(--r-card); overflow: clip;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.mg-postcard__link:hover { transform: translateY(-5px); box-shadow: var(--sh-card); border-color: var(--c-border-hover); color: inherit; }
.mg-postcard__media { aspect-ratio: 16 / 10; background: var(--c-contrast); overflow: clip; }
.mg-postcard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.mg-postcard__link:hover .mg-postcard__media img { transform: scale(1.04); }
.mg-postcard__body { display: flex; flex-direction: column; flex: 1; padding: 24px 24px 26px; }
.mg-postcard .mg-postcard__title { font-size: 21px; line-height: 1.22; margin: 0 0 .5em; text-wrap: balance; transition: color .2s var(--ease); }
.mg-postcard__link:hover .mg-postcard__title { color: var(--c-accent-text); }
.mg-postcard__excerpt { font-size: 15.5px; line-height: 1.6; color: var(--c-text-muted); margin: 0 0 18px; }
.mg-postcard .mg-postmeta { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--c-border-light); }

@media (prefers-reduced-motion: reduce) {
  .mg-featured:hover, .mg-postcard__link:hover { transform: none; }
  .mg-featured:hover .mg-featured__media img, .mg-postcard__link:hover .mg-postcard__media img { transform: none; }
}

/* ---- Pagination --------------------------------------------------------- */
.mg-blog .navigation.pagination { margin-top: 44px; }
.mg-blog .nav-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mg-blog .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--c-border-input); border-radius: var(--r-btn); background: #fff;
  font-family: var(--f-head); font-weight: 700; font-size: 15px; color: var(--c-contrast); text-decoration: none;
}
.mg-blog a.page-numbers:hover { border-color: var(--c-accent); background: var(--c-accent-tint); }
.mg-blog .page-numbers.current { background: var(--c-contrast); border-color: var(--c-contrast); color: #fff; }

/* ---- Article header ----------------------------------------------------- */
.mg-articlehead { padding: 36px 0 38px; }
.mg-articlehead__inner { max-width: 900px; }
.mg-articlehead h1 { font-size: 52px; line-height: 1.06; margin-bottom: .4em; text-wrap: balance; }
.mg-articlehead .mg-lede { max-width: 66ch; margin-bottom: 28px; }
a.mg-articlehead__cat { display: inline-block; text-decoration: none; }
a.mg-articlehead__cat:hover { color: var(--c-contrast); }

.mg-byline { display: flex; align-items: center; gap: 16px; padding-top: 22px; border-top: 1px solid var(--c-border-light); }
.mg-byline p { margin: 0; }
.mg-byline__name { font-size: 16px; line-height: 1.4; color: var(--c-text); }
.mg-byline__name a { font-family: var(--f-head); font-weight: 700; color: var(--c-contrast); text-decoration: none; }
.mg-byline__name a:hover { color: var(--c-accent-text); }
.mg-byline .mg-postmeta { margin-top: 3px; }

.mg-articlehero { margin: 0 0 52px; aspect-ratio: 21 / 9; border-radius: var(--r-panel); overflow: clip; background: var(--c-contrast); }
.mg-articlehero img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Article grid ------------------------------------------------------- */
.mg-articlegrid {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 64px;
  grid-template-areas: "intro side" "body side" "end side";
  align-items: start; padding-bottom: 84px;
}
.mg-articlegrid__intro { grid-area: intro; max-width: 74ch; }
.mg-articlegrid__side  { grid-area: side; align-self: stretch; }
.mg-articlegrid__body  { grid-area: body; min-width: 0; }
.mg-articlegrid__end   { grid-area: end; max-width: 74ch; }
.mg-articleside { position: sticky; top: 110px; display: grid; gap: 20px; }

/* ---- Quick answer and key takeaways ------------------------------------- */
.mg-answer {
  position: relative; overflow: clip; margin: 0 0 20px; padding: 28px 30px;
  background: var(--c-contrast); color: var(--c-on-dark); border-radius: var(--r-card);
}
.mg-answer::before { content: ""; position: absolute; inset: 0; background: var(--glow); pointer-events: none; }
.mg-answer > * { position: relative; }
.mg-answer .mg-answer__label, .mg-takeaways .mg-takeaways__label {
  margin: 0 0 10px; font-family: var(--f-head); font-size: 12px; font-weight: 700; line-height: 1.4;
  letter-spacing: .14em; text-transform: uppercase;
}
.mg-answer .mg-answer__label { color: var(--c-accent-warm); }
.mg-answer p { margin: 0; color: #fff; font-size: 18px; line-height: 1.6; }

.mg-takeaways {
  margin: 0 0 44px; padding: 26px 30px;
  background: var(--c-accent-tint); border: 1px solid #F6D9C6; border-radius: var(--r-card);
}
.mg-takeaways .mg-takeaways__label { color: var(--c-accent-text); }
.mg-takeaways ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mg-takeaways li { position: relative; margin: 0; padding-left: 30px; font-size: 16.5px; line-height: 1.55; color: var(--c-text); }
.mg-takeaways li::before { content: "\2713"; position: absolute; left: 0; top: 0; font-weight: 700; color: var(--c-accent-text); }

/* ---- Contents ----------------------------------------------------------- */
.mg-toc { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-card); }
.mg-toc__title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 16px 20px; cursor: pointer; list-style: none;
  font-family: var(--f-head); font-weight: 800; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--c-contrast);
}
.mg-toc__title::-webkit-details-marker { display: none; }
.mg-toc__title::after { content: "+"; font-size: 22px; line-height: 1; font-weight: 600; color: var(--c-accent); transition: transform .2s var(--ease); }
.mg-toc[open] .mg-toc__title::after { transform: rotate(45deg); }
.mg-toc nav { padding: 0 10px 14px; max-height: calc(100vh - 380px); overflow-y: auto; scrollbar-width: thin; }
.mg-toc__list { list-style: none; margin: 0; padding: 0; counter-reset: mgtoc; }
.mg-toc__list li { margin: 0; counter-increment: mgtoc; }
.mg-toc__list a {
  display: grid; grid-template-columns: 26px 1fr; gap: 4px; padding: 8px 10px;
  border-left: 2px solid transparent; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 15px; line-height: 1.4; color: var(--c-text); text-decoration: none;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.mg-toc__list a::before { content: counter(mgtoc, decimal-leading-zero); padding-top: 2px; font-family: var(--f-head); font-weight: 700; font-size: 12px; color: var(--c-text-meta); }
.mg-toc__list a:hover { background: var(--c-surface-alt); color: var(--c-contrast); }
.mg-toc__list a[aria-current] { background: var(--c-accent-tint); border-left-color: var(--c-accent); color: var(--c-contrast); font-weight: 600; }
.mg-toc__list a[aria-current]::before { color: var(--c-accent-text); }

/* ---- Side call to action ----------------------------------------------- */
.mg-sidecta { position: relative; overflow: clip; padding: 26px 24px; background: var(--c-contrast); border-radius: var(--r-card); color: var(--c-on-dark); }
.mg-sidecta::before { content: ""; position: absolute; inset: 0; background: var(--glow); pointer-events: none; }
.mg-sidecta > * { position: relative; }
.mg-sidecta .mg-sidecta__head { margin: 0 0 8px; font-family: var(--f-head); font-weight: 800; font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; color: #fff; }
.mg-sidecta p { font-size: 15px; line-height: 1.55; color: var(--c-on-dark); }
.mg-sidecta .mg-btn { width: 100%; margin-top: 6px; }
.mg-sidecta .mg-tel { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-top: 10px; color: #fff; }
.mg-sidecta .mg-tel:hover { color: var(--c-accent-warm); }
.mg-sidecta .mg-tel small { color: var(--c-on-dark-faint); }

/* ---- Article body ------------------------------------------------------- */
.mg-prose--article { max-width: 74ch; font-size: 18px; line-height: 1.75; }
.mg-prose--article > p:first-child { font-size: 19px; }
.mg-prose--article h2 { font-size: 32px; line-height: 1.15; margin: 1.8em 0 .55em; scroll-margin-top: 120px; text-wrap: balance; }
.mg-prose--article h2:first-child { margin-top: 0; }
.mg-prose--article h3 { font-size: 23px; line-height: 1.25; margin: 1.5em 0 .5em; scroll-margin-top: 120px; }
.mg-prose--article ol { padding-left: 1.5em; }
.mg-prose--article ol > li { padding-left: 4px; }
.mg-prose--article ol > li::marker { color: var(--c-accent-text); font-family: var(--f-head); font-weight: 700; }
.mg-prose--article li { margin-bottom: .55em; }
.mg-prose--article .mg-figure { margin: 34px 0; }
/* Landscape images fill the column; the site's portrait photography is held
   to a sensible height and centred, so it never dominates the copy. */
.mg-prose--article .mg-figure__img { width: auto; max-width: 100%; height: auto; max-height: 620px; margin: 0 auto; border-radius: var(--r-card); }
.mg-prose--article .mg-figure__cap { text-align: center; }
.mg-prose--article .mg-figure__cap { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--c-text-meta); }
.mg-prose--article .mg-callout { margin: 34px 0; }
.mg-prose--article .mg-callout p { font-size: 17px; }
.mg-prose--article .mg-tablewrap { margin: 28px 0; border: 1px solid var(--c-border); border-radius: var(--r-card); }
.mg-prose--article table { margin: 0; font-size: 15.5px; line-height: 1.55; }
.mg-prose--article thead th { background: var(--c-surface-alt); }
.mg-prose--article tbody tr:last-child td, .mg-prose--article tbody tr:last-child th { border-bottom: 0; }
.mg-prose--article .mg-faqs { margin: 20px 0 0; }
.mg-prose--article .mg-faq summary { font-size: 18px; }
.mg-prose--article .mg-faq__body p { font-size: 16.5px; }

/* Inline call to action inside an article */
.mg-inlinecta {
  display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: center;
  margin: 40px 0; padding: 26px 28px; border-left: 4px solid var(--c-accent);
  background: var(--c-surface-alt); border-radius: 0 var(--r-card) var(--r-card) 0;
}
.mg-inlinecta p { margin: 0; font-size: 17px; line-height: 1.55; }
.mg-inlinecta strong { display: block; font-family: var(--f-head); font-size: 20px; margin-bottom: 4px; }
.mg-prose--article .mg-inlinecta .mg-btn { font-size: 18px; white-space: nowrap; color: #fff; }

/* Sources and standards */
.mg-sources { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--c-border-light); }
.mg-prose--article .mg-sources h2 { font-size: 22px; margin-top: 0; }
.mg-prose--article .mg-sources li, .mg-prose--article .mg-sources p { font-size: 15.5px; color: var(--c-text-muted); }

/* ---- Share and author --------------------------------------------------- */
.mg-share {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  margin-top: 52px; padding: 24px 0; border-top: 1px solid var(--c-border-light); border-bottom: 1px solid var(--c-border-light);
}
.mg-share__label { margin: 0; font-family: var(--f-head); font-weight: 700; font-size: 15px; color: var(--c-contrast); }
.mg-share__list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.mg-share__list li { margin: 0; }
.mg-share__btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 16px;
  border: 1px solid var(--c-border-input); border-radius: var(--r-pill); background: #fff; cursor: pointer;
  font-family: var(--f-body); font-weight: 500; font-size: 15px; color: var(--c-text); text-decoration: none;
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.mg-share__btn:hover { border-color: var(--c-accent); background: var(--c-accent-tint); color: var(--c-contrast); }
.mg-share__btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.mg-share__btn[hidden] { display: none; }

.mg-authorbox {
  display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: start;
  margin-top: 40px; padding: 32px; background: var(--c-surface-subtle);
  border: 1px solid var(--c-border); border-radius: var(--r-panel);
}
.mg-authorbox .mg-eyebrow { margin-bottom: 6px; }
.mg-authorbox .mg-authorbox__name { font-size: 26px; margin: 0 0 2px; }
.mg-authorbox__role { margin: 0 0 12px; font-family: var(--f-head); font-weight: 600; font-size: 15px; color: var(--c-text-muted); }
.mg-authorbox p { font-size: 16px; line-height: 1.65; }
.mg-authorbox__links { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 16px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 1100px) {
  .mg-postgrid-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-articlegrid { grid-template-columns: minmax(0, 1fr) 260px; column-gap: 40px; }
}
@media (max-width: 1023px) {
  .mg-articlegrid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "side" "body" "end"; }
  .mg-articlegrid__side { margin-bottom: 38px; }
  .mg-articleside { position: static; }
  .mg-sidecta { display: none; }
  .mg-toc nav { max-height: none; }
  .mg-featured { grid-template-columns: 1fr; }
  .mg-featured__media { min-height: 0; aspect-ratio: 16 / 9; }
  .mg-featured__body { padding: 32px 30px 34px; }
  .mg-articlehead h1 { font-size: 42px; }
}
@media (max-width: 780px) {
  .mg-postgrid-list { grid-template-columns: 1fr; gap: 22px; }
  .mg-articlehead { padding: 26px 0 30px; }
  .mg-articlehead h1 { font-size: 33px; }
  .mg-articlehero { aspect-ratio: 16 / 10; margin-bottom: 32px; border-radius: var(--r-card); }
  .mg-featured__body h2 { font-size: 26px; }
  .mg-blog__h { font-size: 25px; }
  .mg-prose--article { font-size: 17px; }
  .mg-prose--article > p:first-child { font-size: 18px; }
  .mg-prose--article h2 { font-size: 26px; }
  .mg-prose--article h3 { font-size: 21px; }
  .mg-answer, .mg-takeaways { padding: 22px 20px; }
  .mg-answer p { font-size: 17px; }
  .mg-inlinecta { grid-template-columns: 1fr; padding: 22px 20px; }
  .mg-authorbox { grid-template-columns: 1fr; gap: 16px; padding: 24px 20px; }
  .mg-byline { align-items: flex-start; }
}
