:root {
  font-size: 100%;
  --ink: #1d1d20;
  --muted: #565960;
  --blue: #065abe;
  --line: #dcdde0;
  --mist: #f5f5f7;
  --frame: 66rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}
body {
  font: 400 1rem/1.55 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}
.frame { width: min(var(--frame), calc(100% - 2 * var(--gutter))); margin-inline: auto; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid #1671d1;
  outline-offset: 4px;
}
a:focus:not(:focus-visible) { outline: 0; }
[hidden], .en, html[data-ui-lang="en"] .zh { display: none !important; }
html[data-ui-lang="en"] .en { display: block !important; }

/* Site navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.nav-inner, .nav-links, .nav-tools, .site-identity, .locale-picker,
.footer-inner, .footer-links, .hero-actions, .section-heading, .search-heading {
  display: flex;
  align-items: center;
}
.nav-inner { min-height: 4.25rem; gap: 2rem; }
.site-identity { gap: .6rem; margin-right: auto; font-size: 1.125rem; font-weight: 680; letter-spacing: -.04em; }
.monogram {
  display: grid; place-items: center; width: 2rem; height: 2rem;
  color: white; background: var(--ink); border-radius: .57rem;
  font: 650 .92rem/1 ui-monospace, Menlo, monospace; letter-spacing: -.07em;
}
.site-nav a, .site-footer a { color: var(--ink); text-decoration: none; }
.nav-links { gap: 1.55rem; }
.nav-links a, .footer-links a { font-size: .9rem; color: var(--muted); }
.nav-links a[aria-current], .nav-links a:hover, .site-footer a:hover { color: var(--blue); }
.nav-tools { gap: .5rem; }
.locale-picker { background: #f0f0f2; border-radius: 2rem; padding: 3px; }
.locale-picker a { padding: .22rem .55rem; border-radius: inherit; font-size: .78rem; font-weight: 650; color: var(--muted); }
.locale-picker a[aria-current] { background: #fff; box-shadow: 0 1px 3px #0002; color: var(--ink); }
.icon-button {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border: 0; background: transparent; border-radius: 50%; color: var(--ink);
}
.icon-button:hover { background: var(--mist); }
.search-glyph {
  position: relative; width: .93rem; height: .93rem; margin: -.18rem .18rem 0 0;
  border: 1.7px solid currentColor; border-radius: 50%;
}
.search-glyph::after {
  content: ""; position: absolute; width: .45rem; height: 1.7px; right: -.32rem; bottom: -.16rem;
  background: currentColor; border-radius: 2px; transform: rotate(45deg);
}
.menu-toggle { display: none; }
.menu-glyph { width: 1.15rem; height: .54rem; border-block: 2px solid currentColor; }

/* Portfolio */
.portfolio-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 30%);
  align-items: center;
  gap: clamp(2rem, 7vw, 6rem);
  padding-block: clamp(3rem, 6.5vw, 6rem);
}
.stack-label {
  margin: 0 0 1.25rem; font: 550 .85rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .035em; color: var(--muted);
}
.stack-label span { color: #95979d; margin-inline: .22rem; }
.portfolio-hero h1, .section-title, .reading-head h1, .article-head h1 { color: var(--ink); font-weight: 660; }
.portfolio-hero h1 {
  margin: 0; font-size: clamp(3rem, 6.2vw, 5.35rem); line-height: 1.02;
  letter-spacing: -.062em;
}
.portfolio-hero h1 span { display: block; }
.hero-intro { margin: 1.45rem 0 1.7rem; max-width: 32rem; color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.22rem); line-height: 1.55; }
.hero-actions { gap: 1.45rem; flex-wrap: wrap; }
.primary-action {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .76rem 1.3rem; background: var(--blue); border-radius: 2rem;
  font-size: .9375rem; font-weight: 600; color: white;
}
.primary-action:hover, .primary-action:focus { background: #00499e; color: white; text-decoration: none; }
.text-link { color: var(--blue); font-size: .9375rem; font-weight: 550; text-underline-offset: .22em; }
.hero-portrait {
  width: 100%; height: auto; aspect-ratio: 6/7; object-fit: cover; object-position: 50% 46%;
  border-radius: 1.5rem; background: var(--mist);
}
.work-section { padding-block: clamp(2.75rem, 5.5vw, 4.75rem); background: var(--mist); scroll-margin-top: 4rem; }
.section-title { margin: 0 0 1.65rem; font-size: clamp(1.9rem, 3.7vw, 3rem); line-height: 1.12; letter-spacing: -.048em; }
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.45rem; }
.work-card {
  display: flex; flex-direction: column; overflow: hidden; color: var(--ink); background: white;
  border: 1px solid #16161d0d; border-radius: 1.35rem; text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.work-art {
  position: relative; display: grid; place-items: center; overflow: hidden;
  height: clamp(10.5rem, 17vw, 13rem); isolation: isolate;
}
.practice-art {
  background-color: #d8e7df;
  background-image: radial-gradient(#86a49370 .8px, transparent 1px);
  background-size: 11px 11px;
}
.practice-cover {
  position: relative; width: min(70%, 19rem); padding: 1rem 1.45rem 1.15rem;
  display: grid; justify-items: start; gap: .75rem; color: #f1fbf7; background: #205345;
  border: 1px solid #173f35; border-radius: .85rem; transform: rotate(-4deg);
  box-shadow: 4px 5px 0 #b3cfc0, 5px 6px 0 #779e8c, 9px 10px 0 #c8ded2, 10px 11px 0 #91afa0, 0 15px 22px #14372a20;
}
.practice-cover small { font: 600 .83rem/1.3 ui-monospace, Menlo, monospace; color: #d1e7dc; }
.practice-cover span { font-size: clamp(1.35rem, 2.3vw, 1.9rem); line-height: 1.15; font-weight: 600; letter-spacing: -.035em; }
.reader-art { background: linear-gradient(125deg, #1a202c, #12141b 65%); }
.reader-sample {
  position: relative; width: 100%; display: flex; justify-content: center; align-items: baseline;
  font: 520 clamp(1.65rem, 4vw, 3.3rem)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fbfbff; letter-spacing: -.055em;
}
.reader-sample b { position: relative; color: #ff746f; font-weight: inherit; }
.reader-sample b::before, .reader-sample b::after {
  content: ""; position: absolute; left: 50%; width: 1px; height: .38em; background: #ff746f;
}
.reader-sample b::before { top: -.52em; }
.reader-sample b::after { bottom: -.52em; }
.life-art {
  background:
    radial-gradient(#648a6a55 .8px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(135deg, #e8f0e5, #c8ddc8);
}
.life-board {
  width: min(76%, 22rem); padding: 1rem 1.15rem; display: grid; gap: .55rem;
  color: #23392c; background: #fffefa; border: 1px solid #ffffffb3; border-radius: 1rem;
  box-shadow: 0 12px 28px #29452b20; transform: rotate(-2deg);
}
.life-board-heading { display: flex; align-items: center; justify-content: space-between; color: #66836a; }
.life-board-heading span { font: 650 .62rem/1.2 ui-monospace, Menlo, monospace; letter-spacing: .1em; }
.life-board-heading b { padding: .2rem .48rem; border-radius: 1rem; background: #e6efe2; font-size: .68rem; }
.life-board > strong { font-size: clamp(1.05rem, 2vw, 1.4rem); letter-spacing: -.04em; }
.life-checklist { display: grid; gap: .42rem; margin: .15rem 0 0; padding: 0; list-style: none; }
.life-checklist li { display: flex; align-items: center; gap: .48rem; color: #69756a; font-size: .72rem; }
.life-checklist i { width: .72rem; height: .72rem; flex: 0 0 auto; border: 1px solid #8da78f; border-radius: .24rem; }
.life-checklist li:first-child i { background: #719675; box-shadow: inset 0 0 0 2px #fffefa; }
.vocoby-art { background: linear-gradient(135deg, #e6e8fa, #c9d4f1 55%, #c5e1e3); }
.vocoby-card {
  width: min(76%, 22rem); padding: 1.15rem 1.25rem 1.25rem; display: grid; gap: .42rem;
  color: #23263a; background: #fff; border: 1px solid #ffffffb3; border-radius: 1rem;
  box-shadow: 0 12px 28px #26375a24; transform: rotate(2deg);
}
.vocoby-card-top { display: flex; justify-content: space-between; color: #737b9c; font: 650 .62rem/1.3 ui-monospace, Menlo, monospace; }
.vocoby-card > strong { margin-top: .45rem; font-size: clamp(1.25rem, 2.4vw, 1.8rem); letter-spacing: -.045em; }
.vocoby-card > small { color: #878ba0; font-size: .72rem; }
.vocoby-translation { margin-top: .45rem; padding-top: .65rem; border-top: 1px solid #e8e9f0; color: #515875; font-size: .78rem; }
.work-copy { padding: clamp(1.25rem, 2.5vw, 1.85rem); }
.work-copy h3 { margin: 0; font-size: clamp(1.3rem, 2.3vw, 1.8rem); font-weight: 640; line-height: 1.15; letter-spacing: -.035em; }
.work-copy p { margin: .65rem 0 0; color: var(--muted); line-height: 1.55; }
.work-card:hover, .work-card:focus-visible { color: var(--ink); text-decoration: none; transform: translateY(-3px); box-shadow: 0 12px 30px #16161d14; }
.work-card:hover h3, .work-card:focus-visible h3, .note-row:hover span, .archive-entry:hover h3 { color: var(--blue); }
.notes-section { padding-block: clamp(3rem, 6vw, 5.5rem); }
.section-heading { justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading .section-title { margin: 0; }
.note-row, .archive-entry { display: block; border-bottom: 1px solid var(--line); }
.note-row { display: flex; align-items: baseline; gap: 1.5rem; justify-content: space-between; padding-block: 1.15rem; font-size: 1.1rem; }
.note-row:hover, .archive-entry:hover { text-decoration: none; }
.note-row time, .byline { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.site-footer { padding-block: 1.6rem; background: var(--mist); border-top: 1px solid var(--line); }
.footer-inner { justify-content: space-between; gap: .75rem 2rem; flex-wrap: wrap; }
.footer-name { font-size: .9rem; font-weight: 600; }
.footer-links { gap: 1.15rem; flex-wrap: wrap; }

/* Reading and browsing */
.reading-page { width: min(46rem, calc(100% - 2 * var(--gutter))); margin-inline: auto; padding-block: clamp(2.5rem, 5vw, 4.5rem); }
.reading-head { margin-bottom: 1.75rem; }
.reading-head h1, .article-head h1 { margin: 0; font-size: clamp(2.45rem, 5vw, 4.3rem); line-height: 1.06; letter-spacing: -.052em; overflow-wrap: anywhere; }
.profile-page .post-container, .article-page .post-container { font-size: 1.075rem; line-height: 1.67; }
.post-container a { color: var(--blue); text-underline-offset: .16em; }
.post-container h2::before { display: none; }
.post-container h2, .archive-year h2 { letter-spacing: -.035em; }
.post-container :is(h2,h3,h4) { scroll-margin-top: 5.5rem; }
.profile-page .post-container p { margin: 1.15rem 0; }
.profile-page .post-container h2 { border-top: 1px solid var(--line); padding-top: 1.75rem; margin-top: 2rem; }
.profile-page .post-container ul { padding-left: 1.2rem; }
.profile-page .post-container li + li { margin-top: .5rem; }
.archive-tags, .article-tags { display: flex; flex-wrap: wrap; gap: .42rem; }
.archive-tags button, .article-tags a {
  display: inline-block; border: 1px solid var(--line); border-radius: 2rem; padding: .38rem .8rem;
  font-size: .875rem; color: var(--muted); background: white; text-decoration: none;
}
.archive-tags button[aria-pressed="true"] { color: #fff; border-color: var(--ink); background: var(--ink); }
.archive-tags button:hover, .article-tags a:hover { border-color: #81848d; }
.archive-tags small { font: inherit; font-size: .8em; }
.archive-year { margin-top: 2.5rem; }
.archive-year h2 { margin: 0 0 .3rem; font-size: 1.7rem; }
.archive-entry { padding-block: 1.1rem; }
.archive-entry h3 { margin: 0; font-size: 1.2rem; font-weight: 610; }
.archive-entry p { margin: .35rem 0 0; font-size: .97rem; color: var(--muted); }
.article-head { border-bottom: 1px solid var(--line); padding-bottom: 1.6rem; }
.article-tags { margin-bottom: 1.3rem; }
.article-subtitle { margin: 1.1rem 0; color: var(--muted); font-size: 1.2rem; }
.byline { margin: 1.25rem 0 0; }
.byline span { margin-inline: .3rem; }
.post-comments { margin-top: 2rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.post-comments h2 { margin: 0; color: var(--ink); font-size: clamp(1.7rem, 3vw, 2.2rem); }
.post-comments .giscus { margin-top: 1rem; }
.post-comments .giscus-frame { width: 100%; }
.article-page article .post-container { width: min(46rem, calc(100% - 2 * var(--gutter))); margin-inline: auto; padding: 0; float: none; overflow-wrap: break-word; }
.article-page article .row { position: relative; }
.article-page article .catalog-container { position: absolute; right: 0; top: 2rem; }
.article-page .side-catalog { overflow-y: auto; }
.article-page .catalog-body { max-width: 100%; }
.article-page article .container { width: 100%; padding: 0; }
.article-page article .row { margin: 0; }
.article-page article .sidebar-container:not(.catalog-container) { float: none; width: min(46rem, calc(100% - 2 * var(--gutter))); margin: 0 auto 2.5rem; padding: 0; }
.article-page pre { overflow-x: auto; }
.article-page .post-container img { max-width: 100%; height: auto; }

@media (min-width: 75rem) {
  .article-page article .row {
    display: grid; grid-template-columns: minmax(0, 1fr) 46rem minmax(0, 1fr);
    column-gap: 1.75rem; align-items: start;
  }
  .article-page article .row::before, .article-page article .row::after { display: none; }
  .article-page article .post-container,
  .article-page article .sidebar-container:not(.catalog-container) { grid-column: 2; width: 100%; }
  .article-page article .catalog-container { grid-column: 3; position: sticky; top: 5rem; width: min(100%, 13rem); }
  .article-page .side-catalog, .article-page .side-catalog.fixed {
    position: static; height: auto; max-height: calc(100vh - 6rem); width: 100%;
  }
}

/* Search dialog */
.site-search {
  position: fixed; top: min(14vh, 7rem); bottom: auto;
  width: min(40rem, calc(100% - 2rem)); max-height: 74vh;
  padding: clamp(1.1rem, 3vw, 2rem); color: var(--ink); border: 1px solid var(--line);
  border-radius: 1.25rem; background: #fff; box-shadow: 0 24px 70px #1112;
}
.site-search:not([open]) { display: none; }
.site-search::backdrop { background: #14172166; }
.search-heading { justify-content: space-between; gap: 1rem; }
.search-heading h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.04em; }
.close-search { font-size: 1.75rem; }
#search-input { width: 100%; margin-block: .85rem; padding: .7rem 1rem; border: 1px solid #989ba2; border-radius: .65rem; font-size: 1rem; }
.search-result { display: grid; gap: .2rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.search-result span { font-size: .9rem; color: var(--muted); }
body:has(.site-search[open]) { overflow: hidden; }

@media (max-width: 47.99rem) {
  .nav-inner { gap: .5rem; min-height: 3.65rem; }
  .menu-toggle { display: grid; }
  .nav-tools { gap: .08rem; }
  .nav-links {
    display: none; position: absolute; inset: 100% 0 auto; align-items: stretch; gap: 0;
    padding: .4rem var(--gutter) .7rem; background: white; border-block: 1px solid var(--line);
    box-shadow: 0 10px 15px #0001;
  }
  .menu-open .nav-links { display: grid; }
  .nav-links a { padding-block: .7rem; font-size: 1rem; }
  .portfolio-hero { grid-template-columns: minmax(0, 1fr) 24%; gap: 1.4rem; }
  .hero-portrait { border-radius: 1rem; }
  .work-grid { gap: 1rem; }
}
@media (max-width: 38rem) {
  .portfolio-hero { display: block; position: relative; padding-block: 2.65rem; }
  .hero-portrait { position: absolute; width: 3.25rem; height: 3.25rem; top: 1.6rem; right: 0; border-radius: 50%; object-position: center 36%; }
  .stack-label { margin: 0 4rem 2rem 0; font-size: .8rem; }
  .portfolio-hero h1 { font-size: clamp(2.35rem, 10.35vw, 3.7rem); }
  .hero-intro { margin: 1.05rem 0 1.4rem; }
  .hero-actions { gap: 1.2rem; }
  .work-grid { grid-template-columns: 1fr; }
  .note-row { font-size: 1rem; }
  .section-heading { align-items: baseline; }
}
@media (prefers-reduced-motion: reduce) {
  .work-card { transition: none; }
  .work-card:hover, .work-card:focus-visible { transform: none; }
}
