/**
 * Blog (/blog/). Loaded after home.css and docs.css, whose hero and search
 * field it reuses.
 */

/* ── Hero ─────────────────────────────────────────── */
.blog-hero h1 { max-width: 20ch; margin-inline: auto; font-size: clamp(34px, 4.8vw, 56px); }
.blog-hero .crumbs { justify-content: center; margin-bottom: 18px; }
.blog-search { max-width: 640px; margin: 30px auto 0; text-align: left; }
.blog-search input::-webkit-search-cancel-button { cursor: pointer; }
.blog-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 26px; }
.blog-cats .chip-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 500; transition: border-color .2s, color .2s; }
.blog-cats .chip-btn span { font-size: 12px; color: var(--muted); }
.blog-cats .chip-btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); color: var(--ink); }
.blog-cats .chip-btn[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ── Post cards ───────────────────────────────────── */
.blog-list { padding-top: 24px; }
.post-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s, border-color .25s; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.post-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.post-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.post-card:hover .post-media img { transform: scale(1.04); }
.post-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--brand-ink); background: radial-gradient(70% 90% at 15% 10%, color-mix(in srgb, var(--brand) 22%, var(--surface)), color-mix(in srgb, var(--accent) 14%, var(--surface)) 90%); }
.post-placeholder .ico { width: 34px; height: 34px; opacity: .7; }
.post-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 20px 22px 22px; }
.post-cat { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand-ink); font-size: 12.5px; font-weight: 600; }
.post-cat:hover { background: color-mix(in srgb, var(--brand) 20%, transparent); }
.post-title { font-size: 19px; font-weight: 700; line-height: 1.3; letter-spacing: -.015em; }
.post-title a:hover { color: var(--brand-ink); }
.post-excerpt { color: var(--muted); font-size: 15px; line-height: 1.6; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.post-author { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.post-author img { width: 24px; height: 24px; border-radius: 50%; }
.post-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

/* the newest post on page 1 */
.post-feature { display: grid; grid-template-columns: 1.15fr 1fr; margin-bottom: 26px; }
.post-feature .post-media { aspect-ratio: auto; min-height: 340px; }
.post-feature .post-body { justify-content: center; gap: 14px; padding: 36px 40px; }
.post-feature .post-title { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; letter-spacing: -.025em; }
.post-feature .post-excerpt { font-size: 16.5px; }
.post-feature .post-meta { margin-top: 6px; }

.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ── Pages ────────────────────────────────────────── */
.blog-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 44px; }
.blog-pages .page-numbers { min-width: 42px; height: 42px; display: inline-grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; transition: border-color .2s, color .2s; }
.blog-pages a.page-numbers:hover { border-color: var(--brand); color: var(--ink); }
.blog-pages .current { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.blog-pages .dots { border: 0; background: none; min-width: auto; }
.blog-pages .ico { width: 16px; height: 16px; }
.blog-pages .prev .ico { transform: rotate(180deg); }

/* ── Newsletter strip ─────────────────────────────── */
.blog-sub { display: flex; align-items: center; gap: 18px; margin-top: 56px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--surface) 60%); }
.blog-sub .sup-way-ico { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; color: var(--brand-ink); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.blog-sub .sup-way-ico .ico { width: 22px; height: 22px; }
.blog-sub-text { flex: 1; min-width: 0; }
.blog-sub-text h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.blog-sub .note { margin-top: 2px; font-size: 14px; color: var(--muted); }
.blog-sub .note.ok { color: var(--brand-ink); font-weight: 600; }
.blog-sub .docs-field { flex: 0 1 420px; padding: 5px 5px 5px 16px; border-radius: 14px; box-shadow: none; }
.blog-sub .docs-field input { height: 40px; font-size: 15.5px; }
.blog-sub .docs-field .btn { height: 40px; }

.blog-empty { max-width: 560px; margin: 0 auto; padding: 40px; text-align: center; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.blog-empty .sup-way-ico { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 14px; color: var(--brand-ink); background: color-mix(in srgb, var(--brand) 13%, var(--surface)); }
.blog-empty .sup-way-ico .ico { width: 24px; height: 24px; }
.blog-empty h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.blog-empty p { color: var(--muted); }
.blog-empty a { color: var(--brand-ink); font-weight: 600; }

@media (max-width: 1100px) {
	.post-grid { grid-template-columns: repeat(2, 1fr); }
	.post-feature { grid-template-columns: 1fr; }
	.post-feature .post-media { min-height: 0; aspect-ratio: 16 / 9; }
	.post-feature .post-body { padding: 26px 28px; }
	.blog-sub { flex-wrap: wrap; }
	.blog-sub .docs-field { flex-basis: 100%; }
}
@media (max-width: 640px) {
	.post-grid { grid-template-columns: 1fr; }
	.blog-search .docs-field, .blog-sub .docs-field { flex-wrap: nowrap; padding-left: 14px; }
	.blog-search .docs-field input, .blog-sub .docs-field input { flex-basis: 0; }
	.blog-sub .docs-field { min-width: 0; }
	.blog-search .docs-field .btn, .blog-sub .docs-field .btn { width: auto; padding-inline: 14px; }
	.blog-sub { padding: 20px; }
}

/* ── Single post ──────────────────────────────────── */
.read-bar { position: fixed; inset: 0 0 auto; z-index: 60; height: 3px; pointer-events: none; }
.read-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); transform: scaleX(0); transform-origin: 0 50%; }

