/* Use the system Song typeface across the Chinese portal, including legacy links. */
html[lang="zh-Hans"],
.preface-zh {
    font-family: "Songti SC", SimSun, "Noto Serif CJK SC", "Source Han Serif SC", serif;
}

html[lang="zh-Hans"] body,
html[lang="zh-Hans"] body *,
.preface-zh * {
    /* Legacy navigation and header rules set the font shorthand. */
    font-family: inherit !important;
}

#jflanguageselection .jflanguageselection > li {
    list-style: none;
}

#jflanguageselection .jflanguageselection > li::marker {
    content: none;
}

#jflanguageselection img[src="/images/flagCN.gif"] {
    position: relative;
    top: -2px;
}

body[data-spaced-heading] .mainright .contentheading {
    padding-bottom: 66px;
}

.portal-album {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 18px;
}

.preface {
    padding: 0 clamp(10px, 2vw, 20px) 24px;
    line-height: 1.85;
}

.preface h2 {
    margin: 1.5em 0 .7em;
    line-height: 1.4;
    font-size: 1.3em;
}

.preface-cover {
    margin: 4.5em 0;
}

.preface-book-photos {
    margin-top: 13.75em;
}

.preface p {
    margin: 0 0 1em;
    text-indent: 2em;
}

.preface .preface-credit {
    padding-top: 7.375em;
    text-align: right;
    text-indent: 0;
}

.preface img {
    display: block;
    width: 100%;
    height: auto;
}

.preface-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 12px;
}

.preface-aside {
    max-width: 420px;
    margin: 1.25em auto 1.5em;
}

.preface-chicken {
    margin-block: 2.75em;
}

.preface-credit + .preface-aside {
    margin-top: 4.5em;
}

.preface-photo-viewer {
    position: fixed;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    background: #181714;
}

.preface-photo-viewer::backdrop { background: rgb(0 0 0 / 82%); }
.preface-photo-viewer img {
    display: block;
    width: min(calc(100vw - 32px), calc((100vh - 32px) * 1.78025));
    width: min(calc(100vw - 32px), calc((100dvh - 32px) * 1.78025));
    aspect-ratio: 1280 / 719;
    object-fit: contain;
    cursor: zoom-out;
}

.preface-photo-viewer button {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 36px;
    min-height: 36px;
    color: white;
    background: #222;
    border: 1px solid #aaa;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
}
.portal-album figure { margin: 0; }
.portal-album img {
    display: block;
    max-width: 100%;
    height: auto;
}
.portal-album figcaption { font-size: 13px; line-height: 1.4; margin-top: 6px; }

.portal-audio {
    width: 100%;
    max-width: 390px;
    margin: 8px auto 16px;
}

/* Keep the legacy two-column layout inside the page at higher zoom levels. */
#head .center,
#main .center,
.topMenu ul {
    max-width: 100%;
}

.mainright > table.contentpaneopen {
    width: 100%;
    margin-right: 0;
    table-layout: fixed;
    overflow-wrap: break-word;
}

.contentpaneopen img {
    --photo-frame: clamp(8px, 3vw, 25px);
    max-width: calc(100% - 2 * var(--photo-frame));
    height: auto;
    border-width: var(--photo-frame);
}

.contentpaneopen .buttonheading img {
    max-width: 100%;
    border-width: 0;
}

/* Hide the legacy body divider without shifting the column. */
.col2 .mainright { border-right-color: transparent; }
