/* blog.siao.ai — extends the siao.ai homepage's visual identity
 * (ClaudeDesign/BLOG.md), not the app family's. Same literal color
 * tokens as the homepage, same editorial detailing (hairlines,
 * letter-spaced labels, the ↗ hover affordance). One serif stack for
 * everything — no separate sans face for chrome.
 */

/* size-adjust exists because this site sets Latin and Traditional
 * Chinese in the same line constantly ("Markdown 渲染管線", "GFM 表格").
 *
 * Measured, not guessed: at the same font-size, EB Garamond's cap
 * height renders at 65.8px per 100px em while Noto Serif TC's glyph
 * height renders at 91.6px — the Latin is only 72% as tall, because
 * Garamonds are historically small-on-the-body faces and CJK glyphs
 * fill their em box. Unadjusted, every English word in a Chinese
 * sentence reads as a size too small.
 *
 * 108% brings the Latin cap to ~78% of the CJK glyph, which is the
 * comfortable ratio for a serif pairing. Applied to the @font-face
 * rather than to selectors, so it holds everywhere Latin appears
 * without anybody having to remember it.
 */
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  size-adjust: 108%;
  font-display: block; /* a flash of the wrong serif reads worse than a moment of nothing */
}

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  size-adjust: 108%;
  font-display: block;
}

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  size-adjust: 108%;
  font-display: block;
}

