/* Marketing Magician: blog post page (spec 2.3). Linked from modules/blog/show and from pages/show when a page has a TOC; theme.css is at its size budget.
   Reuses theme.css tokens and .mm-btn / .mm-card. The TOC classes (.mm-toc) are generic so other pages can reuse them.
   Grid: cover | TOC | article | sidebar. 1280+: 240 | 720 | 320, the TOC sticky (it is short);
   the sidebar stays in normal page flow so every block is visible. 1024-1279: TOC box above the
   article, sidebar right. Below: cover, TOC box, article, sidebar. */
.mm-pl { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "cover" "toc" "main" "side"; align-items: start; max-width: 768px; }
.mm-pl > * { min-width: 0; }
.mm-post-cover { grid-area: cover; margin-bottom: 32px; }
.mm-post-cover .mm-art-img { width: 100%; margin-inline: 0; margin-bottom: 0; }
.mm-post-toc { grid-area: toc; }
.mm-post-main { grid-area: main; }
.mm-post-side { grid-area: side; }
.mm-pl .mm-article, .mm-pl #comments { max-width: none; }
.mm-post-toc > .mm-share--compact { display: none; }
/* Page TOC (pages/show prose branch, 3+ headings): TOC box, content, talk card; at 1024-1279 the TOC box sits above the
   content with the talk card right; at 1280+ sticky TOC | content | talk card. */
.mm-pg--toc { grid-template-areas: "toc" "main" "side"; }
.mm-pg-toc { grid-area: toc; }
.mm-pg--toc > .mm-pg-main { grid-area: main; }
.mm-pg--toc > .mm-talk { grid-area: side; }
.mm-pg-toc .mm-toc { margin: 0; }
.mm-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Prose: long URLs wrap, code scrolls inside its box, anchored headings clear the sticky header. */
.mm-pl .mm-prose a { overflow-wrap: anywhere; }
.mm-pl .mm-prose pre { max-width: 100%; }
.mm-prose :is(h2, h3)[id] { scroll-margin-top: 104px; }
.mm-prose :is(h2, h3):target { text-decoration: underline 3px var(--mm-gold); text-underline-offset: 6px; }

/* TOC: an open <details> box; a plain sticky column at 1280+. */
.mm-toc { margin-bottom: 32px; padding: 0 16px 8px; border: 1px solid var(--mm-line); border-radius: var(--mm-r-card); background: var(--mm-surface); }
.mm-toc:not([open]) { padding-bottom: 0; }
.mm-toc > summary { display: flex; align-items: center; justify-content: space-between; min-height: var(--mm-ctl); font-weight: 600; color: var(--mm-ink); cursor: pointer; list-style: none; }
.mm-toc > summary::-webkit-details-marker { display: none; }
.mm-toc > summary::after { content: ""; width: 8px; height: 8px; margin-right: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.mm-toc[open] > summary::after { transform: rotate(-135deg); }
.mm-toc ol { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--mm-line); }
.mm-toc a { display: flex; align-items: center; min-height: var(--mm-ctl); margin-left: -2px; padding: 4px 12px; border-left: 2px solid transparent; color: var(--mm-muted); font-size: var(--mm-fs-sm); line-height: 1.4; text-decoration: none; }
.mm-toc .mm-toc-l3 a { padding-left: 28px; }
.mm-toc a:hover { color: var(--mm-ink); }
.mm-toc a.is-active { border-left-color: var(--mm-ink-line); color: var(--mm-ink); font-weight: 600; }

/* Section label used by the share row, author card and sidebar blocks. */
.mm-ps-h { margin: 0 0 12px; font-size: var(--mm-fs-meta); font-weight: 600; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase; color: var(--mm-muted); }

