/*
 * Blog - what every layout shares: the listing's frame and toolbar, chips,
 * post typography, contents list, sharing, comments and the right-click menu.
 * Each layout's own look lives in its block (content/blocks/blog-*.css), so a
 * site restyles a layout in the Blocks tool without touching this file.
 */

.blog-page { padding-top: 2rem; padding-bottom: 3rem; }

/*
 * The site theme colours and underlines every link in .page-body, with
 * !important and a selector as specific as (0,8,4) (public/css/site.css). A
 * blog's links are its interface - titles, chips, the display switcher - so they
 * opt out here, by id to outrank it. Links written in a post keep the theme's
 * look. A block's CSS sets link colour on the link's parent (it inherits).
 * The reset sits in :where() so it weighs only its id (1,0,0) - still above the
 * theme, and below every exception here. Without it, `:not(.blog-content a)`
 * lifted the reset over the exceptions and the active display button went
 * dark-on-dark.
 */
#dm-blog :where(a[href]:not(.blog-content a)) { color: inherit !important; text-decoration: none !important; }
#dm-blog :where(a[href]:not(.blog-content a)):hover { color: var(--dm-primary, #3b82f6) !important; }
#dm-blog a.blog-chip { color: var(--dm-primary, #3b82f6) !important; }
#dm-blog .blog-displays a[aria-current="true"] { color: #fff !important; }
#dm-blog a.blog-tag, #dm-blog .blog-toc a { color: var(--dm-text-muted) !important; }
#dm-blog a.blog-tag:hover, #dm-blog .blog-toc a:hover { color: var(--dm-text) !important; }
#dm-blog .blog-toc a.is-active { color: var(--dm-primary, #3b82f6) !important; }

/* ── Listing ──────────────────────────────────────────────────────────── */
.blog-archive-head { margin-bottom: 1.25rem; }
.blog-archive-head h1 { margin: 0 0 .35rem; font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -.015em; }
.blog-archive-intro { margin: 0; color: var(--dm-text-muted); font-size: 1.1rem; max-width: 42rem; }

.blog-archive-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.blog-archive-bar:empty { display: none; }

.blog-search { position: relative; flex: 1 1 16rem; max-width: 24rem; }
.blog-search .blog-search-input { width: 100%; padding: .5rem .75rem .5rem 2.1rem; border-radius: 999px;
  border: 1px solid var(--dm-border, rgba(127,127,127,.3)); background: var(--dm-surface, transparent); color: inherit; font: inherit; }
