/* Blog: post list and long-form posts. Builds on site.css tokens. */

/* ---------- List ---------- */
.blog-hero { padding-bottom: clamp(28px, 4vw, 48px); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.filter { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--card); box-shadow: 0 0 0 1px var(--line); font-size: 14px; font-weight: 700; text-decoration: none; transition: background-color .25s, color .25s; }
.filter i { width: 8px; height: 8px; border-radius: 50%; }
.filter span { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.filter:hover { background: var(--desk-2); }
.filter.is-on { background: var(--ink); color: #fff; box-shadow: none; }
.filter.is-on span { color: rgba(255, 255, 255, .6); }

.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: clamp(16px, 2vw, 28px); }
.post-card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.post-card-link { display: grid; gap: 12px; height: 100%; padding: clamp(24px, 3vw, 36px); text-decoration: none; }
.post-card-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 700; color: var(--soft); }
.post-card-kicker { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--edu); }
.post-card-title { margin: 0; font-size: clamp(22px, 2.4vw, 30px); font-weight: 900; line-height: 1.4; }
.post-card-desc { margin: 0; font-size: 14.5px; line-height: 1.95; color: var(--soft); }
.post-card .text-link { margin-top: 6px; }
.post-card-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.post-card-tags li { padding: 3px 10px; border-radius: 7px; background: var(--desk); font-size: 12.5px; font-weight: 700; color: var(--soft); }

.cat-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; background: var(--edu-tint); color: var(--ink); font-size: 12.5px; font-weight: 700; text-decoration: none; }
.cat-chip i { width: 7px; height: 7px; border-radius: 50%; }
a.cat-chip:hover { background: #d3ede4; }

/* ---------- Post header ---------- */
.post-hero { padding-bottom: clamp(32px, 4vw, 56px); }
.post-hero-inner { max-width: 1060px; }
.post-hero .h-lg { font-size: clamp(30px, 4.4vw, 58px); margin-top: 10px; }
.post-hero .lead { max-width: 44em; }
.post-hero .post-card-tags { margin-top: 22px; }
.post-hero .post-card-tags li { background: var(--card); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; font-weight: 700; color: var(--soft); }
.post-kicker { margin: 22px 0 0; font-size: 15px; font-weight: 700; color: var(--edu); }

/* ---------- Layout ---------- */
.post-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.post-toc { position: sticky; top: calc(var(--header-h) + 24px); font-size: 13.5px; }
.post-toc p { margin: 0 0 10px; font-weight: 900; font-size: 12px; letter-spacing: .08em; color: var(--faint); }
.post-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.post-toc a { display: block; padding: 7px 0 7px 16px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--soft); font-weight: 700; line-height: 1.6; transition: color .2s, border-color .2s; }
.post-toc a:hover { color: var(--ink); }
.post-toc a.is-current { color: var(--ink); border-left-color: var(--edu); }
.post-body { max-width: 820px; background: var(--card); border-radius: 28px; box-shadow: var(--shadow); padding: clamp(22px, 5vw, 64px); }
@media (max-width: 960px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .post-toc { position: static; background: var(--card); border-radius: 18px; padding: 18px 22px; box-shadow: 0 0 0 1px var(--line); }
  .post-body { max-width: none; }
}
.post-more { padding: clamp(40px, 6vw, 72px) 0 clamp(64px, 8vw, 110px); }

/* ---------- Body text ---------- */
.post-section + .post-section { margin-top: clamp(48px, 6vw, 72px); }
.post-body h2 { position: relative; margin: 0 0 22px; padding-top: 18px; font-size: clamp(22px, 2.4vw, 28px); font-weight: 900; line-height: 1.45; scroll-margin-top: calc(var(--header-h) + 24px); }
.post-body h2::before { content: ""; position: absolute; left: 0; top: 0; width: 36px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--edu), var(--dev)); }
.post-body p, .post-body li { font-size: 16px; line-height: 2.05; }
.post-body p { margin: 0 0 1.2em; }
.post-body ul { margin: 0 0 1.2em; padding-left: 1.3em; }
.post-body li + li { margin-top: .35em; }
.post-body strong { font-weight: 700; background: linear-gradient(transparent 62%, var(--edu-tint) 62%); }
.post-body a:not(.text-link):not(.cat-chip):not(.btn) { color: var(--dev); text-underline-offset: 3px; }
.post-body code { font-family: var(--mono); font-size: .86em; padding: 2px 6px; border-radius: 6px; background: var(--desk); overflow-wrap: anywhere; }
.cite { font-size: .68em; font-weight: 700; margin-left: 1px; }
.cite.is-loc { font-size: .78em; font-weight: 700; color: var(--soft); margin-left: 2px; white-space: nowrap; }
.theorem-head .cite.is-loc { font-size: .86em; margin-left: 6px; }
.ref-title { color: var(--ink); }
.cite a { text-decoration: none; }
.cite a:hover { text-decoration: underline; }

