:root {
  --paper: #edf0ec; --paper-2: #e3e8e2; --ink: #1b2230; --graphite: #586170; --rule: #cbd2ca;
  --patina: #1d6b62; --brass: #a9781f;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #121619; --paper-2: #1a2023; --ink: #e2e6e4; --graphite: #98a19c; --rule: #2a3130;
          --patina: #5dbbaa; --brass: #d3a64a; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.9 var(--serif); }
a { color: var(--patina); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 2px; }
img { display: block; max-width: 100%; height: auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.site-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; padding: 22px 0 18px; border-bottom: 1px solid var(--rule); }
.brand { font: 700 22px/1.2 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; font: 15px/1.6 var(--sans); }
.site-nav a { color: var(--graphite); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); }

/* Home: the portrait frieze is the one loud element; everything else stays quiet. */
.frieze { display: flex; gap: 4px; margin: 28px 0 0; overflow: hidden; height: 200px; }
.frieze a { flex: 1 1 0; min-width: 0; position: relative; }
.frieze img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.lede { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 48px; align-items: end; padding: 28px 0 32px; border-bottom: 1px solid var(--rule); }
.lede h1 { font: 900 clamp(30px, 5.2vw, 54px)/1.18 var(--serif); margin: 0; letter-spacing: -.01em; max-width: 16em; }
.lede p { margin: 12px 0 0; color: var(--graphite); font-size: 17px; max-width: 34em; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 18px; font: 15px/1.6 var(--sans); }
.jump a { color: var(--ink); text-decoration: none; white-space: nowrap; }
.jump a span { color: var(--graphite); margin-left: 3px; }
.toeic { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; align-items: center; margin: 0 0 8px; padding: 18px 22px; background: var(--paper-2); border-left: 3px solid var(--brass); color: var(--ink); text-decoration: none; }
.toeic b { font: 700 19px/1.4 var(--serif); }
.toeic span { color: var(--graphite); font: 15px/1.6 var(--sans); }
.toeic em { grid-row: 1 / 3; grid-column: 2; font: 600 15px/1 var(--sans); font-style: normal; color: var(--patina); }

