/* Yen writing site — extreme minimal editorial (rsms-inspired type scale)
   Tokens from Figma 4DOJqZaOLLEHSetb8oFyAi; Yen: all-paper bg, no letterbox */

@font-face {
  font-family: "iA Writer Quattro";
  src: url("../fonts/quattro/iAWriterQuattroS-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../fonts/quattro/iAWriterQuattroS-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../fonts/quattro/iAWriterQuattroS-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../fonts/quattro/iAWriterQuattroS-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
:root {
  --paper: #fafaf7;
  --ink: #000;
  --font-latin: "Inter", system-ui, sans-serif;
  --font-zh: "Noto Sans TC", "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Room for a scrollbar on every page, so the home and an article put their
     text column at the same x whether or not either one scrolls. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-latin);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Whole-page language stacks */
body.lang-en {
  font-family: var(--font-latin);
}
body.lang-zh,
body.lang-zh-Hant {
  font-family: var(--font-zh);
}
body.lang-zh :lang(en),
body.lang-zh-Hant .latin {
  font-family: var(--font-latin);
  font-size: 1.06em; /* Latin leads visually vs Noto */
}

a {
  color: inherit;
  text-decoration: none;
}

/* —— Homepage (full-viewport ASCII 河豚 stage) —— */
body.home {
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-weight: 400;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fafaf7;
  color: #2a2420;
}

.home-stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fafaf7;
}

.home-puffer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: auto;
  background: transparent;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.home-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: none;
}

/* Nav sits in the centred column, right above the copy, so every control
   is within one short reach. It stays put when a list replaces the copy. */
.home-chrome {
  position: relative;
  z-index: 5;
  /* The same measure as an article's text column (680 less 20 + 20), so a
     note printed here lines up with its own page. */
  width: min(640px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(72px, calc(50vh - 128px)) 0 72px;
  padding-top: max(72px, calc(50dvh - 128px));
  text-align: center;
  pointer-events: none;
}
.home-chrome a,
.home-chrome button,
.home-view {
  pointer-events: auto;
}

.home-nav {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 0 0 40px;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #2a2420;
}
.home-nav a {
  position: relative;
  color: inherit;
  text-decoration: none;
  transition: color 240ms ease;
}
.home-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 320ms cubic-bezier(0.2, 0, 0, 1);
}
.home-nav a:hover {
  opacity: 1;
}
body[data-view="notes"] .home-nav a,
body[data-view="works"] .home-nav a {
  color: #9a948c;
}
body .home-nav a[aria-current="page"] {
  color: #2a2420;
}
.home-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* View swap: out = fade + 6px up; in = from 8px below. No scale, no blur. */
.home-view {
  transition: opacity 220ms ease, transform 220ms ease;
}
.home-view.is-out {
  opacity: 0;
  transform: translateY(-6px);
}
.home-view:not(.is-out) {
  transition: opacity 420ms cubic-bezier(0.2, 0, 0, 1), transform 420ms cubic-bezier(0.2, 0, 0, 1);
}
.home-view.is-before {
  opacity: 0;
  transform: translateY(8px);
  transition: none;
}
.home-view:focus {
  outline: none;
}

.home-copy {
  position: relative;
  max-width: 36ch;
  margin: 0 auto;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-weight: 400;
  color: #2a2420;
  background: none;
}

/* —— Notes / works list, two columns —— */
.home-panel {
  text-align: left;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  color: #2a2420;
  padding: 18px 20px 22px;
  margin: -18px -20px 0;
  background: rgba(250, 250, 247, 0.86);
  /* Feathered, so the wash reads as paper, not a card. */
  box-shadow: 0 0 28px 14px rgba(250, 250, 247, 0.86);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 14px;
  font-size: 12px;
  color: #8a857e;
}
.panel-back {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.panel-back:hover {
  opacity: 1;
  color: #2a2420;
}

.panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 32px;
}
.panel-list li {
  border-top: 1px solid rgba(42, 36, 32, 0.12);
  transition: opacity 420ms cubic-bezier(0.2, 0, 0, 1), transform 420ms cubic-bezier(0.2, 0, 0, 1);
  transition-delay: calc(var(--i, 0) * 40ms + 60ms);
}
.home-view.is-before .panel-list li,
.panel-list li.is-before {
  opacity: 0;
  transform: translateY(6px);
  transition: none;
}
.panel-list a {
  display: block;
  padding: 14px 0 16px;
  color: inherit;
  text-decoration: none;
}
.panel-list a:hover {
  opacity: 1;
}
.panel-title {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  transition: color 200ms ease;
}

.panel-more {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: #c45c26;
  cursor: pointer;
}
.panel-more:hover {
  opacity: 0.8;
}
@media (max-width: 560px) {
  .panel-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-view,
  .home-view:not(.is-out),
  .panel-list li,
  .home-nav a,
  .home-nav a::after {
    transition: none;
  }
}