/* Helpful vote */
.mm-helpful { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; margin-top: 48px; padding: 24px; border-radius: var(--mm-r-card); background: var(--mm-lilac); }
.mm-helpful-h { margin: 0; font-size: var(--mm-fs-h3); }
.mm-vote { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-vote-b { margin: 0; padding: 0 20px; background: #FFFFFF; color: var(--mm-ink); box-shadow: inset 0 0 0 1.5px var(--mm-line); }
.mm-vote-b:hover { box-shadow: inset 0 0 0 1.5px var(--mm-ink-line); }
.mm-vote-b[aria-pressed="true"] { background: var(--mm-ink); color: #FFFFFF; box-shadow: none; }
.mm-vote-n { font-variant-numeric: tabular-nums; }
.mm-vote-msg { flex-basis: 100%; margin: 0; color: #067647; font-size: var(--mm-fs-sm); font-weight: 600; }
.mm-vote-msg:empty { display: block; height: 0; }

/* Share */
.mm-share { margin-top: 32px; }
.mm-share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-share-a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: var(--mm-ctl); min-height: var(--mm-ctl); margin: 0; padding: 0 16px; border-radius: var(--mm-r-ctl); background: var(--mm-lilac); color: var(--mm-ink); font: 600 var(--mm-fs-sm)/1.2 var(--mm-font-body); text-decoration: none; box-shadow: none; }
a.mm-share-a { padding: 0; }
.mm-share-a:hover { background: var(--mm-ink); color: #FFFFFF; box-shadow: none; }
#share { scroll-margin-top: 104px; }
.mm-share .bookmark .mm-share-a { width: var(--mm-ctl); padding: 0; }
.mm-share .mm-share-a[aria-pressed="true"] { background: var(--mm-ink); color: #FFFFFF; }
.mm-share--compact { margin-top: 24px; }
.mm-share--compact .mm-share-b { padding: 0; width: var(--mm-ctl); }
.mm-share--compact .mm-share-b span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Author card (below the article and in the sidebar; no ids, it is printed twice) */
.mm-author { margin-top: 32px; }
.mm-author-id { display: flex; align-items: center; gap: 12px; }
.mm-av { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--mm-ink); color: var(--mm-gold); font: 600 18px/1 var(--mm-font-display); }
.mm-author-n { font-size: 18px; }
.mm-author-n a { display: inline-flex; align-items: center; min-height: var(--mm-ctl); color: var(--mm-ink); text-decoration: none; }
.mm-author-n a:hover { text-decoration: underline; }
.mm-author-bio { margin: 12px 0 0; color: var(--mm-muted); font-size: var(--mm-fs-sm); }
.mm-author-more { display: inline-flex; align-items: center; min-height: var(--mm-ctl); font-size: var(--mm-fs-sm); font-weight: 600; }

/* Sidebar blocks (listing.css copies the .mm-ps-* rules it needs verbatim; keep in sync, a test compares them). */
.mm-post-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 24px; align-items: start; margin-top: 64px; }
.mm-post-side .mm-author { margin-top: 0; }
.mm-ps-cta { padding: 24px; border-radius: var(--mm-r-card); background: var(--mm-ink); color: var(--mm-on-ink); }
.mm-ps-cta .mm-ps-h { color: var(--mm-gold); }
.mm-ps-cta p { margin: 0 0 16px; font-size: var(--mm-fs-sm); }
.mm-ps-cta .mm-btn { width: 100%; }
.mm-ps-sub { margin: -4px 0 0; color: var(--mm-muted); font-size: var(--mm-fs-sm); }
.mm-ps-news input { max-width: none; }
.mm-ps-news button { width: 100%; }
.mm-ps-msg p { margin: 8px 0 0; font-size: var(--mm-fs-sm); }
.mm-ps-pop ol, .mm-ps-cats ul { margin: 0; padding: 0; list-style: none; counter-reset: mm-pop; }
.mm-ps-pop li { counter-increment: mm-pop; display: grid; grid-template-columns: 32px minmax(0, 1fr); padding: 8px 0; border-top: 1px solid var(--mm-line); }
.mm-ps-pop li:first-child { border-top: 0; padding-top: 0; }
.mm-ps-pop li::before { content: counter(mm-pop); grid-row: span 2; font: 600 18px/1.4 var(--mm-font-display); color: var(--mm-ink-line); }
.mm-ps-pop a { display: flex; align-items: center; min-height: 48px; color: var(--mm-ink); font-weight: 600; line-height: 1.35; text-decoration: none; }
.mm-ps-pop a:hover { text-decoration: underline; }
.mm-ps-meta { color: var(--mm-muted); font-size: var(--mm-fs-meta); }
.mm-ps-cats a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--mm-ctl); border-bottom: 1px solid var(--mm-line); color: var(--mm-ink); font-weight: 500; text-decoration: none; }
.mm-ps-cats li:last-child a { border-bottom: 0; }
.mm-ps-cats a:hover span:first-child { text-decoration: underline; }
.mm-ps-count { flex: none; min-width: 32px; padding: 2px 10px; border-radius: 999px; background: var(--mm-lilac); font-size: var(--mm-fs-meta); font-weight: 600; text-align: center; }
.mm-post-side .ad-zone { margin: 0 auto !important; }
.mm-ps-widgets { display: grid; gap: 24px; }
.mm-ps-widgets .widget { margin: 0; }

@media (max-width: 1023.98px) {
    /* The sidebar follows the comments here, and the author card already sits under the article. */
    .mm-post-side > .mm-author { display: none; }
}

@media (max-width: 767.98px) {
    .mm-pg-toc .mm-toc-l3 { display: none; }
    .mm-post-cover { margin-bottom: 24px; }
    .mm-helpful { padding: 24px 16px; }
    .mm-post-side { margin-top: 48px; }
}

@media (min-width: 1024px) {
    .mm-pg--toc { grid-template-areas: "toc side" "main side"; }
    .mm-pl { max-width: var(--mm-wide); grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "cover side" "toc side" "main side"; column-gap: 48px; }
    .mm-post-side { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
    .mm-post-main, .mm-post-toc { justify-self: center; width: 100%; max-width: 720px; }
}

@media (max-width: 1279.98px) {
    /* The page TOC box above the content lists in two columns (main sections only on phones), so the text starts sooner. */
    .mm-pg-toc ol { columns: 2; column-gap: 24px; border: 0; }
    .mm-pg-toc li { break-inside: avoid; }
    .mm-pg-toc a { margin-left: 0; }
}

@media (min-width: 1280px) {
    .mm-pl { max-width: 1440px; justify-content: center; column-gap: 40px; grid-template-columns: minmax(0, 720px) 320px; grid-template-areas: "cover side" "main side"; }
    .mm-pl--toc { grid-template-columns: 240px minmax(0, 720px) 320px; grid-template-areas: "toc cover side" "toc main side"; }
    .mm-pg--toc { max-width: 1440px; grid-template-columns: 240px minmax(0, 720px) 320px; grid-template-areas: "toc main side"; column-gap: 40px; justify-content: center; }
    .mm-pg-toc, .mm-post-toc { position: sticky; top: 104px; max-height: calc(100vh - 120px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 4px; margin: -4px; }
    .mm-post-toc > .mm-share--compact { display: block; }
    .mm-pg-toc { align-self: start; }
    /* Sidebar: pinned by its bottom edge, so a tall one scrolls into view and its last block stays on screen.
       The min-height keeps a short one a top-aligned column (it would otherwise float at the viewport bottom). */
    .mm-post-side { position: sticky; bottom: 24px; align-self: end; align-content: start; min-height: calc(100vh - 128px); }
    :is(.mm-pg-toc, .mm-post-toc) .mm-toc { margin: 0; padding: 0; border: 0; background: none; }
    :is(.mm-pg-toc, .mm-post-toc) .mm-toc > summary { min-height: 32px; margin-bottom: 8px; font-size: var(--mm-fs-meta); letter-spacing: .08em; text-transform: uppercase; color: var(--mm-muted); }
    .mm-post-main { max-width: none; }
}

@media (min-width: 1280px) and (pointer: fine) {
    /* Mouse only: denser TOC rows. Touch keeps 48px targets. */
    :is(.mm-pg-toc, .mm-post-toc) .mm-toc a { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
    .mm-pl .mm-btn:hover, .mm-pl button:hover { transform: none; }
}
.mm-cm h2 { font-family: var(--mm-font-display); font-size: var(--mm-fs-h3b); margin: 0 0 var(--mm-sp-2); }
.mm-cm-c { display: flex; gap: 14px; padding: 18px 0; border-top: 1px solid var(--mm-line); }
.mm-cm-list > .mm-cm-c:first-child { border-top: 0; }
.mm-cm-more .mm-cm-list > .mm-cm-c:first-child { border-top: 1px solid var(--mm-line); }
.mm-cm-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; background: var(--mm-lilac); color: var(--mm-ink); }
.mm-cm-av--1 { background: #FFE6C9; }
.mm-cm-av--2 { background: #D8F1E7; }
.mm-cm-av--me { background: var(--mm-ink); color: var(--mm-gold); }
.mm-cm-b { flex: 1; min-width: 0; }
.mm-cm-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.mm-cm-nm { font-weight: 600; }
.mm-cm-meta time, .mm-cm-hint, .mm-cm-empty { color: var(--mm-muted); font-size: 13px; }
.mm-cm-badge { font-size: 11px; font-weight: 600; background: var(--mm-gold); color: var(--mm-ink-deep); border-radius: 99px; padding: 2px 8px; }
.mm-cm-tx { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.mm-cm-rp { display: inline-block; padding: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--mm-link); text-decoration: none; }
.mm-cm-rp:hover { text-decoration: underline; }
.mm-cm-kids { margin-top: 12px; padding-left: 18px; border-left: 2px solid var(--mm-lilac); }
.mm-cm-kids .mm-cm-c { border: 0; padding: 10px 0; }
.mm-cm-more summary, .mm-cm-morebtn { cursor: pointer; list-style: none; padding: 10px 0; font: 600 14px var(--mm-font-body); color: var(--mm-link); }
.mm-cm-morebtn { display: block; background: none; border: 0; }
.mm-cm-morebtn:hover { transform: none; box-shadow: none; text-decoration: underline; }
.mm-cm-c[hidden] { display: none; }
.mm-cm-more summary::-webkit-details-marker { display: none; }
.mm-cm-more[open] summary { display: none; }
.mm-cm-form { margin-top: 28px; background: var(--mm-surface); border: 1px solid var(--mm-line); border-radius: var(--mm-r-card); padding: 24px; }
.mm-cm-form h3 { font-family: var(--mm-font-display); font-size: var(--mm-fs-h3); margin: 0 0 4px; }
.mm-cm-form label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
.mm-cm-form input:not([type=hidden]), .mm-cm-form textarea { width: 100%; font: inherit; color: var(--mm-ink); background: #fff; border: 1.5px solid var(--mm-line); border-radius: var(--mm-r-ctl); padding: 12px 14px; }
.mm-cm-form textarea { min-height: 104px; resize: vertical; }
.mm-cm-to { margin: 10px 0 0; padding: 8px 12px; font-size: 14px; background: var(--mm-lilac); border-radius: var(--mm-r-ctl); }
.mm-cm-captcha { margin-top: 12px; }
.mm-cm-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.mm-cm-foot .mm-btn { width: auto; flex: none; }
@media (max-width: 599.98px) {
  .mm-cm-c { gap: 10px; }
  .mm-cm-kids { padding-left: 12px; }
  .mm-cm-form { padding: 18px; }
  .mm-cm-foot { flex-direction: column; align-items: flex-start; }
}
.mm-phero .mm-art-by { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; color: var(--mm-on-ink); }
.mm-art-by > span { display: inline-flex; align-items: center; gap: 6px; }
.mm-art-by > .mm-art-au { gap: 10px; font-weight: 600; }
.mm-art-av { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--mm-gold); color: var(--mm-ink-deep); font: 600 15px var(--mm-font-display); }
.mm-art-au a { text-decoration: none; }
.mm-art-save { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 999px; font-weight: 600; text-decoration: none; }
.mm-art-save:hover { border-color: var(--mm-gold); color: var(--mm-gold); }
.mm-toc-prog { height: 4px; margin: 0 0 12px; overflow: hidden; border-radius: 99px; background: var(--mm-lilac); }
.mm-toc-prog span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--mm-link), var(--mm-gold)); transition: width .3s; }
[data-mm] .mm-toc--compact:not(.is-all) .mm-toc-x { display: none; }
.mm-toc-more { min-height: 36px; margin: 6px 0 4px 12px; padding: 0; border: 0; background: none; color: var(--mm-link); font: 600 14px var(--mm-font-body); cursor: pointer; }
.mm-toc-more:hover { text-decoration: underline; transform: none; box-shadow: none; }
.mm-share--compact .mm-share-a { border-radius: 50%; }
@media (min-width: 1280px) {
  .mm-post-toc .mm-toc--compact { padding: 18px 18px 10px; border: 1px solid var(--mm-line); border-radius: var(--mm-r-card); background: #FFFFFF; }
}