@font-face {
  font-family: "Noto Serif TC";
  src: url("/fonts/noto-serif-tc-chinese-traditional-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Noto Serif TC";
  src: url("/fonts/noto-serif-tc-chinese-traditional-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --paper: #faf9f6;
  --ink: #1a1a1a;
  --ink-dim: #6e6b65;
  --hairline: rgba(26, 26, 26, 0.14);

  /* Sage green, the siao.ai family's brand accent — the literal token
   * from ClaudeDesign/APP_FAMILY.md, not a re-derived approximation.
   * Already measured there: 4.52:1 as text on this paper, which is the
   * reason it is #587b60 and not the original #5f8567 (3.96:1).
   *
   * Used for interaction only — links, hover, focus, the reading
   * progress bar. Not for decoration, and never as the sole signal for
   * anything. */
  --accent: #587b60;
  --accent-wash: rgba(88, 123, 96, 0.09);
  --accent-hairline: rgba(88, 123, 96, 0.35);

  /* Code sits on a barely-tinted panel, not a slab (see the note on
   * `article pre`). Tokenised so dark mode can move it. */
  --code-panel: #f7f5f0;
  --code-inline: #f0eee8;




/* Two families, and the split is the point. Reading matter is set in
   * the serif; everything that is *interface* — nav, labels, byline,
   * sidebar, tag chips, table headers — is set in the system sans.
   *
   * Before this split every one of those was Garamond too, and a page
   * of nothing but serif at six different sizes is tiring to read: the
   * eye gets no signal about what is prose and what is furniture.
   * (The marketing homepage can be all-serif because it is one screen
   * with almost no chrome; this site is not that.)
   *
   * The sans is the platform's own — zero bytes downloaded, and it
   * reads as interface precisely because it is the interface face the
   * reader already knows. CJK order follows APP_FAMILY.md: TC before
   * SC, always, or shared codepoints render simplified. */
  --serif: "EB Garamond", "Noto Serif TC", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", "Heiti TC", sans-serif;
}

/* Dark mode.
 *
 * ClaudeDesign/BLOG.md said "No dark mode, matching the homepage's
 * current decision" — overturned; the banner there records it.
 *
 * The palette is NOT new. These are the exact tokens siaohub already
 * ships (`siaohub/src/app/globals.css`), so a reader moving between
 * blog.siao.ai and git.siao.ai does not cross a seam. Re-deriving a
 * "close enough" dark grey is how a family stops looking like one.
 *
 * Measured against #17161a, not assumed:
 *   #e6e6e6 body text      14.43:1
 *   #9a9a9a muted           6.40:1
 *   #83b58c accent          7.68:1
 *   #e6e6e6 on the panel   13.12:1
 * and every dark-plus token against the #201f24 panel clears 4.5:1
 * (worst 4.91) — see the note in scripts/render-markdown.js.
 *
 * The light accent (#587b60) is 3.79:1 here — large-text only, not
 * enough for a link in running prose — which is why dark mode takes
 * the family's lighter #83b58c instead of reusing it. */
/* shiki bakes BOTH colours into every token as custom properties on the
 * span's own inline style; nothing sets `color`. This is what decides
 * which one is drawn, and without it a dual-theme block renders with no
 * syntax colour at all.
 *
 * The indirection has to happen here, on the span. An earlier version
 * declared `--shiki: var(--shiki-light)` on `:root` and used
 * `color: var(--shiki)` — but `--shiki-light` does not exist at the
 * root, so it was invalid at computed-value time and every token came
 * out black.
 *
 * Scoped to `pre`/`code` rather than a bare `[data-theme]`: the theme
 * toggle stamps `data-theme` on `<html>`, so the unscoped form matched
 * EVERY span on the page and set each one's colour from a variable that
 * does not exist there. */
pre[data-theme] span,
code[data-theme] span {
  color: var(--shiki-light);
}

/* Dark mode.
 *
 * ClaudeDesign/BLOG.md said "No dark mode, matching the homepage's
 * current decision" — overturned; the banner there records it.
 *
 * The palette is NOT new. These are the exact tokens siaohub already
 * ships (siaohub/src/app/globals.css), so a reader moving between
 * blog.siao.ai and git.siao.ai does not cross a seam. Re-deriving a
 * "close enough" dark grey is how a family stops looking like one.
 *
 * Measured against #17161a, not assumed:
 *   #e6e6e6 body text      14.43:1
 *   #9a9a9a muted           6.40:1
 *   #83b58c accent          7.68:1
 *   #e6e6e6 on the panel   13.12:1
 * and every dark-plus token against the #201f24 panel clears 4.5:1
 * (worst 4.91) — see the note in scripts/render-markdown.js.
 *
 * The light accent (#587b60) is 3.79:1 here — large text only, not
 * enough for a link in running prose — which is why dark mode takes
 * the family's lighter #83b58c rather than reusing it.
 *
 * This block must come AFTER the light `[data-theme] span` rule above:
 * same specificity, so source order decides, and a media query does not
 * change that. Written the other way round first, and the dark tokens
 * silently lost. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17161a;
    --ink: #e6e6e6;
    --ink-dim: #9a9a9a;
    --hairline: #2c2b30;
    --accent: #83b58c;
    --accent-wash: rgba(131, 181, 140, 0.12);
    --accent-hairline: rgba(131, 181, 140, 0.4);
    --code-panel: #201f24;
    --code-inline: #26252b;
  }

  pre[data-theme] span,
  code[data-theme] span {
    color: var(--shiki-dark);
  }
}

/* The manual override. `prefers-color-scheme` is the default; a reader
 * who has said otherwise gets what they said, on every page, before
 * paint (the init script in the head).
 *
 * Both directions are needed, not just the dark one: without the light
 * block, a reader on a dark system who chose light would still get the
 * media query. Same reason SiaoHub carries both. */
:root[data-theme="dark"] {
    --paper: #17161a;
    --ink: #e6e6e6;
    --ink-dim: #9a9a9a;
    --hairline: #2c2b30;
    --accent: #83b58c;
    --accent-wash: rgba(131, 181, 140, 0.12);
    --accent-hairline: rgba(131, 181, 140, 0.4);
    --code-panel: #201f24;
    --code-inline: #26252b;
}

:root[data-theme="dark"] pre[data-theme] span,
:root[data-theme="dark"] code[data-theme] span {
  color: var(--shiki-dark);
}

:root[data-theme="light"] {
  --paper: #faf9f6;
  --ink: #1a1a1a;
  --ink-dim: #6e6b65;
  --hairline: rgba(26, 26, 26, 0.14);
  --accent: #587b60;
  --accent-wash: rgba(88, 123, 96, 0.09);
  --accent-hairline: rgba(88, 123, 96, 0.35);
  --code-panel: #f7f5f0;
  --code-inline: #f0eee8;
}

:root[data-theme="light"] pre[data-theme] span,
:root[data-theme="light"] code[data-theme] span {
  color: var(--shiki-light);
}

/* The toggle, matched to AnswerHub's ghost button: 32px tall, fully
 * rounded, a muted wash on hover, a 14px icon in `currentColor`. Those
 * are the computed values of `<Button variant="ghost" size="sm">` over
 * there — copied as numbers because this site has no Tailwind to share
 * them with. */
.theme-toggle {
  appearance: none;
  background: none;
  border: none;
  padding: 0 0.6rem;
  margin: 0 0 0 0.35rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: var(--ink-dim);
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-toggle svg {
  width: 0.875rem;
  height: 0.875rem;
  display: block;
}

.theme-toggle:hover {
  background: var(--accent-wash);
  color: var(--ink);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Which icon shows is decided here, not in script — see the note in
 * build.js. The moon offers dark; the sun offers a way back. */
.theme-toggle .icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-moon {
    display: none;
  }
  .theme-toggle .icon-sun {
    display: block;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

/* A label for anyone who cannot see the glyph. Not `display: none`,
 * which would take it out of the accessibility tree along with the
 * only thing that says what the button does. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  /* Sans is the default because most of what is on screen at any moment
   * is interface. Reading matter opts back into the serif below. */
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;

  /* 禁則處理: Chinese typesetting does not allow a line to *begin* with
   * closing punctuation (。、」）) or to *end* with opening punctuation.
   * Browsers default to `line-break: auto`, which is permissive and
   * regularly strands a 。 alone at the start of a line. This is the
   * single most visible difference between text that has been typeset
   * for Chinese and text that has merely been displayed in it. */
  line-break: strict;
  /* Don't break a Latin word mid-glyph when it sits inside Chinese
   * text; wrap it whole to the next line instead. */
  overflow-wrap: break-word;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
}

a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* A visible focus ring in the brand colour. The default outline is the
 * browser's blue, which is the one colour on this page that belongs to
 * nobody — and removing it without a replacement is how keyboard
 * navigation gets quietly broken. */
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* Fills left-to-right as the reader scrolls through a post
 * (reading-progress.js). Zero width, invisible, and inert on any page
 * without an <article> — the script is a no-op there. */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 10;
}

/* "全站都改成這種寬樣式" — the same wider style /tags/ established,
 * carried to every browse page (homepage, archive, a tag's own
 * subgraph page). wrap-read overrides this right below: the article
 * reading column is a separate, deliberately narrower measure
 * (AGENTS.md — 680px, measured against Medium's own article page),
 * not something this widening is meant to touch.
 *
 * No top/bottom padding here any more — .site-header/.site-footer
 * carry their own now (below), since they're no longer children of
 * this element (see the comment in build.js's layout()). This is
 * purely the content column's own horizontal measure. */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* A post page is narrower, so the reading column ends up optically
 * centred in the viewport rather than sitting left of a sidebar that
 * isn't there. Was 680px, measured directly against Medium's own
 * article page; widened to 760px on direct instruction — "文章頁面還
 * 是停留在窄樣式...但看在人眼注意力確實是垂直，稍微拉寬就行" (still
 * narrow, but since reading attention really is a vertical thing, just
 * widen it a bit) — a modest step up, not the same full-bleed
 * treatment /tags/ got, since a reading column staying reasonably
 * narrow was never in question, only exactly how narrow. */
.wrap-read {
  max-width: 792px; /* 760px column + the 1.5rem padding either side */
}

/* Two columns — reading column plus a persistent sidebar
 * (ClaudeDesign/BLOG.md: search, tags, recent posts always visible,
 * not one click away). Stacks to one column once there isn't room for
 * both without the sidebar crowding the reading measure. */
.layout {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.layout main {
  flex: 1;
  min-width: 0;
  max-width: 900px;
}

/* Reading shape: no sidebar, so main takes the full (already narrow)
 * wrap and the 680px measure comes from the wrap itself. */
.layout-read main {
  max-width: none;
}

/* Full-bleed shape (currently just /tags/): no persistent sidebar and
 * no width ceiling at all — "整個螢幕都是Map" was explicit that the
 * graph should fill the screen, not live in a bounded reading column.
 * Still its own flex column internally (so .layout-full below can
 * flex:1 and hand real height down to the graph) — but the OUTER
 * height:100vh ceiling now lives on .page-shell-full instead of here,
 * since .site-header/.site-footer moved out to be this element's
 * siblings, not its children (build.js's layout()) — the 100vh budget
 * has to cover all three of them together, at the page-shell level,
 * or the page grows past a full screen again by however tall the
 * header and footer are. */
/* "是Map、側欄對齊Header不是Header去對齊其下面的內容" — the causality
 * was backwards: max-width:none here, then uncapping .site-header to
 * follow it, made the HEADER adapt itself to the CONTENT's own width.
 * It has to run the other way — .site-header is fixed, identical on
 * every page (that was the whole point of an earlier pass), so the map
 * caps itself at the exact same 1400px frame instead. On any monitor
 * up to 1400px wide (nearly everyone's) this changes nothing at all —
 * the map already filled the practical viewport either way. Only past
 * 1400px does it now stop rather than keep going, which is what
 * "aligns TO Header" actually requires: the same fixed frame, not two
 * independently-sized things that happen to start at the same x. */
.wrap-full {
  max-width: 1400px;
  /* width:100% + margin:auto, not the base .wrap's plain margin:0 auto
   * — .wrap-full is a flex item of .page-shell-full, and auto margins
   * on a flex item are a POSITIONING mechanism (they absorb free space
   * to centre the item) that overrides align-items/self:stretch for
   * that axis. Without an explicit width, margin:auto shrinks the box
   * to its own content first and centres THAT — confirmed hitting the
   * exact same bug fixing .site-header's alignment a few commits back.
   * width:100% gives max-width something real to actually clamp. */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
}

/* "整個site-header還是根據下面的內容在變，全站不統一" — as a CHILD of
 * .wrap, .site-header's own rendered width was whatever max-width that
 * page's content shape happened to use (792/1400/none) — it visibly
 * resized page to page despite looking identical in the markup. Now a
 * sibling of .wrap (build.js), sized here directly and identically
 * regardless of what .wrap next to it is doing: the header is site
 * chrome, not part of any one page's content shape. Same padding-top
 * .wrap used to carry (2.5rem) — moved here since this is the first
 * thing in the page now, not .wrap. */
.page-shell-full {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* A real ceiling, not just a floor — min-height only guarantees "at
   * least this tall," so when actual content (mainly the folder tree's
   * full list) is naturally taller than the viewport, flex-grow never
   * has genuine surplus to hand the graph and flex-shrink never has a
   * fixed size to shrink INTO either: the column just sizes to content
   * and the page scrolls, which measured out to the graph sitting at
   * exactly the same height at a 700px viewport and a 2000px one —
   * proof the fill chain wasn't reacting to the viewport at all. A
   * fixed height is what makes the tree's own overflow-y:auto and the
   * graph's own pan/zoom the things that scroll, not the page. */
  height: 100vh;
}

/* No override here any more — .site-header/.site-footer use their
 * ordinary capped-and-centred rule on this page too, same as every
 * other page. It was uncapped for one pass ("一樣" — matching the map's
 * OWN then-unbounded width), which had the causality backwards: see
 * .wrap-full above for why the map caps itself to the header now,
 * rather than the header stretching to match the map. */
.page-shell-full > .site-header,
.page-shell-full > .site-footer {
  flex-shrink: 0;
}

.page-shell-full > .wrap {
  flex: 1;
  min-height: 0;
}

/* "消失邊界應該要到頂部" — the graph's own clipped edge (where a panned
 * node stops being visible) should sit close to the header, not below
 * a page-heading-sized gap. The label+h1 pair stays — every page needs
 * a real heading, and dropping it here would be inconsistent with
 * every other page on the site — but shrunk specifically on this page:
 * a magazine-sized headline made sense above a reading column, not
 * above an instrument that wants the screen. */

.layout-full {
  flex: 1;
  min-height: 0;
  /* The base .layout rule sets align-items:flex-start, deliberately,
   * so a browse page's main and sidebar don't force-match heights.
   * .layout-full has no sidebar to protect from that — its only child
   * is main, and without stretch here, main never receives
   * .layout-full's own height at all: it just sizes to its own content
   * regardless of how much room the wrap's flex column actually gave
   * it. This was the real reason the graph never grew past the folder
   * tree's own natural content height, at any viewport size. */
  align-items: stretch;
}

.layout-full main {
  max-width: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* No .label here any more (build.js's renderTagsIndex) — this page's
 * own h1 already says 所有標籤, so the usual eyebrow label was pure
 * duplication. Font-size and margin both cut further than the earlier
 * pass too: the header's own margin-bottom is fixed identically across
 * the whole site now ("全站不統一" — it can't shrink just for this
 * page any more), so the heading is the only place left to close the
 * remaining gap. */
.layout-full main h1 {
  font-size: 1.25rem;
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
    /* `align-items: flex-start` above is what centres nothing and lets
     * the sidebar sit at the top of a row. In a COLUMN it means
     * something else entirely: the cross axis is now width, so each
     * child is sized to its max-content instead of the container.
     * For a page whose widest element is a code block or a wide table,
     * that is a hard overflow with no scrollbar on the element that
     * overflows — measured at 953px inside a 493px container. */
    align-items: stretch;
  }
  .layout main {
    max-width: none;
    min-width: 0;
  }
}

/* The site header: name + the tag/archive nav ClaudeDesign/BLOG.md's
 * "personal wiki" framing asks for, present on every page. */
/* Sized here directly, not inherited from a parent .wrap — see the
 * comment on .page-shell-full above for why: this is site chrome, and
 * it needs to look the same on every page shape regardless of how wide
 * that page's own content column is. */
.site-header {
  /* width:100% is load-bearing, not decorative, on the fullBleed page
   * specifically: .site-header is a flex ITEM there (.page-shell-full),
   * and flexbox auto margins are a POSITIONING mechanism (they absorb
   * free space to centre the item) that takes priority over
   * align-items/align-self stretch for that axis — confirmed directly,
   * align-self:stretch changed nothing while width:100% alone fixed it.
   * With width left at its default auto, the item shrank to its own
   * content size (~392px, just the name+nav) before the auto margins
   * ever got a chance to centre a properly-sized box. width:100% gives
   * it an explicit size to be capped by max-width below, leaving real
   * free space for the auto margins to legitimately split and centre
   * within — on every other page .site-header is a normal block child,
   * where this was never a distinction that mattered. */
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 1.5rem 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--hairline);
}

/* The wordmark stays serif — it's the one piece of chrome that is
 * brand rather than interface. `.name` is an <h1> on the index and a
 * <span> elsewhere, so reset the h1 sizing it would otherwise inherit.
 * Now carries the Siao mark alongside the text (siteHeader() in
 * scripts/build.js), matching siaohub/AnswerHub's header treatment —
 * still one piece of brand chrome, just no longer text-only. */
.site-header .name {
  font-family: var(--serif);
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 400;
  margin: 0;
}

.site-header .name a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: none;
}

.brand-mark {
  border-radius: 4px;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
}

.site-nav a {
  position: relative;
  border-bottom: none;
  color: var(--ink-dim);
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--accent);
}

