/* The blog (blog.py): article typography, index cards, call-to-action box.
   Same palette as the rest of the site (site.css): white, light grey panels,
   one orange accent. Readable first: 17px body, ~68 characters a line. */

.blog-wrap { max-width: 720px; margin: 0 auto; padding: 8px 24px 80px; }
.blog-wrap-wide { max-width: 1000px; }

/* --- index / hub --- */
.blog-index-head { max-width: 640px; margin: 24px 0 28px; }
.blog-index-head h1 { margin: 0 0 8px; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.blog-index-head p { margin: 0; color: var(--text-muted); font-size: 16px; line-height: 1.6; }
.blog-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .blog-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .blog-cards { grid-template-columns: minmax(0, 1fr); } }
.blog-wrap:not(.blog-wrap-wide) .blog-cards { grid-template-columns: minmax(0, 1fr); }
.blog-card { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px; border-radius: 18px; background: var(--panel-bg); color: var(--text); text-decoration: none; transition: transform 0.2s ease, background-color 0.2s ease; }
.blog-card:hover { transform: translateY(-2px); background: #f1f1f3; }
.blog-card-top { display: flex; gap: 6px; min-height: 22px; }
.blog-card-tag { padding: 2px 9px; border-radius: 999px; background: #fff; color: var(--accent); font-size: 12px; font-weight: 700; }
.blog-card h3 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.4; }
.blog-card p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-meta { margin-top: auto; padding-top: 4px; color: var(--text-muted); font-size: 12.5px; }
.blog-empty { color: var(--text-muted); font-size: 15px; }

/* Category chips above the list (and, under 考试笔记, a second row of subjects). One row that scrolls on a phone. */
.blog-chips { display: flex; gap: 8px; margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.blog-chips::-webkit-scrollbar { display: none; }
.blog-chips-sub { margin-top: -8px; }
.blog-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--panel-bg); color: var(--text-muted); font-size: 14px; font-weight: 600; text-decoration: none; transition: background-color 0.15s ease, color 0.15s ease; }
.blog-chip small { font-size: 12px; font-weight: 600; opacity: 0.7; }
.blog-chip:hover { color: var(--text); }
.blog-chip.is-active { background: var(--text); color: #fff; }
.blog-chips-sub .blog-chip { min-height: 32px; padding: 0 12px; font-size: 13px; }
.blog-chips-sub .blog-chip.is-active { background: #fff1e8; color: var(--accent); }

/* --- article --- */
.blog-crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; color: var(--text-muted); font-size: 13.5px; }
.blog-crumbs a { color: var(--text-muted); text-decoration: none; }
.blog-crumbs a:hover { color: var(--text); }
.blog-head { margin: 22px 0 28px; }
.blog-tag { display: inline-block; text-decoration: none; margin: 0 0 12px; padding: 3px 11px; border-radius: 999px; background: #fff1e8; color: var(--accent); font-size: 13px; font-weight: 700; }
.blog-head h1 { margin: 0 0 14px; font-size: 36px; font-weight: 800; line-height: 1.22; letter-spacing: -0.02em; }
.blog-lede { margin: 0 0 14px; color: #4b5563; font-size: 18px; line-height: 1.6; }
.blog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 0; color: var(--text-muted); font-size: 13.5px; }
.blog-meta > span + span::before { content: "·"; margin: 0 8px; }
.blog-author { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 600; }
.blog-author img { width: 22px; height: 22px; border-radius: 50%; }
.blog-cover { display: block; width: 100%; height: auto; margin: 0 0 28px; border-radius: 18px; background: var(--panel-bg); }

.blog-body { font-size: 17px; line-height: 1.8; color: #262a30; }
.blog-body > :first-child { margin-top: 0; }
.blog-body h2 { margin: 40px 0 12px; font-size: 25px; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; scroll-margin-top: 16px; }
.blog-body h3 { margin: 30px 0 10px; font-size: 20px; font-weight: 800; line-height: 1.35; scroll-margin-top: 16px; }
.blog-body p { margin: 0 0 18px; }
.blog-body ul, .blog-body ol { margin: 0 0 18px; padding-left: 24px; }
.blog-body li { margin-bottom: 8px; }
.blog-body li::marker { color: var(--accent); }
.blog-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.blog-body strong { font-weight: 750; color: var(--text); }
.blog-body blockquote { margin: 24px 0; padding: 14px 18px; border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; background: #fff7f1; color: #4b3b30; }
.blog-body blockquote p:last-child { margin-bottom: 0; }
.blog-body img { max-width: 100%; height: auto; border-radius: 14px; }
.blog-body hr { margin: 36px 0; border: 0; border-top: 1px solid var(--border); }
.blog-body code { padding: 1px 6px; border-radius: 6px; background: var(--panel-bg); font-size: 0.92em; }
.blog-table { margin: 0 0 22px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.blog-body table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.blog-body th, .blog-body td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.blog-body th { background: var(--panel-bg); font-weight: 750; white-space: nowrap; }
.blog-body tr:last-child td { border-bottom: 0; }

.blog-cta { display: flex; align-items: flex-start; gap: 16px; margin: 44px 0 0; padding: 22px; border-radius: 20px; background: #fff1e8; }
.blog-cta img { flex: none; width: 56px; height: 56px; }
.blog-cta h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.blog-cta p { margin: 0 0 14px; color: #5b4636; font-size: 15px; line-height: 1.6; }
.blog-cta-btn { display: inline-flex; align-items: center; padding: 10px 20px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 800; text-decoration: none; box-shadow: 0 3px 0 #c44700; transition: transform 0.1s ease, box-shadow 0.1s ease; }
.blog-cta-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c44700; }

.blog-related { margin-top: 48px; }
.blog-related h2 { margin: 0 0 14px; font-size: 20px; font-weight: 800; }

/* ===== Article extras: layout with a side panel, progress, contents, AI, share, feedback ===== */
.blog-wrap-article { max-width: 1100px; }
.blog-layout { display: block; }
.blog-article { max-width: 720px; margin: 0 auto; }
.blog-side { display: none; }
@media (min-width: 1100px) {
    .blog-layout { display: grid; grid-template-columns: minmax(0, 720px) 250px; gap: 56px; justify-content: center; }
    .blog-article { margin: 0; }
    .blog-side { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 28px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 30px 0 8px; scrollbar-width: thin; }
    .blog-inline-only { display: none; }
}

/* Reading progress along the very top. */
.blog-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: 3px; pointer-events: none; }
.blog-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left center; }

/* Side panel. */
.blog-side-time { margin: 0; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.blog-side-time.is-done { color: #1f9d5c; }
.blog-side-title { margin: 0 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.blog-toc-list, .blog-toc-list ol { margin: 0; padding: 0; list-style: none; }
.blog-toc-list ol { margin: 2px 0 4px; }
.blog-toc-list a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--border); color: var(--text-muted); font-size: 13.5px; line-height: 1.45; text-decoration: none; transition: color 0.15s ease, border-color 0.15s ease; }
.blog-toc-list ol a { padding-left: 24px; font-size: 13px; }
.blog-toc-list a:hover { color: var(--text); }
.blog-toc-list a.is-active { border-left-color: var(--accent); color: var(--text); font-weight: 700; }

/* Contents on phones / tablets: a box that folds open, above the article. */
.blog-toc-inline { margin: 0 0 26px; border-radius: 16px; background: var(--panel-bg); }
.blog-toc-inline summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-size: 15px; font-weight: 700; cursor: pointer; list-style: none; }
.blog-toc-inline summary::-webkit-details-marker { display: none; }
.blog-toc-inline summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.2s ease; }
.blog-toc-inline[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.blog-toc-inline .blog-toc-list { padding: 0 18px 14px; }
.blog-toc-inline .blog-toc-list a { border-left-color: #e8e8ec; }

/* Summarise with AI. */
.blog-ai { margin: 0 0 22px; padding: 16px 18px; border-radius: 16px; background: linear-gradient(135deg, #fff4ec, #f6f3ff); }
.blog-ai.is-compact { margin: 0; padding: 14px; }
.blog-ai-title { display: flex; align-items: center; gap: 7px; margin: 0 0 4px; font-size: 15px; font-weight: 800; }
.blog-ai.is-compact .blog-ai-title { margin-bottom: 10px; font-size: 13.5px; }
.blog-ai-title svg { width: 17px; height: 17px; flex: none; color: var(--accent); }
.blog-ai-hint { margin: 0 0 12px; color: var(--text-muted); font-size: 13.5px; }
.blog-ai-links { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-ai-link { display: inline-flex; align-items: center; min-height: 34px; padding: 0 13px; border-radius: 999px; background: #fff; color: var(--text); font-size: 13.5px; font-weight: 700; text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.blog-ai.is-compact .blog-ai-link { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.blog-ai-link:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08); }

/* Heading link icon (added by blog.js). */
.blog-body h2, .blog-body h3 { position: relative; }
.blog-anchor { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-left: 6px; border-radius: 8px; color: var(--text-muted); vertical-align: middle; opacity: 0; transition: opacity 0.15s ease, background-color 0.15s ease; }
.blog-anchor svg { width: 16px; height: 16px; }
.blog-body h2:hover .blog-anchor, .blog-body h3:hover .blog-anchor, .blog-anchor:focus-visible { opacity: 1; }
.blog-anchor:hover { background: var(--panel-bg); color: var(--accent); }
@media (hover: none) { .blog-anchor { opacity: 0.45; } }

/* Share. */
.blog-share { margin: 36px 0 0; padding-top: 22px; border-top: 1px solid var(--border); }
.blog-share-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.blog-share-links { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-share-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color 0.15s ease; }
.blog-share-link:hover { background: var(--panel-bg); }
.blog-share-link[hidden] { display: none; }

/* Was this helpful? */
.blog-feedback { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 24px 0 0; padding: 14px 18px; border-radius: 16px; background: var(--panel-bg); }
.blog-feedback p { margin: 0; font-size: 15px; font-weight: 700; }
.blog-feedback-btns { display: flex; gap: 8px; }
.blog-feedback-btns[hidden], .blog-feedback-thanks[hidden] { display: none; }
.blog-feedback-btns button { min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform 0.15s ease; }
.blog-feedback-btns button:active { transform: scale(0.96); }
.blog-feedback-thanks { color: #1f9d5c; }

/* Previous / next. */
.blog-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 0; }
.blog-pager a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; color: var(--text); text-decoration: none; transition: background-color 0.15s ease; }
.blog-pager a:hover { background: var(--panel-bg); }
.blog-pager small { color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.blog-pager b { font-size: 14.5px; line-height: 1.4; }
.blog-pager-next { text-align: right; }

/* Back to top + toast. */
.blog-top { position: fixed; right: 20px; bottom: 24px; z-index: 40; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; background: #fff; color: var(--text); cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); transition: transform 0.15s ease; }
.blog-top[hidden] { display: none; }
.blog-top:hover { transform: translateY(-2px); }
.blog-top svg { width: 20px; height: 20px; }
.blog-toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; padding: 10px 18px; border-radius: 999px; background: var(--text); color: #fff; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity 0.2s ease, transform 0.2s ease; }
.blog-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Search on the lists. */
.blog-search { position: relative; max-width: 420px; margin: 0 0 20px; }
.blog-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; color: var(--text-muted); transform: translateY(-50%); }
.blog-search input { width: 100%; height: 44px; padding: 0 16px 0 42px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--text); font: inherit; font-size: 15px; outline: none; transition: border-color 0.15s ease; }
.blog-search input:focus { border-color: var(--accent); }
.blog-card[hidden] { display: none; }

@media print {
    .site-header, .site-footer, .mobile-drawer, .mobile-drawer-backdrop, .blog-progress, .blog-side, .blog-inline-only, .blog-toc-inline,
    .blog-share, .blog-feedback, .blog-cta, .blog-pager, .blog-related, .blog-top, .blog-toast, .blog-anchor { display: none !important; }
    .blog-wrap { padding: 0; }
    .blog-body a { color: inherit; }
}

@media (max-width: 600px) {
    .blog-author { width: 100%; margin-bottom: 4px; }
    .blog-meta > .blog-author + span::before { content: none; margin: 0; }
    .blog-top { right: 14px; bottom: 16px; width: 42px; height: 42px; }
    .blog-pager { grid-template-columns: 1fr; }
    .blog-pager-next { text-align: left; }
    .blog-head h1 { font-size: 28px; }
    .blog-lede { font-size: 16.5px; }
    .blog-body { font-size: 16.5px; }
    .blog-body h2 { font-size: 22px; }
    .blog-index-head h1 { font-size: 28px; }
    .blog-cta { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    .blog-card, .blog-cta-btn, .blog-chip, .blog-ai-link, .blog-toast, .blog-top, .blog-toc-list a { transition: none; }
}
