/* nth.ink and blog.nth.ink: white summer glare above, a lavender sea below. */
@font-face {
  font-family: Recursive;
  src: url(recursive.6ca69238f5.woff2) format("woff2");
  font-weight: 300 1000;
  font-display: swap;
}
@view-transition { navigation: auto; }

:root {
  color-scheme: light dark;
  --sky: #ffffff;
  --sea: #f1edfb;
  --swell: #f8f6fd;
  --parasol: #d4c3e0;
  --iris: #5957a3;
  --ink: #2a2340;
  --soft: #6a6284;
  --blush: #f2a7b8;
  --code: #f7f5fc;
  --sans: Recursive, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
  --wide: 1040px;
  --text: 40rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sky: #1d1933;
    --sea: #2a2449;
    --swell: #231e3e;
    --parasol: #5a5085;
    --iris: #bcb6f5;
    --ink: #ece8fa;
    --soft: #aaa3c8;
    --blush: #f2a7b8;
    --code: #241f40;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: clip;
  background: var(--sky);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
}
main { flex: 1 0 auto; }
a { color: var(--iris); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--iris); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; font-weight: 700; text-wrap: balance; }
/* Balancing splits Chinese and Japanese words, which have no spaces to break at. */
:lang(zh-CN) h1, :lang(zh-CN) h2, :lang(zh-CN) h3, h1:lang(zh-CN), :lang(ja) h1, :lang(ja) h2, :lang(ja) h3, h1:lang(ja) { text-wrap: wrap; }
:lang(zh-CN), :lang(ja) { line-height: 1.85; }
:lang(zh-CN) h1, :lang(zh-CN) h2, :lang(zh-CN) h3, h1:lang(zh-CN) { line-height: 1.35; }

