/* 数学ビジュアライズ, set as a 図鑑: every post is shown by its drawing (scripts/site/mathvis_figures.py),
   in the colour of its カテゴリー (--c) on a faint wash of it; drawings draw themselves in as they come
   into view. The four lists (すべての記事・連載一覧・単発記事一覧・カテゴリー) are equal blocks next to
   the name at the top of every page, and a bar at the bottom on phones.
   Loaded after blog.css: the first part restyles the shared article parts, the rest is this site's own.
   The statements keep their colours (定義 green, 命題 blue, 定理 red, 例 neutral); a post's カテゴリー
   colour (--accent) marks only the chrome of its page: headings, the table of contents, links. */

:root {
  --paper: #ffffff;
  --ink: #15171c;
  --ink-2: #2a2d35;
  --soft: #646873;
  --faint: #a1a4ad;
  --line: #e6e7ea;
  --line-strong: #cdd0d6;
  --accent: var(--ink);
  --radius: 0px;
  --fig-bg: #f5f6f8;

  --card: var(--paper);
  --desk: #f3f4f6;
  --desk-2: #e8e9ed;
  --edu: #1f9d74; --edu-tint: #e3f4ee;
  --dev: #3257ff; --dev-tint: #e8edff;
  --ai: #ff6a3d; --ai-tint: #ffece5;
  --night: var(--ink);
  --shadow: 0 0 0 1px var(--line);
  --shadow-lift: 0 0 0 1px var(--line-strong);
  --font: "IBM Plex Sans JP", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --header-h: 64px;
  --pad: clamp(16px, 3.6vw, 56px);
}

/* ---------- Article parts (blog.css) ---------- */
[data-bd] { word-break: keep-all; overflow-wrap: anywhere; }
.post-hero .post-card-tags { margin-top: 0; }

.post-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.post-body { max-width: 44rem; background: none; border-radius: 0; box-shadow: none; padding: 0; }
.post-body p, .post-body li { font-size: 16.5px; line-height: 2.05; }
@media (max-width: 960px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .post-toc { position: static; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); background: var(--paper); padding: 16px 18px; }
}

/* この記事の要点 is a <details>: always open on a wide screen, folded on a phone (mathvis.js). */
.post-summary > summary { display: block; list-style: none; pointer-events: none; }
.post-summary > summary::-webkit-details-marker { display: none; }

/* Table of contents. On a phone the side one (after the article) gives way to a folded one at the top (.post-toc-m). */
.post-toc-m { display: none; }
.post-toc { top: calc(var(--header-h) + 24px); font-size: 13px; }
.post-toc p { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--soft); }
.post-toc ol { position: relative; border-left: 2px solid var(--line); }
.post-toc ol::before { content: ""; position: absolute; left: -2px; top: 0; width: 2px; height: 100%; background: var(--accent); transform-origin: top; transform: scaleY(var(--read, 0)); }
.post-toc a { padding: 6px 0 6px 16px; margin-left: -2px; border-left: 2px solid transparent; font-weight: 700; color: var(--soft); transition: color .25s; }
.post-toc a:hover { color: var(--ink); }
.post-toc a.is-current { color: var(--ink); border-left-color: transparent; }

