body { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
.folio { width: min(88rem, calc(100% - 2 * clamp(1rem, 4.7vw, 5rem))); margin-inline: auto; }
.skip { position: absolute; z-index: 3; top: .5rem; left: 1rem; padding: .5rem 1rem; background: var(--mw-surface); }
.skip:not(:focus) { transform: translateY(-180%); }
.masthead { border-bottom: 1px solid var(--mw-divider); }
.masthead-inner, .identity, .masthead-nav, .light-switch, .hero-actions,
.plate-caption, .expand, .section-heading, .colophon, .reader-head { display: flex; align-items: center; }
.masthead-inner { min-height: 5rem; column-gap: clamp(1rem, 3vw, 3rem); }
.identity { gap: .75rem; margin-right: auto; color: var(--mw-text); text-decoration: none; }
.mountain-seal {
  position: relative; width: 2.5rem; height: 2.5rem; flex: none;
  background: var(--mw-action); color: var(--mw-on-action); border-radius: 2px;
}
.mountain-seal::before, .mountain-seal::after { content: ""; position: absolute; }
.mountain-seal::before {
  inset: 16% 10%; background: currentColor;
  clip-path: polygon(2% 84%, 26% 45%, 36% 59%, 57% 9%, 68% 41%, 73% 30%, 98% 79%, 77% 55%, 72% 64%, 64% 49%, 58% 28%, 39% 80%, 29% 67%);
}
.mountain-seal::after { right: 18%; top: 14%; width: 9%; aspect-ratio: 1; background: currentColor; border-radius: 50%; }
.wordmark { font: 700 1.42rem/1.25 var(--mw-font-display); letter-spacing: .12em; }
.wordmark span { display: block; margin-top: .15rem; font: 600 .55rem/1.2 var(--yq-mono); letter-spacing: .11em; }
.masthead-title { margin-left: .38rem; border-left: 1px solid var(--mw-divider); padding-left: 1.08rem; color: var(--mw-text-muted); font: 500 .9rem/1.4 var(--mw-font-display); letter-spacing: .12em; }
.masthead-nav { align-self: stretch; gap: clamp(1rem, 2.7vw, 2.8rem); }
.masthead-nav a {
  display: grid; grid-template-rows: auto 2px; place-content: center; justify-items: center; row-gap: .22em;
  min-height: 44px; color: var(--mw-text-muted); font-size: .86rem; text-decoration: none;
}
.masthead-nav a::after { content: ""; width: .9rem; height: 2px; }
.masthead-nav a[aria-current], .masthead-nav a:hover { color: var(--mw-action); }
.masthead-nav a[aria-current]::after { background: currentColor; }
.light-switch {
  border: 1px solid var(--mw-divider); border-radius: 2px; padding: .36rem .85rem; gap: .5rem;
  background: transparent; color: var(--mw-text); font-size: .8rem; line-height: 1.55;
}
.light-switch:hover, .close-reader:hover { background: var(--mw-surface-muted); }
.moon-icon { display: block; width: .8rem; height: .8rem; border-radius: 50%; box-shadow: inset .25rem -.12rem 0 currentColor; transform: rotate(-13deg); }
[data-mw-theme="ink"] .moon-icon { border: 1px solid currentColor; box-shadow: 0 0 0 2px var(--mw-bg), 0 0 0 3px currentColor; transform: scale(.72); }

.frontispiece { margin: clamp(1.1rem, 2vw, 2rem) 0 0; }
.hero {
  --painting-paper: #e9dfca; position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; min-height: clamp(24.5rem, 32.2vw, 31.8rem);
  border: 1px solid var(--mw-divider); background: var(--painting-paper);
}
.hero-art { position: absolute; inset: 0; z-index: -1; background: url("art/shanmen.webp") center / cover no-repeat; }
[data-mw-theme="ink"] .hero { --painting-paper: #152421; }
[data-mw-theme="ink"] .hero-art { background-image: url("art/shanmen-night.webp"); }
.hero-copy { width: fit-content; max-width: 55%; padding: 2.6rem clamp(1.5rem, 4.4vw, 4.8rem); padding-right: 0; }
.kicker { display: flex; align-items: center; gap: .65rem; margin: 0 0 1rem; font-size: .76rem; font-weight: 600; letter-spacing: .2em; color: #71362b; }
.kicker span { height: 1px; width: 1.7rem; background: currentColor; position: relative; }
.kicker span::after { content: ""; position: absolute; top: -2px; right: 0; width: 5px; height: 5px; background: currentColor; transform: rotate(45deg); }
[data-mw-theme="ink"] .kicker { color: var(--mw-action); }
.hero h1 { display: flex; align-items: flex-start; gap: .1em; margin: 0; font: 600 clamp(5.75rem, 8vw, 8.25rem)/1.08 var(--mw-font-display); letter-spacing: .055em; color: #192b29; }
[data-mw-theme="ink"] .hero h1 { color: var(--mw-text); }
.name-seal { margin-top: .8em; padding: .24em .11em; writing-mode: vertical-rl; border: 1px solid currentColor; border-radius: 2px; color: var(--mw-action); font: 700 clamp(.68rem,.85vw,.83rem)/1 var(--mw-font-display); letter-spacing: .05em; }
.roman-title { margin: .35rem 0 0 .2rem; font: italic clamp(1.55rem, 2.25vw, 2.2rem)/1.15 Baskerville, "Baskervville", Georgia, serif; color: #414f43; }
[data-mw-theme="ink"] .roman-title { color: #d4cfac; }
.hero-intro { margin: 1.25rem 0 1.55rem; color: #263530; font: 500 clamp(.91rem, 1.15vw, 1.07rem)/1.7 var(--mw-font-display); }
[data-mw-theme="ink"] .hero-intro { color: #e7e9da; }
.hero-actions { gap: clamp(1.1rem, 2.1vw, 2rem); }
.primary-action, .text-action { display: inline-flex; align-items: center; justify-content: center; gap: .85rem; min-height: 44px; text-decoration: none; font-size: .86rem; font-weight: 550; letter-spacing: .05em; }
.primary-action { padding: .55rem 1.25rem; background: var(--mw-action); border: 1px solid var(--mw-action); color: var(--mw-on-action); border-radius: 2px; }
.primary-action:hover { background: var(--mw-action-hover); }
.text-action { gap: .5rem; color: var(--mw-text); }
.text-action:hover, .colophon a:hover, .expand:hover { text-decoration: underline; text-underline-offset: .3em; }
.hero-actions a span { font: 1.15rem/1 system-ui, sans-serif; }
.frontispiece figcaption { display: flex; justify-content: space-between; align-items: center; gap: .5rem; border-bottom: 1px solid var(--mw-divider); min-height: 2.6rem; color: var(--mw-text-muted); }
.plate-caption, .expand { font-size: .72rem; letter-spacing: .09em; line-height: 1.4; }
.plate-caption { gap: .63rem; }
.target { display: inline-block; width: .62rem; height: .62rem; border: 1px solid var(--yq-brass); position: relative; transform: rotate(45deg); }
.target::after { content: ""; position: absolute; inset: 2px; background: var(--yq-brass); }
.caption-rule { width: 1rem; height: 1px; background: var(--mw-control-border); }
.expand { gap: .6rem; padding: .5rem 0 .5rem .5rem; border: 0; background: transparent; color: var(--mw-text-muted); }
.expand i { width: .8rem; height: .8rem; background: linear-gradient(currentColor,currentColor) left top/40% 1px,linear-gradient(currentColor,currentColor) left top/1px 40%,linear-gradient(currentColor,currentColor) right bottom/40% 1px,linear-gradient(currentColor,currentColor) right bottom/1px 40%; background-repeat: no-repeat; }

.atlas { margin-block: clamp(2rem, 3.3vw, 3.5rem) clamp(2.5rem, 4.1vw, 4.2rem); scroll-margin-top: 1.5rem; }
.section-heading { gap: 1rem; margin-bottom: 1.25rem; }
.section-heading h2, .reader-head h2 { margin: 0; font: 600 clamp(1.65rem, 2.2vw, 2.15rem)/1.4 var(--mw-font-display); letter-spacing: .08em; }
.section-english { color: var(--mw-text-muted); font: .65rem/1.3 var(--yq-mono); letter-spacing: .15em; }
.ledger-line { flex: 1; height: 1px; background: var(--mw-divider); position: relative; }
.ledger-line::after { content: ""; position: absolute; right: 0; top: -2px; height: 5px; width: 5px; background: var(--yq-brass); transform: rotate(45deg); }
.plates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.85rem, 1.65vw, 1.65rem); }
.plate { min-width: 0; padding: 0; text-align: start; background: var(--mw-surface); color: var(--mw-text); border: 1px solid var(--mw-divider); border-radius: 2px; transition: border-color var(--mw-transition); }
.plate:hover { border-color: var(--yq-brass); }
.plate img { display: block; width: 100%; height: auto; aspect-ratio: 3/1; object-fit: cover; border-bottom: 1px solid var(--mw-divider); }
.plate-body { display: grid; position: relative; gap: .35rem; padding: 1rem clamp(1rem, 1.6vw, 1.5rem) 1.15rem; }
.plate-type { color: var(--yq-jade); font: 600 .68rem/1.5 var(--mw-font-body); letter-spacing: .08em; }
.plate-type span { margin-left: .15em; font: .61rem/1.4 var(--yq-mono); letter-spacing: .1em; }
.plate strong { font: 600 clamp(1.35rem, 1.7vw, 1.75rem)/1.4 var(--mw-font-display); letter-spacing: .09em; }
.plate-summary { color: var(--mw-text-muted); font-size: .82rem; line-height: 1.6; }
.plate-arrow { position: absolute; right: 1.2rem; top: .9rem; color: var(--yq-brass); font: 1.15rem/1.2 system-ui, sans-serif; }
.plate:hover .plate-arrow { color: var(--mw-action); }
.colophon { justify-content: space-between; gap: .8rem; border-top: 1px solid var(--mw-divider); min-height: 4rem; font-size: .74rem; color: var(--mw-text-muted); }
.colophon span span { margin-inline: .4rem; }
.colophon a { color: inherit; text-decoration: none; }

.reader { inline-size: min(35rem, calc(100% - 2rem)); max-block-size: calc(100dvh - 2rem); padding: clamp(1.15rem, 3vw, 2rem); color: var(--mw-text); background: var(--mw-surface); border: 1px solid var(--yq-brass); border-radius: 2px; overflow: auto; overscroll-behavior: contain; }
.reader:has(.painting:not([hidden])) { inline-size: min(70rem, calc(100% - 2rem)); }
.reader::backdrop { background: rgb(10 25 24 / .76); }
body:has(.reader[open]) { overflow: hidden; }
.reader-head { justify-content: space-between; gap: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--mw-divider); }
.close-reader { width: 44px; height: 44px; border: 1px solid var(--mw-divider); background: transparent; color: var(--mw-text); font: 1.6rem/1 var(--yq-mono); }
.reader-section p { margin: 1rem 0; font-size: .94rem; line-height: 1.8; }
.painting img { display: block; width: 100%; height: auto; margin-top: 1rem; }
.painting p { margin-bottom: 0; }
.swatches { display: grid; margin: 1rem 0; }
.swatches div { display: grid; grid-template-columns: 1.7rem 1fr auto; gap: .9rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--mw-divider); }
.swatches div::before { content: ""; height: 1.4rem; background: var(--swatch); border: 1px solid var(--mw-control-border); }
.swatches dd, .geometry-study dd { margin: 0; color: var(--mw-text-muted); font: .85rem/1.5 var(--yq-mono); }
.reader-link { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; font-size: .86rem; }
.geometry-study { display: flex; align-items: center; justify-content: center; gap: clamp(1rem, 4vw, 3.5rem); margin: 1.25rem 0; padding: 1rem; border: 1px solid var(--mw-divider); }
.geometry-study dl { flex: auto; max-width: 12rem; margin: 0; }
.geometry-study dl div { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--mw-divider); padding: .35rem 0; font-size: .85rem; }
.instrument { display: grid; place-items: center; flex: none; width: clamp(3.8rem, 12vw, 6.5rem); aspect-ratio: 1; border: 1px solid var(--yq-brass); border-radius: 50%; position: relative; background: repeating-conic-gradient(var(--yq-brass) 0 1deg, transparent 1deg 15deg); }
.instrument i { width: 89%; height: 89%; background: var(--mw-surface); border: 1px solid var(--yq-brass); border-radius: 50%; }
.instrument b { position: absolute; width: 125%; height: 32%; border: 1px solid var(--yq-jade); border-radius: 50%; transform: rotate(-38deg); }
.instrument::after { content: ""; width: 14%; height: 14%; border-radius: 50%; position: absolute; background: var(--mw-action); }
.type-study { margin: 1rem 0; padding: 1.2rem; border-block: 1px solid var(--mw-divider); }
.type-study output { display: block; font: 600 clamp(2.15rem, 6vw, 3.5rem)/1.4 var(--mw-font-display); overflow-wrap: anywhere; }
.type-study span { font: .66rem/1.2 var(--yq-mono); color: var(--yq-jade); letter-spacing: .12em; }
.sample-label { display: block; margin: 1rem 0 .4rem; font-size: .9rem; }
#type-input { min-height: 44px; font-size: 1rem; }

@media (max-width: 63rem) and (min-width: 44.01rem) {
  .hero-copy { padding-left: 2rem; }
  .hero-art { background-position: 62% center; }
  .hero-intro { max-width: 14em; }
}
@media (max-width: 44rem) {
  .masthead-inner { min-height: 4rem; gap: 0 1rem; flex-wrap: wrap; justify-content: space-between; }
  .identity { gap: .55rem; }
  .mountain-seal { width: 2rem; height: 2rem; }
  .wordmark { font-size: 1.1rem; }
  .wordmark span { font-size: .5rem; }
  .masthead-title { font-size: .85rem; padding-left: .65rem; margin-left: .1rem; }
  .masthead-nav { order: 3; width: 100%; justify-content: flex-start; gap: 2rem; border-top: 1px solid var(--mw-divider); }
  .masthead-nav a { min-width: 44px; }
  .light-switch { margin-block: .55rem; }
  .frontispiece { margin-top: 1rem; }
  .hero { display: grid; align-content: end; min-height: 0; }
  .hero-art { position: relative; z-index: 0; height: clamp(11.25rem, 44vw, 17rem); background-position: 77% center; }
  .hero-art::after { content: ""; position: absolute; inset: auto 0 -1px; height: 25%; background: linear-gradient(transparent, var(--painting-paper)); }
  .hero-copy { max-width: 100%; padding: .3rem 1.4rem 1.4rem; }
  .kicker { margin-bottom: .55rem; font-size: .67rem; }
  .hero h1 { font-size: clamp(4.5rem, 18vw, 6.6rem); }
  .roman-title { margin-top: .1rem; font-size: 1.45rem; }
  .hero-intro { margin: .75rem 0 .9rem; }
  .plates { grid-template-columns: 1fr; gap: 1rem; }
  .plate-body { padding: .9rem 1.1rem 1.05rem; }
  .plate strong { font-size: 1.5rem; }
  .section-heading { gap: .75rem; }
}
@media (pointer: coarse) { .light-switch, .expand, .colophon a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; } }
