/* Shared article hierarchy across all disciplines. */
#reader.person-reader .profile-relationship-notes{border-top:1px solid #ddd;padding-top:16px;margin-top:24px;font-size:14px}
#reader.person-reader .profile-relationship-notes>summary{cursor:pointer;color:#555;font:500 14px/1.8 var(--sans)}
#reader.person-reader .profile-relationship-notes[open]>summary{margin-bottom:18px}
#reader.person-reader .profile-relationship-notes .connection-group{margin-top:16px}
#reader.person-reader{--note-title:23px;--note-body:16px;--note-meta:13px}
#reader.person-reader #reader-body .profile-work .work-heading h4{font-size:17px;font-weight:500;margin:0;line-height:1.7}
#reader.person-reader #reader-body .profile-work .work-description{font-size:14px;line-height:1.75;color:#666;margin:6px 0 0}
#reader.person-reader #reader-body .connection-description{font-size:15px;line-height:1.8;margin:8px 0}
#reader-body .profile-section>h3{font-size:23px;font-weight:600;line-height:1.5;margin:0 0 22px;padding-left:14px;border-left:3px solid #333}
#reader-body .profile-entry h4,#reader-body .connection-group>h4{font-size:17px;font-weight:600;line-height:1.6;margin:0 0 10px;color:#222}
#reader-body .profile-entry{padding:0 0 20px;margin:0 0 20px}
#reader-body .profile-entry p{font-size:16px;line-height:1.9;margin:8px 0 0}
#reader-body .profile-work{padding:16px 0;margin:0;border-bottom:1px solid #e1e1e1}
#reader-body .profile-work .work-heading{display:flex;align-items:baseline;gap:12px;justify-content:space-between}
#reader-body .profile-work .work-heading h4{font-size:17px;font-weight:500;line-height:1.7;margin:0;min-width:0}
#reader-body .profile-work .work-date{font-size:13px;line-height:1.6;color:#666;flex:none;font-variant-numeric:tabular-nums;text-align:right;white-space:normal;max-width:40%}
#reader-body .profile-work .work-description{font-size:14px;line-height:1.75;color:#666;margin:6px 0 0}
#reader-body .connection-row{padding:14px 0}
#reader-body .connection-name{font-size:17px;font-weight:500}
#reader-body .connection-type,#reader-body .connection-row a{font-size:12px;color:#666}
#reader-body .connection-description{font-size:15px;line-height:1.8;margin:8px 0}
.workspace-head>.layout-controls{align-self:center;flex:none}
.workspace-head>.layout-controls:has(button:not([hidden])){margin-right:8px}
.workspace-head>.layout-controls:not(:has(button:not([hidden]))){display:none}
body.mobile-layout .workspace-head>.layout-controls{display:none}
/* The search is now nested inside count-search: position its wrapper in the grid. */
body.mobile-layout>header,body.mobile-layout.top-collapsed>header{height:174px;min-height:174px;flex:0 0 174px;grid-template-columns:minmax(0,1fr) 64px;grid-template-rows:48px 40px 50px;gap:6px 8px;padding:10px 12px}
body.mobile-layout>header .count-search{grid-column:1/-1;grid-row:2;width:100%;min-width:0;gap:10px;align-self:center}
body.mobile-layout>header .count-search .search{width:auto;min-width:0;flex:1;min-height:38px;height:38px;padding:6px 12px}
body.mobile-layout>header .search input{width:100%;min-width:0;font-size:14px}
body.mobile-layout>header .culture-fields{grid-column:1/-1;grid-row:3;height:50px;min-height:0;align-items:center;padding:0;gap:4px;overflow-x:auto;overflow-y:hidden}
body.mobile-layout>header .culture-fields [data-culture-field]{font-size:15px;min-width:54px;width:54px;height:40px}
body.mobile-layout>header .culture-fields .role-count{display:none}
body.mobile-layout>header .atlas-counter{margin:0}
body.mobile-layout>header .counter-digit{width:15px;min-width:15px;max-width:15px;flex-basis:15px;height:23px;--digit-height:23px;font-size:17px}
body.mobile-layout>header .counter-digits{gap:2px}
body.mobile-layout .global-search-results{position:fixed;top:112px;left:12px;right:12px;width:auto;max-height:calc(100dvh - 140px)}
@media(max-width:380px){body.mobile-layout>header .brand-zh{font-size:18px}body.mobile-layout>header .brand-en{font-size:7px;letter-spacing:1px}body.mobile-layout>header .brand{gap:7px}}