/* The personal page */
.hero {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  width: 100%;
  margin: 0 auto;
  padding: clamp(48px, 9vh, 104px) var(--gutter) 0;
  min-height: min(62vh, 600px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(24px, 5vw, 72px);
  align-items: end;
  position: relative;
  z-index: 1;
}
.hero-text { padding-bottom: clamp(36px, 7vh, 64px); }
.name {
  margin: 0 0 .3em -.03em;
  font-size: clamp(2.5rem, 13.2vw, 6.5rem);
  line-height: 1;
  white-space: nowrap;
  font-weight: 650;
  letter-spacing: -.02em;
}
.ch {
  display: inline-block;
  animation: ripple .9s cubic-bezier(.3, .7, .2, 1) calc(120ms + var(--i) * 55ms) both;
}
@keyframes ripple {
  0% { opacity: 0; transform: translateY(.12em); }
  45% { opacity: 1; transform: translateY(-.07em); }
  100% { opacity: 1; transform: none; }
}
.us { position: relative; color: transparent; }
.us-line {
  position: absolute;
  left: .02em;
  right: .02em;
  bottom: -.04em;
  width: calc(100% - .04em);
  height: .4em;
  overflow: visible;
  fill: none;
  stroke: var(--iris);
  /* In viewBox units, of which the line's height has 40 in .4em: .085em at any size. */
  stroke-width: 8.5;
  stroke-linecap: round;
}
.us-line path { vector-effect: none; }
.intro { max-width: 34rem; font-size: 1.1875rem; line-height: 1.6; }
.intro p { margin: 0 0 .7em; }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 22px 0 0 -10px; }
.icon {
  all: unset;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  transition: color .2s, background-color .2s, transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.icon svg { fill: currentColor; }
.icon .line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.icon:hover { background: var(--sea); color: var(--iris); transform: translateY(-3px); }
.icon:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; border-radius: 50%; }
.blog-link {
  margin-left: 14px;
  font-weight: 600;
  font-variation-settings: "MONO" 0, "CASL" .4;
  transition: font-variation-settings .3s;
}
.blog-link:hover { font-variation-settings: "MONO" 0, "CASL" 1; }
.copied {
  position: absolute;
  z-index: 5;
  padding: 4px 11px;
  border-radius: 8px 8px 8px 2px;
  background: var(--ink);
  color: var(--sky);
  font-size: .875rem;
  white-space: nowrap;
  transform: translateY(-100%);
  pointer-events: none;
}
.avatar {
  display: block;
  width: clamp(120px, 21vw, 212px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px var(--parasol);
  margin-bottom: 14px;
  position: relative;
  z-index: 2;
}

/* The panel's preview reloads as you type, so it shows the page at rest. */
.preview .ch { animation: none; }

/* The sea */
.wave { display: block; width: 100%; height: clamp(44px, 6vw, 80px); margin-top: -1px; flex: none; position: relative; }
.wave .back { fill: var(--swell); }
.wave .front { fill: var(--sea); }
.sea { background: var(--sea); margin-top: -1px; flex: none; position: relative; }
.sea-in { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(20px, 4vh, 40px) var(--gutter) 40px; }

.exp {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 8px clamp(16px, 4vw, 48px);
  padding: 22px 0;
}
.exp h2 {
  margin: 0;
  font-size: 1.1875rem;
  line-height: 1.6;
  font-weight: 700;
  font-variation-settings: "MONO" 0, "CASL" .8;
  color: var(--iris);
}
.exp-items { display: grid; gap: 22px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; }
.entry h3 { margin: 0; font-size: 1.1875rem; line-height: 1.6; font-weight: 650; }
.period { color: var(--soft); font-size: .9375rem; line-height: 1.9; font-variation-settings: "MONO" 1; white-space: nowrap; }
.org, .detail { grid-column: 1 / -1; margin: 0; max-width: var(--text); }
.org { color: var(--soft); }
.detail { margin-top: 6px; }
.none { margin: 0; color: var(--soft); line-height: 1.8; }
/* A section written by hand. With no title, its HTML takes the heading's column too. */
.exp-wide { grid-template-columns: minmax(0, 1fr); }
.exp-html > * { margin-block: 0; }
.exp-html h3 { font-size: 1.1875rem; line-height: 1.6; font-weight: 650; }
.exp-html ul, .exp-html ol { padding-left: 1.25em; }

/* The blog */
.top {
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: none;
}
.mark { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.mark-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--parasol); }
.mark-name { font-weight: 650; font-size: 1.1875rem; }
.top-nav { display: flex; gap: clamp(14px, 3vw, 28px); }
.top-nav a { text-decoration: none; font-weight: 500; }
.top-nav a:hover { text-decoration: underline; }