.section { padding: 48px 0 8px; }
.section > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin-bottom: 20px; }
.section h2 { font: 800 30px/1.3 var(--serif); margin: 0; }
.section header p { margin: 0; color: var(--graphite); font: 15px/1.6 var(--sans); }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 28px 20px; }
.person { color: var(--ink); text-decoration: none; }
.person figure { margin: 0 0 10px; aspect-ratio: 4 / 5; overflow: hidden; background: var(--paper-2); }
.person img, .person svg { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.person b { display: block; font: 700 17px/1.45 var(--serif); }
.person:hover b { color: var(--patina); }

.entries { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 40px; }
.entries li { border-top: 1px solid var(--rule); }
.entries a { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; padding: 16px 0; color: var(--ink); text-decoration: none; }
.entries .thumb { width: 88px; height: 66px; overflow: hidden; background: var(--paper-2); }
.entries .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.entries b { display: block; font: 700 17px/1.5 var(--serif); }
.entries a:hover b { color: var(--patina); }
.entries small { display: block; color: var(--graphite); font: 14px/1.6 var(--sans); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Post page */
.post { display: grid; grid-template-columns: minmax(0, 700px) 220px; justify-content: space-between; gap: 56px; padding: 36px 0 0; }
.post.no-toc { grid-template-columns: minmax(0, 700px); justify-content: center; }
.post-head { margin-bottom: 28px; }
.post-head .crumb { font: 15px/1.6 var(--sans); color: var(--graphite); }
.post-head .crumb a { color: var(--graphite); }
.post-head h1 { font: 900 clamp(28px, 4.4vw, 42px)/1.3 var(--serif); margin: 8px 0 10px; letter-spacing: -.005em; }
.post-head .meta { font: 14px/1.6 var(--sans); color: var(--graphite); }
.post-head .meta .ai { color: var(--brass); }
.cover { margin: 0 0 32px; }
.cover svg { display: block; width: 100%; height: auto; }
.garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 24px; }
.garage a { color: var(--ink); text-decoration: none; }
.garage figure { margin: 0 0 10px; aspect-ratio: 3 / 2; overflow: hidden; background: var(--paper-2); }
.garage img { width: 100%; height: 100%; object-fit: cover; }
.garage b { display: block; font: 700 17px/1.45 var(--serif); }
.garage small { display: block; color: var(--graphite); font: 14px/1.5 var(--sans); margin-top: 2px; }
.garage a:hover b { color: var(--patina); }
.section h3.sub { font: 700 17px/1.4 var(--serif); margin: 32px 0 4px; }
.section .note { color: var(--graphite); font: 15px/1.6 var(--sans); margin: 8px 0 0; }
.photo { margin: 0 0 32px; }
.photo img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: cover; background: var(--paper-2); }
.photo figcaption { font: 12px/1.5 var(--sans); color: var(--graphite); margin-top: 6px; }
.photo figcaption a { color: var(--graphite); }
.portrait { float: right; width: 220px; margin: 6px 0 16px 28px; }
.portrait figcaption, .cover figcaption { font: 12px/1.5 var(--sans); color: var(--graphite); margin-top: 6px; }
.portrait figcaption a, .cover figcaption a { color: var(--graphite); }
article .body > :first-child { margin-top: 0; }
article .body h2 { font: 800 25px/1.45 var(--serif); margin: 44px 0 12px; }
article .body h3 { font: 700 20px/1.5 var(--serif); margin: 32px 0 8px; }
article .body p { margin: 0 0 1.1em; text-align: justify; }
article .body ul, article .body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
article .body li { margin: .3em 0; }
article .body blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--patina); color: var(--graphite); }
article .body code { font: .88em/1.5 ui-monospace, Menlo, monospace; background: var(--paper-2); padding: 1px 5px; }
article .body strong { color: var(--ink); }
article .body img { margin: 1.2em auto; }
.after { clear: both; margin-top: 48px; border-top: 1px solid var(--rule); padding-top: 20px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font: 15px/1.6 var(--sans); }
.pager a { color: var(--ink); text-decoration: none; }
.pager a:hover { color: var(--patina); }
.pager small { display: block; color: var(--graphite); }
.pager .next { text-align: right; }
.related { margin-top: 36px; }
.related h2 { font: 700 18px/1.5 var(--serif); margin: 0 0 4px; }

aside.toc { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; font: 14px/1.6 var(--sans); padding-top: 6px; }
aside.toc summary { cursor: pointer; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
aside.toc ol { list-style: none; padding: 0 0 0 12px; margin: 0; border-left: 1px solid var(--rule); }
aside.toc li { margin: 7px 0; }
aside.toc li.h3 { padding-left: 14px; }
aside.toc a { color: var(--graphite); text-decoration: none; }
aside.toc a:hover { color: var(--patina); }

.top { position: fixed; right: 16px; bottom: 16px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink); font: 18px/1 var(--sans); text-decoration: none; }
.site-foot { margin-top: 72px; padding: 24px 0 40px; border-top: 1px solid var(--rule); font: 13px/1.9 var(--sans); color: var(--graphite); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.site-foot a { color: var(--graphite); }
.notfound { padding: 80px 0; }

@media (max-width: 900px) {
  .post, .post.no-toc { display: block; }
  aside.toc { position: static; max-height: none; margin: 0 0 28px; padding: 12px 16px; background: var(--paper-2); }
  aside.toc ol { border-left: 0; padding-left: 0; }
  aside.toc .toc-wide { display: none; }
  .lede { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .frieze { height: 120px; }
  .frieze a:nth-child(n+7) { display: none; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .entries { grid-template-columns: 1fr; }
  .entries a { grid-template-columns: 72px minmax(0, 1fr); }
  .entries .thumb { width: 72px; height: 56px; }
  .portrait { float: none; width: 60%; max-width: 240px; margin: 0 0 24px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .toeic { grid-template-columns: 1fr; }
  .toeic em { grid-row: auto; grid-column: auto; margin-top: 4px; }
}
