/* blog index + article pages */
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }
.page-head .lede a { color: var(--accent); }

/* year filter row under the page title */
.year-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 22px; }
.year-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.year-chips a {
  display: inline-block; padding: 3px 14px; border: 1px solid var(--border-strong); border-radius: 999px;
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; color: var(--ink-soft); text-decoration: none;
}
.year-chips a:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.year-chips a[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* index layout: list on the left, finding tools on the right */
.blog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 0 56px; align-items: start; margin-top: 8px; }
.blog-main .year:first-child { margin-top: 20px; }
.year[hidden], .post-row[hidden], .no-result[hidden] { display: none; }
.no-result { margin: 40px 0; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

.side { padding: 4px 0 24px; }          /* not sticky: with several widgets it would be taller than the window */
.widget { margin: 0 0 30px; }
.widget[hidden] { display: none; }
.widget h2 { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.search input {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.side-list, .recent { list-style: none; margin: 0; padding: 0; }
.side-btn {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 15px; line-height: 1.5; padding: 6px 0 6px 12px;
  border: 0; border-left: 2px solid var(--border); background: none; color: var(--ink-soft); cursor: pointer; text-decoration: none;
}
.side-btn:hover { color: var(--accent); border-left-color: var(--accent); }
.side-btn[aria-pressed="true"] { color: var(--accent); font-weight: 700; border-left-color: var(--accent); }
.clear { font: inherit; font-size: 13.5px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; margin: 0; }
.clear[hidden] { display: none; }
.recent li { border-top: 1px solid var(--border); }
.recent li:first-child { border-top: 0; }
.recent a { display: block; padding: 8px 0; font-size: 14.5px; line-height: 1.55; color: var(--ink); text-decoration: none; }
.recent a:hover { color: var(--accent); }

/* list */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { border-bottom: 1px solid var(--border); }
.post-row:last-child { border-bottom: 0; }
.post-row > a {
  display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 8px 28px; align-items: center;
  padding: 24px 0; color: inherit; text-decoration: none;
}
.post-row h3 { font-size: 21px; line-height: 1.45; margin: 4px 0 8px; font-weight: 600; text-wrap: balance; }
.post-row > a:hover h3 { color: var(--accent); }
.row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0; font-size: 12.5px; color: var(--muted); }
.row-meta time { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.04em; }
.row-abs { margin: 0; font-size: 14.5px; line-height: 1.75; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-cover { aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.row-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.post-row > a:hover .row-cover img { transform: scale(1.04); }

/* article */
.post-cover { margin: 26px auto 0; }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 8; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.load-more { text-align: center; margin: 36px 0 8px; }
.load-more[hidden] { display: none; }
.load-more .btn { cursor: pointer; font: inherit; font-size: 15px; font-weight: 700; }
.post-head { padding-top: 56px; padding-bottom: 8px; }
.post-head .eyebrow a { color: inherit; text-decoration: none; }
.post-head .eyebrow a:hover { text-decoration: underline; }
.post-head h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.35; margin: 0 0 16px; font-weight: 700; text-wrap: balance; }
.post-meta { margin: 0; font-size: 14px; color: var(--muted); }
.post-meta time { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.04em; }
.views { color: var(--accent); }
.post-meta .views::before { content: "·"; margin: 0 8px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.prose { font-size: 17px; line-height: 2; padding-top: 22px; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.35em; text-align: justify; text-justify: inter-character; }
.prose h2 { font-size: 25px; line-height: 1.5; margin: 2.3em 0 0.7em; font-weight: 700; text-wrap: balance; }
.prose h3 { font-size: 20px; line-height: 1.5; margin: 2em 0 0.6em; font-weight: 600; }
.prose h4 { font-size: 17px; margin: 1.8em 0 0.5em; }
.prose a { word-break: break-all; }
.prose strong { font-weight: 700; }
.prose blockquote { margin: 1.8em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--ink-soft); }
.prose blockquote p { margin: 0 0 0.9em; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 1.35em; padding-left: 1.4em; }
.prose li { margin: 0 0 0.5em; text-align: justify; text-justify: inter-character; }
.prose li::marker { color: var(--accent); }
.prose li > ul, .prose li > ol { margin: 0.5em 0 0; }
.prose hr { border: 0; margin: 2.4em 0; text-align: center; }
.prose hr::after { content: "· · ·"; letter-spacing: 0.6em; color: var(--muted); }
.prose sub { font-size: 0.7em; }
.prose .media-link { text-align: left; }
.prose .memo-label { margin: 1.6em 0 0.4em; font-size: 14px; letter-spacing: 0.12em; font-weight: 700; color: var(--accent); text-align: left; }
.prose .memo-label + ul.memo { margin-top: 0; padding: 14px 20px 14px 2.2em; font-size: 15.5px; line-height: 1.85; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.prose ul.memo li { margin-bottom: 0.3em; text-align: left; }
.prose ul.memo li:last-child { margin-bottom: 0; }
.prose figure { margin: 2em 0; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.prose figcaption { margin-top: 10px; text-align: center; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.prose figcaption .cap, .prose figcaption .credit { display: block; }
.prose figcaption a { color: inherit; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; margin-bottom: 8px; }
.pn { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.pn small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pn span { display: block; font-size: 15.5px; line-height: 1.5; font-weight: 600; }
a.pn:hover { border-color: var(--accent); }
.pn.newer { text-align: right; order: 2; }
.pn.older { order: 1; }
.pn.empty { border: 0; background: none; padding: 0; }

@media (max-width: 900px) {
  /* phones/tablets: search + filters above the list, the rest below it */
  .blog-layout { display: flex; flex-direction: column; }
  .side { display: contents; }
  .side-find { order: -1; margin-bottom: 8px; }
  .blog-main { order: 0; width: 100%; }
  .side-more { order: 1; margin-top: 40px; width: 100%; }
  .side-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .side-btn { display: inline-block; width: auto; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 14px; }
  .side-btn:hover, .side-btn[aria-pressed="true"] { border-color: var(--accent); }
  .side-btn[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
  .widget { margin-bottom: 20px; }
}
@media (max-width: 720px) {
  .post-row > a { grid-template-columns: minmax(0, 1fr) 104px; gap: 6px 16px; padding: 20px 0; }
  .post-row h3 { font-size: 18px; }
  .row-abs { -webkit-line-clamp: 3; font-size: 14px; }
  .post-head { padding-top: 36px; }
  .prose { font-size: 16.5px; }
  .prose h2 { font-size: 22px; }
  .post-nav { grid-template-columns: 1fr; }
  .pn.newer { order: 1; text-align: left; }
  .pn.older { order: 2; }
  .narrow { padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) { .row-cover img { transition: none; } }

/* comments */
.comments { margin-top: 64px; padding-top: 8px; border-top: 1px solid var(--border-strong); }
.comments h2 { font-size: 22px; margin: 28px 0 8px; font-weight: 700; }
.c-note { margin: 0 0 20px; font-size: 13.5px; line-height: 1.75; color: var(--muted); }
.c-form { display: grid; gap: 14px; margin: 0 0 8px; }
.c-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.c-form label { display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-soft); }
.c-form input[type=text], .c-form input[type=email], .c-form textarea {
  font: inherit; font-size: 15.5px; line-height: 1.7; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; width: 100%;
}
.c-form textarea { min-height: 128px; resize: vertical; }
.c-form input:focus, .c-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.c-form .req { color: #b3402f; }
.c-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.c-remember { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px !important; font-size: 13.5px; }
.c-remember input { width: 16px; height: 16px; accent-color: var(--accent); }
.c-replying { margin: 0; font-size: 14px; color: var(--accent); font-weight: 700; }
.c-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.c-actions button { font: inherit; font-size: 15px; padding: 10px 22px; border-radius: 999px; cursor: pointer; }
.c-actions button[type=submit] { background: var(--accent); border: 1px solid var(--accent); color: var(--bg); font-weight: 700; }
.c-actions button[type=submit]:hover:not(:disabled) { filter: brightness(1.08); }
.c-actions button:disabled { opacity: .55; cursor: default; }
.c-cancel { background: none; border: 1px solid var(--border-strong); color: var(--ink-soft); }
.c-cancel:hover { border-color: var(--accent); color: var(--accent); }
.c-turnstile { min-height: 0; }
.c-msg { min-height: 1.5em; margin: 6px 0 0; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.c-msg.is-ok { color: var(--accent); }
.c-msg.is-error { color: #b3402f; }

.c-list { margin-top: 20px; }
.c-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 14px; padding: 22px 0; border-top: 1px solid var(--border); }
.c-item:first-child { border-top: 0; }
.c-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: block; background: var(--surface); }
.c-avatar .av-bg { fill: var(--surface); }
.c-avatar.is-owner .av-bg { fill: var(--accent); }
.c-avatar .av-mark { fill: var(--bg); font: 700 21px "Noto Serif TC", serif; }
.c-avatar .av-fg { fill: var(--muted); opacity: .55; }
.c-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 4px; }
.c-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.c-badge { font-size: 11.5px; line-height: 1; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--bg); }
.c-time { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; letter-spacing: 0.03em; color: var(--muted); margin-left: auto; }
.c-reply { font: inherit; font-size: 13px; padding: 0; background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.c-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.85; font-size: 16px; }
.c-to { color: var(--muted); }
.c-replies { margin-top: 6px; }
.c-replies .c-item { padding: 18px 0 6px; border-top: 1px solid var(--border); }
.c-main > .c-formwrap { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.c-empty { color: var(--muted); margin: 8px 0; }

@media (max-width: 720px) {
  .c-row { grid-template-columns: 1fr; }
  .c-item { grid-template-columns: 32px minmax(0, 1fr); gap: 0 10px; }
  .c-avatar { width: 32px; height: 32px; }
  .c-time { margin-left: 0; width: 100%; order: 3; }
}

/* recent comments widget */
.rc-widget[hidden] { display: none; }
.rc-list a { display: block; padding: 9px 0; font-size: 14px; line-height: 1.6; color: var(--ink-soft); text-decoration: none; }
.rc-list a:hover .rc-who { color: var(--accent); }
.rc-who { font-weight: 700; color: var(--ink); }
.rc-on { color: var(--muted); }
.rc-text { display: block; margin-top: 2px; color: var(--ink-soft); overflow-wrap: anywhere; }
.c-item.is-target { animation: c-flash 2.4s ease-out; }
@keyframes c-flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .c-item.is-target { animation: none; background: var(--accent-soft); } }

.post-kw { margin-top: 2.2em; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13.5px; color: var(--muted); }
.post-kw span { margin-right: 4px; font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.06em; }
.post-kw em { font-style: normal; padding: 2px 10px; border-radius: 20px; background: var(--chip-bg, var(--surface)); border: 1px solid var(--border); color: var(--ink-soft); }

/* photo gallery inside an article (:::gallery in the Markdown): thumbnails, click to enlarge */
.prose .gallery-fig { margin: 2em 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery a.ph { display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.gallery a.ph img { display: block; width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0; transition: transform .25s ease; }
.gallery a.ph:hover img { transform: scale(1.04); }
@media (max-width: 640px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
@media (prefers-reduced-motion: reduce) { .gallery a.ph img { transition: none; } .gallery a.ph:hover img { transform: none; } }
