/* Shared reading layout for the web and WeChat handbooks. */
:root {
  color-scheme: light;
  --paper: #f7f4eb;
  --sheet: #fffdf7;
  --ink: #302c23;
  --muted: #655f51;
  --rule: #ded5bf;
  --gold: #78551f;
  --gold-bg: #f3e9d2;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", SimSun, "STSong", serif;
  font: 16px/1.7 "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ol, dl, dd, figure { margin: 0; }
body { min-width: 0; }
button, input { font: inherit; color: inherit; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #996920; outline-offset: 3px; }
[hidden], dialog:not([open]) { display: none !important; }
.wrap { width: min(1152px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: absolute; top: -150px; left: 10px; padding: .5rem 1rem; background: var(--sheet); z-index: 5; }
.skip:focus { top: 8px; }
.mast { border-bottom: 1px solid var(--rule); background: #fcfaf4; }
.mast-row, .brand, .platforms, .hero-links, .toolbar, .search, .foot, .foot nav {
  display: flex; align-items: center;
}
.mast-row { justify-content: space-between; min-height: 66px; gap: 1rem; }
.brand { gap: .55rem; color: var(--ink); text-decoration: none; font: 700 22px/1.2 var(--serif); letter-spacing: .04em; white-space: nowrap; }
.brand img { width: 34px; height: 34px; }
.platforms { gap: .45rem; }
.platforms a { font-size: .9rem; color: var(--muted); text-decoration: none; padding: .35rem .8rem; border-radius: 4px; }
.platforms a:hover, .platforms a[aria-current="page"] { color: var(--gold); background: var(--gold-bg); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 33%); align-items: center; gap: clamp(30px, 6vw, 96px); padding: 40px 0 34px; border-bottom: 1px solid var(--rule); }
.back { display: inline-block; font-size: .84rem; color: var(--muted); text-decoration: none; }
h1 { font: 700 clamp(2.25rem, 4.4vw, 3.75rem)/1.25 var(--serif); letter-spacing: .02em; margin: .55rem 0 .65rem; }
.intro { max-width: 40em; color: var(--muted); font-size: 1.02rem; line-height: 1.85; }
.hero-links { flex-wrap: wrap; gap: .6rem 1.1rem; margin-top: 1.05rem; font-size: .9rem; }
.main-link { display: inline-block; padding: .48rem .95rem; background: #795821; border: 1px solid #795821; color: white; border-radius: 5px; text-decoration: none; font-weight: 600; }
.main-link:hover { background: #674818; text-decoration: none; }
.hero-shot { text-align: center; }
.shot-link { display: grid; place-items: center; overflow: hidden; border: 1px solid var(--rule); border-radius: 7px; padding: 10px; background: #f3eedf; cursor: zoom-in; text-decoration: none; }
.shot-link:hover { border-color: #a68a52; }
.shot-link img { display: block; max-width: 100%; width: auto; height: auto; max-height: 350px; object-fit: contain; }
.hero-shot .shot-link { background: #f0ead9; }
.hero-shot.board .shot-link { display: inline-grid; padding: 5px; box-shadow: 0 4px 14px #76551917; }
.hero-shot.board img { max-height: 192px; }
.hero-shot figcaption { max-width: 29em; margin-inline: auto; }
figcaption { color: var(--muted); font-size: .82rem; line-height: 1.6; margin-top: .45rem; overflow-wrap: anywhere; }
.reader { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: start; padding: 28px 0 50px; }
.reader > * { min-width: 0; }
.contents { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #cdbd99 transparent; }
.contents-panel { border-left: 2px solid #b69d69; padding-left: 17px; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.contents-panel > summary { display: flex; align-items: center; justify-content: space-between; padding: .18rem .25rem .35rem 0; font-weight: 700; font-size: 1.04rem; }
.contents-panel > summary::after, .lesson > summary::after { content: ""; width: 9px; height: 9px; flex: none; border-right: 1.6px solid var(--gold); border-bottom: 1.6px solid var(--gold); transform: rotate(45deg); margin: 0 3px 4px 10px; }
.contents-panel[open] > summary::after, .lesson[open] > summary::after { transform: rotate(225deg); margin-bottom: -3px; }
.toc-group { margin-top: .78rem; }
.toc-group p { font-size: .8rem; font-weight: 700; color: var(--gold); margin-bottom: .18rem; letter-spacing: .04em; }
.toc-group a { display: block; padding: .18rem .48rem; font-size: .88rem; line-height: 1.5; text-decoration: none; color: var(--muted); border-radius: 3px; }
.toc-group a:hover, .toc-group a[aria-current="location"] { color: var(--gold); background: var(--gold-bg); }
.toolbar { gap: .65rem; flex-wrap: wrap; padding-bottom: .15rem; }
.search { flex: 1 1 14rem; gap: .5rem; min-width: 0; }
.search input { background: var(--sheet); border: 1px solid #b9ad91; border-radius: 5px; padding: .45rem .7rem; width: 100%; min-width: 0; font-size: .94rem; }
.search input::placeholder { color: #6e685a; }
.btn { cursor: pointer; padding: .46rem .8rem; background: var(--sheet); border: 1px solid #c5b694; color: var(--gold); border-radius: 5px; white-space: nowrap; line-height: 1.5; font-size: .9rem; }
.btn:hover { background: var(--gold-bg); }
.btn:disabled { opacity: .5; cursor: default; }
.status { font-size: .84rem; margin-top: .3rem; color: var(--muted); }
.empty { padding: 1.3rem; background: var(--sheet); border: 1px solid var(--rule); margin-top: 1rem; border-radius: 6px; }
.subject { margin-top: 1.65rem; }
.subject h2 { font: 700 1.48rem/1.45 var(--serif); margin: 0 0 .7rem; }
.lesson { scroll-margin-top: 12px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 7px; margin-bottom: .5rem; }
.lesson[open] { border-color: #c9b68c; }
.lesson > summary { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.1rem; }
.lesson > summary:hover { background: #f6f0e3; border-radius: 7px; }
.lesson h3 { font-weight: 600; font-size: 1.025rem; line-height: 1.55; }
.lesson[open] > summary { border-bottom: 1px solid var(--rule); }
.lesson-body { padding: 1.05rem 1.3rem 1.2rem; overflow-wrap: anywhere; }
.lesson-body > * + * { margin-top: .85rem; }
.lesson-body .route { font-size: .875rem; font-weight: 600; color: #6b4d1e; padding-left: .7rem; border-left: 3px solid #bba16f; }
.lesson-body ol { padding-left: 1.6rem; }
.lesson-body li { padding-left: .13rem; }
.lesson-body li + li { margin-top: .48rem; }
.lesson-body li::marker { color: var(--gold); font-weight: 600; }
.lesson-body h4 { font-size: 1rem; margin-bottom: -.32rem; }
.lesson-body dl { display: grid; gap: .6rem; }
.lesson-body dt { font-weight: 650; }
.lesson-body dd { margin-top: .08rem; color: #494336; }
.tip { padding: .62rem .85rem; font-size: .91rem; background: #f5efdd; border-radius: 4px; }
.figures { display: grid; align-items: start; gap: 1rem; }
.figures.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guide-figure.slim .shot-link img { max-height: 286px; }
.footer { border-top: 1px solid var(--rule); }
.foot { justify-content: space-between; gap: .5rem 1.4rem; padding-block: 22px; font-size: .86rem; flex-wrap: wrap; }
.foot nav { gap: .5rem 1.1rem; flex-wrap: wrap; }
.lightbox { width: max-content; max-width: min(94vw, 1180px); max-height: 94vh; max-height: 94dvh; padding: .8rem; background: var(--sheet); color: var(--ink); border: 1px solid #c4b48e; border-radius: 9px; overflow-y: auto; }
.lightbox::backdrop { background: #332f24aa; }
.viewer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-bottom: .65rem; font-size: .88rem; }
.lightbox img { display: block; margin: auto; max-width: 100%; max-height: 69vh; max-height: 69dvh; width: auto; height: auto; object-fit: contain; }
.lightbox figcaption { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 860px) {
  .wrap { width: min(100% - 36px, 740px); }
  .reader { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding-top: 18px; }
  .contents { position: static; overflow: visible; max-height: none; }
  .contents-panel { background: var(--sheet); border: 1px solid var(--rule); padding: .38rem .85rem; border-radius: 5px; }
  .contents-panel > summary { padding: .25rem 0; }
  .contents-panel nav { padding-bottom: .55rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem 1rem; }
  .toc-group a { padding-block: .28rem; }
  .hero { gap: 1.3rem; padding: 24px 0; }
}
@media (max-width: 580px) {
  .wrap { width: calc(100% - 28px); }
  .mast-row { min-height: 55px; gap: .3rem; }
  .brand { font-size: 18px; gap: .3rem; }
  .brand img { width: 27px; height: 27px; }
  .platforms { gap: .12rem; }
  .platforms a { font-size: .77rem; padding: .32rem .44rem; }
  .hero { display: block; }
  h1 { font-size: clamp(1.9rem, 7.2vw, 2.45rem); }
  .intro { font-size: .94rem; }
  .hero-links { font-size: .84rem; gap: .6rem .8rem; }
  .hero-shot { display: flex; gap: .75rem; align-items: center; text-align: left; margin-top: 1rem; }
  .hero-shot .shot-link { padding: 4px; width: 144px; max-width: 45%; flex: none; }
  .hero-shot.board .shot-link { width: 78px; }
  .hero-shot figcaption { margin: 0; font-size: .77rem; max-width: 19em; }
  .toolbar { gap: .5rem; }
  .search { flex-basis: 10rem; }
  .subject { margin-top: 1.25rem; }
  .subject h2 { font-size: 1.3rem; }
  .lesson > summary { padding: .75rem .8rem; }
  .lesson-body { padding: .85rem .85rem 1rem; }
  .lesson-body ol { padding-left: 1.35rem; }
  .figures.pair { grid-template-columns: minmax(0, 1fr); }
  .shot-link img { max-height: 340px; }
}
@media (max-width: 370px) {
  .wrap { width: calc(100% - 20px); }
  .brand { font-size: 16px; }
  .platforms a { padding-inline: .3rem; }
  .btn { padding-inline: .55rem; }
}
@media print {
  :root { background: white; color: black; font-size: 11pt; }
  .mast, .hero-links, .back, .contents, .toolbar, .status, .empty, .footer, .lightbox, .skip { display: none !important; }
  .wrap { width: 100%; }
  .hero { display: block; padding: 0 0 .8rem; }
  .hero-shot { display: none; }
  .reader { display: block; padding: 0; }
  .lesson { border: 0; background: white; }
  .lesson > summary { padding: .6rem 0; border-bottom: 1px solid #bbb; break-after: avoid; }
  .lesson > summary::after { display: none; }
  .lesson-body { padding: .5rem 0 1rem; }
  .figures { break-inside: avoid; }
  .shot-link img { max-height: 190px; }
}
