/* Reading and exploration share the original graph and timeline. */
:root { --detail-width: 440px; }
.site-header { min-height: 60px; padding-block: 6px; }
.title-copy p { line-height: 1.3; margin-top: 1px; }
.title-copy h1 { line-height: 1.3; }
.header-counts { padding-right: 8px; }
.page-shell > footer { min-height: 24px; padding-block: 3px; }
.site-header h1 { font-size: 23px; }
.toolbar { gap: 6px; padding-block: 6px; }
.type-filters label, .fixed-layer, .type-filters button { min-height: 32px; }
.pane-head { height: 60px; min-height: 60px; gap: 6px; }
.pane-head p { max-width: 490px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-head h2 { font-size: 16px; }
.pane-actions { flex-shrink: 0; }
.pane-actions button { padding: 6px 9px; min-height: 34px; border: 1px solid var(--rule); background: var(--paper-light); color: var(--cinnabar); cursor: pointer; white-space: nowrap; font-size: 12px; }
.pane-actions a { display: none; }
.pane-actions #fit-graph { height: 34px; }
#mobile-view { display: none; }
.core-people { position: absolute; z-index: 3; top: 60px; left: 0; right: 0; display: flex; gap: 5px; padding: 6px 12px; overflow-x: auto; background: rgba(255,250,240,.88); border-bottom: 1px solid var(--rule); scrollbar-width: thin; }
.core-people button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 5px; border: 1px solid transparent; border-radius: 3px; background: transparent; font-size: 12px; white-space: nowrap; cursor: pointer; }
.core-people button[aria-pressed=true], .core-people button:hover { border-color: var(--rule-dark); background: #eee5d7; }
.explore-avatar { width: 30px; height: 30px; flex: 0 0 30px; position: relative; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; color: #fffaf0; background: #766047; border: 1px solid #d0bda2; font-family: var(--reading-font); font-size: 17px; vertical-align: middle; }
.explore-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #ebe0cb; }
.core-people .explore-avatar { width: 26px; height: 26px; flex-basis: 26px; font-size: 15px; }
#network { inset: 110px 0 29px; }
.graph-tip { right: 12px; display: flex; gap: 12px; justify-content: space-between; }
#explore-status { color: var(--green); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-pane { overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--rule-dark) transparent; }
#detail { height: auto; overflow: visible; }
.person-detail { padding: 18px 22px 20px; }
.explore-profile { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--rule-dark); padding-bottom: 15px; }
.explore-profile .is-profile { width: 68px; height: 68px; flex-basis: 68px; font-size: 35px; border-width: 2px; }
.explore-profile h2 { margin: 1px 0 4px; font-family: var(--reading-font); font-size: 27px; color: var(--cinnabar); font-weight: 600; letter-spacing: .04em; }
.explore-profile p { margin: 0; font-family: var(--ui-font); font-size: 11px; color: var(--muted); }
.explore-profile > div { min-width: 0; flex: 1; }
.explore-profile > button { align-self: flex-start; }
.person-detail button, .explore-dialog button { border: 1px solid var(--rule); color: var(--cinnabar); background: #fbf6ea; padding: 6px 10px; cursor: pointer; }
.person-detail button:hover, .explore-dialog button:hover, .pane-actions button:hover { background: #eee4d4; }
.explore-trail { display: flex; align-items: center; gap: 5px; overflow-x: auto; margin: -3px 0 12px; color: var(--muted); scrollbar-width: thin; }
.explore-trail button { border: 0; padding: 2px 3px; white-space: nowrap; font-size: 11px; background: none; color: var(--muted); }
.explore-trail button[aria-current=true] { color: var(--cinnabar); }
.explore-date-note { margin: 8px 0; font-size: 11px; color: var(--muted); }
.explore-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin: 14px 0 16px; }
.explore-tabs button { flex: 1; padding: 10px 2px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 13px; }
.explore-tabs button[aria-selected=true] { color: var(--cinnabar); border-bottom-color: var(--cinnabar); font-weight: 600; }
.explore-tabs small { font-weight: normal; font-size: 10px; }
.explore-story { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.explore-story:first-child { padding-top: 0; }
.explore-story-head { display: flex; align-items: center; gap: 10px; }
.explore-story-head > span { color: #a28a68; font-size: 15px; font-style: italic; }
.explore-story h3 { margin: 0; font-size: 16px; font-weight: 600; }
.explore-story-head h3 { flex: 1; }
.explore-story-head button { flex-shrink: 0; font-size: 12px; }
.explore-source-heading { margin: 7px 0 10px; color: var(--muted); font-size: 11px; font-family: var(--ui-font); }
.explore-story blockquote, .explore-evidence blockquote, .explore-comparison blockquote { margin: 13px 0; padding: 0 0 0 12px; border-left: 2px solid #c5ad88; font-size: 17px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; }
.explore-reading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 11px; font-family: var(--ui-font); }
.explore-reading-actions a { flex: 1 1 180px; }
.explore-reading-actions button { font-size: 11px; }
.explore-citation, .explore-portrait-credit { font-size: 11px; overflow-wrap: anywhere; }
.explore-evidence { padding: 14px; background: #f5ede0; border-left: 3px solid var(--green); margin-bottom: 16px; }
.explore-evidence h3 { margin: 0; font-size: 16px; }
.relation-person { display: flex; align-items: center; gap: 8px; }
.relation-person b { flex: 1; text-align: left; }
.relation-person span:not(.explore-avatar) { flex-shrink: 0; }
.time-person { align-items: center; padding: 3px 7px 3px 4px; }
.time-person .explore-avatar { width: 23px; height: 23px; flex-basis: 23px; font-size: 13px; }
.time-person small { font-size: 10px; }
.timeline-person-list { scrollbar-width: thin; }
.timeline-pane { grid-template-rows: auto 46px 28px minmax(54px,1fr); padding-block: 7px; }
.timeline-ruler { height:46px; }
.timeline-pan-row { margin:3px 0; }
.timeline-pan-row button { height:22px; }
.timeline-head { margin-bottom:4px; }
.timeline-head { gap: 8px; }
.timeline-head p { font-size: 11px; }
.explore-dialog { width: min(980px,calc(100vw - 36px)); max-height: calc(100dvh - 50px); border: 1px solid var(--rule-dark); padding: 22px; background: #fffaf0; color: var(--ink); box-shadow: 0 16px 80px #0005; }
.explore-dialog::backdrop { background: #101c17aa; }
.explore-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.explore-dialog h2 { font-size: 23px; margin: 0; }
.explore-dialog h3 { font-size: 16px; }
.explore-comparison { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 26px; padding-top: 12px; }
#learning-panel { margin: 0 20px 20px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
@media (max-width: 1100px) {
  .pane-head { align-items: flex-start; padding: 7px 10px; }
  .pane-head p { max-width: 250px; }
  .pane-actions { gap: 3px; }
  .pane-actions button { padding: 5px; }
  .core-people { padding-inline: 6px; gap: 1px; }
  .person-detail { padding-inline: 15px; }
  .explore-profile { gap: 9px; }
  .explore-profile .is-profile { width: 50px; height: 50px; flex-basis: 50px; }
  .explore-profile h2 { font-size: 23px; }
}
@media (max-width: 820px) {
  .page-shell { height: 100dvh; max-height: 100dvh; min-height: 0; overflow: hidden; display: grid; grid-template-rows: auto auto minmax(180px,1fr) 190px; }
  .site-header { min-height: 54px; padding: 6px 12px; grid-template-areas: 'mark title'; }
  .site-header .title-copy h1 { font-size: 19px; }
  .title-copy p { display: none; }
  .site-header .header-counts { display: none; }
  .toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 5px 8px; gap: 4px; }
  .search-box { grid-column: 1; grid-row: 1; min-width: 0; grid-template-columns: auto minmax(0,1fr) auto; }
  .search-box input, .search-box button { height: 34px; }
  .language-toggle { grid-column: 2; grid-row: 1; height: 36px; }
  .type-filters { grid-column: 1/-1; grid-row: 2; height: 34px; min-height: 34px; }
  .type-filters label, .fixed-layer, .type-filters button { min-height: 32px; font-size: 11px; padding-inline: 5px; }
  .research-filters { grid-column: 1/-1; grid-row: 3; width: 100%; }
  .research-filters label { min-width: 0; min-height: 30px; }
  .research-filters select { height: 28px; font-size: 11px; }
  .main-grid { position: relative; display: block; min-height: 0; }
  .graph-pane { height: 100%; border: 0; }
  .pane-head { height: 50px; min-height: 50px; padding: 5px 8px; }
  .pane-head h2 { font-size: 14px; }
  .pane-head p { max-width: 170px; font-size: 10px; }
  .pane-actions #open-learning { display: none; }
  .pane-actions button { min-height: 31px; }
  #mobile-view { display: inline-block; }
  .core-people { top: 50px; height: 45px; padding-block: 4px; }
  #network { inset: 95px 0 24px; }
  .graph-tip { display: flex; font-size: 9px; }
  #graph-density { display: none; }
  .detail-pane { display: none; }
  body.reading-view .detail-pane { display: block; position: absolute; inset: 50px 0 0; z-index: 4; }
  body.reading-view .graph-pane .core-people, body.reading-view #network, body.reading-view .graph-tip { visibility: hidden; }
  #detail { max-height: none; overflow: visible; }
  .person-detail { padding-top: 12px; }
  .explore-tabs { margin-block: 10px; }
  .timeline-pane { height: 190px; min-height: 0; padding: 6px 8px; display: grid; grid-template-rows: auto 32px 18px minmax(0,1fr); gap: 3px; }
  .timeline-head { flex-direction: row; align-items: center; margin: 0; gap: 3px; }
  .timeline-head h2 { font-size: 12px; }
  .timeline-head p, .timeline-controls label, #time-reset { display: none; }
  .timeline-controls { gap: 3px; flex-wrap: nowrap; }
  .timeline-controls button, .timeline-controls select { height: 26px; min-width: 26px; padding: 2px 5px; font-size: 11px; }
  .timeline-ruler { height: 32px; min-height: 32px; margin: 0; }
  .timeline-pan-row { margin: 0; height: 18px; }
  .timeline-pan-row button { height: 18px; line-height: 14px; }
  .timeline-residents { padding: 3px; }
  .timeline-resident-head { flex-direction: row; margin-bottom: 3px; }
  .timeline-resident-head b { font-size: 11px; }
  #timeline-rule-note { font-size: 9px; }
  .time-person b { font-size: 11px; }
  .time-person small { display: none; }
  .time-person .explore-avatar { width: 20px; height: 20px; flex-basis: 20px; }
  .page-shell > footer, .timeline-splitter { display: none; }
  .explore-comparison { grid-template-columns: 1fr; gap: 12px; }
  .explore-dialog { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { scroll-behavior: auto !important; } }
@media (max-width:820px) and (max-height:560px) {
  .page-shell { grid-template-rows: 46px auto minmax(100px,1fr) 108px; }
  .site-header { min-height:46px; }
  .site-header img { width:32px; height:32px; }
  .type-filters, .research-filters { display:none; }
  .timeline-pane { height:108px; grid-template-rows:26px 27px minmax(0,1fr); }
  .timeline-pan-row, .timeline-resident-head { display:none; }
  .timeline-residents { grid-row:3; }
  .core-people { height:35px; }
  .core-people .explore-avatar { width:21px; height:21px; flex-basis:21px; }
  #network { top:85px; bottom:0; }
  .graph-tip { display:none; }
}