/* A grown underline instead of an instant colour swap — the accent
 * still means the same thing (interaction or "you are here", never
 * decoration), it just arrives as a small motion instead of a snap.
 * `transform: scaleX`, not `width`, so it's compositor-only motion —
 * animating width forces layout on every frame. */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after,
.site-nav a[aria-current]::after {
  transform: scaleX(1);
}

/* "You are here." The accent is doing real work — it is the only
 * persistent use of colour on a browse page, and it means exactly one
 * thing. Weight carries it too, so the state does not depend on colour
 * alone. */
.site-nav a[aria-current] {
  color: var(--accent);
  font-weight: 600;
}

/* Uppercase, letter-spaced section labels — same device the homepage
 * uses above its list groups (e.g. ELSEWHERE, CONTACT). */
.label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 0.75rem;
}

/* Headings are reading matter, so they stay serif even on browse
 * pages where the surrounding chrome is sans. */
h1,
h2,
h3 {
  font-family: var(--serif);
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

/* A post's own headline — deliberately larger and more confident than
 * a section-index h1 (歸檔/標籤), the same "commit to the headline"
 * move Medium makes on an article page. */
.post-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
}

h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
}

/* Sans, and small: this is metadata about the article, not part of it.
 * The family has to be stated, not inherited — the byline sits inside
 * <article>, which sets the serif for everything under it. */
.byline {
  font-family: var(--sans);
  color: var(--ink-dim);
  font-size: 0.85rem;
  margin: 0 0 1.75rem;
  letter-spacing: 0.01em;
}

/* Post/archive/tag listings share this shape: a hairline-divided list,
 * each item a title link plus a muted excerpt or meta line. */
/* No border-top: each item carries its own bottom rule, so the list
 * closes itself. It used to have one, which on the index stacked a
 * second hairline directly under the header's own bottom border —
 * two parallel lines with a gap and nothing between them. */
.post-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.post-list li {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.2s ease;
}

.post-list li:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

/* The last one has no rule under it. The footer already draws a line,
 * and it is a different width — main's 624px against the wrap's 912px —
 * so the two read as one mistake rather than as two dividers.
 * `.widget-list` has had this rule from the start; this list did not. */
.post-list li:last-child {
  border-bottom: none;
}

/* The headline of a listing entry — upright and weighted, so it reads
 * as a title rather than as another line of the italic body voice the
 * excerpt below it uses. `font-style: normal` is load-bearing: the
 * rule below sets every `p` in a list item italic, and the title is a
 * `p` too. */
.post-list .title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.post-list .title a {
  border-bottom: none;
  transition: color 0.15s ease;
}

.post-list .title a:hover {
  color: var(--accent);
}

/* An excerpt is prose, so it stays serif; a meta line (post counts,
 * dates) is interface, so it doesn't. */
.post-list p {
  font-family: var(--serif);
  color: var(--ink-dim);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0.4rem 0 0;
}

.post-list .meta {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.85rem;
}

/* Prev/next between paginated listing pages (ticket 01,
 * .scratch/pagination-and-tag-graph). Interface, so sans, same
 * quiet-until-hovered treatment as .site-nav — this is wayfinding, not
 * content, so it should not compete with the post list above it. */
.pagination {
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
}

.pagination a {
  border-bottom: none;
  color: var(--ink-dim);
}

.pagination a:hover {
  color: var(--accent);
}

/* Only one link exists (first or last page): the other side of the
 * flex row must still hold its place, or the lone link jumps to
 * whichever edge it happens to be. */
.pagination a[rel="next"] {
  margin-left: auto;
}

/* Sort direction switcher (ticket 02, .scratch/pagination-and-tag-graph)
 * — a network-authored <details>/<summary> menu, not a native <select>:
 * every option is a link to a different static route, not a form
 * value. Same caret-rotation affordance as .doc-entry (Motion section,
 * AGENTS.md) — colour is reserved for aria-current, not the disclosure
 * itself. */
.sort-menu {
  margin: 0 0 1.5rem;
}

.sort-menu summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-dim);
}

.sort-menu summary::-webkit-details-marker {
  display: none;
}

.sort-menu summary::before {
  content: "▸";
  color: var(--ink-dim);
  margin-right: 0.4rem;
  display: inline-block;
  transition: transform 0.12s ease;
}

.sort-menu[open] > summary::before {
  transform: rotate(90deg);
}

.sort-menu nav {
  display: flex;
  gap: 1rem;
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.sort-menu nav a {
  border-bottom: none;
  color: var(--ink-dim);
}

.sort-menu nav a:hover {
  color: var(--accent);
}

/* Same "you are here" device as .site-nav a[aria-current] — weight
 * carries the state too, so it doesn't depend on colour alone. */
.sort-menu nav a[aria-current] {
  color: var(--accent);
  font-weight: 600;
}

/* Tag chips — on a post page (linking to that tag's index) and on the
 * tag index itself (linking to each tag, with its post count).
 * Interface, so sans, and tinted with the brand wash on hover rather
 * than just darkening. */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.75rem;
}

.tags a {
  font-family: var(--sans);
  border: 1px solid var(--hairline);
  /* Fully rounded, same device as .theme-toggle's own pill — a chip is
   * a single short label, and 3px on a ~28px-tall box reads as barely-
   * softened corners rather than an actual shape decision. */
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
  display: inline-block;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.tags a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-wash);
  /* A hairline lift, not a bounce — enough to read as "this responded
   * to you" without being the kind of motion prefers-reduced-motion
   * exists to spare anyone, so it stays outside that gate like the
   * colour swap above it. */
  transform: translateY(-1px);
}