/* hero: text left, featured image right */
.post-hero { padding-block: clamp(48px, 7vw, 88px); background: linear-gradient(90deg, var(--bg), color-mix(in srgb, var(--brand) 12%, var(--bg)) 50%, var(--bg)); }
.post-hero .wrap.has-cover { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); align-items: center; gap: clamp(36px, 4vw, 56px); }
.post-hero-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.post-hero-cats a, .post-hero-cats span { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.post-hero-cats a:hover { color: var(--brand-ink); }
.post-hero h1 { font-size: clamp(32px, 3.6vw, 48px); font-weight: 600; line-height: 1.12; letter-spacing: -.025em; }
.post-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 24px; font-size: 14.5px; color: var(--muted); }
.post-hero-meta > span:not(.post-dot) { display: inline-flex; align-items: center; gap: 8px; }
.post-hero-author { color: var(--ink-2); }
.post-hero-meta img { width: 22px; height: 22px; border-radius: 50%; }
.post-hero-meta svg { width: 16px; height: 16px; }
.post-cover img { display: block; width: 100%; height: auto; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: var(--surface); }

.post-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 250px; grid-template-areas: "toc main side"; gap: 56px; align-items: start; padding-top: 64px; }

/* contents */
.post-toc { grid-area: toc; position: sticky; top: calc(92px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 110px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.post-toc summary { display: flex; align-items: center; gap: 8px; padding: 4px 6px; white-space: nowrap; list-style: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc summary .ico { width: 16px; height: 16px; flex: none; color: var(--muted); }
.post-toc summary small { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.post-toc summary .chev { transition: transform .2s; }
.post-toc[open] summary { padding-bottom: 12px; margin-bottom: 10px; border-bottom: 1px dashed var(--line); }
.post-toc[open] summary .chev { transform: rotate(180deg); }
.post-toc ol { display: grid; gap: 2px; margin: 0 0 0 6px; padding: 0; list-style: none; border-left: 1.5px solid var(--line); }
.post-toc li a { display: block; margin-left: -1.5px; padding: 6px 10px 6px 14px; border-left: 2px solid transparent; border-radius: 0 10px 10px 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); transition: color .2s, background .2s, border-color .2s; }
.post-toc li.lv-3 a { padding-left: 28px; font-size: 13px; }
.post-toc li a:hover { color: var(--ink); background: var(--surface-2); }
.post-toc li a.is-active { color: var(--brand-ink); border-left-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); font-weight: 600; }

/* the post */
.post-article { grid-area: main; min-width: 0; }
.post-content { font-size: 18px; }
.post-content > :first-child { margin-top: 0; }
.post-content > p:first-child { font-size: 1.1em; color: var(--ink); }
.post-content .wp-block-table { border: 1px solid var(--line); border-radius: 14px; }
.post-content .wp-block-table table { margin: 0; }
.post-content .wp-block-table th, .post-content .wp-block-table td { border: 0; border-bottom: 1px solid var(--line); }
.post-content .wp-block-table thead { border: 0; }
.post-content .wp-block-table tr:last-child td { border-bottom: 0; }
.post-content .wp-block-table th + th, .post-content .wp-block-table td + td { border-left: 1px solid var(--line); }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.post-tags a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; color: var(--ink-2); }
.post-tags a:hover { border-color: var(--brand); color: var(--ink); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; }
.post-nav a { display: grid; align-content: start; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); transition: border-color .2s, transform .2s; }
.post-nav a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.post-nav small { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.post-nav .ico { width: 14px; height: 14px; }
.post-nav .prev .ico { transform: rotate(180deg); }
.post-nav .next { grid-column: 2; text-align: right; }
.post-nav .next small { justify-content: flex-end; }
.post-nav b { font-size: 15.5px; font-weight: 600; line-height: 1.35; color: var(--ink); }

/* beside the post */
.post-side { grid-area: side; position: sticky; top: calc(92px + env(safe-area-inset-top, 0px)); display: grid; gap: 16px; }
.post-share, .post-plugins { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.post-side h2 { margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
.post-share > div { display: flex; flex-wrap: wrap; gap: 8px; }
.post-share a { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); transition: color .2s, border-color .2s, background .2s; }
.post-share a svg { width: 18px; height: 18px; }
.post-share a:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); background: var(--surface-2); color: var(--ink); }
.post-copy { flex: 1 0 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--tint); color: var(--ink-2); font: 500 14px/1 var(--f); cursor: pointer; transition: color .2s, border-color .2s; }
.post-copy .ico { width: 16px; height: 16px; }
.post-copy:hover { border-color: var(--brand); color: var(--ink); }
.post-copy.is-done { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--brand-ink); }
.post-plugins a { display: flex; align-items: center; gap: 11px; margin-inline: -8px; padding: 8px; border-radius: 12px; transition: background .2s; }
.post-plugins a:hover { background: var(--surface-2); }
.post-plugins img { width: 36px; height: 36px; flex: none; padding: 4px; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.post-plugins span { display: grid; min-width: 0; line-height: 1.3; }
.post-plugins b { font-size: 14px; font-weight: 600; color: var(--ink); }
.post-plugins small { font-size: 12.5px; color: var(--muted); }
.post-plugins p { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }

/* keep reading */
.post-more { padding-top: 88px; }
.post-more-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.post-more-head h2 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.03em; }
.post-more-head a { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--brand-ink); }
.post-more-head .ico { width: 16px; height: 16px; }

@media (max-width: 1200px) {
	.post-layout { grid-template-columns: 240px minmax(0, 1fr); grid-template-areas: "toc main" ". side"; gap: 40px 44px; }
	.post-side { position: static; grid-template-columns: 1fr 1fr; align-items: start; }
}
@media (max-width: 900px) {
	.post-hero .wrap.has-cover { grid-template-columns: minmax(0, 1fr); }
	.post-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "toc" "main" "side"; gap: 28px; padding-top: 40px; }
	.post-toc { position: static; max-height: none; }
	.post-content { font-size: 17px; }
}
@media (max-width: 640px) {
	.post-side { grid-template-columns: 1fr; }
	.post-nav { grid-template-columns: 1fr; }
	.post-nav .next { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
	.read-bar { display: none; }
}