.post-summary { margin: 0 0 22px; border-radius: 18px; background: var(--desk); padding: clamp(20px, 3vw, 30px); }
.post-summary-head { margin: 0 0 12px !important; font-size: 13px !important; font-weight: 900; letter-spacing: .06em; color: var(--edu); }
.post-summary dl { margin: 0; display: grid; gap: 12px; }
.post-summary dl > div { display: grid; grid-template-columns: 8em minmax(0, 1fr); gap: 12px; }
.post-summary dt { font-weight: 900; font-size: 14px; line-height: 1.95; }
.post-summary dd { margin: 0; font-size: 14.5px; line-height: 1.95; color: var(--ink-2); }
@media (max-width: 560px) { .post-summary dl > div { grid-template-columns: 1fr; gap: 0; } }
.read-guide { font-size: 13.5px !important; line-height: 2 !important; color: var(--soft); margin-bottom: 40px !important; }
.read-guide .deep-tag { margin: 0 4px 0 0; }
ul.read-guide { padding-left: 1.3em; }
ul.read-guide li { margin: 0 0 6px; }

.paper-card { margin: 0 0 28px; padding: clamp(20px, 3vw, 30px); border-radius: 18px; background: var(--card); box-shadow: 0 0 0 1.5px var(--edu), 0 18px 40px -28px rgba(21, 24, 43, .45); }
.paper-card p { margin: 0 !important; }
.paper-card-label { font-size: 12.5px !important; font-weight: 900; letter-spacing: .06em; color: var(--edu); }
.paper-card-title { margin-top: 8px !important; font-size: clamp(20px, 2.4vw, 26px) !important; font-weight: 900; line-height: 1.4 !important; }
.post-body .paper-card .paper-card-title a:not(.btn) { color: var(--ink); text-decoration: none; }
.post-body .paper-card .paper-card-title a:not(.btn):hover { text-decoration: underline; text-underline-offset: 4px; }
.paper-card-meta { margin-top: 8px !important; font-size: 13px !important; font-weight: 700; color: var(--soft); }
.paper-card-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 18px; }
.post-body .paper-card-links .btn { min-height: 46px; padding: 0 20px; font-size: 14px; }
.post-body .paper-card-links .btn:not(.btn--ghost) { color: #fff; }
.post-body .paper-card-links .btn--ghost { color: var(--ink); }
.post-body .paper-card-links .text-link { color: var(--ink); font-size: 14px; }
.paper-card-note { margin-top: 14px !important; font-size: 12.5px !important; line-height: 1.85 !important; color: var(--faint); }

.compare-wrap { margin: 8px 0 28px; overflow-x: auto; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.compare { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 14.5px; line-height: 1.8; }
.compare th, .compare td { padding: 12px 16px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.compare thead th { border-top: 0; background: #f6f7fa; font-size: 13px; font-weight: 900; }
.compare thead th:last-child { color: var(--edu); }
.compare tbody th { width: 8.5em; font-size: 13px; font-weight: 900; color: var(--soft); white-space: nowrap; }
.compare td:last-child { font-weight: 700; }

/* ---------- Math ---------- */
.katex { font-size: 1.08em; }
.katex-display { margin: 1.1em 0 1.4em; padding: 6px 2px; overflow-x: auto; overflow-y: hidden; }
.katex-display > .katex { white-space: nowrap; }

.post-body .eq-text { margin: 1.1em 0 1.4em; text-align: center; font-weight: 700; }
.eq-op { display: inline-block; margin: 0 .7em; }

/* Statements: one colour per kind (定義 green, 命題・補題・系 blue, 定理 red, 例 neutral).
   The kind is a small filled label; the box is a soft tint with a hairline ring, no side bar. */
.theorem { --k: var(--edu); --k-tint: var(--edu-tint); --k-ring: rgba(31, 157, 116, .28);
  margin: 8px 0 28px; padding: 18px 24px 8px; border-radius: 16px; background: var(--k-tint); box-shadow: inset 0 0 0 1px var(--k-ring); }
.theorem.is-prop { --k: var(--dev); --k-tint: #eef1ff; --k-ring: rgba(50, 87, 255, .24); }
.theorem.is-thm { --k: #d7334f; --k-tint: #fdedf0; --k-ring: rgba(215, 51, 79, .28); }
.theorem.is-ex { --k: var(--ink-2); --k-tint: #f2f3f7; --k-ring: var(--line); }
.theorem-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 8px !important; font-weight: 900; font-size: 14px !important; color: var(--ink); }
.theorem-label { display: inline-block; padding: 1px 11px 2px; border-radius: 8px; background: var(--k); color: #fff; font-size: 13px; letter-spacing: .04em; line-height: 1.7; }
.theorem p:not(.theorem-head) { font-weight: 700; }
.theorem.is-ex p:not(.theorem-head) { font-weight: 500; }
.theorem-sm { padding: 14px 20px 4px; }

/* ---------- Proofs: steps first, details folded ---------- */
.proof { position: relative; margin: 4px 0 30px; padding: 14px 22px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--card); }
.proof:has(> details[open]) { padding-bottom: 30px; }
.proof:has(> details[open])::after { content: ""; position: absolute; right: 18px; bottom: 16px; width: 9px; height: 9px; background: var(--ink-2); }
.theorem + .proof { margin-top: -20px; }
.post-body .proof-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-height: 30px; margin: 0; padding: 0 110px 0 0; list-style: none; cursor: pointer; line-height: 1.5; font-size: 14px; font-weight: 900; color: var(--ink); }
.proof-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.post-body .proof-steps > li { position: relative; margin: 0; padding: 4px 0 4px 34px; counter-increment: step; }
.proof-steps > li::before { content: counter(step); position: absolute; left: 0; top: 9px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--desk); font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.step-more .proof-steps > li::before { content: counter(step, lower-alpha); background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.proof .step, .proof summary { font-size: 15.5px; line-height: 1.95; }
details.step > summary { position: relative; list-style: none; cursor: pointer; border-radius: 8px; transition: background-color .2s; }
details.step > summary::-webkit-details-marker { display: none; }
.step-toggle { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 0 8px 0 7px; border-radius: 999px; background: var(--dev-tint); color: var(--dev); font-size: 11.5px; font-weight: 800; line-height: 1.75; vertical-align: 1px; white-space: nowrap; transition: background-color .2s, color .2s; }
.step-toggle::before { content: ""; width: 5px; height: 5px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-1px) rotate(45deg); transition: transform .3s var(--ease); }
.step-toggle > span + span, details.step[open] > summary .step-toggle > span:first-child { display: none; }
details.step[open] > summary .step-toggle > span + span { display: inline; }
details.step[open] > summary .step-toggle { background: var(--desk); color: var(--soft); }
details.step[open] > summary .step-toggle::before { transform: translateY(1px) rotate(225deg); }
details.step > summary:hover .step-toggle { background: var(--dev); color: #fff; }
details.step > summary:hover { background: var(--desk); }
details.step > summary:focus-visible { outline: 3px solid var(--dev); outline-offset: 2px; }
.step-more { margin: 6px 0 8px; padding: 10px 0 4px 16px; border-left: 2px solid var(--dev-tint); }
.post-body .step-more p, .post-body .step-more li { font-size: 15px; line-height: 1.95; }
.step-more > p:last-child { margin-bottom: .4em; }
details.step[open] > .step-more { animation: deep-in .35s var(--ease); }
@media (max-width: 560px) {
  .proof { padding: 14px 12px 28px; }
  .post-body .proof-steps > li { padding-left: 28px; }
  .proof-steps > li::before { width: 20px; height: 20px; font-size: 11px; }
  .step-more { padding-left: 8px; margin-left: -18px; }
  .post-body .theorem-head:has(+ .ask), .post-body .proof-head:has(+ .ask) { padding-right: 100px; }
}

.proof-head::-webkit-details-marker { display: none; }
.proof-fold[open] > .proof-head { margin-bottom: 6px; }
.proof-head:hover .step-toggle { background: var(--dev); color: #fff; }
.proof-fold[open] > summary .step-toggle > span:first-child { display: none; }
.proof-fold[open] > summary .step-toggle > span + span { display: inline; }
.proof-fold[open] > summary .step-toggle { background: var(--desk); color: var(--soft); }
.proof-fold[open] > summary .step-toggle::before { transform: translateY(1px) rotate(225deg); }
.proof-fold[open] > .proof-steps { animation: deep-in .35s var(--ease); }
.proof-head .step-toggle { margin-left: 0; vertical-align: 0; }
.proof-tools { display: inline-flex; gap: 6px; margin-left: 4px; white-space: nowrap; }
.proof-fold:not([open]) .proof-tools { display: none; }
.proof-tools button { white-space: nowrap; border: 0; border-radius: 999px; padding: 4px 11px; background: var(--desk); font: inherit; font-size: 12px; font-weight: 700; color: var(--soft); cursor: pointer; transition: background-color .2s, color .2s; }
.proof-tools button:hover { background: var(--desk-2); color: var(--ink); }

/* ---------- Statement references and term notes ---------- */
.term { text-decoration: underline dotted; text-decoration-color: var(--dev); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; border-radius: 3px; }
.term:hover, .term:focus-visible { background: var(--dev-tint); outline: none; }
.pop { position: absolute; z-index: 60; width: min(440px, calc(100vw - 24px)); max-height: min(60vh, 460px); overflow: auto; padding: 4px; border-radius: 16px; background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 24px 50px -18px rgba(21, 24, 43, .45); animation: deep-in .2s var(--ease); }
.pop[hidden] { display: none; }
.pop .theorem { margin: 0; }
.pop .theorem p, .pop .theorem li { font-size: 14.5px; line-height: 1.9; }
.pop.is-term { padding: 14px 18px 6px; }
.pop.is-term p { margin: 0 0 .8em; font-size: 14px; line-height: 1.9; }
.pop .pop-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px !important; font-weight: 900; font-size: 14.5px !important; }
.pop .pop-head span { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--dev); }
.pop .pop-ref { font-size: 13.5px; line-height: 1.85; color: var(--soft); }
.pop-jump { display: block; margin: 8px 12px 10px; font-size: 13.5px; font-weight: 700; color: var(--dev); }

/* ---------- 「AIに質問」 ---------- */
.theorem, .proof { position: relative; }
.theorem > .ask { position: absolute; right: 14px; top: 12px; }
.proof > .ask { position: absolute; right: 14px; top: 16px; }
.post-body .theorem-head:has(+ .ask), .post-body .proof-head:has(+ .ask) { padding-right: 110px; }
.deep { position: relative; }
.deep > .ask { position: absolute; right: 50px; top: 13px; }
.deep:not([open]) > .ask { display: none; }
.deep[open] > summary { padding-right: 160px; }
.ask { position: relative; z-index: 4; font-weight: 700; line-height: 1; }
.ask-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px 5px 9px; border: 1.5px solid transparent; border-radius: 999px;
  background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(120deg, #3257ff, #8b5cf6 55%, #ff6a3d) border-box;
  font: inherit; font-size: 12px; font-weight: 800; letter-spacing: .02em; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 14px -8px rgba(80, 70, 220, .55); transition: transform .2s var(--ease), box-shadow .2s, color .2s; }
.ask-btn:hover, .ask-btn[aria-expanded="true"] { transform: translateY(-1px); color: #4b3fd8; box-shadow: 0 8px 20px -8px rgba(80, 70, 220, .6); }
.ask-spark { width: 14px; height: 14px; fill: #6d5cf0; }
.ask-btn:hover .ask-spark { animation: ask-twinkle .9s var(--ease); }
@keyframes ask-twinkle { 50% { transform: rotate(18deg) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .ask-btn, .ask-btn:hover .ask-spark { transition: none; animation: none; transform: none; } }
.ask-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(300px, 82vw); padding: 8px; border-radius: 16px; background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 24px 48px -18px rgba(21, 24, 43, .45); text-align: left; animation: deep-in .25s var(--ease); }
.ask-menu[hidden], .ask-pick[hidden], .ask-paste[hidden], .ask-go[hidden] { display: none; }
.ask-pick, .ask-paste { display: grid; gap: 2px; }
.post-body .ask-menu-head, .post-body .ask-paste-head { margin: 4px 8px 6px !important; font-size: 12px !important; font-weight: 900; letter-spacing: .04em; color: var(--faint); line-height: 1.6 !important; }
.post-body .ask-paste-head { color: var(--edu); font-size: 13px !important; }
.ask-menu button[data-ai] { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 11px; padding: 7px 8px; background: transparent; text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: background-color .15s; }
.ask-menu button[data-ai]:hover, .ask-menu button[data-ai]:focus-visible { background: var(--desk); }
.ask-mark { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; font-size: 14px; font-weight: 900; color: #fff; }
.ask-mark.is-chatgpt { background: #10a37f; }
.ask-mark.is-claude { background: #d97757; }
.ask-mark.is-gemini { background: linear-gradient(135deg, #4285f4, #9b72cb 60%, #d96570); }
.ask-mark.is-copy { background: var(--desk-2); color: var(--ink-2); }
.ask-name { display: grid; gap: 2px; font-size: 14px; font-weight: 800; line-height: 1.3; }
.ask-name small { font-size: 11.5px; font-weight: 400; color: var(--soft); }
.post-body .ask-menu-note, .post-body .ask-paste-text { margin: 6px 8px 4px !important; font-size: 12px !important; font-weight: 400; line-height: 1.8 !important; color: var(--soft); }
.post-body .ask-paste-text { color: var(--ink-2); font-size: 13px !important; }
.ask-go, .ask-back { margin: 4px 8px; border: 0; border-radius: 999px; padding: 10px 14px; font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; }
.ask-go { background: var(--ink); color: #fff; }
.ask-go:hover { background: var(--ink-2); }
.ask-back { background: transparent; color: var(--soft); padding: 6px 14px; }
.ask-back:hover { color: var(--ink); }
.fig figcaption > .ask { float: right; margin: 0 0 6px 12px; }
.fig3d-bar > .ask { order: 3; }
.fig3d-bar > .ask .ask-menu { top: auto; bottom: calc(100% + 8px); }
.fig3d-bar > .fig3d-hint { margin-left: auto; }

/* ---------- Collapsible deep dives ---------- */
.deep-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.7; white-space: nowrap; color: #fff; }
.deep-tag.lv-1 { background: var(--dev); }
.deep-tag.lv-2 { background: var(--ai); }
.deep { margin: 26px 0; border-radius: 16px; box-shadow: 0 0 0 1px var(--line); background: #fbfbfd; transition: box-shadow .3s; }
.deep[open] { box-shadow: 0 0 0 1px var(--line-strong); background: var(--card); }
.deep summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 16px 52px 16px 20px; position: relative; cursor: pointer; list-style: none; font-weight: 700; font-size: 15px; line-height: 1.6; }
.deep summary::-webkit-details-marker { display: none; }
.deep summary::after { content: ""; position: absolute; right: 22px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--soft); border-bottom: 2px solid var(--soft); transform: translateY(-70%) rotate(45deg); transition: transform .35s var(--ease); }
.deep[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.deep summary:hover .deep-title { color: var(--ink); }
.deep-title { color: var(--ink-2); }
.deep-body { padding: 4px clamp(18px, 3vw, 28px) 10px; border-top: 1px dashed var(--line); }
.deep-body > :first-child { margin-top: 18px; }
.deep-body p, .deep-body li { font-size: 15px; }
.deep[open] .deep-body { animation: deep-in .45s var(--ease); }
@keyframes deep-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Figures ---------- */
.fig { margin: 28px 0 32px; }
.fig-frame { border-radius: 18px; background: #f6f7fa; box-shadow: inset 0 0 0 1px var(--line); padding: clamp(12px, 2.4vw, 24px); display: grid; place-items: center; }
.fig-svg { width: 100%; height: auto; max-width: 560px; display: block; overflow: visible; }
.fig-sm .fig-svg { max-width: 380px; }
.fig-svg foreignObject { overflow: visible; }
.fig-svg .fig-html { line-height: 1.25; white-space: nowrap; font-family: inherit; }
.fig-svg .fig-html .katex { font-size: 1.12em; }
.fig figcaption { margin-top: 12px; font-size: 13.5px; line-height: 1.9; color: var(--soft); }
.fig figcaption b { color: var(--ink); margin-right: 2px; }

/* Interactive hexagon demo */
.demo .fig-frame { padding: 0; overflow: hidden; }
.demo .hex-svg { max-width: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.demo .needle-end { pointer-events: none; transition: r .2s; }
.demo .needle-end.is-drag { r: 17; }
.demo .needle-hit { cursor: grab; }
.demo .needle-hit:active { cursor: grabbing; }
.demo.is-bad .needle-line { stroke: #e5383b; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.demo-modes { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--desk); box-shadow: inset 0 0 0 1px var(--line); }
.demo-modes button { border: 0; background: transparent; border-radius: 999px; padding: 7px 16px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.demo-modes button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.demo-shuffle { border: 0; border-radius: 999px; padding: 9px 18px; background: var(--card); box-shadow: 0 0 0 1px var(--line-strong); font-size: 13.5px; font-weight: 700; cursor: pointer; transition: background-color .2s; }
.demo-shuffle:hover { background: var(--desk); }
.demo-read { display: flex; align-items: center; gap: 8px; margin: 12px 0 0 !important; font-size: 14px !important; font-weight: 700; }
.demo-sw { width: 18px; height: 18px; border-radius: 6px; background: var(--desk-2); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.demo-msg { margin-left: 4px; }
.demo.is-bad .demo-msg { color: #e5383b; }

/* Remaining candidates */
.cand-frame { display: grid; gap: 4px; padding: clamp(14px, 3vw, 26px); place-items: stretch; }
.cand-row { display: grid; grid-template-columns: 7em auto minmax(0, 1fr); align-items: center; gap: 10px 18px; padding: 10px 0; border-top: 1px solid var(--line); }
.cand-row:first-child { border-top: 0; }
.cand-year { font-weight: 900; font-size: 14px; }
.cand-vals { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.cand-vals li { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 !important; border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line-strong); font-family: var(--mono); font-size: 17px; font-weight: 700; line-height: 1; }
.cand-vals li.is-out { color: var(--faint); background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); text-decoration: line-through; }
.cand-vals li.is-left { background: var(--ink); color: #fff; box-shadow: none; }
.cand-note { font-size: 13px; color: var(--soft); line-height: 1.6; }
.cand-row.is-now .cand-year { color: var(--edu); }
@media (max-width: 560px) {
  .cand-row { grid-template-columns: 1fr; gap: 8px; }
  .cand-vals li { width: 36px; height: 36px; }
}

/* Proof outline */
.flow-steps { list-style: none; margin: 8px 0 32px; padding: 0; display: grid; gap: 0; counter-reset: step; }
.flow-steps > li { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 0 0 22px; margin: 0 !important; }
.flow-steps > li:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--line); }
.flow-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 900; font-size: 16px; }
.flow-steps > li:last-child .flow-num { background: var(--edu); }
.flow-steps b { display: block; font-size: 16px; line-height: 1.6; padding-top: 7px; }
.flow-steps p { margin: 4px 0 0 !important; font-size: 14.5px !important; line-height: 1.95 !important; color: var(--soft); }

/* Rotatable 3D figures (blog-3d.js) */
.fig3d { width: 100%; }
.fig-frame:has(.fig3d) { padding: 0; overflow: hidden; display: block; }
.fig3d-stage { position: relative; aspect-ratio: 16 / 11; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.fig3d.is-dragging .fig3d-stage { cursor: grabbing; }
.fig3d-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fig3d-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fig3d-label { position: absolute; left: 0; top: 0; padding: 1px 7px; border-radius: 8px; background: rgba(246, 247, 250, .82); font-size: 14px; font-weight: 700; line-height: 1.5; white-space: nowrap; color: var(--ink); opacity: 0; transition: opacity .3s; }
.fig3d.is-ready .fig3d-label { opacity: 1; }
.fig3d-label[hidden] { display: none; }
.fig3d-label.is-axis { background: none; color: var(--faint); font-size: 15px; }
.fig3d-label.c-edu { color: var(--edu); } .fig3d-label.c-dev { color: var(--dev); } .fig3d-label.c-ai { color: #e2522a; }
.fig3d-label.is-purple { color: #7c4ae8; }
.fig3d-label.is-sheet { background: none; font-size: 12.5px; font-weight: 900; letter-spacing: .06em; color: var(--faint); }
.fig-kind { display: inline-block; margin: 0 8px 0 6px; padding: 0 8px; border-radius: 999px; background: var(--dev-tint); color: var(--dev); font-size: 11.5px; font-weight: 900; line-height: 1.8; vertical-align: 1px; white-space: nowrap; }
.fig-kind.is-concept { background: var(--ai-tint); color: #d9481f; }
.post-body li > .fig-kind:first-child { margin: 0 8px 0 0; }
.fig3d-fallback { position: absolute; inset: 0; display: grid; place-items: center; margin: 0 !important; padding: 24px; text-align: center; font-size: 14px !important; color: var(--soft); }
.fig3d-fallback[hidden] { display: none; }
.fig3d-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--card); }
.fig3d-group { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 999px; background: var(--desk); box-shadow: inset 0 0 0 1px var(--line); }
.fig3d-group button { border: 0; background: transparent; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink); cursor: pointer; transition: background-color .2s, color .2s; }
.fig3d-group button:hover { background: var(--desk-2); }
.fig3d-group button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.fig3d-group button .katex { font-size: 1em; }
.fig3d-hint { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--faint); }
.fig3d-notes { padding: 0 18px 14px; background: var(--card); }
.post-body .fig3d-note { margin: 0 !important; font-size: 14.5px; line-height: 1.95; color: var(--ink-2); }
.fig3d-note[hidden] { display: none; }
@media (max-width: 560px) {
  .fig3d-stage { aspect-ratio: 1 / 1; }
  .fig3d-hint { display: none; }
  .fig3d-group button { padding: 6px 11px; font-size: 13px; }
}

/* Series list at the end of a post */
.series-box { margin: clamp(48px, 6vw, 72px) 0 0; padding: clamp(20px, 3vw, 28px); border-radius: 18px; background: var(--desk); }
.post-body .series-head { margin: 0 0 10px; font-size: 13px; font-weight: 900; letter-spacing: .06em; color: var(--edu); }
.series-box ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.post-body .series-box li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: 8px; margin: 0; font-size: 15px; line-height: 1.8; }
.series-box li span { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--faint); padding-top: 2px; }
.series-box b { font-weight: 900; }
.series-box + .post-section { margin-top: clamp(48px, 6vw, 72px); }

/* ---------- Code ---------- */
.post-body pre.code { margin: 0 0 24px; padding: 20px 22px; border-radius: 16px; background: var(--night); color: #e7e9f6; overflow-x: auto; font-size: 13px; line-height: 1.8; }
.post-body pre.code code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; white-space: pre; }

/* ---------- References ---------- */
.refs { margin: 0; padding-left: 2em; font-size: 13.5px; }
.post-body .refs li { font-size: 13.5px; line-height: 1.85; color: var(--soft); scroll-margin-top: calc(var(--header-h) + 24px); }
.post-body .refs li + li { margin-top: .6em; }
.refs li:target { color: var(--ink); background: var(--edu-tint); border-radius: 6px; }
.ref-au { color: var(--ink); font-weight: 700; }
.post-body .refs a { overflow-wrap: anywhere; }