/* Archive: year headings, month sub-groups. */
.archive-year {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.5rem;
}

.archive-year:first-of-type {
  margin-top: 0;
}

.archive-month {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 1.25rem 0 0.5rem;
}

/* A post's own body content.
 *
 * Reading type is set HERE, not on `body` — the site chrome (nav,
 * sidebar, listings) stays at the smaller global size. Medium tunes
 * exactly this way: 20px/1.6 for article prose, smaller everywhere
 * else. Measured off their article page rather than guessed.
 */
article {
  margin-top: 0.5rem;
  font-family: var(--serif);
  font-size: 1.25rem; /* 20px */
  line-height: 1.6;
}

/* A link inside prose carries the accent from the start, not only on
 * hover — inside a paragraph there is no other cue that it is a link,
 * and hover is not a cue a touch reader ever receives. */
article a {
  color: var(--accent);
  border-bottom-color: var(--accent-hairline);
}

article a:hover {
  border-bottom-color: var(--accent);
  background: var(--accent-wash);
}

/* ~34px between paragraphs at this size, matching the measured
 * breathing room on Medium — noticeably more than the browser default,
 * and the single biggest thing that makes long prose feel readable
 * rather than dense. */
article p {
  margin: 0 0 1.7rem;
}

article h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 2.75rem 0 1rem;
}

article h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}

/* The headline block (title, byline, tags) sits closer together than
 * body prose, so it reads as one unit rather than three stacked
 * paragraphs. */
.post-title + .byline {
  margin-top: -0.25rem;
}

/* 延伸閱讀 (ticket 03, .scratch/pagination-and-tag-graph) sits after
 * </article>, not inside it — this is navigation to other posts, not
 * this post's own prose, so its heading is sans/uppercase like `.label`
 * rather than the serif `article h2` treatment. The post-list items
 * inside it are untouched: same shared .post-list shape as every other
 * listing, just relevance-ordered instead of date-ordered. */
.related-reading {
  margin: 3rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.related-reading h2 {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}

/* A markdown `---` becomes this — a centered "· · ·" scene break
 * instead of a plain rule, Medium's section-divider convention. The
 * author already writes `---` for this in GFM; nothing new to learn. */
article hr {
  border: none;
  height: auto;
  margin: 2.5rem 0;
  text-align: center;
}

article hr::after {
  content: "· · ·";
  /* The one ornamental mark on the page, so it wears the brand colour
   * rather than another grey. It carries no information, which is
   * exactly why colouring it costs nothing. */
  color: var(--accent);
  letter-spacing: 0.5em;
  font-size: 1.1rem;
}

/* Horizontal rules only — no vertical lines, no outer box. A full grid
 * on every cell reads as a spreadsheet; the same data with rules only
 * between rows reads as typeset. This is the same hairline the rest of
 * the site divides with, so a table sits in the page rather than on
 * top of it. */
article table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95em;
}

article th,
article td {
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 0.7rem 1rem 0.7rem 0;
  text-align: left;
  vertical-align: top;
}

article thead th {
  border-bottom-color: var(--ink);
  font-size: 0.8em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 400;
  padding-bottom: 0.5rem;
}

article tbody tr:last-child td {
  border-bottom: none;
}

