:root {
  color-scheme: light;
  --paper: #f7f6f1;
  --surface: #fffefa;
  --ink: #202521;
  --muted: #555e57;
  --link: #234ec3;
  --line: #dcdcd2;
  --highlight: #fae9ad;
  --highlight-ink: #634611;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, ol, ul, p, figure { margin: 0; }
a { color: var(--link); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
.wrap { width: min(1080px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: absolute; left: 14px; top: 8px; background: var(--surface); padding: 8px 12px; transform: translateY(-150%); z-index: 2; }
.skip:focus { transform: none; }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 68px; }
.wordmark { display: inline-flex; align-items: baseline; gap: 12px; color: var(--ink); font-size: 25px; font-weight: 800; text-decoration: none; }
.wordmark span { font-size: 14px; font-weight: 650; }
.top nav { display: flex; gap: 16px; flex-wrap: wrap; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 5px; color: var(--muted); font-size: 14px; text-decoration: none; white-space: nowrap; }
.top nav a[aria-current] { color: var(--link); text-decoration: underline; font-weight: 700; }

.intro { border-bottom: 1px solid var(--line); margin-bottom: 30px; padding: clamp(35px, 6vw, 78px) 0 28px; }
.eyebrow { color: var(--link); font-size: 13px; font-weight: 750; letter-spacing: .03em; }
h1 { max-width: 19em; margin-top: 10px; font-size: clamp(2rem, 5vw, 4.1rem); font-weight: 800; line-height: 1.13; letter-spacing: -.045em; }
.description { margin-top: 16px; color: var(--muted); }
.home-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.home-layout h2 { font-size: 22px; margin-bottom: 13px; }
.lessons, .notes, .jump ul, .ideas ol { list-style: none; padding: 0; }
.lessons li + li { margin-top: 10px; }
.lesson-link, .writing-card { border: 1px solid var(--line); border-radius: 9px; padding: 20px; }
.lesson-link { position: relative; display: grid; gap: 4px; padding-right: 52px; background: var(--surface); color: var(--ink); text-decoration: none; }
.lesson-link:hover { border-color: var(--link); }
.lesson-no { color: var(--link); font-size: 13px; font-weight: 750; }
.lesson-link strong { font-size: 19px; }
.meta { color: var(--muted); font-size: 13px; }
.arrow { position: absolute; right: 21px; top: 21px; color: var(--link); font-weight: 700; }
.writing-card { background: #f5efd9; }
.writing-card p { color: #514b37; }
.button { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 13px; color: var(--ink); font-weight: 750; }

.reading-layout { display: grid; grid-template-columns: minmax(175px, .30fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.jump { position: sticky; top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.jump h2 { font-size: 16px; margin-bottom: 4px; }
.jump a { display: flex; align-items: center; min-height: 38px; padding: 5px 0; font-size: 14px; text-decoration: none; }
.jump a:hover { text-decoration: underline; }
.jump .writing-link { margin-top: 8px; border-top: 1px solid var(--line); font-weight: 750; }
.cross-reference { margin: 0 0 12px; font-size: 14px; }
.photo-section { padding: clamp(15px, 3vw, 27px); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); scroll-margin-top: 16px; }
.section-head, .note-head, .idea-meta { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; }
.section-head { margin-bottom: 8px; }
.section-head h2 { font-size: clamp(1.38rem, 3vw, 1.8rem); line-height: 1.28; }
.photo-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; margin-top: 12px; }
.note { border-top: 1px solid var(--line); padding: 13px 0 15px; scroll-margin-top: 20px; }
.note:target { border-top-color: #c6a455; border-radius: 4px; background: #fcf3d6; }
.note h3 { font-size: 15px; font-weight: 750; }
.transcription { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mark { display: inline-flex; align-items: center; flex: 0 0 auto; border-radius: 4px; padding: 2px 8px; background: var(--highlight); color: var(--highlight-ink); font-size: 13px; font-weight: 750; }
.uncertain { color: #78531a; background: #faf1d9; }
.annotation { color: var(--muted); }
.original img { display: block; width: 100%; height: auto; aspect-ratio: auto 3 / 4; border-radius: 5px; background: var(--paper); }
.original figcaption { display: grid; justify-items: start; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.zoom-button, .photo-viewer button { min-height: 44px; padding: 5px 0; border: 0; color: var(--link); background: none; font: inherit; font-size: 14px; font-weight: 720; cursor: pointer; text-decoration: underline; text-underline-offset: .22em; }
.photo-viewer { width: min(1100px, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }
.photo-viewer::backdrop { background: rgb(20 25 22 / 70%); }
.photo-viewer header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.photo-viewer h2 { font-size: 16px; }
.photo-viewer form { margin: 0; }
.photo-viewer img { display: block; width: 100%; height: auto; }

.idea-list { max-width: 780px; }
.ideas + .ideas { margin-top: 28px; }
.ideas h2 { margin-bottom: 12px; font-size: 19px; }
.idea { padding: 18px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.idea-meta { justify-content: flex-start; align-items: center; }
.idea h3 { margin-top: 8px; font-size: 18px; }
.idea a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; margin-top: 3px; font-size: 14px; }
.footer { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 38px; padding-block: 16px 26px; color: var(--muted); font-size: 13px; }

@media (min-width: 861px) and (min-height: 690px) {
  .original { position: sticky; top: 16px; }
}

@media (max-width: 860px) {
  .photo-body { grid-template-columns: minmax(0, 1fr); }
  .original img { max-width: 540px; }
}

@media (max-width: 670px) {
  .wrap { width: calc(100% - 32px); }
  .top-inner { flex-direction: column; align-items: stretch; gap: 0; padding-top: 9px; }
  .top nav { gap: 8px; }
  .top nav a { padding-inline: 4px; }
  .intro { margin-bottom: 18px; padding-bottom: 19px; }
  .home-layout, .reading-layout { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .jump { position: static; }
  .jump ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 9px; }
  .jump a { min-height: 44px; }
  .note-head { gap: 4px 7px; }
  .footer { margin-top: 23px; }
}
