@charset "UTF-8";

:root {
  --serif: "STSong", "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
  --sans: "Microsoft YaHei", "PingFang SC", sans-serif;
  --brown: #3f3028;
  --brown-deep: #251914;
  --paper: #f2eadb;
  --gold: #ae824c;
  --line: rgba(100, 67, 42, .24);
}
* { box-sizing: border-box; }
html, body { min-width: 320px; margin: 0; }
html { scroll-behavior: smooth; }
body { color: var(--brown); background: var(--paper); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
button, summary { font: inherit; }
button { color: inherit; }
button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid #a16932; outline-offset: 4px; }
img { max-width: 100%; }

/* 首屏延续 B 小样的木构、灯火、图谱与运镜。 */
.theme-hall {
  --ink: #f5ead6;
  --muted: #c0ae93;
  --accent: #dbb979;
  --hairline: rgba(214, 178, 115, .24);
  --panel: rgba(43, 29, 22, .96);
  --hover: rgba(233, 189, 118, .11);
  --background: #251914;
  --texture: radial-gradient(ellipse at 71% 47%, rgba(186,117,49,.25), transparent 37%), radial-gradient(ellipse at 50% 112%, rgba(159,85,36,.23), transparent 50%), repeating-linear-gradient(90deg, transparent 0 15.7%, rgba(11,7,5,.34) 15.8% 16.7%, rgba(165,117,73,.06) 16.8% 17%, transparent 17.1% 33%), linear-gradient(105deg, #1d1411, #3b2920 52%, #1b1412);
  --diagram-glow: radial-gradient(ellipse, rgba(204,138,69,.17), transparent 65%);
  color: var(--ink);
}
.page { isolation: isolate; position: relative; overflow: hidden; min-height: 720px; min-height: max(720px, 100svh); background: var(--background); }
.page::before, .page::after { content: ""; position: absolute; pointer-events: none; z-index: -1; }
.page::before { inset: 0; background: var(--texture); }
.page::after { inset: 18px 24px; border: 1px solid rgba(217,175,110,.28); box-shadow: inset 0 0 0 5px rgba(20,12,9,.3); }
.masthead { position: absolute; z-index: 4; inset: 36px 5.2% auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.logo { display: block; width: 160px; height: 52px; object-fit: contain; object-position: left top; }
.sample-mark { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: 255px; text-align: right; }
.sample-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.sample-badge::before { content: ""; width: 7px; height: 7px; background: currentColor; transform: rotate(45deg); }
.notice { font-size: 11px; letter-spacing: .05em; line-height: 1.6; color: var(--muted); }
.hero-copy { position: absolute; z-index: 2; top: 50%; left: 8.1%; width: 38%; max-width: 500px; transform: translateY(-47%); pointer-events: none; }
.eyebrow { display: flex; align-items: flex-start; gap: 12px; color: var(--accent); font-size: 12px; letter-spacing: .12em; line-height: 1.9; }
.eyebrow::before { content: ""; flex: 0 0 26px; height: 1px; margin-top: .95em; background: currentColor; }
.hero-copy h1 { margin: 29px 0 24px; font-family: var(--serif); font-size: clamp(34px, 3.15vw, 48px); font-weight: 400; letter-spacing: .09em; line-height: 1.65; }
.hero-copy h1 span { display: block; white-space: nowrap; }
.subtitle { display: flex; align-items: center; gap: 14px; color: var(--muted); font-family: var(--serif); font-size: 16px; letter-spacing: .2em; }
.subtitle::after { content: ""; width: 42px; height: 1px; background: currentColor; opacity: .55; }
.diagram { position: absolute; inset: 9% 1.5% 10% 38%; }
.diagram::before { content: ""; position: absolute; inset: 2% -2%; border-radius: 50%; pointer-events: none; background: var(--diagram-glow); }
.diagram::after { content: ""; position: absolute; inset: 8% 3%; pointer-events: none; background: radial-gradient(ellipse at 50% 60%, rgba(237,173,92,.12), transparent 52%); filter: blur(28px); animation: breathe 8s ease-in-out infinite alternate; }
.graph { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; }
.graph:active { cursor: grabbing; }
.graph canvas, .graph svg { display: block; width: 100%; height: 100%; }
.graph svg { overflow: visible; }
.graph [data-person] { cursor: pointer; }
.diagram-caption { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); white-space: nowrap; color: var(--muted); font-size: 11px; letter-spacing: .16em; pointer-events: none; }
.diagram-caption::before, .diagram-caption::after { content: ""; display: inline-block; width: 24px; height: 1px; margin: 0 10px 3px; background: currentColor; opacity: .45; }
.person-card { position: absolute; z-index: 5; right: 1%; bottom: 7%; width: min(260px, 75%); padding: 20px 23px 19px; color: var(--ink); background: var(--panel); border: 1px solid var(--hairline); box-shadow: 0 14px 45px rgba(21,12,6,.18); backdrop-filter: blur(12px); }
.person-card[hidden] { display: none; }
.card-close { position: absolute; top: 9px; right: 11px; border: 0; padding: 2px 5px; background: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.card-kicker { color: var(--accent); font-size: 10px; letter-spacing: .22em; }
.card-name { display: block; margin-top: 10px; font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: .1em; }
.card-date, .card-story { margin: 8px 0 0; font-size: 12px; line-height: 1.7; letter-spacing: .05em; }
.card-date { color: var(--muted); }
.card-story { padding-top: 9px; border-top: 1px solid var(--hairline); }
.card-story[hidden] { display: none; }
.hero-footer { position: absolute; z-index: 3; inset: auto 5.3% 36px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; color: var(--muted); }
.footer-label { font-family: var(--serif); font-size: 12px; letter-spacing: .24em; }
.footer-label span { display: block; }
.footer-label span + span { margin-top: 7px; font-family: var(--sans); font-size: 9px; letter-spacing: .17em; opacity: .75; }
.scroll-cue { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 10px; letter-spacing: .18em; }
.scroll-cue::after { content: ""; display: block; width: 1px; height: 25px; background: linear-gradient(currentColor, transparent); }
.people-menu { position: relative; font-size: 11px; letter-spacing: .1em; text-align: right; }
.people-menu summary { list-style: none; cursor: pointer; }
.people-menu summary::-webkit-details-marker { display: none; }
.people-menu summary::after { content: " ＋"; color: var(--accent); }
.people-menu[open] summary::after { content: " −"; }
.people-list { position: absolute; right: 0; bottom: 29px; width: 220px; max-height: min(50vh, 420px); overflow: auto; padding: 7px; border: 1px solid var(--hairline); background: var(--panel); box-shadow: 0 10px 35px rgba(20,12,8,.16); }
.people-list button { display: block; width: 100%; padding: 9px 11px; border: 0; text-align: left; background: none; cursor: pointer; font-size: 12px; }
.people-list button:hover, .people-list button:focus-visible { background: var(--hover); }
.people-list small { float: right; color: var(--muted); }
@keyframes breathe { from { opacity: .35; transform: translateY(10px); } to { opacity: .8; transform: translateY(-12px); } }




.process-layout { max-width: 840px; }

.book-pages { display: flex; gap: 20px; overflow-x: auto; padding: 0 0 20px; scroll-snap-type: x mandatory; scrollbar-color: #a58260 #e5d7c1; }
.book-page { flex: 0 0 calc((100% - 40px) / 3); margin: 0; scroll-snap-align: start; background: #f8f0e3; box-shadow: 0 10px 24px rgba(91,60,38,.1); }
.book-page img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.book-caption { display: flex; gap: 16px; min-height: 110px; padding: 20px; }
.book-caption p { margin: 0; font: 16px/1.9 var(--serif); }
.tone-toggle { padding: 9px 15px; border: 1px solid #ad8661; background: transparent; color: #795537; cursor: pointer; font-size: 13px; }
.tone-toggle:hover, .tone-toggle[aria-pressed="true"] { color: #fff5e4; background: #815b3f; }
.couplet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.couplet-card { text-align: center; }
.couplet-card h4 { color: #8c6648; font-size: 19px; letter-spacing: .1em; }
.couplet-scroll { max-width: 390px; margin: auto; padding: 28px 30px 38px; background: linear-gradient(90deg, #c49d72 0 3%, #f4e6cf 3% 97%, #c49d72 97%); box-shadow: 0 8px 20px rgba(89,56,32,.12); }
.couplet-horizontal { display: inline-block; padding: 7px 14px; border: 1px solid #ac7657; color: #8b4437; font: 22px var(--serif); letter-spacing: .22em; }
.couplet-verses { display: flex; flex-direction: row-reverse; justify-content: center; gap: 55px; margin-top: 25px; }
.verse-line { display: flex; flex-direction: column; gap: 5px; }
.verse-unit { display: flex; align-items: center; height: 40px; }
.verse-character { min-width: 36px; font: 31px/1 var(--serif); color: #583c2d; }
.verse-tone { width: 18px; color: #a66b4a; font-size: 11px; visibility: hidden; }
.show-tones .verse-tone { visibility: visible; }
.tone-notes { display: none; margin: 14px 0 0; color: #906b51; font-size: 12px; line-height: 1.7; }
.tone-notes p { margin: 3px 0; }
.show-tones .tone-notes { display: block; }





@media (max-width: 700px) {
  .page { min-height: 760px; min-height: max(760px, 100svh); }
  .page::after { inset: 10px 12px; }
  .masthead { inset: 24px 7% auto; gap: 12px; }
  .logo { width: 126px; height: 42px; }
  .sample-mark { max-width: 160px; gap: 4px; }
  .sample-badge { font-size: 11px; }
  .notice { font-size: 10px; line-height: 1.5; }
  .diagram { inset: 9% 2% 36%; }
  .diagram-caption { bottom: 0; font-size: 10px; letter-spacing: .08em; }
  .diagram-caption::before, .diagram-caption::after { width: 12px; margin: 0 6px 3px; }
  .hero-copy { top: 64%; left: 8%; width: 84%; max-width: none; transform: none; }
  .eyebrow { font-size: 10px; letter-spacing: .04em; line-height: 1.65; }
  .eyebrow::before { flex-basis: 20px; }
  .hero-copy h1 { margin: 12px 0 11px; font-size: clamp(25px, 7vw, 34px); line-height: 1.4; letter-spacing: .06em; }
  .subtitle { font-size: 13px; letter-spacing: .13em; }
  .subtitle::after { width: 25px; }
  .person-card { bottom: 5%; right: 2%; width: min(250px, 78%); padding: 15px 18px; }
  .card-name { margin-top: 7px; font-size: 21px; }
  .card-date, .card-story { font-size: 11px; }
  .hero-footer { inset: auto 8% 23px; }
  .footer-label { font-size: 10px; letter-spacing: .12em; }
  .footer-label span + span { margin-top: 4px; font-size: 8px; }
  .scroll-cue { gap: 6px; font-size: 9px; }
  .scroll-cue::after { height: 18px; }
  .people-menu { font-size: 10px; }
  .book-pages { gap: 14px; margin-right: -20px; padding-right: 20px; }
  .book-page { flex-basis: 83%; }
  .book-caption { min-height: 104px; padding: 16px; }
  .book-caption p { font-size: 15px; }
  .couplet-grid { gap: 35px; }
  .couplet-verses { gap: 45px; }
}
@media (max-width: 370px) {
  .hero-copy h1 { font-size: 25px; }
  .notice { max-width: 135px; }
  .footer-label span + span { letter-spacing: .05em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition-duration: 0s !important; }
}

/* 示例家谱沿用纸色与四族标识，横向浏览五代亲人。 */
.family-block { margin-top: 35px; }
.has-observer .family-block.reveal.is-visible { transform: none; }
.family-hint { margin: -12px 0 15px; color: #866c51; font-size: 12px; letter-spacing: .06em; }
.family-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 18px; align-items: stretch; }
.family-viewport { overflow-x: auto; overflow-y: hidden; border: 1px solid rgba(126,88,58,.23); background: rgba(255,250,241,.45); scrollbar-color: #a58260 #e5d7c1; -webkit-overflow-scrolling: touch; }
.family-tree { position: relative; width: 1600px; height: 500px; }
.family-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.family-links path { fill: none; opacity: .46; stroke-width: 1.4; }
.family-level { position: absolute; left: 18px; width: 75px; transform: translateY(-50%); color: #92765b; font-size: 12px; letter-spacing: .08em; }
.family-node { position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 82px; min-height: 48px; padding: 5px; border: 1px solid var(--branch); border-radius: 2px; background: #faf3e7; transform: translate(-50%, -50%); cursor: pointer; }
.family-node:hover, .family-node[aria-pressed="true"] { background: #f2e1c5; box-shadow: 0 0 0 3px rgba(171,127,76,.16); }
.family-node-name { color: #553d2e; font: 14px/1.3 var(--serif); white-space: nowrap; }
.family-node-relation { margin-top: 3px; color: #8a7058; font: 10px/1.1 var(--sans); white-space: nowrap; }
.family-person { position: relative; min-height: 220px; padding: 29px 24px; border: 1px solid rgba(126,88,58,.23); background: #f8efe1; }
.family-card-empty { margin: 0; color: #8b725b; font-size: 14px; line-height: 2; }
.family-card-close { position: absolute; top: 9px; right: 12px; padding: 2px 5px; border: 0; color: #8a6a4b; background: none; font-size: 24px; cursor: pointer; }
.family-person-kicker { display: block; color: #a2764d; font-size: 11px; letter-spacing: .12em; }
.family-person-name { display: block; margin-top: 18px; font: 26px var(--serif); }
.family-person-date, .family-person-story { margin: 12px 0; color: #806950; font-size: 13px; line-height: 1.8; }
.family-person-story { margin-top: 23px; padding-top: 18px; border-top: 1px solid var(--line); }
.family-read-button, .story-read-button, .card-read-story { padding: 9px 13px; border: 1px solid #a77e56; color: #795438; background: transparent; font-size: 12px; cursor: pointer; }
.family-read-button:hover, .story-read-button:hover { color: #fff9ee; background: #795438; }
.card-read-story { margin-top: 10px; color: #f4dfbd; border-color: rgba(219,185,121,.55); }
.card-read-story:hover { background: rgba(233,189,118,.12); }
.story-read-button { margin-top: 14px; }

/* 阅读器是独立的大浮层，打开时固定背景。 */
body.reader-open { position: fixed; top: var(--reader-scroll-offset); right: 0; left: 0; width: 100%; overflow: hidden; }
.story-reader[hidden] { display: none; }
.story-reader { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 28px; background: rgba(31,21,16,.78); }
.reader-shell { display: flex; flex-direction: column; width: min(100%, 960px); height: min(100%, 820px); overflow: hidden; border: 1px solid #c0a076; background: #f8f0e3; box-shadow: 0 24px 80px rgba(20,12,7,.35); }
.reader-header { position: relative; display: flex; justify-content: space-between; gap: 25px; padding: 25px 38px 18px; border-bottom: 1px solid var(--line); }
.reader-overline { display: flex; align-items: center; gap: 12px; color: #a47850; font-size: 11px; letter-spacing: .16em; }
.reader-sample { padding: 3px 7px; border: 1px solid #ae654e; color: #a34f3c; font-weight: 700; letter-spacing: .06em; }
.reader-heading h2 { margin: 10px 0 5px; color: #4b3326; font: 29px/1.3 var(--serif); letter-spacing: .05em; }
.reader-heading p { margin: 0; color: #8c7057; font-size: 12px; }
.reader-close { flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border: 1px solid rgba(138,99,64,.4); color: #78573f; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
.reader-tabs { display: flex; flex: 0 0 auto; gap: 4px; overflow-x: auto; padding: 0 38px; border-bottom: 1px solid var(--line); }
.reader-tab { flex: 0 0 auto; min-width: 65px; padding: 14px 12px 12px; border: 0; border-bottom: 2px solid transparent; color: #8a7059; background: none; font-size: 13px; cursor: pointer; }
.reader-tab[aria-selected="true"] { border-bottom-color: #a76543; color: #67432f; font-weight: 700; }
.reader-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 31px 38px 50px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.reader-content-enter { animation: reader-fade-in .28s ease both; }
.reader-content-exit { animation: reader-fade-out .14s ease both; }
@keyframes reader-fade-in { from { opacity: .15; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes reader-fade-out { from { opacity: 1; } to { opacity: 0; } }
.reader-prose, .reader-afterword { max-width: 730px; margin: 0 auto; }
.reader-prose p, .comparison-panel p { margin: 0 0 1.3em; color: #523e30; font: 16px/2 var(--serif); }
.reader-prose p:last-child, .comparison-panel p:last-child { margin-bottom: 0; }
.dialect-label, .reader-section-label { display: inline-block; margin-bottom: 15px; color: #a16e46; font: 11px/1.4 var(--sans); letter-spacing: .14em; }
.reader-prose .dialect-note, .comparison-panel .dialect-note { margin-top: 20px; color: #8b7058; font: 12px/1.8 var(--sans); }
.reader-afterword { display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px; margin-top: 38px; padding-top: 25px; border-top: 1px solid var(--line); }
.reader-afterword p { margin: 0 0 8px; font: 15px/1.95 var(--serif); }
.reader-afterword small { color: #93785e; font-size: 12px; }
.reader-book { max-width: 480px; margin: auto; }
.reader-book-page { margin: 0; background: #fff8eb; }
.reader-book-page img { display: block; width: 100%; height: min(47vh, 500px); object-fit: contain; background: #eee1cc; }
.reader-book-page figcaption { padding: 16px 20px; font: 16px/1.7 var(--serif); }
.reader-book-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 15px; }
.book-turn { min-height: 40px; padding: 7px 11px; border: 1px solid #bea486; color: #75543d; background: transparent; cursor: pointer; }
.book-turn:disabled { opacity: .35; cursor: default; }
.book-page-number { color: #a17e5e; font: 12px Georgia, serif; letter-spacing: .12em; }
.reader-comparison { display: grid; grid-template-columns: minmax(0, var(--oral-share, calc(50% - 12px))) 24px minmax(0, 1fr); height: min(60vh, 560px); border: 1px solid var(--line); background: rgba(255,250,242,.55); }
.comparison-panel { min-width: 0; min-height: 0; overflow: auto; padding: 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.comparison-panel h3 { margin: 0 0 12px; color: #6e4e37; font: 21px var(--serif); }
.comparison-divider { display: flex; align-items: center; justify-content: center; background: rgba(167,126,84,.12); cursor: col-resize; touch-action: none; }
.comparison-grip { width: 4px; height: 58px; border-radius: 3px; background: #ad8963; }

/* 先落卷轴杆，再揭纸面、显字、出横批。 */
.couplet-scroll { max-width: 390px; padding: 0; background: none; box-shadow: none; }
.couplet-scroll .couplet-verses { gap: 38px; margin-top: 15px; }
.couplet-strip { width: 94px; }
.scroll-rod { position: relative; z-index: 1; height: 12px; margin: 0 -8px; border: 1px solid #84613f; border-radius: 7px; background: linear-gradient(#bc9470, #80603f 50%, #b48a63); box-shadow: 0 3px 6px rgba(70,42,25,.18); }
.scroll-paper { padding: 22px 16px 30px; background: linear-gradient(90deg, #c49d72 0 3%, #f4e6cf 3% 97%, #c49d72 97%); box-shadow: 0 8px 20px rgba(89,56,32,.12); }
.scroll-animated:not(.unfolded) .scroll-rod, .scroll-animated:not(.unfolded) .verse-unit, .scroll-animated:not(.unfolded) .couplet-horizontal { opacity: 0; }
.scroll-animated:not(.unfolded) .scroll-paper { clip-path: inset(0 0 100% 0); }
.scroll-animated.unfolded .scroll-rod { animation: rod-appear .35s ease both; }
.scroll-animated.unfolded .scroll-paper { animation: paper-unroll .9s .35s ease both; }
.scroll-animated.unfolded .verse-unit { animation: verse-appear .35s calc(1.05s + var(--char-order) * .11s) ease both; }
.scroll-animated.unfolded .couplet-horizontal { animation: verse-appear .4s 2.1s ease both; }
@keyframes rod-appear { from { opacity: 0; transform: scaleX(.8); } to { opacity: 1; transform: scaleX(1); } }
@keyframes paper-unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes verse-appear { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px) {
  .family-block { margin-top: 25px; }
  .family-layout { display: block; }
  .family-viewport { margin-right: -20px; }
  .family-person { display: none; }
  .family-person.is-selected { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: block; min-height: 0; max-height: 45vh; overflow: auto; padding: 22px 25px calc(22px + env(safe-area-inset-bottom)); border-width: 1px 0 0; box-shadow: 0 -10px 30px rgba(57,35,22,.22); }
  .family-person-name { margin-top: 8px; font-size: 23px; }
  .family-person-date, .family-person-story { margin: 6px 0; }
  .family-person-story { padding-top: 8px; }
  .story-reader { align-items: stretch; padding: 0; }
  .reader-shell { width: 100%; height: 100%; border: 0; }
  .reader-header { gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 20px 14px; }
  .reader-heading h2 { font-size: 24px; }
  .reader-close { flex-basis: 40px; width: 40px; height: 40px; }
  .reader-tabs { gap: 0; padding: 0 12px; }
  .reader-tab { min-width: 58px; padding: 13px 10px 11px; }
  .reader-scroll { padding: 23px 20px calc(40px + env(safe-area-inset-bottom)); }
  .reader-prose p, .comparison-panel p { font-size: 15px; line-height: 1.95; }
  .reader-afterword { grid-template-columns: 1fr; gap: 22px; margin-top: 30px; }
  .reader-book-page img { height: min(42vh, 430px); }
  .reader-comparison { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, var(--oral-share, calc(50% - 12px))) 24px minmax(0, 1fr); height: min(62vh, 560px); }
  .comparison-panel { padding: 16px; }
  .comparison-divider { cursor: row-resize; }
  .comparison-grip { width: 58px; height: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-animated:not(.unfolded) .scroll-rod, .scroll-animated:not(.unfolded) .verse-unit, .scroll-animated:not(.unfolded) .couplet-horizontal { opacity: 1; }
  .scroll-animated:not(.unfolded) .scroll-paper { clip-path: none; }
}