article figure {
  margin: 2rem 0;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

/* ```dot (diagram-embed.js) and ```chart (chart-embed.js) both emit
 * `<figure class="diagram|chart"><svg style="color:var(--ink)">...`.
 * The colour lives here, not baked into the SVG, so `currentColor`
 * (diagram-embed.js's swapped-in ink) and the chart's `var(--accent)`
 * follow the reader's theme without either script knowing which theme
 * is active. */
article figure.diagram,
article figure.chart {
  padding: 1.25rem 1rem 0.75rem;
  color: var(--ink);
}

/* Bug (found while reviewing the tag graph in dark mode): Graphviz's
 * SVG output never writes a `fill` on its <text> nodes at all — not
 * even a literal "black" the currentColor swap in diagram-embed.js
 * could catch. SVG's own initial value for `fill` is black, so every
 * node label rendered as near-invisible dark text on the dark theme's
 * dark background. A stylesheet rule beats that implicit default the
 * same way it would beat an explicit presentation attribute. */
article figure.diagram svg text {
  fill: currentColor;
}

article figure.diagram figcaption,
article figure.chart figcaption {
  padding: 0.6rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

/* ::demo{...} (demo-embed.js). The fallback link only shows for a
 * reader whose browser/extension blocks the sandboxed iframe outright —
 * everyone else sees a live demo and never notices the link is there. */
article figure.demo-embed {
  padding: 0;
  overflow: visible;
}

article figure.demo-embed iframe {
  display: block;
}

article figure.demo-embed p {
  margin: 0.5rem 1rem;
  font-size: 0.85rem;
}

article figure.demo-embed figcaption {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.85rem;
  color: var(--ink-dim);
}

/* :::details{summary="..."} (details-directive.js) — a post-authored
 * disclosure, styled identically to the journal panel's own .doc-entry
 * (a caret that rotates, not a colour change — same reasoning as there:
 * the accent means "interactive", not decoration, so every entry being
 * accent-tinted would say nothing). Deliberately not scoped to a class:
 * this is the only place a bare <details> appears in article prose,
 * since .doc-entry (the journal panel) lives outside <article>. */
article details {
  margin: 1.5rem 0;
  padding: 0.7rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

article details summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

article details summary::-webkit-details-marker {
  display: none;
}

article details summary::before {
  content: "▸";
  color: var(--ink-dim);
  margin-right: 0.5rem;
  display: inline-block;
  transition: transform 0.12s ease;
}

article details[open] > summary::before {
  transform: rotate(90deg);
}

article details summary:hover {
  color: var(--accent);
}

article details > :not(summary):first-of-type {
  margin-top: 0.9rem;
}

/* A code block is a quotation of something else, not a hole punched in
 * the page. The dark shiki theme measured 13.93:1 against this paper —
 * a near-black slab that pulled the eye off the prose every time. A
 * light theme on a barely-tinted panel keeps the code legible as code
 * while leaving the page one continuous surface. */
article pre {
  overflow-x: auto;
  padding: 1.1rem 1.25rem;
  margin: 0;
  background: var(--code-panel) !important;
  border-radius: 8px;
  line-height: 1.55;
  /* Code reads left-to-right always, independent of the surrounding
   * page direction. Found on the Arabic translation (2026-08-24): shiki
   * wraps each highlighted token in its own <span>, and under an
   * inherited `dir="rtl"` (from <html>, once that got fixed to exist at
   * all) the bidi algorithm was free to reorder those sibling spans —
   * `$ xxd -l 8 global-metadata.dat` rendered with the `$` prompt at the
   * END of the line. `unicode-bidi: isolate` walls this element off from
   * the surrounding paragraph's bidi context instead of just flipping
   * alignment, which is what actually stops the token reordering,
   * matching how GitHub/MDN keep code blocks readable in RTL pages. */
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}

article code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}

/* Inline code — distinguished by a tint, not a border, so it doesn't
 * fragment a sentence into boxes. Also isolated LTR like `article pre`
 * above: a single technical term like `UnityFramework` inside an Arabic
 * sentence is short enough that it never visibly reordered, but leaving
 * it unisolated is the same bug waiting for a longer inline snippet. */
article p > code,
article li > code {
  background: var(--code-inline);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Language switcher, the same hairline/label device as everything
 * else — not a separate widget style. */
nav[aria-label="Languages"] {
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* The current-language <span> stays plain ink-dim text with no
 * underline — it isn't a link, it shouldn't look like one. */
nav[aria-label="Languages"] span {
  border-bottom: none;
}

/* Links get the accent colour AND an underline, not colour alone.
 *
 * Found by axe (2026-08-24, dark mode only): stripping the underline
 * here left `color: var(--ink)` as the *only* thing telling a link
 * apart from the "·"-joined ink-dim text around it — ink vs ink-dim is
 * 3.28:1 in light mode (barely clears WCAG 1.4.1's 3:1 floor) and
 * 2.25:1 in dark mode (fails it outright). Nothing caught this earlier
 * because the one page with a switcher (hello-world, one translation)
 * was never in the dark-mode WCAG test's page list, and the one page in
 * that list (this post) had zero translations until this session added
 * nine. Now every "·"-joined link list in prose gets the same treatment
 * `article a` already uses, rather than a bespoke exception. */
nav[aria-label="Languages"] a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-hairline);
}

nav[aria-label="Languages"] a:hover {
  border-bottom-color: var(--accent);
}

/* "Referenced in" / embed-source notes render as quiet, italic asides
 * — the same register as the homepage's italic descriptions. */
p[role="note"] {
  color: var(--ink-dim);
  font-style: italic;
  font-size: 0.95rem;
}

/* The /tags/ page's split view: a folder tree beside the graph,
 * Obsidian's own sidebar-explorer-plus-canvas layout. Narrow viewports
 * stack instead — a fixed-width side tree next to a graph that's
 * already fighting for room doesn't fit a phone screen. */
/* "可以做成無框化，這樣整個螢幕都是Map" — the map fills whatever
 * vertical space is actually left after the header and the "所有標籤"
 * heading, rather than a fixed height chosen by guesswork. That means
 * a real flex-fill chain from .wrap-full down to .tag-graph: each link
 * needs `flex:1; min-height:0` or the height simply doesn't propagate.
 * `align-items: stretch` (the flex default, but named explicitly here
 * since it's load-bearing) is what makes the tree column match the
 * graph's height instead of sizing to its own content, the way it did
 * when the graph was a fixed 480px box next to it. */
.tag-explorer {
  display: flex;
  gap: 1.75rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  margin: 0.25rem 0 0;
}

.tag-explorer-tree {
  width: 260px;
  flex-shrink: 0;
  overflow-y: auto;
  /* The real bug behind the graph never actually reaching the height
   * the flex-fill chain intended: a flex item's min-height defaults to
   * auto ("never shrink below your own content"), not 0. With a full
   * folder list that's taller than the space actually available, that
   * default silently overrode every flex:1 below it — the row (and,
   * via align-items:stretch, the graph beside it) stayed exactly as
   * tall as the folder list needed, no matter how much room the
   * heading gave back above it. min-height:0 is what lets overflow-y
   * scroll internally instead of dictating the row's height. */
  min-height: 0;
}

.tag-explorer-graph {
  flex: 1;
  min-width: 0; /* a flex child's content (the graph) must not force the row wider than the column */
  min-height: 0; /* same reasoning as .tag-explorer-tree above — a missed link in the fill chain */
  display: flex;
  flex-direction: column;
}

@media (max-width: 720px) {
  /* "所有東西都對齊只有Map跟側欄超出去" — real bug, not a false report:
   * .page-shell-full's height:100vh (above) is a hard CEILING, and
   * flex:initial below is "don't grow" but still defaults to
   * flex-shrink:1 ("don't shrink" needs saying explicitly). With a tag
   * list long enough that tree+graph stacked genuinely need more than
   * one screen's worth of height, the shrink algorithm was squashing
   * .tag-explorer down to whatever 100vh minus the header/footer left —
   * confirmed directly: .tag-explorer measured 535px tall while its own
   * children (tree 791px + graph 360px+) added up to over 1150px. The
   * children don't shrink to match (nothing tells THEM to), so they
   * just spill out past their own shrunk parent's box — the "misaligned
   * Map and sidebar" is that spillover, not a positioning bug in either
   * one individually. height:100vh only ever made sense as "the map
   * fills exactly one screen", which was never the mobile design here
   * to begin with — the stacked fallback below was always meant to
   * scroll normally, like every other page. */
  .page-shell-full {
    height: auto;
    min-height: 100vh;
  }

  /* A map that fills "whatever's left" works on a desktop viewport
   * with room to spare; forced onto a stacked mobile layout it would
   * squeeze a long folder list and the graph into whatever's left of a
   * much shorter screen. Fall back to a fixed, generous graph height
   * and a tree that takes its own content height instead, same as any
   * other embedded map on a narrow viewport. */
  .tag-explorer {
    flex-direction: column;
    flex: initial;
    align-items: stretch;
  }

  .tag-explorer-tree {
    width: 100%;
    overflow-y: visible;
  }

  .tag-explorer-graph {
    flex: initial;
  }

  /* Specificity has to genuinely OUTRANK .tag-explorer-graph .tag-graph
   * further down (0,2,0), not just match it — "手機上關聯圖直接消失":
   * an EARLIER equal-specificity attempt here still lost, because with
   * two rules of the same specificity the LATER one in source order
   * wins regardless of which is inside the narrower media query, and
   * that unconditional rule (needed for the desktop flex-fill chain)
   * comes after this block in the file. Three classes (0,3,0), not two,
   * so this wins outright instead of depending on staying below it in
   * the file. Without this: height:auto with nothing above it actually
   * stretching (.tag-explorer/-graph are both flex:initial here, not
   * flex:1) resolves to 0 — a percentage-height child (the SVG,
   * width/height:100%) of an auto-height parent with no definite size
   * collapses to nothing. The graph wasn't rendering small, it was
   * rendering at zero height, full stop. */
  .tag-explorer .tag-explorer-graph .tag-graph-figure {
    flex: initial;
  }

  .tag-explorer .tag-explorer-graph .tag-graph {
    flex: initial;
    height: 60vh;
    min-height: 360px;
  }
}

.tag-search {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  margin: 0 0 1rem;
  transition: border-color 0.15s ease;
}

.tag-search:focus {
  border-color: var(--accent);
}

/* One <details> "folder" per tag — same caret-rotation affordance as
 * .doc-entry (Motion section, AGENTS.md): the accent means "you are
 * here"/"interactive", not decoration, so opening a folder is a turning
 * caret, not a colour change. */
.tag-folder {
  border-top: 1px solid var(--hairline);
  padding: 0.5rem 0;
}

.tag-folder:last-child {
  border-bottom: 1px solid var(--hairline);
}

.tag-folder summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.tag-folder summary::-webkit-details-marker {
  display: none;
}

.tag-folder-name::before {
  content: "▸";
  color: var(--ink-dim);
  margin-right: 0.4rem;
  display: inline-block;
  transition: transform 0.12s ease;
}

.tag-folder[open] > summary .tag-folder-name::before {
  transform: rotate(90deg);
}

.tag-folder summary .meta {
  color: var(--ink-dim);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.tag-folder ul {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0 0 0 1.1rem;
}

.tag-folder li {
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.tag-folder a {
  border-bottom: none;
  color: var(--ink-dim);
}

.tag-folder a:hover {
  color: var(--accent);
}

/* The first item once a folder is open — a real link to that tag's own
 * subgraph page, set off from the plain post items below it since it
 * goes somewhere different in kind, not just another post. */
.tag-folder-view-all {
  font-weight: 600;
  color: var(--ink);
}

/* A search match — in the tree or in the graph (graph-physics.js adds
 * this same class to matching nodes). Weight carries it alongside
 * colour, same "not colour alone" rule as everywhere else on this
 * site. */
.tag-folder a.is-search-match,
.tag-folder-name.is-search-match {
  color: var(--accent);
  font-weight: 600;
}

/* The /tags/ relation graph — pan/zoom rewrite (ticket 04/06,
 * .scratch/pagination-and-tag-graph), modelled on Obsidian's Graph
 * View: a map you pan and zoom and drag nodes around on, not a fixed
 * picture. graph-physics.js (d3-force/d3-zoom/d3-drag) builds the
 * actual SVG into `.tag-graph` at runtime; this only styles what it
 * produces. Every node is quiet (ink-dim) until interacted with —
 * :hover/:focus-visible switch it to the accent colour, same rule as
 * .tags/.site-nav: colour means interaction, never decoration, so post
 * vs. tag is told apart by shape (circle vs. square) instead. */
/* No border, no padding-box, no card — "無框化" was explicit: this
 * isn't a bounded figure sitting in a column any more on /tags/, it's
 * the map itself, so it shouldn't look like a framed picture of one.
 * This same markup is also reused, unchanged, by each tag's own
 * subgraph page (renderTagPage) — an ordinary block in the normal
 * reading column there, not inside .tag-explorer-graph's flex-fill
 * chain — so the base rule below still needs a real height of its own;
 * only the /tags/ index's flex-fill override further down replaces it. */
.tag-graph-figure {
  margin: 1.5rem 0 2rem;
  /* No border — matches article figure.diagram/.chart, this site's own
   * convention for an embedded figure. Just enough padding that a
   * subgraph page's fixed-size box has breathing room around it;
   * overridden to 0 below when the map fills the screen instead. */
  padding: 1.25rem 1rem 0.75rem;
}

.tag-graph-figure figcaption {
  padding: 0.6rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-dim);
  flex-shrink: 0;
}

/* Fixed height, not aspect-ratio: a force graph's natural shape is
 * roughly square regardless of how wide its column is, and letting it
 * grow with a narrow mobile viewport's width would make it very short
 * and cramped. `overflow: hidden` clips panned/zoomed content to the
 * viewport instead of spilling past it. Overridden below on /tags/
 * itself, where the graph fills the screen instead of a fixed box. */
/* "Top下面的高度...改成漸隱" — the gap between the header and the map
 * was never going to close to zero (the header's own margin is fixed
 * site-wide now, and can't shrink per-page again without undoing that
 * fix), so instead of fighting for the last pixels of spacing, the top
 * (and, to match, the bottom) edge fades out rather than getting hard-
 * clipped by overflow:hidden. A panned node doesn't just vanish at an
 * arbitrary line any more, it dissolves toward it — same "soft edge of
 * an otherwise-boundless canvas" read as many real map UIs. mask-image
 * modulates alpha, not colour, so this needs no light/dark-specific
 * value the way painting a matching-background gradient over the edge
 * would. Not gated behind prefers-reduced-motion — a static mask,
 * nothing here animates. */
.tag-graph {
  height: 480px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 48px, black calc(100% - 48px), transparent);
  mask-image: linear-gradient(to bottom, transparent, black 48px, black calc(100% - 48px), transparent);
}

/* The /tags/ index only: the map fills whatever height
 * .tag-explorer's flex-fill chain gives it instead of the fixed 480px
 * a subgraph page's own bounded figure uses (fixed 60vh on the mobile
 * fallback above). */
.tag-explorer-graph .tag-graph-figure {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* A more generous fade specifically on the /tags/ index than the base
 * rule's 48px (still 48px on a tag's own small 480px subgraph box,
 * where 80px+80px would eat a third of it) — "Header邊緣": 48px read
 * as a small dissolve confined to the graph's own corner, not as
 * something reaching toward the header above it. This is still bounded
 * by the same heading/margin trims next to it — the fade can only ever
 * blend into space that's actually there. */
.tag-explorer-graph .tag-graph {
  flex: 1;
  min-height: 0;
  height: auto;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 80px, black calc(100% - 80px), transparent);
  mask-image: linear-gradient(to bottom, transparent, black 80px, black calc(100% - 80px), transparent);
}

.tag-graph-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  /* d3-zoom needs to own touch gestures on this element to pan/zoom —
   * without this, a touch drag scrolls the page underneath the graph
   * instead of panning it, the same trade-off any embedded pannable
   * map makes. */
  touch-action: none;
}

