@font-face {
  font-family: 'Instrument Serif';
  src: url('instrument-serif.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f8f6ee;
  --surface: #fcfbf7;
  --ink: #252c22;
  --muted: #5a6255;
  --forest: #31523c;
  --sage: #e6eddf;
  --rust: #9b452d;
  --rule: #dcded2;
  --sans: 'PingFang SC', 'Microsoft YaHei UI', 'Noto Sans CJK SC', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 2rem; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.65 var(--sans); }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; }

.frame { width: min(100% - 6rem, 73rem); margin-inline: auto; }
.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 1; top: 1rem; left: 1rem; padding: .45rem .8rem; background: var(--surface); }

.topbar { border-bottom: 1px solid var(--rule); }
.topbar-inner { display: flex; min-height: 4.75rem; justify-content: space-between; align-items: center; gap: 1rem; }
.wordmark { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.mark { display: grid; width: 2.15rem; height: 2.15rem; place-items: center; border-radius: .5rem; background: var(--rust); color: #fff8e7; font: 1.65rem/.9 var(--serif); padding-bottom: .18rem; }
.wordmark-latin { font: 2rem/.95 var(--serif); }
.wordmark-zh { margin-left: .14em; font-size: .92rem; font-weight: 700; }
.topbar nav { display: flex; gap: clamp(1rem, 3vw, 2.2rem); font-size: .9rem; font-weight: 600; }
.topbar nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.topbar nav a:hover { color: var(--forest); text-decoration: underline; text-underline-offset: .35em; }

.hero { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.12fr); align-items: center; column-gap: clamp(2.4rem, 6vw, 6.25rem); padding-block: clamp(2.6rem, 5.5vw, 5rem); }
.hero-label { display: flex; align-items: center; gap: .68rem; margin: 0 0 1rem; color: var(--rust); font-size: .85rem; font-weight: 700; letter-spacing: .17em; }
.hero-label::before { content: ''; width: 1.65rem; height: 1px; background: currentColor; }
.hero h1 { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .11em; margin: 0; line-height: 1.04; font-size: clamp(3.2rem, 6.6vw, 6.25rem); font-weight: 400; letter-spacing: -.04em; }
.hero-latin { font-family: var(--serif); }
.hero-zh { font-size: .58em; font-weight: 700; line-height: 1.3; letter-spacing: -.075em; }
.hero-intro { max-width: 22rem; margin: 1.15rem 0 1.7rem; color: var(--muted); font-size: clamp(1rem, 1.35vw, 1.13rem); line-height: 1.85; }
.hero-link { display: inline-flex; min-height: 2.85rem; align-items: center; gap: 1.1rem; padding: .5rem .95rem .52rem 1.12rem; background: var(--forest); border-radius: .4rem; color: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; }
.hero-link:hover { background: #253f2d; }
.hero-link span { font-size: 1.17rem; line-height: 1; }
.hero-image { width: 100%; height: auto; aspect-ratio: 1.56; object-fit: cover; border-radius: .85rem; background: #d5b88f; }

.notes-section { padding-block: clamp(1.6rem, 4vw, 2.75rem) clamp(2rem, 5vw, 4rem); border-top: 1px solid var(--rule); }
.notes-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.notes-heading h2, .about h2 { margin: 0; color: var(--ink); font-size: clamp(1.55rem, 2.9vw, 2.15rem); line-height: 1.3; letter-spacing: -.06em; }
.search { display: flex; align-items: center; gap: .65rem; width: min(15rem, 100%); min-height: 2.55rem; padding: .3rem .75rem; border: 1px solid var(--rule); border-radius: .45rem; background: var(--surface); color: var(--muted); }
.search:focus-within { outline: 2px solid var(--forest); outline-offset: 2px; }
.search-icon { position: relative; width: .77rem; height: .77rem; border: 1.5px solid currentColor; border-radius: 100%; flex: 0 0 auto; }
.search-icon::after { content: ''; position: absolute; top: .59rem; left: .54rem; width: .38rem; height: 1.5px; background: currentColor; transform: rotate(45deg); transform-origin: left; }
.search input { width: 100%; min-width: 0; background: transparent; border: 0; padding: 0 .15rem; color: var(--ink); font-size: .875rem; outline: none; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.filters button { min-height: 2.25rem; padding: .26rem .8rem; border: 1px solid var(--rule); border-radius: 2rem; background: transparent; color: var(--muted); font-size: .8rem; cursor: pointer; }
.filters button:hover { border-color: var(--forest); color: var(--forest); }
.filters button[aria-pressed='true'] { background: var(--forest); border-color: var(--forest); color: #fff; }

.notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; list-style: none; padding: 0; margin: 0; }
.note-card { display: flex; }
.note-link { position: relative; display: flex; flex: 1; flex-direction: column; gap: .65rem; min-height: 10.5rem; padding: 1.28rem 3rem 1.35rem 1.35rem; border: 1px solid var(--rule); border-radius: .65rem; background: var(--surface); text-decoration: none; }
.note-link:hover { border-color: #9aa990; background: #f5f7ee; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .72rem; line-height: 1.35; }
.category { display: inline-flex; padding: .24em .55em; background: var(--sage); border-radius: .25rem; color: var(--forest); font-size: .75rem; font-weight: 700; }
.note-card[data-category='tools'] .category { background: #f4e7de; color: #873f2c; }
.reading-time { font-size: .75rem; color: var(--muted); }
.note-link h3 { margin: 0; color: var(--ink); font-weight: 700; font-size: clamp(1.03rem, 1.6vw, 1.28rem); line-height: 1.5; }
.note-link p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.7; }
.note-arrow { position: absolute; inset: 1.12rem 1.25rem auto auto; color: var(--forest); font-size: 1.4rem; }
.empty { border: 1px dashed #a8ad9e; border-radius: .65rem; padding: 1.25rem; color: var(--muted); }

.about { display: grid; grid-template-columns: 1fr 2.4fr; align-items: start; gap: 1rem 2rem; padding: clamp(1.5rem, 4vw, 2.65rem); border-radius: .75rem; background: var(--sage); }
.about h2 { color: var(--forest); font-size: clamp(1.3rem, 2.3vw, 1.65rem); }
.about p { margin: 0; max-width: 42rem; color: var(--forest); }
.footer { display: flex; justify-content: center; margin-top: 3.5rem; padding-block: 1.55rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .84rem; }
.filing { text-underline-offset: .2em; }
.filing:hover { color: var(--forest); }

.article-frame { max-width: 48rem; padding-top: clamp(1.35rem, 5vw, 3rem); }
.back-link { display: inline-flex; gap: .48rem; color: var(--forest); font-size: .9rem; font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; text-underline-offset: .26em; }
.article-header { margin-block: 1.8rem 2.3rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--rule); }
.article-header h1 { margin: .82rem 0 .6rem; font-size: clamp(1.9rem, 4.2vw, 3.35rem); line-height: 1.25; letter-spacing: -.054em; }
.article-header p { margin: 0; line-height: 1.8; color: var(--muted); }
.article-section { margin-bottom: 2rem; }
.article-section h2, .article-references h2 { margin: 0 0 .75rem; font-size: clamp(1.2rem, 2.5vw, 1.55rem); line-height: 1.4; }
.article-section p { margin: .75rem 0; line-height: 1.9; }
.article-section pre { margin: 1rem 0; padding: 1rem 1.2rem; overflow: auto; border-radius: .52rem; background: #26372c; color: #f6f7ec; }
.article-section code, kbd { font: .89em/1.7 var(--mono); }
.article-section p code, kbd { background: var(--sage); color: #254332; padding: .08em .22em; border-radius: .2rem; overflow-wrap: anywhere; }
.article-references { padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.article-references ul { padding-left: 1.2rem; }
.article-references a, .article-navigation a { color: var(--forest); text-underline-offset: .24em; }
.article-navigation { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; margin-top: 2.1rem; padding: .85rem 1rem; border-radius: .52rem; background: var(--sage); }
.article-navigation span { color: var(--forest); font-size: .85rem; }
.article-navigation a { font-weight: 700; }

@media (max-width: 760px) {
  .frame { width: calc(100% - 2.75rem); }
  .hero { grid-template-columns: 1fr; gap: 1.75rem; padding-block: 2.2rem 2.25rem; }
  .hero h1 { font-size: clamp(3.5rem, 12vw, 5.75rem); }
  .hero-intro { margin-block: .75rem 1.2rem; }
  .hero-image { aspect-ratio: 1.7; }
  .note-link { padding-right: 2.65rem; }
  .footer { margin-top: 2.25rem; }
}

@media (max-width: 540px) {
  .frame { width: calc(100% - 2.2rem); }
  .topbar-inner { min-height: 4rem; }
  .topbar nav { gap: .9rem; font-size: .78rem; }
  .wordmark { gap: .4rem; }
  .wordmark-latin { font-size: 1.7rem; }
  .wordmark-zh { font-size: .83rem; }
  .mark { width: 1.8rem; height: 1.8rem; font-size: 1.4rem; }
  .notes-grid, .about { grid-template-columns: 1fr; }
  .search { width: min(10.2rem, 55%); }
  .note-link { min-height: 0; }
  .about { gap: .6rem; }
}