.blog-search .blog-search-input:focus { outline: 2px solid color-mix(in srgb, var(--dm-primary, #3b82f6) 45%, transparent); outline-offset: 1px; }
.blog-search svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }

.blog-sort { padding: .45rem .6rem; border-radius: 999px; border: 1px solid var(--dm-border, rgba(127,127,127,.3));
  background: var(--dm-surface, transparent); color: inherit; font: inherit; font-size: .9rem; }

.blog-displays { display: inline-flex; margin-left: auto; padding: 3px; border-radius: 999px;
  border: 1px solid var(--dm-border, rgba(127,127,127,.3)); }
.blog-displays a { padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; text-decoration: none; color: var(--dm-text-muted); }
.blog-displays a:hover { color: var(--dm-text); }
.blog-displays a[aria-current="true"] { background: var(--dm-primary, #3b82f6); color: #fff; }

.blog-pills { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; }
.blog-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--dm-border, rgba(127,127,127,.3)); background: none; color: inherit; font: inherit; font-size: .88rem; }
.blog-pill:hover { border-color: var(--dm-primary, #3b82f6); }
.blog-pill.is-active { background: var(--dm-primary, #3b82f6); border-color: var(--dm-primary, #3b82f6); color: #fff; }
.blog-pill .n { font-size: .75rem; opacity: .7; font-variant-numeric: tabular-nums; }
.blog-pill[disabled] { opacity: .4; cursor: default; }

.blog-active { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -.25rem 0 1rem; font-size: .88rem; color: var(--dm-text-muted); }
.blog-active:empty { display: none; }
.blog-active .blog-filter-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .35rem .2rem .7rem; border-radius: 999px;
  background: color-mix(in srgb, var(--dm-primary, #3b82f6) 14%, transparent); color: var(--dm-text); }
.blog-active .blog-filter-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .25rem; border-radius: 50%; }
.blog-active .blog-filter-chip button:hover { background: rgba(127,127,127,.2); }
.blog-active .blog-clear { border: 0; background: none; color: var(--dm-primary); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.blog-items--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: 1.5rem; }
.blog-items--stack { display: flex; flex-direction: column; }
.blog-items .blog-item[hidden] { display: none !important; }
.blog-items.is-swapping { opacity: .35; transition: opacity .15s; }

.blog-empty { padding: 3rem 1rem; text-align: center; color: var(--dm-text-muted); }
.blog-more { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-top: 2rem; }
.blog-more-count { font-size: .85rem; color: var(--dm-text-muted); }
.blog-pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; }
.blog-page-of { font-size: .9rem; color: var(--dm-text-muted); }

/* Right-click affordance on a listing that answers it. */
.blog-archive.is-live .blog-item { cursor: context-menu; }
.blog-archive.is-live .blog-item a { cursor: pointer; }
.blog-item.is-flash { animation: blog-flash .9s ease; }
@keyframes blog-flash { 0% { box-shadow: 0 0 0 3px var(--dm-primary, #3b82f6); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* ── Chips and tags ───────────────────────────────────────────────────── */
.blog-chip { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; text-decoration: none;
  color: var(--dm-primary, #3b82f6); background: color-mix(in srgb, var(--dm-primary, #3b82f6) 12%, transparent);
  border: 1px solid transparent; }
.blog-chip:hover { border-color: currentColor; }
.blog-tag { font-size: .85rem; color: var(--dm-text-muted); text-decoration: none; }
.blog-tag:hover { color: var(--dm-primary); }

/* ── A post ───────────────────────────────────────────────────────────── */
.blog-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1100; pointer-events: none; }
.blog-progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: var(--dm-primary, #3b82f6); transition: transform .08s linear; }

.blog-content { font-size: 1.075rem; line-height: 1.75; }
.blog-content > * + * { margin-top: 1.1em; }
.blog-content h2 { font-size: 1.6rem; margin-top: 2em; line-height: 1.25; scroll-margin-top: calc(var(--dm-navbar-height, 64px) + 1rem); }
.blog-content h3 { font-size: 1.25rem; margin-top: 1.6em; scroll-margin-top: calc(var(--dm-navbar-height, 64px) + 1rem); }
.blog-content img { max-width: 100%; height: auto; border-radius: var(--dm-radius-md, 8px); }
.blog-content blockquote { margin: 1.75em 0; padding: .25em 0 .25em 1.25em; border-left: 3px solid var(--dm-primary, #3b82f6);
  font-size: 1.2em; font-style: italic; color: var(--dm-text-muted); }
.blog-content pre { padding: 1rem; border-radius: var(--dm-radius-md, 8px); overflow-x: auto; background: rgba(127,127,127,.1); font-size: .9em; }
.blog-content :not(pre) > code { padding: .1em .35em; border-radius: 4px; background: rgba(127,127,127,.14); font-size: .9em; }

.blog-toc { font-size: .9rem; }
.blog-toc-title { margin: 0 0 .5rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dm-text-muted); }
.blog-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--dm-border, rgba(127,127,127,.25)); }
.blog-toc li a { display: block; padding: .3rem 0 .3rem .9rem; margin-left: -2px; border-left: 2px solid transparent;
  color: var(--dm-text-muted); text-decoration: none; line-height: 1.35; }
.blog-toc li.blog-toc-l3 a { padding-left: 1.7rem; font-size: .85rem; }
.blog-toc li a:hover { color: var(--dm-text); }
.blog-toc li a.is-active { color: var(--dm-primary, #3b82f6); border-left-color: var(--dm-primary, #3b82f6); font-weight: 600; }

.blog-share { display: flex; gap: .4rem; flex-wrap: wrap; }
.blog-share-btn { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--dm-border, rgba(127,127,127,.3)); background: none; color: inherit; font: inherit; font-size: .85rem; text-decoration: none; }
.blog-share-btn:hover { border-color: var(--dm-primary, #3b82f6); color: var(--dm-primary, #3b82f6); }

.blog-prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2.5rem 0 0; }
.blog-prevnext a { display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.1rem; border-radius: var(--dm-radius-lg, 12px);
  border: 1px solid var(--dm-border, rgba(127,127,127,.25)); text-decoration: none; color: inherit; }
.blog-prevnext a:hover { border-color: var(--dm-primary, #3b82f6); }
.blog-prevnext a span { font-size: .78rem; color: var(--dm-text-muted); text-transform: uppercase; letter-spacing: .05em; }
.blog-prevnext .is-newer { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .blog-prevnext { grid-template-columns: 1fr; } .blog-prevnext .is-newer { grid-column: 1; } }

.blog-section-title { font-size: 1.35rem; margin: 0 0 1.1rem; display: flex; align-items: center; gap: .5rem; }
.blog-related { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--dm-border, rgba(127,127,127,.25)); }
.blog-count { font-size: .8rem; padding: .05rem .5rem; border-radius: 999px; background: rgba(127,127,127,.16); font-weight: 600; }

/* ── Comments ─────────────────────────────────────────────────────────── */
.blog-comments { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--dm-border, rgba(127,127,127,.25)); }
.blog-comment-list { list-style: none; margin: 0 0 2rem; padding: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.blog-comment-list:empty { display: none; }
.blog-comment { padding: .9rem 1rem; border-radius: var(--dm-radius-md, 8px); background: rgba(127,127,127,.07); }
.blog-comment.is-new { outline: 2px solid color-mix(in srgb, var(--dm-success, #16a34a) 55%, transparent); }
.blog-comment-head { margin: 0 0 .35rem; font-size: .9rem; }
.blog-comment-head time { color: var(--dm-text-muted); font-size: .82rem; margin-left: .35rem; }
.blog-comment-body { margin: 0; white-space: pre-line; }
.blog-comment-form { display: flex; flex-direction: column; gap: .8rem; }
.blog-comment-form h3 { margin: 0; font-size: 1.1rem; }
.blog-comment-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 600; }
.blog-comment-form label small { font-weight: 400; color: var(--dm-text-muted); }
.blog-comment-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 600px) { .blog-comment-row { grid-template-columns: 1fr; } }
.blog-comment-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.blog-comment-status { font-size: .9rem; }
.blog-comment-status.is-ok { color: var(--dm-success, #16a34a); }
.blog-comment-status.is-error { color: var(--dm-danger, #dc2626); }
.blog-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ── The right-click menu ─────────────────────────────────────────────── */
.blog-menu { position: fixed; z-index: 10000; min-width: 220px; max-width: 300px; padding: .3rem;
  background: var(--dm-surface, #fff); color: var(--dm-text, #111); border: 1px solid var(--dm-border, rgba(127,127,127,.3));
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.22); font-size: .88rem; }
.blog-menu[hidden] { display: none; }
.blog-menu-head { padding: .45rem .65rem .35rem; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--dm-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blog-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .45rem .65rem; border: 0; border-radius: 6px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.blog-menu button:hover, .blog-menu button:focus-visible { background: color-mix(in srgb, var(--dm-primary, #3b82f6) 12%, transparent); outline: none; }
.blog-menu button .k { margin-left: auto; font-size: .78rem; color: var(--dm-text-muted); }
.blog-menu hr { border: 0; border-top: 1px solid var(--dm-border, rgba(127,127,127,.25)); margin: .3rem .2rem; }
.blog-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 10001; padding: .55rem 1rem;
  border-radius: 999px; background: var(--dm-text, #111); color: var(--dm-background, #fff); font-size: .88rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

@media (prefers-reduced-motion: reduce) {
  .blog-item, .blog-item * { transition: none !important; animation: none !important; }
}

/* A Feature post's hero starts where the theme's content does - no page padding
   above it. (It cannot reach the navbar: the theme's wrapper clips overflow.) */
.blog-page:has(.pf-hero) { padding-top: 0; }