.list-main { width: 100%; max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(28px, 7vh, 72px) var(--gutter) clamp(40px, 8vh, 88px); }
.list-title {
  margin: 0 0 clamp(28px, 6vh, 56px) -.03em;
  font-size: clamp(2.25rem, 7vw, 4rem);
  line-height: 1.1;
  letter-spacing: -.02em;
  font-weight: 750;
  font-variation-settings: "MONO" 0, "CASL" 1;
}
.year { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); column-gap: clamp(12px, 3vw, 32px); align-items: start; }
.year + .year { margin-top: clamp(28px, 5vh, 48px); }
.year h2 {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: 650;
  color: var(--iris);
  font-variation-settings: "MONO" 1, "CASL" 1;
  padding-top: 16px;
  position: sticky;
  top: 0;
}
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 20px;
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
}
.row-title {
  grid-column: 1;
  grid-row: 1;
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 600;
  width: fit-content;
  font-variation-settings: "MONO" 0, "CASL" 0;
  transition: font-variation-settings .35s cubic-bezier(.2, .7, .2, 1), color .2s;
}
.row-date { grid-column: 2; grid-row: 1; color: var(--soft); font-size: .9375rem; line-height: 1.9; font-variation-settings: "MONO" 1; white-space: nowrap; }
.row-excerpt {
  grid-column: 1;
  max-width: var(--text);
  margin-top: 5px;
  color: var(--soft);
  font-size: 1rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.row:hover .row-title, .row:focus-visible .row-title { color: var(--iris); font-variation-settings: "MONO" 0, "CASL" 1; }
.compact .row { padding: 7px 0; }
.compact .row-title { font-size: 1.125rem; font-weight: 500; }
.compact .year h2 { padding-top: 8px; }
.more { margin: 32px 0 0 calc(5.5rem + clamp(12px, 3vw, 32px)); font-weight: 600; }
.lost { max-width: 34rem; margin: 0; font-size: 1.1875rem; }
.list-main .lost + .more { margin-left: 0; }

/* A post */
.post { width: 100%; max-width: calc(var(--text) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(28px, 6vh, 64px) var(--gutter) clamp(40px, 8vh, 80px); }
.post-head h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -.015em;
  font-weight: 750;
  font-variation-settings: "MONO" 0, "CASL" 1;
  width: fit-content;
}
.post-head h1:lang(zh-CN), .post-head h1:lang(ja) { letter-spacing: 0; line-height: 1.3; }
.post-meta { margin: 14px 0 0; color: var(--soft); font-size: .9375rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tag { color: var(--iris); text-decoration: none; }
.tag:hover { text-decoration: underline; }
.prose { margin-top: clamp(28px, 5vh, 44px); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre, .prose figure { margin: 0 0 1.15em; }
.prose h2 { margin: 1.9em 0 .55em; font-size: 1.625rem; font-weight: 700; font-variation-settings: "MONO" 0, "CASL" .4; }
.prose h3 { margin: 1.6em 0 .45em; font-size: 1.25rem; font-weight: 650; }
.prose h4 { margin: 1.4em 0 .4em; font-size: 1.0625rem; font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .3em; }
.prose img { display: block; border-radius: 12px; margin: 1.4em 0; height: auto; }
.prose figure img { margin: 0; }
.prose figcaption { margin-top: 8px; color: var(--soft); font-size: .9375rem; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose blockquote { margin-left: 0; padding: 2px 0 2px 1.1em; border-left: 3px solid var(--parasol); color: var(--soft); }
.prose hr { border: 0; height: 12px; margin: 2.4em 0; background: no-repeat center / 96px 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'%3E%3Cpath d='M2 6c8-7 15-7 23 0s15 7 23 0 15-7 23 0 15 7 23 0' fill='none' stroke='%23b9a2e6' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: .9375rem; }
.prose th, .prose td { padding: 7px 14px 7px 0; border-bottom: 1px solid var(--parasol); text-align: left; vertical-align: top; }
.prose th { font-weight: 650; }
.prose code, .prose pre, .syn_hl_click { font-family: var(--sans); font-variation-settings: "MONO" 1; font-feature-settings: "liga" 1; }
.prose code { font-size: .9em; padding: .12em .34em; border-radius: 5px; background: var(--code); }
.prose pre, .syn_hl_click {
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--code);
  font-size: .875rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }
/* Code colours come from the art: iris, parasol shadow and a blush rose. */
.chroma .k, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr, .chroma .kt, .gjz { color: var(--iris); font-weight: 650; }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .sd, .chroma .se, .chroma .sh, .chroma .si, .chroma .sr, .chroma .ss, .chroma .sx, .zfc { color: #a63f6c; }
.chroma .c, .chroma .c1, .chroma .cm, .chroma .ch, .chroma .cs, .zs { color: var(--soft); font-style: italic; }
.chroma .cp, .chroma .cpf, .ycl { color: #6d7a2f; }
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mh, .chroma .mo, .chroma .il { color: #9a5a12; }
.chroma .nf, .chroma .fm, .chroma .nc, .chroma .nb, .vari { color: #3f62a8; }
.chroma .o, .chroma .ow, .operator { color: var(--soft); }
.chroma .gd { color: #b23a48; }
.chroma .gi { color: #2f7d4a; }
@media (prefers-color-scheme: dark) {
  .chroma .s, .chroma .s1, .chroma .s2, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .sd, .chroma .se, .chroma .sh, .chroma .si, .chroma .sr, .chroma .ss, .chroma .sx, .zfc { color: #f2a7c4; }
  .chroma .cp, .chroma .cpf, .ycl { color: #c4cf83; }
  .chroma .m, .chroma .mi, .chroma .mf, .chroma .mh, .chroma .mo, .chroma .il { color: #e9bd7c; }
  .chroma .nf, .chroma .fm, .chroma .nc, .chroma .nb, .vari { color: #9dbcf2; }
  .chroma .gd { color: #ef8f9c; }
  .chroma .gi { color: #8fd3a5; }
  .prose img { background: #fff; }
}

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 4vw, 48px); padding-bottom: 28px; }
.pager-link { display: block; color: inherit; text-decoration: none; }
.pager-link.older { text-align: right; }
.pager-dir { display: block; color: var(--soft); font-size: .9375rem; }
.pager-title {
  display: block;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 600;
  font-variation-settings: "MONO" 0, "CASL" 0;
  transition: font-variation-settings .35s, color .2s;
}
.pager-link:hover .pager-title { color: var(--iris); font-variation-settings: "MONO" 0, "CASL" 1; }
.foot { display: flex; justify-content: space-between; gap: 16px; color: var(--soft); font-size: .9375rem; }

/* The butterfly */
.butterfly {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  pointer-events: none;
  overflow: visible;
  visibility: hidden;
  will-change: transform;
}
.butterfly.ready { visibility: visible; }
.blog .butterfly { width: 20px; height: 16px; }
.wing { fill: var(--blush); stroke: var(--iris); stroke-width: 1.3; stroke-linejoin: round; transform-box: view-box; transform-origin: 20px 16px; animation: rest 4.5s ease-in-out infinite; }
.wing-r { animation-name: rest-r; }
.body { stroke: var(--iris); stroke-width: 2; stroke-linecap: round; }
.flying .wing { animation: flap .16s ease-in-out infinite alternate; }
.flying .wing-r { animation-name: flap-r; }
@keyframes rest { 0%, 78%, 100% { transform: scaleX(1); } 88% { transform: scaleX(.45); } }
@keyframes rest-r { 0%, 78%, 100% { transform: scaleX(1); } 88% { transform: scaleX(.45); } }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.25); } }
@keyframes flap-r { from { transform: scaleX(1); } to { transform: scaleX(.25); } }

::view-transition-group(*) { animation-duration: .42s; animation-timing-function: cubic-bezier(.3, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .24s; }

/* Below this the name and the avatar no longer fit side by side. */
@media (max-width: 1040px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: clamp(32px, 6vh, 64px); min-height: 0; gap: 26px; }
  .avatar { order: -1; margin-bottom: 0; width: clamp(112px, 18vw, 148px); margin-left: 2px; }
  .hero-text { padding-bottom: 28px; }
  .name { font-size: min(13.2vw, 6.5rem); }
}
@media (max-width: 640px) {
  .exp { grid-template-columns: minmax(0, 1fr); }
  .year { grid-template-columns: minmax(0, 1fr); }
  .year h2 { position: static; padding-top: 0; margin-bottom: 4px; }
  .row-title { font-size: 1.25rem; }
  .compact .row-title { font-size: 1.0625rem; }
  .more { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ch { animation: none; }
  .wing, .flying .wing { animation: none; }
  .row-title, .pager-title, .icon, .blog-link { transition: none; }
  .icon:hover { transform: none; }
  @view-transition { navigation: none; }
}
@media print {
  .wave, .butterfly, .top-nav { display: none; }
  .sea { background: none; }
}