.tag-graph-svg:active {
  cursor: grabbing;
}

.graph-edge {
  stroke: var(--hairline);
  stroke-width: 1;
  transition: opacity 0.15s ease;
}

.graph-node-post circle {
  fill: var(--ink-dim);
}

.graph-node-tag rect {
  fill: none;
  stroke: var(--ink-dim);
  stroke-width: 1.5;
  /* SVG only hit-tests the *painted* area by default — an unfilled
   * shape's interior doesn't register clicks/hover at all, only its
   * thin stroke outline does. Without this, a tag square is only
   * clickable along a 1.5px border; measured via a real pointer-based
   * Playwright hover landing on the <svg> underneath instead of the
   * <rect> when aimed at the square's own centre. */
  pointer-events: all;
}

.graph-node-label {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink-dim);
  pointer-events: none; /* the label is part of its node's hit target, not a second one */
}

.graph-node,
.graph-node.is-dimmed {
  transition: opacity 0.15s ease;
}

/* Hover or keyboard focus on a node highlights its direct neighbours
 * by dimming everything else — same device Obsidian's own graph uses.
 * Keyboard focus gets it too, not just the mouse (graph-physics.js
 * listens for both), since a reader tabbing through the links deserves
 * the same "what does this connect to" signal a mouse user gets. */
.graph-node.is-dimmed,
.graph-edge.is-dimmed {
  opacity: 0.2;
}

/* is-search-match gets the exact same treatment as hover/focus — a
 * search result is "the thing you're currently looking at", same as a
 * hovered node, just driven by typing instead of the pointer. Colour
 * fades rather than snaps — a plain property transition, same as the
 * other quiet colour swaps on this site (line ~1408), not gated behind
 * prefers-reduced-motion since it isn't the kind of motion that rule
 * exists to spare anyone. */
.graph-node circle,
.graph-node rect {
  /* transform is listed here, always-on, even though only the
   * prefers-reduced-motion:no-preference block (below, near the hover
   * scale rule) ever actually changes its value: transition is a
   * timing/easing declaration, not a value, and it has to be present
   * on the way OUT of :hover too, not just the way in — otherwise the
   * scale fades in smoothly but snaps back instantly the moment the
   * pointer leaves, since the hover rule's own transition list would
   * stop applying at exactly the moment its transform value reverts.
   * Under reduced motion the value never moves from its default, so
   * this is a no-op there — nothing to animate, nothing spared wrongly. */
  /* A smooth deceleration curve, not a bounce — cubic-bezier values
   * past 1 overshoot past the target before settling back, which reads
   * as a playful/cheap wobble on a small UI shape rather than the
   * "絲滑精緻" (smooth, refined) this whole pass is meant to land on.
   * Same curve as node-pop/bar-grow/figure-arrive below, for one
   * consistent motion language across the graph instead of two. */
  transition: fill 0.15s ease, stroke 0.15s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-box: fill-box;
  transform-origin: center;
}

.graph-node:hover circle,
.graph-node:focus-visible circle,
.graph-node.is-search-match circle {
  fill: var(--accent);
}

.graph-node:hover rect,
.graph-node:focus-visible rect,
.graph-node.is-search-match rect {
  fill: var(--accent-wash);
  stroke: var(--accent);
}

.graph-node:hover text,
.graph-node:focus-visible text,
.graph-node.is-search-match text {
  fill: var(--accent);
}

/* Ticket 06 (.scratch/pagination-and-tag-graph): the grab cursor is a
 * promise that dragging works, so it only shows once graph-physics.js
 * has actually run — `.has-js` is the same class the inline theme
 * script stamps on <html> before paint, reused rather than a second
 * signal for the same fact. Without JS the node is still a perfectly
 * normal link, just not draggable. */
.has-js .graph-node {
  cursor: grab;
  touch-action: none;
  /* Without this, a drag that passes over a tag's <text> label selects
   * the text instead of moving the node — measured triggering Chrome's
   * own selection-translate popup mid-drag. */
  user-select: none;
  -webkit-user-select: none;
}

.has-js .graph-node.is-dragging {
  cursor: grabbing;
}

/* Sidebar: search, tag cloud, recent posts, post count — all real
 * data, no placeholder categories (ClaudeDesign/BLOG.md). */
.sidebar {
  width: 240px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .sidebar {
    width: 100%;
  }
}

.widget {
  margin-bottom: 2rem;
}

.widget .label {
  margin-bottom: 0.6rem;
}

.widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.95rem;
}

.widget-list li:last-child {
  border-bottom: none;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud a {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.tag-cloud a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-wash);
}

.sidebar > .meta {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

#search-input {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  transition: border-color 0.15s ease;
}

#search-input:focus {
  border-color: var(--accent);
}

.search-results {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}