/* Headings */
.post-body h2 { padding-top: 22px; font-size: clamp(22px, 2.3vw, 28px); scroll-margin-top: calc(var(--header-h) + 24px); }
.post-body h2::before { width: 28px; height: 4px; border-radius: 2px; background: var(--accent); transform-origin: left; transition: transform .8s var(--ease), width .8s var(--ease); }
.js .post-body h2:not(.is-in)::before { transform: scaleX(0); }
.post-body h2.is-in::before { width: 44px; }
.post-body strong { background: linear-gradient(transparent 64%, color-mix(in srgb, var(--accent) 16%, transparent) 64%); }
.post-body a:not(.text-link):not(.cat-chip):not(.btn) { color: color-mix(in srgb, var(--accent) 80%, #000); }
.term { text-decoration-color: var(--accent); }
/* Buttons: site.css (not loaded here) has the HP's round ones; these are square like the rest of this site.
   blog.css sets their size and text colour inside .paper-card-links. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--ink); background: var(--ink);
  font-weight: 700; line-height: 1.4; text-decoration: none; transition: background-color .25s, border-color .25s; }
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn--ghost { background: transparent; border-color: var(--line-strong); }
.btn--ghost:hover { background: transparent; border-color: var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 5px; }
.text-link:hover { text-decoration-color: currentColor; }

/* Statements, proofs, deep dives: shapes follow the proposal (--radius), colours follow their kind. */
.theorem { border-radius: var(--radius); }
.proof, .deep, .post-summary, .series-box, .compare-wrap, .paper-card { border-radius: var(--radius); }
.fig-frame { border-radius: var(--radius); background: var(--fig-bg, #f6f7fa); }
.fig3d-label { background: rgba(255, 255, 255, .86); }
.fig3d-group button[aria-pressed="true"], .demo-modes button[aria-pressed="true"] { background: var(--ink); }
.proof-fold[open] > .proof-steps > li, details.step[open] > .step-more > .proof-steps > li { animation: step-in .5s var(--ease) both; animation-delay: calc(var(--n, 0) * 45ms); }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
.js .post-body .fig { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .post-body .fig.is-in { opacity: 1; transform: none; }
.series-head { color: var(--accent) !important; }
.refs li:target { background: color-mix(in srgb, var(--accent) 12%, #fff); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}


*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 20px); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.85;
  font-feature-settings: "palt" 1; -webkit-font-smoothing: antialiased; overflow-x: clip; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: #fff; padding: 10px 16px; font-weight: 700; }
.skip-link:focus { top: 12px; }

@view-transition { navigation: auto; }
.i-top { view-transition-name: i-top; }
::view-transition-group(i-top) { animation: none; }
::view-transition-old(root) { animation: .18s ease both i-out; }
::view-transition-new(root) { animation: .38s var(--ease) both i-in; }
@keyframes i-out { to { opacity: 0; } }
@keyframes i-in { from { opacity: 0; } }

/* ---------- The name and the four lists ---------- */
.i-top { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: auto minmax(0, 1fr); height: var(--header-h); background: var(--paper); border-bottom: 2px solid var(--ink); }
.i-name { display: flex; align-items: center; padding: 0 clamp(18px, 2.4vw, 34px); font-weight: 700; font-size: 17px; letter-spacing: .04em; white-space: nowrap; }
.i-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.i-nav .nh { display: none; }
.i-tocbtn, .i-toc { display: none; }
.i-nav a { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 clamp(14px, 1.6vw, 24px); border-left: 1px solid var(--line-strong);
  font-weight: 700; font-size: 15px; white-space: nowrap; isolation: isolate; transition: color .3s; }
.i-nav a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform .45s var(--ease); }
.i-nav a:hover::before { transform: scaleY(.08); }
.i-nav a[aria-current] { color: #fff; }
.i-nav a[aria-current]::before { transform: none; }
.i-nav .ns { display: none; }
.i-nav .nn { font-weight: 500; font-size: 14px; color: var(--soft); transition: color .3s; }
.i-nav a[aria-current] .nn { color: rgba(255, 255, 255, .7); }

.i-main { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 var(--pad) clamp(56px, 8vw, 110px); }

/* ---------- Figures ---------- */
.fig-i { display: block; width: 100%; height: auto; overflow: visible; }
.fig-i path, .fig-i circle:not(.g-dot) { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig-i .g-axis { stroke: color-mix(in srgb, var(--c) 28%, #fff); stroke-width: 1; }
.fig-i .g-soft { stroke: color-mix(in srgb, var(--c) 42%, #fff); stroke-width: 1; stroke-dasharray: 3 3; }
.fig-i .g-curve { stroke: var(--c); stroke-width: 1.5; }
.fig-i .g-thin { stroke-width: .7; }
.fig-i .g-accent { stroke: color-mix(in srgb, var(--c) 72%, #000); stroke-width: 2.3; }
.fig-i circle.g-dot { fill: color-mix(in srgb, var(--c) 72%, #000); }
.fig-i .g-accent-dot { fill: var(--c); }
.fig-i .g-cloud { fill: var(--c); opacity: .5; }
.fig-i .g-label { font-size: 9px; font-family: var(--font); fill: var(--soft); }
.js .fig-i .g-curve { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .fig-i circle.g-dot { transform: scale(0); transform-box: fill-box; transform-origin: center; }
.js .is-in .fig-i .g-curve { animation: draw 1.5s var(--ease) forwards; animation-delay: calc(min(var(--i), 24) * 45ms); }
.js .is-in .fig-i circle.g-dot { animation: pop .5s var(--ease) forwards; animation-delay: calc(400ms + min(var(--i), 24) * 30ms); }
.js .is-in a:hover .fig-i .g-curve { animation: redraw 1.1s var(--ease) both; animation-delay: calc(min(var(--i), 24) * 30ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes redraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pop { to { transform: none; } }
/* Filled tiles (plane-not-five-colorable): faint, except the ones the needle lands on. */
.fig-i .g-tile { stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; fill-opacity: .32; }
.fig-i .g-tile-hit { fill-opacity: 1; }
.fig-i path.g-needle { stroke: #e5383b; stroke-width: 3; }
.fig-i circle.g-needle-end { fill: #fff; stroke: #e5383b; stroke-width: 2.4; }
.wash { background: color-mix(in srgb, var(--c) 7%, #fff); }

/* ---------- Home: a plate of specimens, with the name in the first box ---------- */
.i-hero { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: clamp(18px, 2.4vw, 32px) 0 0; }
.ih-name { grid-column: span 2; display: flex; flex-direction: column; justify-content: flex-end; margin: 0; padding: 0 18px 20px 0;
  font-size: clamp(30px, 3.5vw, 54px); font-weight: 700; line-height: 1.12; letter-spacing: .02em; }
.ih-name span { white-space: nowrap; }
.ih-plate { grid-column: span 5; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 2px solid var(--ink); border-left: 1px solid var(--line); }
.ih-plate li { position: relative; aspect-ratio: 4 / 3.3; padding: 6px 6px 26px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background-color .35s; }
.ih-plate li:hover { background: color-mix(in srgb, var(--c) 6%, #fff); }
.spec { height: 100%; }
.spec .g-curve { stroke-width: 1.3; }
.spec .g-thin { stroke-width: .6; }
.spec .g-soft { stroke-dasharray: none; stroke: color-mix(in srgb, var(--c) 30%, #fff); stroke-width: .8; }
.ih-l { position: absolute; left: 10px; bottom: 7px; font-size: 11.5px; font-weight: 500; line-height: 1.3; color: var(--soft); }
.js .i-hero .g-curve { animation: draw 2s var(--ease) forwards; animation-delay: calc(var(--k) * 90ms + 120ms); }
.js .i-hero circle.g-dot { animation: pop .5s var(--ease) forwards; animation-delay: calc(var(--k) * 90ms + 900ms); }
.js .i-hero li:hover .g-curve { animation: redraw 1.4s var(--ease) both; }
.i-home .i-sec:first-of-type { margin-top: clamp(40px, 4.6vw, 64px); }

/* ---------- Sections ---------- */
.i-sec { margin-top: clamp(56px, 6.4vw, 92px); }
.i-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; margin-bottom: 22px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.i-head h2 { margin: 0; font-size: clamp(21px, 2vw, 26px); font-weight: 700; line-height: 1.3; }
.i-head.is-cat { border-bottom-color: var(--c); }
.i-head.is-cat h2 { color: var(--c); }
.i-more { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; }
.i-more span { padding: 1px 8px; background: var(--ink); color: #fff; font-weight: 500; font-size: 13px; transition: background-color .25s; }
.i-more:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.i-more:hover span { background: var(--soft); }

/* Plates */
.pls { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px clamp(16px, 2vw, 28px); }
.pls.is-dense { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 30px 20px; }
.pl a { display: grid; gap: 4px; }
.pl-fig { display: grid; place-items: center; aspect-ratio: 3 / 2; margin-bottom: 8px; padding: 6%; background: color-mix(in srgb, var(--c) 7%, #fff); transition: background-color .35s; }
.pl a:hover .pl-fig { background: color-mix(in srgb, var(--c) 12%, #fff); }
.pl-cat { font-size: 12px; font-weight: 700; color: var(--c); }
.pl-t { font-size: 16.5px; font-weight: 700; line-height: 1.55; }
.pl a:hover .pl-t { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.pl-m { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 12.5px; font-weight: 500; color: var(--soft); }
.pl-m time { margin-left: auto; }
.pl.is-off { display: none; }

/* A series as a strip of its parts */
.strips { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.strip { display: grid; grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); gap: 16px clamp(20px, 3vw, 40px); padding: 22px 0; border-bottom: 1px solid var(--line); }
.strip:first-child { padding-top: 4px; }
.st-name { font-size: 20px; font-weight: 700; line-height: 1.45; }
.st-name:hover { color: color-mix(in srgb, var(--c) 72%, #000); text-decoration: underline; text-underline-offset: 5px; }
.st-meta { display: flex; flex-wrap: wrap; gap: 0 12px; margin: 6px 0 0; font-size: 12.5px; font-weight: 700; color: var(--soft); }
.st-desc { margin: 8px 0 0; font-size: 13.5px; line-height: 1.85; color: var(--soft); }
.st-parts { list-style: none; margin: 0; padding: 0 0 6px; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: thin; }
.st-parts li { flex: 0 0 148px; }
.st-parts a { display: grid; gap: 1px; }
.st-fig { display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 6%; margin-bottom: 6px; background: color-mix(in srgb, var(--c) 7%, #fff); transition: background-color .35s; }
.st-parts a:hover .st-fig { background: color-mix(in srgb, var(--c) 13%, #fff); }
.st-cat { color: var(--c); }
.st-n { font-size: 11.5px; font-weight: 700; color: var(--c); }
.st-t { font-size: 13px; font-weight: 700; line-height: 1.5; }

/* カテゴリー, each with its newest figure */
.cts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 28px 18px; }
.ct a { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; }
.ct-fig { grid-column: 1 / -1; display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 7%; margin-bottom: 8px; background: color-mix(in srgb, var(--c) 7%, #fff);
  box-shadow: inset 0 -4px 0 var(--c); transition: background-color .35s; }
.ct a:hover .ct-fig { background: color-mix(in srgb, var(--c) 13%, #fff); }
.ct-n { font-size: 19px; font-weight: 700; color: var(--c); }
.ct-c { font-size: 14px; font-weight: 500; color: var(--soft); }
.ct-s { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.75; color: var(--soft); }
.cts.is-big { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 40px 28px; margin-top: 30px; }
.cts.is-big .ct-n { font-size: 26px; }

/* ---------- List pages ---------- */
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 26px; font-size: 13px; font-weight: 500; color: var(--soft); }
.crumb i { font-style: normal; color: var(--faint); }
.crumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.i-h1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 14px 0 0; font-size: clamp(32px, 4.4vw, 56px); font-weight: 700; line-height: 1.25; }
.i-h1 > span { font-size: .38em; font-weight: 500; color: var(--soft); }
.i-h1.is-cat { color: var(--c); }
.i-kick { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 14px 0 0; font-size: 13.5px; font-weight: 700; color: var(--soft); }
.i-kick a:first-child, .k-cat { color: var(--c); }
.i-kick a:hover { text-decoration: underline; text-underline-offset: 4px; }
.i-desc { margin: 12px 0 0; font-size: 15.5px; line-height: 2; color: var(--soft); max-width: 40em; }
.month { margin-top: 44px; }
.month h2 { margin: 0 0 18px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-size: 18px; font-weight: 700; }
.month[hidden] { display: none; }
.i-list > .i-sec:first-of-type { margin-top: 40px; }

.flt { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 26px; }
.flt div { display: flex; flex-wrap: wrap; gap: 0; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.flt button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border: 0; background: none; cursor: pointer; font-size: 13.5px; font-weight: 700; transition: background-color .2s, color .2s; }
.flt button + button { box-shadow: inset 1px 0 0 var(--line-strong); }
.flt button:hover { background: var(--desk); }
.flt button i { width: 9px; height: 9px; background: var(--c); }
.flt-k button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.flt-c button[aria-pressed="true"] { background: var(--c); color: #fff; }
.flt-c button[aria-pressed="true"] i { background: #fff; }
.flt-t button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* タグ */
.tags-line { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tg, .post-card-tags a, .tag-list a { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 10px; box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: 12.5px; font-weight: 500; color: var(--ink-2); transition: box-shadow .2s, background-color .2s; }
.tg::before, .post-card-tags a::before, .tag-list a::before { content: "#"; color: var(--faint); }
.tg:hover, .post-card-tags a:hover, .tag-list a:hover { box-shadow: inset 0 0 0 1px var(--ink); background: var(--desk); }
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a { padding: 5px 12px; font-size: 14px; }
.tag-list span { font-size: 12px; color: var(--soft); }
.ct-t { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--soft); }
.ct-t span::before { content: "#"; color: var(--faint); }

/* A series: its parts with their figures */
.sparts { list-style: none; margin: 34px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.sparts a { display: grid; grid-template-columns: 180px 4.6em minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sp-fig { display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 6%; background: color-mix(in srgb, var(--c) 7%, #fff); transition: background-color .35s; }
.sparts a:hover .sp-fig { background: color-mix(in srgb, var(--c) 13%, #fff); }
.sp-n { font-size: 14px; font-weight: 700; color: var(--c); }
.sp-t { font-size: 19px; font-weight: 700; line-height: 1.5; }
.sparts time { font-size: 13px; color: var(--soft); }

/* ---------- Post ---------- */
.post-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 380px); gap: clamp(24px, 4vw, 56px); align-items: end; padding: 0 0 clamp(28px, 4vw, 44px); margin: 18px 0 clamp(28px, 4vw, 44px); border-bottom: 2px solid var(--ink); }
.ph-fig { display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 6%; background: color-mix(in srgb, var(--c) 7%, #fff); }
.ph-fig .g-curve { stroke-width: 1.1; }
.ph-fig .g-accent { stroke-width: 1.8; }
.post-title { margin: 12px 0 0; font-size: clamp(30px, 3.8vw, 48px); font-weight: 700; line-height: 1.35; }
.post-hero .lead { margin-top: 14px; font-size: 15.5px; line-height: 2; color: var(--soft); max-width: 40em; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 16px; font-size: 13px; font-weight: 500; color: var(--soft); }
.post-card-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.post-card-tags li { padding: 0; background: none; }
/* One column for the text and every figure (about 50 characters a line), so the page keeps its shape
   whether or not a figure is there. The page is only as wide as that column and the contents,
   so on a wide screen they sit together in the middle. */
.i-post { --col: 52rem; --toc: 210px; --gap: clamp(32px, 4vw, 56px);
  max-width: calc(var(--col) + var(--gap) + var(--toc) + 2 * var(--pad)); }
.post-layout { grid-template-columns: minmax(0, var(--col)) var(--toc); gap: var(--gap); }
.post-body { max-width: none; }
.post-toc { order: 2; }
.post-body h2::before { border-radius: 0 !important; }
.post-more { margin-top: clamp(48px, 7vw, 88px); }
.pls.is-pair { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); max-width: 640px; }
.post-more h2 { margin: 44px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-size: 18px; font-weight: 700; }
.mores { display: flex; flex-wrap: wrap; gap: 12px 32px; }

/* ---------- Footer ---------- */
.i-foot { display: grid; gap: 12px; padding: 40px var(--pad) 48px; border-top: 2px solid var(--ink); }
.i-fname { margin: 0; font-weight: 700; font-size: 17px; }
.i-foot nav { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; font-weight: 700; }
.i-foot nav span { margin-left: 6px; font-weight: 500; color: var(--soft); }
.i-foot a:hover { text-decoration: underline; text-underline-offset: 4px; }
.i-fcats a { color: var(--c); }
.i-ftags a::before { content: "#"; color: var(--faint); }
.i-op { margin: 0; font-size: 12.5px; color: var(--soft); }

/* ---------- Narrow ---------- */
@media (max-width: 1100px) {
  .pls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .i-nav .nl { font-size: 14px; }
}
@media (max-width: 1100px) and (min-width: 821px) {
  .i-hero { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ih-plate { grid-column: span 3; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ih-plate li:nth-child(n + 7) { display: none; }
}
@media (max-width: 960px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .post-toc { order: 0; }
  aside.post-toc { display: none; }
  .post-toc-m { display: block; margin: 0 0 28px; padding: 0; }
  .post-toc-m > summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; list-style: none; cursor: pointer;
    font-size: 14px; font-weight: 700; }
  .post-toc-m > summary::-webkit-details-marker { display: none; }
  .post-toc-m > summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border: solid var(--soft); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .25s var(--ease); }
  .post-toc-m[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
  .post-toc-m ol { margin: 0 18px 16px; }
  .post-summary > summary { pointer-events: auto; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
  .post-summary > summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .25s var(--ease); }
  .post-summary[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
  .post-summary:not([open]) > summary { margin: 0 !important; }
  .post-hero { grid-template-columns: minmax(0, 1fr); }
  .ph-fig { order: -1; max-width: 420px; }
  .strip { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  :root { --header-h: 56px; }
  .i-hero { grid-template-columns: minmax(0, 1fr); }
  .ih-name { grid-column: auto; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding: 0 0 14px; font-size: 8.4vw; }
  .i-name[aria-current] { display: none; }
  .ih-plate { grid-column: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ih-plate li:nth-child(n + 7) { display: none; }
  .ih-l { font-size: 10px; left: 6px; }
  /* The bar at the top: the name (and 目次 on a post) over the five lists. It slides away while the page
     is read downwards and comes back as soon as it is scrolled up (mathvis.js, .is-away). */
  :root { --header-h: 96px; }
  .i-top { position: sticky; top: 0; z-index: 40; display: grid; grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 0;
    transition: transform .3s var(--ease); }
  .i-top.is-away { transform: translateY(-100%); }
  .i-name { grid-column: 1; padding: 10px var(--pad); font-size: 17px; }
  .i-nav { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 46px; border-top: 1px solid var(--line); }
  .i-nav .nh { display: flex; }
  .i-nav a { flex-direction: column-reverse; justify-content: center; gap: 0; padding: 0; border-left: 1px solid var(--line); font-size: 10px; line-height: 1.25; }
  .i-nav a:first-child { border-left: 0; }
  .i-nav .nl { display: none; }
  .i-nav .ns { display: block; }
  .i-nav .nn { font-size: 14px; font-weight: 700; color: var(--ink); }
  .i-tocbtn { display: flex; grid-column: 2; grid-row: 1; align-self: center; align-items: center; gap: 8px; margin-right: var(--pad); padding: 6px 12px;
    border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
  .i-tocbtn::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .25s var(--ease); }
  .i-tocbtn[aria-expanded="true"] { background: var(--ink); color: #fff; }
  .i-tocbtn[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
  .i-toc { display: block; position: absolute; top: 100%; left: 0; right: 0; max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
    padding: 8px var(--pad) 16px; background: var(--paper); border-bottom: 2px solid var(--ink); box-shadow: 0 24px 40px -24px rgba(21, 24, 43, .45); }
  .i-toc[hidden] { display: none; }
  .i-toc ol { margin: 0; padding: 0; list-style: none; }
  .i-toc a { display: block; padding: 10px 0 10px 14px; border-left: 3px solid transparent; font-size: 14.5px; font-weight: 700; line-height: 1.5; color: var(--soft); }
  .i-toc a.is-current { color: var(--ink); border-left-color: var(--accent); }
  .pls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .pls.is-dense { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .pl-t { font-size: 15px; }
  .pl-m time { margin-left: 0; }
  .cts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .st-parts { margin-right: calc(var(--pad) * -1); padding-right: var(--pad); }
  .st-parts li { flex-basis: 132px; }
  .sparts a { grid-template-columns: 120px minmax(0, 1fr); gap: 4px 14px; }
  .sp-fig { grid-row: 1 / 4; }
  .sp-n, .sp-t, .sparts time { grid-column: 2; }
  .sp-t { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* Figures never widen their column (a drawing's own width must not push the grid). */
.pl a, .ct a { grid-template-columns: minmax(0, 1fr); }
.ct a { grid-template-columns: minmax(0, 1fr) auto; }
.pl-fig, .st-fig, .ct-fig, .sp-fig, .ph-fig { grid-template-columns: minmax(0, 1fr); min-width: 0; }

/* ---------- A post in two languages (日本語 / English) ----------
   The page holds both; <html data-lang> (set in <head> before drawing, then by the switch) picks one.
   Without JS it stays Japanese. */
:root:not([data-lang="en"]) .l-en, :root[data-lang="en"] .l-ja { display: none !important; }
.lang-sw { display: inline-flex; margin: 0 0 6px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.lang-sw button { font: inherit; font-size: 13px; font-weight: 700; padding: 7px 16px; border: 0; background: none; color: var(--soft); cursor: pointer; }
.lang-sw button:hover { color: var(--ink); }
.lang-sw button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.lang-sw button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- A running record (openai-math-updates): status, withdrawals, the table of changes ---------- */
.post-body h3 { margin: 2.2em 0 .7em; font-size: 18px; font-weight: 700; line-height: 1.6; }
.post-body p.upd-checked { margin: 0 0 36px; font-size: 13.5px; line-height: 1.9; color: var(--soft); }
.upd-meter { height: 14px; background: var(--desk-2); }
.upd-meter span { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--accent); }

.upd-deps { display: grid; grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); grid-template-rows: auto auto; gap: 14px 0; align-items: center; }
.upd-deps .is-origin { grid-row: 1 / 3; }
.upd-arrows { grid-column: 2; grid-row: 1 / 3; align-self: stretch; position: relative; }
.upd-arrows::before, .upd-arrows::after { content: ""; position: absolute; border: 0 solid var(--accent); }
.upd-arrows::before { left: 0; width: 50%; top: 50%; border-top-width: 2px; }
.upd-arrows::after { left: 50%; right: 0; top: 25%; bottom: 25%; border-width: 2px 0 2px 2px; }
.upd-paper { padding: 12px 14px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 14px; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.upd-paper.is-origin { box-shadow: inset 0 0 0 2px var(--accent); }
.upd-tag { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--accent); }
@media (max-width: 640px) {
  .upd-deps { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .upd-deps .is-origin, .upd-arrows { grid-row: auto; grid-column: auto; }
  .upd-arrows { height: 28px; }
  .upd-arrows::before { left: 50%; width: 0; top: 0; bottom: 0; border-width: 0 0 0 2px; }
  .upd-arrows::after { display: none; }
  .upd-deps .upd-paper + .upd-paper { margin-top: 10px; }
}

.compare.upd-table { min-width: 640px; }
.compare.upd-table thead th:last-child { color: inherit; }
.compare.upd-table tbody th { width: 32%; white-space: normal; color: var(--ink); font-size: 13.5px; line-height: 1.7; }
.compare.upd-table td:last-child { font-weight: 500; }
.upd-v { font-size: 13px; white-space: nowrap; color: var(--soft); }
.post-body ul.upd-list { list-style: none; padding: 0; margin: 0 0 1.2em; }
.post-body ul.upd-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.8; }
.post-body ul.upd-list li:last-child { border-bottom: 1px solid var(--line); }
.post-body ul.upd-notes li { margin-top: .6em; }