/* Secondary work titles stay subordinate to the original and its year. */
#reader-body .profile-work .work-title-group{min-width:0;flex:1}
#reader.person-reader #reader-body .profile-work .work-title-translation{font-size:13px;line-height:1.65;color:#777;font-weight:400;margin:3px 0 0;letter-spacing:0}

#reader.person-reader #reader-body .profile-work .work-metadata{font-size:12px;line-height:1.5;color:#777;font-weight:400;margin:3px 0 0;letter-spacing:0}

#reader.person-reader #reader-body .profile-work .work-subline{font-size:13px;line-height:1.65;color:#777;margin:3px 0 0}
#reader-body .work-subline-divider{padding:0 4px;color:#999}

/* Reserve the date column even in a narrow reader; only the title wraps. */
#reader.person-reader #reader-body .profile-work .work-heading{display:grid;grid-template-columns:minmax(0,1fr) max-content;align-items:baseline;column-gap:16px}
#reader.person-reader #reader-body .profile-work .work-date{max-width:none;white-space:nowrap;text-align:right}
#reader.person-reader #reader-body .profile-work .work-title-group{min-width:0;overflow-wrap:anywhere}

/* Keep the sidebar opener attached to the page title, not in an empty gutter. */
body .workspace .workspace-head{column-gap:12px}
body .workspace-head>.layout-controls:has(button:not([hidden])){margin:0}
body .workspace-head>.layout-controls [data-layout="side"]{width:30px;min-width:30px;height:30px;padding:5px;border:1px solid #deded9;background:#f6f6f3;color:#666;border-radius:2px}
body .workspace-head>.layout-controls [data-layout="side"]:hover{color:#222;background:#eeeee9;border-color:#aaa}
body .workspace-head>.layout-controls [data-layout="side"] svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linejoin:round}

/* Match the grey back-to-top control; direction indicates opening the sidebar. */
body .workspace-head>.layout-controls [data-layout="side"]{width:32px;min-width:32px;height:32px;padding:0;border:1px solid transparent;border-radius:0;background:#f5f5f5;color:#333;font-size:12px}
body .workspace-head>.layout-controls [data-layout="side"]:hover{background:#303030;color:#fff;border-color:transparent}

/* Sidebar opener stays unfilled, including on hover. */
body .workspace-head>.layout-controls [data-layout="side"],body .workspace-head>.layout-controls [data-layout="side"]:hover{background:transparent;border-color:transparent;color:#333}

/* Pointer hover uses only a background change on genealogy cards. */
body .map-stage.group-layout .map-person:not(.graph-current):hover{border-color:transparent}

/* Fixed layout with scale-aware text rasterization; no low-resolution layer cache. */
.map-window .map-stage{zoom:1;left:0;top:0;transform-origin:0 0;will-change:auto;transition:none}

/* Show zoom controls initially, then fade; the surrounding hit area reveals them instantly. */
.map-zoom{opacity:1;animation:atlas-zoom-intro 2s linear 2s forwards;transition:opacity 2s linear}
.map-zoom::before{content:'';position:absolute;inset:-24px;z-index:-1}
.map-zoom:hover,.map-zoom:focus-within{animation:none;opacity:1;transition:none}
@keyframes atlas-zoom-intro{from{opacity:1}to{opacity:0}}
@media(hover:none){.map-zoom{animation:none;opacity:1}}

#reader .profile-tag-group{display:grid;grid-template-columns:110px minmax(0,1fr);gap:10px;margin:10px 0;align-items:start}#reader .profile-tag-group dt{font-size:13px;color:#777;padding-top:7px}#reader .profile-tag-group dd{margin:0;display:flex;flex-wrap:wrap;gap:6px}#reader .profile-tag-group .chip{margin:0}body.mobile-layout #reader .profile-tag-group{grid-template-columns:88px minmax(0,1fr);gap:8px}


/* Work titles and typed credits occupy separate semantic rows. */
#reader-body .work-facts{margin:9px 0 0;font-size:12px;line-height:1.7;color:#555}#reader-body .work-facts>div{display:flex;gap:14px}#reader-body .work-facts dt{flex:0 0 5em;color:#777;font-weight:400}#reader-body .work-facts dd{margin:0;min-width:0;overflow-wrap:anywhere}