.search-results li {
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.search-results a {
  border-bottom: none;
}

.search-empty {
  color: var(--ink-dim);
  font-style: italic;
}

/* Same reasoning as .site-header above — sized here directly so it's
 * identical on every page, not inherited from whichever .wrap variant
 * happens to be its sibling. */
.site-footer {
  /* width:100% — same reason as .site-header above: it's also a flex
   * item of .page-shell-full on the fullBleed page, and auto margins
   * there need an explicit width to cap-then-centre rather than
   * shrinking to content first. */
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 3rem;
  padding: 1.25rem 1.5rem 4rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.site-footer a {
  border-bottom: none;
  color: var(--ink-dim);
}

.site-footer a:hover {
  color: var(--accent);
}


/* ── The journals beside an article ─────────────────────────────────
 *
 * The "read" shape deliberately has nothing alongside it: the reading
 * column is 680px inside a 712px wrap so it sits optically centred in
 * the viewport, measured against Medium's own article page.
 *
 * This panel is the one exception, and the distinction is what makes it
 * one. What a post page withholds is *site chrome* — search, tag cloud,
 * recent posts — navigation a reader mid-article is not using. These are
 * the primary sources for the argument they are reading right now, and
 * the point is to open one without losing your place.
 *
 * The trade is explicit: a post carrying journals is 1144px rather than
 * 792px, so its column is no longer centred in the viewport, it is
 * centred in a two-column page. Posts without journals are untouched.
 */

.wrap-read-docs {
  max-width: 1144px; /* 1064 + the same +80px .wrap-read's own column got */
}

.wrap-read-docs .layout-read {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.wrap-read-docs .layout-read main {
  flex: 0 1 760px;
  min-width: 0;
}

.doc-panel {
  flex: 0 0 300px;
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  font-family: var(--sans);
  border-left: 1px solid var(--hairline);
  padding-left: 1.5rem;
}

.doc-panel h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.doc-panel-note {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0.5rem 0 1.1rem;
}

.doc-entry {
  border-top: 1px solid var(--hairline);
  padding: 0.7rem 0;
}

.doc-entry summary {
  cursor: pointer;
  list-style: none;
  display: block;
}

.doc-entry summary::-webkit-details-marker {
  display: none;
}

/* The affordance is a caret that turns, not a colour change — the
 * accent means "you are here" or "this is interactive", and every
 * entry being accent-coloured would say neither. */
.doc-entry summary::before {
  content: "▸";
  color: var(--muted);
  margin-right: 0.4rem;
  display: inline-block;
  transition: transform 0.12s ease;
}

.doc-entry[open] > summary::before {
  transform: rotate(90deg);
}

.doc-entry summary:hover .doc-title {
  color: var(--accent);
}

.doc-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.doc-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.15rem 0 0 1.1rem;
}

.doc-body {
  margin: 0.55rem 0 0.3rem 1.1rem;
  font-size: 0.82rem;
  line-height: 1.65;
}

.doc-summary {
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.doc-loading,
.doc-error {
  color: var(--muted);
  font-size: 0.8rem;
}

/* An injected journal is reference matter in a narrow column, so it is
 * set smaller than the article and left in the sans — it is being
 * consulted, not read at length. `整份打開` gives it the full measure. */
.doc-content {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.78rem;
  line-height: 1.7;
}

.doc-content h1,
.doc-content h2,
.doc-content h3 {
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  margin: 1.4rem 0 0.4rem;
}

.doc-content h1 {
  margin-top: 0;
}

.doc-content pre {
  font-size: 0.72rem;
  padding: 0.7rem 0.8rem;
  overflow-x: auto;
}

.doc-content table {
  font-size: 0.72rem;
  display: block;
  overflow-x: auto;
}

.doc-content img {
  max-width: 100%;
}

@media (max-width: 1000px) {
  .wrap-read-docs {
    max-width: 792px;
  }
  .wrap-read-docs .layout-read {
    flex-direction: column;
    /* See the note on `.layout` above: in a column, `flex-start` sizes
     * children to max-content and the article overflows the viewport
     * with no scrollbar. */
    align-items: stretch;
  }
  .wrap-read-docs .layout-read main {
    flex: 1 1 auto;
    max-width: none;
  }
  .doc-panel {
    /* Stacked, it stays after the article — putting it first pushed the
     * headline 600px down the page, so the reader met a list of files
     * before they met the article.
     *
     * Reachability is the table of contents' job instead: its last entry
     * links straight here. Before that entry existed the panel sat at
     * y=23292px on a 39-minute article, which is a panel nobody can
     * reach. */
    position: static;
    max-height: none;
    overflow-y: visible;
    border-left: none;
    border-top: 1px solid var(--hairline);
    padding: 1.5rem 0 0;
    margin: 2.5rem 0 0;
    flex-basis: auto;
    width: 100%;
  }
}

/* ── Narrow viewports: what must scroll, and what must wrap ─────────
 *
 * Measured at 390px, where the page scrolled horizontally by 82px with
 * no scrollbar on anything that looked responsible.
 *
 * `pre` already had `overflow-x: auto`, which was not enough: shiki
 * renders `<pre><code>` and the `code` box takes the pre's content
 * width, so long lines spilled *out of* it rather than making it wide.
 * The pre therefore measured its content as ~348px and never scrolled,
 * while the lines themselves pushed the document out to 472px. Sizing
 * `code` to `max-content` is what gives the pre something real to
 * scroll; `min-width: 100%` keeps short blocks full-width so the
 * background does not shrink-wrap the text.
 */
article pre code,
.doc-content pre code {
  display: block;
  width: max-content;
  min-width: 100%;
}

/* An inline identifier can be longer than a phone is wide —
 * `game.qualiarts.hololive.dreams.com` is 34 characters with no space
 * in it. Prose wraps at spaces, so without this the paragraph is the
 * thing that overflows. */
article p > code,
article li > code,
article td > code,
.doc-content code {
  overflow-wrap: anywhere;
}

/* A wide table scrolls inside itself rather than widening the page. */
article table,
.doc-content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

/* Long URLs in prose, same reason as inline code. */
article a {
  overflow-wrap: anywhere;
}

/* ── Table of contents ──────────────────────────────────────────────
 * A 39-minute article with no way to jump is a scroll bar and hope.
 * Set in the sans and unnumbered-looking, so it reads as apparatus
 * rather than as the article's first section.
 */
.toc {
  font-family: var(--sans);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 1.1rem 0;
  margin: 2rem 0 2.5rem;
}

.toc h2 {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
}

.toc li {
  break-inside: avoid;
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.toc a {
  border-bottom: none;
}

.toc a:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  .toc ol {
    columns: 1;
  }
}

/* The "本節來源" line closing each section. Set small and in the sans:
 * it is apparatus attached to the section, not a sentence of it. */
.doc-source-line,
article p:has(> a[href^="#doc-"]) {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
}

article p > a[href^="#doc-"] {
  border-bottom: none;
  color: var(--accent);
}

/* Arriving from a source link, the row it opens should be findable
 * without hunting: a brief tint says "this is the one". */
.doc-entry:target {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 3px;
}

/* ── Motion ─────────────────────────────────────────────────────────
 *
 * Every rule here sits inside `prefers-reduced-motion: no-preference`,
 * so the default for anyone who has asked for less motion is the
 * behaviour this site had before: instant jumps, instant disclosure.
 * The homepage makes the same promise and has a test for it.
 */

/* Landing flush against the top edge reads as "the page moved", not as
 * "you arrived somewhere". Applies with or without smooth scrolling —
 * it is spacing, not motion. */
article h2,
article h3,
.doc-entry,
#doc-panel {
  scroll-margin-top: 1.75rem;
}

@media (prefers-reduced-motion: no-preference) {
  /* Not `scroll-behavior: smooth`: its duration grows with distance,
   * and on this article that is 1.6 seconds. The animation lives in
   * reading-progress.js, which caps it. This stays `auto` so the two
   * do not fight over the same scroll. */

  /* A disclosure that snaps open moves everything below it with no
   * indication of where the new content came from. Animating the height
   * is what makes the panel read as one thing opening rather than as
   * the page reflowing.
   *
   * `interpolate-size: allow-keywords` is what allows the transition to
   * end at `auto`; without it the only animatable end state is a fixed
   * height, which cannot be right for content whose length is not known
   * until it is fetched. `content-visibility` needs `allow-discrete`
   * or the content vanishes at frame one on the way closed.
   *
   * Browsers without `::details-content` get today's behaviour: it
   * opens, immediately. */
  :root {
    interpolate-size: allow-keywords;
  }

  /* Every disclosure on the site gets this, not just the journal panel
   * — "有些展開式內容也是直接出現沒有動畫" (some open with no animation
   * at all): the sort menu, a tag's folder in the /tags/ tree, and a
   * :::details block in an article were all snapping open with none of
   * this. One rule, same reasoning as .doc-entry's own comment above:
   * a disclosure that snaps open moves everything below it with no
   * indication of where the new content came from. */
  .doc-entry::details-content,
  .sort-menu::details-content,
  .tag-folder::details-content,
  article details::details-content {
    block-size: 0;
    overflow: clip;
    transition:
      block-size 260ms cubic-bezier(0.32, 0.72, 0, 1),
      content-visibility 260ms allow-discrete;
  }

  .doc-entry[open]::details-content,
  .sort-menu[open]::details-content,
  .tag-folder[open]::details-content,
  article details[open]::details-content {
    block-size: auto;
  }

  /* The journal arrives after a fetch, which the height transition
   * above cannot cover: by the time the content lands, that transition
   * has already finished at the height of an empty box.
   *
   * Measured with the fragment delayed 900ms: the box eased open to
   * 205px, then jumped to 5294px in a single frame — five thousand
   * pixels, taking everything below it along.
   *
   * So the arriving content animates its OWN height. Injecting the
   * element is what starts it, which is the trigger a transition does
   * not have here. `block-size: 0 -> auto` is only interpolable because
   * of `interpolate-size` above; `overflow: clip` keeps the text from
   * spilling out of the box while it is shorter than its contents. */
  .doc-content {
    animation: doc-arrive 420ms cubic-bezier(0.4, 0, 0.2, 1) both;
    overflow: clip;
  }

  @keyframes doc-arrive {
    from {
      block-size: 0;
      opacity: 0;
    }
    40% {
      opacity: 0;
    }
  }

  /* A theme switch (the toggle, or the system firing its own
   * prefers-color-scheme change) fades every colour instead of
   * snapping — the same "one thing changed, not a different page"
   * read as the rest of this section. A more specific selector's own
   * `transition` (post-list, tags, nav, graph nodes, all below) simply
   * replaces this one for that element rather than fighting it; none
   * of them lose anything they need, since their own listed properties
   * cover what this broad rule would otherwise have given them. */
  *,
  *::before,
  *::after {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, fill 0.25s ease,
      stroke 0.25s ease;
  }

  /* Listing pages settle in rather than the whole page's worth of
   * entries snapping into place at once — one arrival per row, quick
   * enough in sequence that it still reads as "the page loaded", not
   * as a slideshow. Capped at 10 explicit steps (this site's own page
   * size, AGENTS.md) — anything past that arrives with the last one
   * rather than composing 30+ individual rules for a length nothing
   * ever paginates past anyway. */
  .post-list li,
  .search-results:not([hidden]) li {
    animation: list-item-arrive 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .search-results:not([hidden]) li {
    animation-duration: 320ms;
  }

  @keyframes list-item-arrive {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }

  .post-list li:nth-child(1),
  .search-results li:nth-child(1) {
    animation-delay: 0ms;
  }
  .post-list li:nth-child(2),
  .search-results li:nth-child(2) {
    animation-delay: 40ms;
  }
  .post-list li:nth-child(3),
  .search-results li:nth-child(3) {
    animation-delay: 80ms;
  }
  .post-list li:nth-child(4),
  .search-results li:nth-child(4) {
    animation-delay: 120ms;
  }
  .post-list li:nth-child(5),
  .search-results li:nth-child(5) {
    animation-delay: 160ms;
  }
  .post-list li:nth-child(6),
  .search-results li:nth-child(6) {
    animation-delay: 200ms;
  }
  .post-list li:nth-child(7),
  .search-results li:nth-child(7) {
    animation-delay: 240ms;
  }
  .post-list li:nth-child(8),
  .search-results li:nth-child(8) {
    animation-delay: 280ms;
  }
  .post-list li:nth-child(n + 9) {
    animation-delay: 320ms;
  }

  .tag-folder {
    animation: list-item-arrive 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .tag-folder:nth-child(1) {
    animation-delay: 0ms;
  }
  .tag-folder:nth-child(2) {
    animation-delay: 25ms;
  }
  .tag-folder:nth-child(3) {
    animation-delay: 50ms;
  }
  .tag-folder:nth-child(4) {
    animation-delay: 75ms;
  }
  .tag-folder:nth-child(5) {
    animation-delay: 100ms;
  }
  .tag-folder:nth-child(n + 6) {
    animation-delay: 125ms;
  }

  /* Chart/diagram figures — a fade-and-rise arrival, same device as
   * .doc-content's own doc-arrive just above, so a figure doesn't just
   * appear mid-scroll as though it had always been sitting there. */
  article figure.chart,
  article figure.diagram {
    animation: figure-arrive 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes figure-arrive {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
  }

  /* Bars grow from their own zero-anchored edge, not the plot's bottom
   * edge — a negative bar's zero is at ITS top, not its bottom (see the
   * class assignment and comment in chart-embed.js's barChart()). --i,
   * set there too, staggers bar-by-bar so the shape reads as arriving
   * data, not as one box wiping open. transform, not height/y: those
   * force layout every frame, and every bar's own y/height already
   * carries its final geometry — scaling in from the anchored edge
   * gets the same "grows out of nothing" read for free. */
  figure.chart .chart-bar-positive,
  figure.chart .chart-bar-negative {
    transform-box: fill-box;
    animation: bar-grow 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 50ms);
  }

  figure.chart .chart-bar-positive {
    transform-origin: center bottom;
  }

  figure.chart .chart-bar-negative {
    transform-origin: center top;
  }

  @keyframes bar-grow {
    from {
      transform: scaleY(0);
    }
  }

  /* A line fades in rather than drawing stroke-first: an actual
   * stroke-dasharray "draw" reveal would collide with the second
   * series' own dasharray, which already carries real meaning (colour
   * alone can't distinguish main from baseline — AGENTS.md) — using
   * that same property for two jobs at once would break whichever one
   * runs second. --i (the series index, from chart-embed.js) staggers
   * a two-series chart's lines one after the other instead of both
   * fading in on top of each other. */
  figure.chart .chart-line {
    animation: chart-fade 420ms ease both;
    animation-delay: calc(var(--i, 0) * 120ms + 200ms);
  }

  figure.chart .chart-point {
    transform-box: fill-box;
    transform-origin: center;
    animation: point-pop 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 35ms + 200ms);
  }

  @keyframes chart-fade {
    from {
      opacity: 0;
    }
  }

  @keyframes point-pop {
    from {
      opacity: 0;
      transform: scale(0);
    }
  }

  /* The graph's own arrival (graph-physics.js's --i staggers both,
   * capped there so a large graph's tail doesn't drag this out past
   * about a third of a second). The scale-pop lives on the shape
   * (circle/rect), never on .graph-node itself: that <a> already
   * carries an SVG `transform="translate(x,y)"` PRESENTATION ATTRIBUTE
   * that graph-physics.js rewrites every simulation tick, and a CSS
   * `transform` on the same element doesn't compose with it — it wins
   * outright, snapping every node to the SVG origin for as long as the
   * animation ran. The shape has no such attribute, so scaling it is
   * safe; fading .graph-node's own opacity is safe for the same reason
   * opacity was never the contested property here. */
  .graph-node {
    animation: node-fade 420ms ease both;
    animation-delay: calc(var(--i, 0) * 18ms);
  }

  .graph-node circle,
  .graph-node rect {
    /* transform-box/transform-origin are already set on the base,
     * ungated rule (near .graph-node:hover circle) — always on, since
     * the hover scale below needs them regardless of motion
     * preference for correctness, not just when this animation runs. */
    animation: node-pop 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 18ms);
  }

  .graph-edge {
    animation: edge-fade 420ms ease both;
    animation-delay: calc(var(--i, 0) * 10ms);
  }

  @keyframes node-fade {
    from {
      opacity: 0;
    }
  }

  @keyframes node-pop {
    from {
      transform: scale(0.3);
    }
  }

  @keyframes edge-fade {
    from {
      opacity: 0;
    }
  }

  /* Hover/focus/search-match already swap fill via a plain transition
   * (styles.css, near .graph-node:hover) — this adds a small scale on
   * top, the same "responded to you" read as the tag-chip hover lift.
   * Lives on the shape only, for the exact reason the entrance
   * animation above does. Its transition timing is the base rule's,
   * not redeclared here — see the comment there for why it has to stay
   * always-on for the shrink-back-down on hover-out to animate too. */
  .graph-node:hover circle,
  .graph-node:focus-visible circle,
  .graph-node.is-search-match circle,
  .graph-node:hover rect,
  .graph-node:focus-visible rect,
  .graph-node.is-search-match rect {
    transform: scale(1.18);
  }
}