.home-greeting {
  margin: 0 0 8px;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: clamp(22px, 2.6vw, 28px);
  /* Medium weight and no tightening, so the mono cells show. */
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
  color: #2a2420;
}

.home-role,
.home-slogan {
  margin: 0 auto 8px;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: #2a2420;
}
.home-slogan {
  margin-bottom: 18px;
}
@media (min-width: 900px) {
  .home-role,
  .home-slogan {
    font-size: 15px;
    line-height: 1.58;
  }
}

.home-links {
  margin: 0;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #c45c26;
}
.home-links a {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 640px) {
  .home-nav {
    gap: 22px;
    margin-bottom: 32px;
  }
}

/* —— Home: night palette and the notes / works shell ——
   body.theme-night is set from prefers-color-scheme (see _layouts/home.html). */
/* Night: the same type and layout on a cool ink ground; the koi stay gold, and gold is the one accent. */
body.home.theme-night,
body.theme-night .home-stage { background: #0d0f12; color: #e8e6e3; }
body.theme-night .home-nav,
body.theme-night .home-greeting,
body.theme-night .home-role,
body.theme-night .home-slogan,
body.theme-night .home-copy,
body.theme-night .home-panel,
body.theme-night .panel-back:hover,
body.theme-night .home-nav a[aria-current="page"] { color: #e8e6e3; }
body.theme-night .panel-head { color: #8a8f99; }
body.theme-night[data-view="notes"] .home-nav a,
body.theme-night[data-view="works"] .home-nav a { color: #626873; }
body.theme-night .home-links,
body.theme-night .panel-more { color: #f5b942; }
body.theme-night .home-panel { background: rgba(13, 15, 18, 0.86); box-shadow: 0 0 28px 14px rgba(13, 15, 18, 0.86); }
body.theme-night .panel-list li { border-top-color: rgba(232, 230, 227, 0.16); }
body.theme-night .home-puffer { filter: drop-shadow(0 0 3px rgba(242, 176, 80, 0.45)); }

/* —— Notes: a shell session. A prompt runs `ls -lt`, rows sit in `ls -l` columns,
      and the row under the pointer or keyboard turns reverse video like a TUI picker. —— */
.sh-panel .panel-list { grid-template-columns: 1fr; }
.sh-panel .panel-list li { border-top: 0; }
.sh-line { margin: 0; font-size: 13px; line-height: 1.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Prompt in ink tones only: the one accent (朱 by day, amber by night) is kept for what needs the eye. */
.sh-prompt { color: #c45c26; font-weight: 600; }
.sh-path { color: #2a2420; font-weight: 600; }
.sh-dim { color: #8a857e; }
.sh-cmd::after {
  content: ""; display: inline-block; width: 0.6em; height: 1.05em; margin-left: 2px;
  vertical-align: -0.18em; background: currentColor; animation: sh-blink 1.1s steps(1) infinite;
}
.sh-cmd:not(.is-typing)::after { display: none; }
@keyframes sh-blink { 50% { opacity: 0; } }
.sh-panel .panel-list a { padding: 3px 6px; margin: 0 -6px; border-radius: 1px; font-size: 13px; line-height: 1.75; }
.sh-notes .panel-list a {
  display: grid; grid-template-columns: 1.5ch 10ch 10ch minmax(0, 1fr) 10ch; gap: 14px; align-items: baseline;
}
.sh-panel .panel-title { font-size: 13px; line-height: 1.75; }
.ls-mark { color: transparent; }
.ls-perm, .ls-size, .ls-date { color: #8a857e; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ls-size { text-align: right; }
/* While the command types itself out, the listing waits, as if the shell hasn't answered yet. */
.home-panel.is-listing .sh-total,
.home-panel.is-listing .panel-list,
.home-panel.is-listing .panel-more,
.home-panel.is-listing .sh-out,
.home-panel.is-listing .sh-live { visibility: hidden; }
.sh-panel .panel-list a:hover,
.sh-panel .panel-list a:focus-visible,
.sh-panel .panel-list a.is-opening { background: #2a2420; color: #fafaf7; outline: none; }
.sh-panel .panel-list a.is-opening * { color: inherit; }
.sh-panel .panel-list a:hover *,
.sh-panel .panel-list a:focus-visible * { color: inherit; }
.sh-panel .panel-list a:hover .panel-title { color: inherit; }
.sh-panel .panel-list a:focus-visible .ls-mark,
.sh-panel .panel-list a:hover .ls-mark { color: inherit; }
/* Back to home, said the shell way. */
.home-panel .panel-back.sh-back { padding: 1px 6px; margin-left: -6px; border-radius: 1px; color: #8a857e; }
.sh-back .sh-dollar { color: #8a857e; }
.home-panel .panel-back.sh-back:hover,
.home-panel .panel-back.sh-back:focus-visible { background: #2a2420; color: #fafaf7; outline: none; }
.sh-back:hover .sh-dollar, .sh-back:focus-visible .sh-dollar { color: inherit; }

/* The last prompt takes commands (a small easter egg): cd ~, cd -, ls, help… */
.sh-out { margin: 18px 0 0; display: grid; }
.sh-out:empty { display: none; }
.sh-out p { margin: 0; font-size: 13px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.sh-live { margin-top: 18px; display: flex; align-items: baseline; cursor: text; }
.sh-live[hidden] { display: none; }
.sh-out:not(:empty) + .sh-live { margin-top: 0; }
.sh-input {
  flex: 1; min-width: 0; margin-left: 0.6ch; padding: 0; border: 0; outline: none; background: none;
  font: inherit; color: inherit; caret-color: currentColor; caret-shape: block;
}
/* Key hints sit up top beside $ cd ~, so the prompt can be the last line and print below it. */
.sh-keys { margin: 0; font-size: 12px; color: #8a857e; }
.sh-panel .panel-head { justify-content: space-between; }
.sh-keys kbd { font: inherit; padding: 0 4px; border: 1px solid rgba(42, 36, 32, 0.25); border-radius: 2px; }
@media (max-width: 560px) {
  .sh-notes .panel-list a { grid-template-columns: 1.5ch 10ch minmax(0, 1fr) 9ch; gap: 10px; }
  .ls-perm { display: none; }
  .sh-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sh-cmd::after { animation: none; } }

/* —— Works: the same shell, listing directories. Each row leads with its seal character. —— */
.sh-works .panel-list a {
  display: grid; grid-template-columns: 1.5ch 10ch minmax(0, 1fr) auto; column-gap: 14px; align-items: baseline;
}
.work-status { font-size: 12px; color: #8a857e; white-space: nowrap; }
/* Status by shape, not colour: ● in progress (the accent), ◐ experiment, ○ done. */
.work-status::before { content: "○ "; }
.work-status[data-status="experiment"]::before { content: "◐ "; }
.work-status[data-status="in progress"]::before { content: "● "; color: #c45c26; }
.work-desc { grid-column: 3 / -1; font-size: 12px; line-height: 1.6; color: #8a857e; padding-bottom: 4px; }
@media (max-width: 560px) {
  .sh-works .panel-list a { grid-template-columns: 1.5ch minmax(0, 1fr) auto; column-gap: 10px; }
  .work-desc { grid-column: 2 / -1; }
}

body.theme-night .ls-perm,
body.theme-night .ls-size,
body.theme-night .ls-date,
body.theme-night .sh-dim,
body.theme-night .sh-keys,
body.theme-night .work-status,
body.theme-night .work-desc { color: #8a8f99; }
body.theme-night .sh-prompt { color: #f5b942; }
body.theme-night .sh-path { color: #e8e6e3; }
body.theme-night .sh-keys kbd { border-color: rgba(232, 230, 227, 0.3); }
body.theme-night .home-panel .panel-back.sh-back { color: #8a8f99; }
body.theme-night .sh-back .sh-dollar { color: #8a8f99; }
body.theme-night .home-panel .panel-back.sh-back:hover,
body.theme-night .home-panel .panel-back.sh-back:focus-visible { background: #e8e6e3; color: #0d0f12; }
body.theme-night .sh-panel .panel-list a:hover,
body.theme-night .sh-panel .panel-list a:focus-visible,
body.theme-night .sh-panel .panel-list a.is-opening { background: #e8e6e3; color: #0d0f12; }
body.theme-night .work-status[data-status="in progress"]::before { color: #f5b942; }

/* —— Home copy: a few terminal marks on a human page —— */
/* The same underline cursor as article titles. */
/* The same block cursor as the notes / works prompts, in the text's colour. */
.home-greeting::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 0.12em;
  vertical-align: -0.18em;
  background: currentColor;
  animation: sh-blink 1.1s steps(1) infinite;
}
/* Like a login banner's "Last login": the newest note, linked. It sits
   below the links behind a short rule, far enough apart that a tap on one
   never lands on the other. */
.home-last {
  display: inline-block;
  margin: 32px auto 0;
  padding-top: 14px;
  border-top: 1px solid rgba(42, 36, 32, 0.14);
  font-size: 12px;
  line-height: 1.55;
  color: #6e6a64;
  font-variant-numeric: tabular-nums;
}
.home-last-label {
  color: #9a948c;
}
.home-last a {
  display: inline-block;
  padding: 4px 0;
  color: #2a2420;
  border-bottom: 1px solid rgba(42, 36, 32, 0.25);
}
body.theme-night .home-last { color: #8a8f99; border-top-color: rgba(232, 230, 227, 0.18); }
body.theme-night .home-last-label { color: #626873; }
body.theme-night .home-last a { color: #e8e6e3; border-bottom-color: rgba(232, 230, 227, 0.3); }
@media (prefers-reduced-motion: reduce) {
  .home-greeting::after { animation: none; }
}

/* —— Article (Jekyll default layout): a quiet reading column on plain
      paper. The pond stays empty while reading; one small koi swims across
      when (END) comes into view. Footnotes sit in the right margin on wide
      screens and at the end on narrow ones. —— */
.post-body {
  margin: 0;
  background: #fafaf7;
  color: #2a2420;
}
.post-pond {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.post {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 20px 96px;
}

.post-back,
.post-meta {
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: #8a857e;
}
.post-back {
  color: inherit;
  text-decoration: none;
  transition: color 200ms ease;
}
.post-title {
  margin: 28px 0 12px;
  font-family: "iA Writer Quattro", "Noto Sans TC", system-ui, sans-serif;
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #2a2420;
}
.post-meta {
  margin: 0;
}
.post-head {
  margin-bottom: 44px;
}

/* Prose: washi paper, sumi ink, one vermilion (朱) accent. Structure is
   marked the way the home page marks it: a terminal cursor, small square
   cells, and mono labels, never colour blocks or shadows. */
.post-prose {
  --ink: #2a2420;
  --ink-soft: #5a544e;
  --ink-faint: #8a857e;
  --rule: rgba(42, 36, 32, 0.14);
  --washi: #f2efe9;
  --shu: #c45c26;
  --mono: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-family: "iA Writer Quattro", "Noto Sans TC", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
  overflow-wrap: break-word;
}
.post-prose ::selection {
  background: rgba(196, 92, 38, 0.16);
}
.post-prose > :first-child {
  margin-top: 0;
}
.post-prose p {
  margin: 0 0 1.25em;
}

/* Headings: size steps stay above body size; the small ones turn into
   mono labels instead of shrinking past the text. */
.post-prose h2,
.post-prose h3,
.post-prose h4 {
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}
.post-prose h2 {
  margin: 2.6em 0 0.8em;
  font-size: 21px;
}

.post-prose h3 {
  margin: 2.2em 0 0.7em;
  font-size: 18px;
}
.post-prose h4 {
  margin: 2em 0 0.6em;
  font-size: 17px;
}
.post-prose h5,
.post-prose h6 {
  margin: 2em 0 0.6em;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.06em;
}
.post-prose h5 {
  color: var(--ink-soft);
}
.post-prose h6 {
  color: var(--ink-faint);
}

.post-prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--shu);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 200ms ease;
}
.post-prose strong {
  font-weight: 700;
}
.post-prose del {
  color: var(--ink-faint);
  text-decoration-color: var(--ink-faint);
}
.post-prose mark {
  /* A brush of vermilion under the words, not a highlighter block. */
  color: inherit;
  background: linear-gradient(transparent 58%, rgba(196, 92, 38, 0.2) 58%, rgba(196, 92, 38, 0.2) 92%, transparent 92%);
}
.post-prose kbd {
  display: inline-block;
  padding: 0 0.45em;
  font-family: var(--mono);
  font-size: 0.78em;
  line-height: 1.7;
  color: var(--ink);
  background: #fdfcf9;
  border: 1px solid rgba(42, 36, 32, 0.22);
  border-bottom-width: 2px;
  border-radius: 3px;
}
.post-prose sub,
.post-prose sup {
  font-size: 0.72em;
  line-height: 0;
}

/* Lists: square cells for bullets, zero-padded mono numbers. */
.post-prose ul,
.post-prose ol {
  margin: 0 0 1.25em;
  padding-left: 1.5em;
}
.post-prose li {
  margin: 0.35em 0;
}
.post-prose li > ul,
.post-prose li > ol {
  margin: 0.2em 0 0.2em;
}
.post-prose ul {
  list-style: none;
}
.post-prose ul > li {
  position: relative;
}
.post-prose ul > li::before {
  content: "";
  position: absolute;
  left: -1.05em;
  top: 0.78em;
  width: 5px;
  height: 5px;
  background: var(--ink-soft);
}
.post-prose ul ul > li::before {
  background: none;
  border: 1px solid var(--ink-faint);
  width: 3px;
  height: 3px;
}
.post-prose ul ul ul > li::before {
  border: 0;
  width: 6px;
  height: 1px;
  top: 0.9em;
  background: var(--ink-faint);
}
.post-prose ol {
  list-style: decimal-leading-zero;
  padding-left: 2.1em;
}
.post-prose ol > li::marker {
  font-family: var(--mono);
  font-size: 0.78em;
  color: var(--ink-faint);
}
.post-prose ol ol {
  padding-left: 1.9em;
}

/* Task list: a hollow cell; done = filled vermilion, text eased back. */
.post-prose ul.task-list {
  padding-left: 0.2em;
}
.post-prose li.task-list-item::before {
  content: none;
}
.post-prose li.task-list-item {
  padding-left: 1.6em;
}
.post-prose .task-list-item-checkbox {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 11px;
  height: 11px;
  margin: 0;
  border: 1px solid var(--ink-faint);
  border-radius: 0;
  background: transparent;
}
.post-prose .task-list-item-checkbox:checked {
  border-color: var(--shu);
  background: var(--shu);
  box-shadow: inset 0 0 0 2px var(--washi);
}
.post-prose li.task-list-item:has(.task-list-item-checkbox:checked) {
  color: var(--ink-faint);
}

/* Quotes: set in from a single hairline, ink softened. */
.post-prose blockquote {
  margin: 1.8em 0;
  padding: 0.1em 0 0.1em 1.2em;
  border-left: 1px solid var(--ink-faint);
  color: var(--ink-soft);
}
.post-prose blockquote p:last-child {
  margin-bottom: 0;
}
.post-prose blockquote blockquote {
  margin: 1em 0 0;
  border-left-color: var(--rule);
}

/* Code: washi panel, mono, a quiet sumi palette with vermilion for literals. */
.post-prose code {
  font-family: var(--mono);
  font-size: 0.84em;
  padding: 0.12em 0.36em;
  border-radius: 2px;
  background: rgba(42, 36, 32, 0.06);
}
.post-prose div.highlighter-rouge {
  position: relative;
  margin: 1.8em 0;
}
.post-prose div.highlighter-rouge[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.post-prose pre {
  margin: 1.8em 0;
  padding: 16px 18px;
  overflow-x: auto;
  border-left: 2px solid var(--shu);
  background: var(--washi);
  font-size: 13.5px;
  line-height: 1.7;
}
.post-prose div.highlighter-rouge pre {
  margin: 0;
}
.post-prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}
.post-prose .highlight .c,
.post-prose .highlight .c1,
.post-prose .highlight .cm,
.post-prose .highlight .cs,
.post-prose .highlight .sd {
  color: #9a948c;
  font-style: italic;
}
.post-prose .highlight .k,
.post-prose .highlight .kd,
.post-prose .highlight .kn,
.post-prose .highlight .kr,
.post-prose .highlight .kc,
.post-prose .highlight .kt,
.post-prose .highlight .ow {
  color: var(--ink);
  font-weight: 600;
}
.post-prose .highlight .s,
.post-prose .highlight .s1,
.post-prose .highlight .s2,
.post-prose .highlight .sh,
.post-prose .highlight .sb,
.post-prose .highlight .dl,
.post-prose .highlight .se {
  color: #6b7a4f; /* moss */
}
.post-prose .highlight .m,
.post-prose .highlight .mi,
.post-prose .highlight .mf,
.post-prose .highlight .mh {
  color: var(--shu);
}
.post-prose .highlight .nf,
.post-prose .highlight .nc,
.post-prose .highlight .fm {
  color: #3f5a78; /* ai, indigo */
}
.post-prose .highlight .nb,
.post-prose .highlight .bp,
.post-prose .highlight .na {
  color: #7a5a3a;
}
.post-prose .highlight .p,
.post-prose .highlight .o {
  color: var(--ink-faint);
}

/* Tables: mono labels for the head, hairlines only. */
.post-prose table {
  width: 100%;
  margin: 1.8em 0;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.post-prose th {
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--ink-faint);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-align: left;
}
.post-prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.post-prose th:first-child,
.post-prose td:first-child {
  padding-left: 0;
}
.post-prose th:last-child,
.post-prose td:last-child {
  padding-right: 0;
}

/* Images: sit on the paper, a hairline edge, no shadow. */
.post-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto 0.8em;
  border: 1px solid rgba(42, 36, 32, 0.08);
}
.post-prose p:has(> img:only-child) + p {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
}

/* Break: three koi cells. */
.post-prose hr {
  height: 5px;
  margin: 3em auto;
  border: 0;
  width: 33px;
  background:
    linear-gradient(var(--ink-faint), var(--ink-faint)) left / 5px 5px no-repeat,
    linear-gradient(var(--shu), var(--shu)) center / 5px 5px no-repeat,
    linear-gradient(var(--ink-faint), var(--ink-faint)) right / 5px 5px no-repeat;
}

/* Definition list: the term as a mono label, the meaning set in below it. */
.post-prose dl {
  margin: 1.6em 0;
}
.post-prose dt {
  margin-top: 1em;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.post-prose dd {
  margin: 0.2em 0 0 1.5em;
  color: var(--ink-soft);
}

/* Details: hairlines above and below, a mono +/− instead of the triangle. */
.post-prose details {
  margin: 1.8em 0;
  padding: 0.6em 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.post-prose summary {
  display: block;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  list-style: none;
}
.post-prose summary::-webkit-details-marker {
  display: none;
}
.post-prose summary::before {
  content: "+";
  display: inline-block;
  width: 1.4em;
  color: var(--shu);
}
.post-prose details[open] summary::before {
  content: "−";
}
.post-prose details[open] summary {
  margin-bottom: 0.8em;
}
.post-prose details > :last-child {
  margin-bottom: 0;
}

/* Footnotes. */
.post-prose a.footnote {
  margin-left: 2px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--shu);
  text-decoration: none;
}
.post-prose .footnotes {
  margin-top: 3.5em;
  padding-top: 1.4em;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.post-prose .footnotes ol {
  margin: 0;
}
.post-prose .footnotes li::marker {
  color: var(--shu);
}
.post-prose .footnotes p {
  margin: 0.3em 0;
}
.post-prose a.reversefootnote {
  text-decoration: none;
  color: var(--ink-faint);
}

@media (max-width: 640px) {
  .post-prose table {
    display: block;
    overflow-x: auto;
  }
}

/* Wide screens: footnotes move into the right margin, level with their reference. */
/* The text column stays centred; the notes are added in the margin to its
   right, 160–200px wide as the margin allows (see RAIL_MIN in post.js). */
.post-rail {
  position: absolute;
  top: 0;
  left: calc(100% + 28px);
  width: clamp(160px, calc((100vw - 680px) / 2 - 44px), 200px);
}
.post-note {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
  font-family: "iA Writer Quattro", "Noto Sans TC", system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.6;
  color: #6e6a64;
  transition: color 200ms ease;
}
.post-note p {
  display: inline;
  margin: 0;
}
.post-note-n {
  margin-right: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: #c45c26;
}
.post-note.is-lit {
  color: #2a2420;
}
body.has-rail .post-prose .footnotes {
  display: none;
}

@media (max-width: 640px) {
  .post {
    padding: 48px 20px 72px;
  }
  .post-prose {
    font-size: 16px;
  }
}

/* —— Article, terminal pass: the page reads like `cat note.md` in a shell
      that renders Markdown (after Charm's Glow). Body text stays in the
      reading face; the terminal lives in the structure around it. —— */

/* Header: the cat command with $ cd .. beside it, the title, date · chars. */
.post-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.post-back {
  display: inline-block;
  flex: none;
  padding: 1px 6px;
  margin-right: -6px;
}
.post-back .sh-dollar {
  color: #8a857e;
}
.post-cmd {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #2a2420;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-bar + .post-title {
  margin-top: 14px;
}
.post-meta {
  font-variant-numeric: tabular-nums;
}

/* Lists: a dim hyphen for bullets, plain mono numbers. */
.post-prose ul > li::before,
.post-prose ul ul > li::before,
.post-prose ul ul ul > li::before {
  content: "-";
  top: 0;
  left: -1.1em;
  width: auto;
  height: auto;
  border: 0;
  background: none;
  font-family: var(--mono);
  color: var(--ink-faint);
}
.post-prose ol {
  list-style: decimal;
}
.post-prose ol > li::marker {
  font-variant-numeric: tabular-nums;
}
/* Task list: [ ] and [x] in mono; the real checkbox stays for assistive tech. */
.post-prose .task-list-item-checkbox {
  opacity: 0;
}
.post-prose li.task-list-item::before {
  content: "[ ]";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-size: 0.82em;
  line-height: 2.2;
  color: var(--ink-faint);
  white-space: pre;
}
.post-prose li.task-list-item:has(.task-list-item-checkbox:checked)::before {
  content: "[x]";
  color: var(--shu);
}
.post-prose li.task-list-item {
  padding-left: 2.4em;
}

/* Code blocks: a ── lang ── rule on top, a line-number gutter, no accent bar. */
.post-prose div.highlighter-rouge::before,
.post-prose div.highlighter-rouge[data-lang]::before {
  content: "── code ────────────────────────────────────────────────────────────────────────────────";
  position: static;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--ink-faint);
}
.post-prose div.highlighter-rouge[data-lang]::before {
  content: "── " attr(data-lang) " ────────────────────────────────────────────────────────────────────────────────";
}
.post-prose pre {
  border-left: 0;
}
.post-prose pre.has-gutter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 16px;
}
.code-gutter {
  white-space: pre;
  text-align: right;
  color: var(--ink-faint);
  opacity: 0.6;
  user-select: none;
  -webkit-user-select: none;
}

/* Tables: mono, boxed in hairlines like a terminal table. */
.post-prose table {
  font-family: var(--mono);
  font-size: 13px;
}
.post-prose th,
.post-prose td,
.post-prose th:first-child,
.post-prose td:first-child,
.post-prose th:last-child,
.post-prose td:last-child {
  padding: 6px 12px;
  border: 1px solid var(--rule);
}
.post-prose th {
  border-bottom-color: var(--ink-faint);
}

/* Break: a short box-drawing rule. */
.post-prose hr {
  width: auto;
  height: auto;
  margin: 3em 0;
  background: none;
  text-align: center;
  overflow: visible;
}
.post-prose hr::before {
  content: "────────";
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
}

/* Footnote references read [1]. */
.post-prose a.footnote::before,
.post-note-n::before {
  content: "[";
}
.post-prose a.footnote::after,
.post-note-n::after {
  content: "]";
}

/* Selected text: reverse video, like a link under the pointer. */
.post-prose ::selection,
.post-head ::selection {
  background: var(--link-sel-bg);
  color: var(--link-sel-fg);
}

/* End: (END) like less at the end of a file, the next / prev notes, then a prompt. */
.post-end {
  margin-top: 4em;
  font-family: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;
  font-size: 13px;
  color: #2a2420;
}
.post-eof {
  margin: 0 0 1.6em;
  color: #8a857e;
}
.post-pager {
  display: grid;
  margin: 0 0 1.6em;
}
.post-pager a {
  display: grid;
  grid-template-columns: 5ch 10ch minmax(0, 1fr);
  column-gap: 14px;
  align-items: baseline;
  padding: 3px 6px;
  margin: 0 -6px;
  line-height: 1.75;
}
.post-pager-label,
.post-pager time {
  color: #8a857e;
  font-variant-numeric: tabular-nums;
}
.post-end .sh-live {
  margin-top: 0;
}
.post-end .sh-out:not(:empty) {
  margin: 0;
}
.post-end .sh-keys {
  margin-top: 14px;
}
.post-end .sh-keys kbd {
  font: inherit;
  padding: 0 4px;
  border: 1px solid rgba(42, 36, 32, 0.25);
  border-radius: 2px;
}

/* A note printed in the notes shell before its page takes over (shell.js):
   the article's own header and text, laid out exactly as on its page. */
.sh-cat {
  text-align: left;
  pointer-events: none;
}
.sh-cat .post {
  max-width: none;
  margin: 0;
  padding: 0;
}
canvas[data-koi].is-leaving {
  opacity: 0;
  transition: opacity 300ms ease;
}

/* Arrival, like `cat` in a terminal (see post.js): the command line, then
   the title typed character by character behind a block cursor, the date
   line typed out, and the first screen of prose streamed in line by line.
   Everything below the first screen is simply there. A key, a scroll or a
   tap finishes it at once (.stream-done). Should the script not run, a
   safety reveal shows everything after 4s. */
html.post-print .post-head > *,
html.post-print .post-end {
  opacity: 0;
  animation: post-show 1ms 4s forwards;
}
html.post-print .post-prose > * {
  clip-path: inset(0 0 100% 0);
  animation: post-unclip 1ms 4s forwards;
}
/* Opened from the notes list: the command line is already there (it slides up from the list). */
html.post-print .post-head > .is-shown,
html.post-print .post-end.is-shown {
  opacity: 1;
  animation: none;
}
html.post-print .post-prose > .is-streaming {
  animation: post-unclip var(--stream-dur, 1ms) steps(var(--stream-lines, 1), end) var(--stream-delay, 0ms) both;
}
/* The date line is mono, so stepping its clip one character at a time reads as typing. */
html.post-print .post-meta.is-shown {
  width: fit-content;
  animation: post-type var(--type-dur, 1ms) steps(var(--type-chars, 1), end) both;
}
html.post-print.stream-done .post-head > *,
html.post-print.stream-done .post-end {
  opacity: 1 !important;
  animation: none !important;
}
html.post-print.stream-done .post-prose > * {
  clip-path: none !important;
  animation: none !important;
}
/* Typed text keeps its full width from the start; the untyped rest is hidden. */
.type-rest {
  visibility: hidden;
}
/* A block cursor while the title types (no blink; it goes once the title is out). */
.type-cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.95em;
  margin-left: 0.06em;
  vertical-align: -0.1em;
  background: currentColor;
}
@keyframes post-show {
  to {
    opacity: 1;
  }
}
@keyframes post-unclip {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes post-type {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Navigations between pages cross-fade briefly (old page out fast, new one in
   behind it). A note opened from the list hands over with no transition at
   all: it is already on screen (see the head script in default.html). */
@view-transition {
  navigation: auto;
}
::view-transition-group(*) {
  animation-duration: 240ms;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
::view-transition-old(root) {
  animation: vt-out 160ms cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: vt-in 220ms 100ms cubic-bezier(0, 0, 0.2, 1) both;
}
@keyframes vt-out {
  to {
    opacity: 0;
  }
}
@keyframes vt-in {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* Night: the same cool ink ground as the home, light text, gold only for the accent and selection. */
body.post-body.theme-night {
  background: #0d0f12;
  color: #e8e6e3;
  --link-sel-bg: #f5b942;
  --link-sel-fg: #0d0f12;
}
body.theme-night .post-prose {
  --ink: #e8e6e3;
  --ink-soft: #b6b9bf;
  --ink-faint: #8a8f99;
  --rule: rgba(232, 230, 227, 0.14);
  --washi: #151820;
  --shu: #f5b942;
}
body.theme-night .post-back,
body.theme-night .post-meta,
body.theme-night .post-eof,
body.theme-night .post-pager-label,
body.theme-night .post-pager time,
body.theme-night .post-end .sh-dim,
body.theme-night .post-end .sh-keys { color: #8a8f99; }
body.theme-night .post-title,
body.theme-night .post-cmd,
body.theme-night .post-end { color: #e8e6e3; }
body.theme-night .post-back .sh-dollar { color: #8a8f99; }
body.theme-night .post-head .sh-prompt,
body.theme-night .post-end .sh-prompt { color: #f5b942; }
body.theme-night .post-head .sh-path,
body.theme-night .post-end .sh-path { color: #e8e6e3; }
body.theme-night .post-prose :not(pre) > code { background: rgba(232, 230, 227, 0.08); }
body.theme-night .post-prose kbd { background: #151820; color: #e8e6e3; border-color: rgba(232, 230, 227, 0.25); }
body.theme-night .post-prose img { border-color: rgba(232, 230, 227, 0.1); }
body.theme-night .post-prose .highlight .c,
body.theme-night .post-prose .highlight .c1,
body.theme-night .post-prose .highlight .cm,
body.theme-night .post-prose .highlight .cs,
body.theme-night .post-prose .highlight .sd { color: #8a8f99; }
body.theme-night .post-prose .highlight .s,
body.theme-night .post-prose .highlight .s1,
body.theme-night .post-prose .highlight .s2,
body.theme-night .post-prose .highlight .sh,
body.theme-night .post-prose .highlight .sb,
body.theme-night .post-prose .highlight .dl,
body.theme-night .post-prose .highlight .se { color: #a6d6a8; }
body.theme-night .post-prose .highlight .nf,
body.theme-night .post-prose .highlight .nc,
body.theme-night .post-prose .highlight .fm { color: #8db7ff; }
body.theme-night .post-prose .highlight .nb,
body.theme-night .post-prose .highlight .bp,
body.theme-night .post-prose .highlight .na { color: #c8a8ff; }
body.theme-night .post-note { color: #a3a7af; }
body.theme-night .post-note.is-lit { color: #e8e6e3; }
body.theme-night .post-note-n { color: #f5b942; }
body.theme-night .post-end .sh-keys kbd { border-color: rgba(232, 230, 227, 0.3); }

/* —— Day / night switch (theme.js): a small mono button in the top right
      that scrolls away with the page, highlighted like a link. —— */
.theme-toggle {
  position: absolute;
  z-index: 20;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  margin: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 1px;
  background: none;
  font: 12px/1.5 "JetBrains Mono", ui-monospace, monospace;
  color: #8a857e;
  cursor: pointer;
}
body.theme-night .theme-toggle {
  color: #8a8f99;
}
.theme-toggle:focus-visible,
.theme-toggle:active {
  outline: none;
  background: var(--link-sel-bg);
  color: var(--link-sel-fg);
}
@media (hover: hover) {
  .theme-toggle:hover {
    background: var(--link-sel-bg);
    color: var(--link-sel-fg);
  }
}

/* —— Links: reverse video when pointed at, focused from the keyboard or
   tapped, like the selected row of a terminal picker. Inline links keep
   their underline at rest so they can be found in a sentence; when one
   wraps, each line gets its own block. Night (home) uses amber.
   The selected state outranks every palette rule (nav, panels, night),
   hence !important on its colours. —— */
:root {
  --link-sel-bg: #2a2420;
  --link-sel-fg: #fafaf7;
}
body.theme-night {
  --link-sel-bg: #f5b942;
  --link-sel-fg: #0d0f12;
}
a {
  border-radius: 1px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
a:focus-visible,
a:active {
  opacity: 1;
  outline: none;
  background-color: var(--link-sel-bg) !important;
  /* 5px of room each side, 2px above and below; a shadow, so nothing moves. */
  box-shadow: -3px 0 0 2px var(--link-sel-bg), 3px 0 0 2px var(--link-sel-bg);
  color: var(--link-sel-fg) !important;
  text-decoration-color: transparent;
  border-bottom-color: transparent;
}
/* Hover only where a pointer can hover, so a tapped link doesn't stay lit on phones. */
@media (hover: hover) {
  a:hover {
    opacity: 1;
    background-color: var(--link-sel-bg) !important;
    box-shadow: -3px 0 0 2px var(--link-sel-bg), 3px 0 0 2px var(--link-sel-bg);
    color: var(--link-sel-fg) !important;
    text-decoration-color: transparent;
    border-bottom-color: transparent;
  }
  a:hover * {
    color: inherit !important;
  }
}
a:focus-visible *,
a:active * {
  color: inherit !important;
}
/* The current-page underline under a nav item keeps the highlight colour. */
.home-nav a[aria-current="page"]:hover::after,
.home-nav a[aria-current="page"]:focus-visible::after {
  background: var(--link-sel-bg);
}
