.polity-tabs.history-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 14px;
}
.polity-tabs.history-tabs button { min-height: 34px; width: 100%; }
.court-roster { display: block; }
.court-roster [data-office-group="sovereign"] .office-grid,
.court-roster [data-office-group="royal"] .office-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.court-roster .office-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.court-tier { margin: 0 0 18px; }
.court-tier > h3 { color: var(--gold); font-size: 17px; margin: 16px 0 8px; }
.court-section > h4 { color: #d3c396; font-size: 12px; margin: 10px 0 6px; }
.court-section h5 { color: #cbd4b5; font-size: 13px; margin: 13px 0 6px; }
.court-section > .place-row { margin: 4px 0; }
.court-section .office-review-status { color: #ffd59b; font-weight: 600; }
.court-roster .office-card > header b { font-size: 14px; }
.court-roster .office-person { padding: 9px 10px; }
.court-roster .office-person strong { font-size: 17px; }
.court-roster .office-person span { font-size: 13px; line-height: 1.5; }
.office-term-details { padding: 5px 10px 8px; }
.office-term-details summary { color: var(--gold); cursor: pointer; font-size: 13px; padding: 3px 0; }
.office-term-details p { color: #d2d9c3; font-size: 13px; line-height: 1.7; margin: 5px 0; }
.office-term-details .office-citation { font-size: 12px; overflow-wrap: anywhere; }
.office-change { margin: 4px 0; }
.office-change > .place-row small { font-size: 12px; line-height: 1.5; }
.court-ministry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.court-roster .court-ministry-grid > .court-section { grid-column: auto; border: 1px solid #bdb88c38; padding: 0 10px 8px; border-radius: 4px; }
.court-ministry-grid .office-grid { grid-template-columns: 1fr; }
.profile-image-button { padding: 0; align-self: flex-start; flex: 0 0 auto; border-radius: 4px; }
.profile-image-button .profile-avatar { display: block; }
.profile-image-button small { display: block; text-align: center; color: #d3c396; margin-top: 5px; }
.person-portrait-frame { position: relative; display: block; overflow: hidden; flex: 0 0 auto; aspect-ratio: 5/6; border: 0; outline: 1px solid var(--line); outline-offset: -1px; border-radius: 5px; background: #17232e; }
.person-portrait-frame--profile { width: 96px; }
#modal .person-portrait-frame--profile { width: clamp(64px,9vw,96px); }
.office-person-portrait > .person-portrait-frame--court { grid-column: 2; grid-row: 1 / span 3; width: 56px; }
.person-portrait-frame img.profile-avatar,.person-portrait-frame img.court-avatar,
#modal .person-portrait-frame img.profile-avatar,#detail .person-portrait-frame img.court-avatar { display: block; position: absolute; width: 100%; height: 100%; left: 0; top: 0; max-width: none; aspect-ratio: auto; border: 0; border-radius: 0; object-fit: cover; object-position: center 20%; }
.person-portrait-frame.has-crop img.profile-avatar,.person-portrait-frame.has-crop img.court-avatar,
#modal .person-portrait-frame.has-crop img.profile-avatar,#detail .person-portrait-frame.has-crop img.court-avatar { object-fit: fill; }
.person-aliases { margin: -5px 0 12px; color: #c8bb90; font-size: 13px; }
.person-footprint-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 0; }
.person-footprint-line small { color: #aebba5; }
.person-profile .person-hero > div { max-width: 68ch; min-width: 0; }
.person-profile .person-hero p { margin: 4px 0 0; line-height: 1.75; }
.person-profile > .biography-section { grid-template-columns: minmax(7ch, 13ch) minmax(0, 66ch); gap: 12px; }
.readable-content p,.readable-content .biography-section p { font-size: 14px !important; line-height: 1.85; }
.readable-content .person-hero p { max-width: 68ch; }
.readable-content .small-note,.readable-content .source-line { font-size: 12px !important; }
.readable-content .event-narrative { max-width: none; margin: 20px 0; padding: 0; }
dialog.wide-modal:has(.event-detail) { width: min(820px,calc(100vw - 48px)); }
.event-detail { max-width: 740px; margin-inline: auto; }
.event-detail.readable-content > p { max-width: none; }
.event-detail .event-narrative h3 { margin: 0 0 8px; color: var(--gold); font-size: 16px; }
.event-detail .event-narrative p { margin: 0 0 10px; }
.event-detail .event-narrative .evidence { margin: 8px 0 0; padding-top: 8px; }
.readable-content .poem-excerpt,.readable-content .work-original { max-width: 68ch; margin-left: 0; }
.work-detail:has([data-work-primary-text]):not(:has([data-work-gallery])) { max-width: 640px; margin-inline: auto; }
.person-evaluation { max-width: 69ch; padding: 12px 14px; margin: 8px 0; background: #3e5b543d; border-left: 2px solid #bb9a61; }
.person-evaluation b { color: #ead69f; font-size: 14px; }
.person-evaluation small { margin-left: 10px; color: #b4c7a9; }
.person-evaluation blockquote { margin: 9px 0; color: #f0dfb6; }
.person-evaluation p { margin: 6px 0 0; }
.person-profile [data-person-footprint]:disabled { cursor: default; opacity: .75; padding-left: 0; }
.court-ministry-grid .court-section .office-grid { grid-template-columns: 1fr; }
.work-detail > p,.event-detail > p,.custom-detail > p { max-width: 68ch; line-height: 1.9; }
.work-original,.work-edition-body { white-space: pre-line; line-height: 1.9; max-width: 66ch; }
.work-media { max-width: 100%; max-height: 480px; object-fit: contain; }
.work-roles,.work-cast { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.work-roles { column-gap: 24px; }
.work-cast > small { color: #c8bb90; }
.culture-byline > span { flex-shrink: 0; }
.work-credit-evidence { margin: 0; padding: 0; border: 0; font-size: .8em; }
.work-credit-evidence > summary { cursor: pointer; }
.work-credit-evidence[open] { flex-basis: 100%; }
.work-full-text > summary,.work-image-zoom > summary { margin: 10px 0; cursor: pointer; color: var(--gold); }
.work-image-zoom img { max-width: 100%; width: 100%; height: auto; }
.work-figure figcaption { margin: 6px 0; color: #c8bb90; }
.work-gallery-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:24px; margin:20px 0; }
.work-gallery-grid .work-figure { margin:0; min-width:0; display:flex; flex-direction:column; align-items:flex-start; }
.work-gallery-grid .work-media { width:100%; height:280px; object-fit:contain; background:#101e2b; }
.work-gallery-grid figcaption { font-size:12px; line-height:1.7; }
.work-gallery-grid .work-image-zoom { margin-top:auto; }
.work-sequence > .work-figure { margin: 12px 0; }
.work-sequence-count { color: var(--gold, #d5b66f); font-size: 13px; }
.work-sequence-pages { border-top: 1px solid #43505b; margin-top: 16px; padding-top: 12px; }
.work-sequence-pages > summary { cursor: pointer; color: #e2cd9a; }
.map-content-return { position: absolute; z-index: 5; left: 24px; bottom: 175px; padding: 9px 12px; background: #183939; color: #f3d991; border: 1px solid #d5b574; border-radius: 4px; }
body.detail-open .map-content-return { display: none; }
.detail-return { padding: 10px 17px 0; }
.institution-edge-label { fill: #efdda4; stroke: #18383a; stroke-width: 3px; paint-order: stroke; font-size: 11px; }
.event-category-filter { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; font-size: 12px; color: #c8bb90; }
.event-category-filter select { min-width: 135px; padding: 5px 8px; }
.technology-diagram { margin: 18px 0; }
.technology-flow { display: flex; gap: 22px; margin: 8px 0; padding: 0; list-style: none; }
.technology-flow li { position: relative; display: flex; flex: 1 1 0; align-items: baseline; gap: 8px; padding: 10px 12px; border: 1px solid #a18d566b; border-radius: 4px; background: #294848; color: #e9d8a8; }
.technology-flow li span { font: 12px/1 system-ui,sans-serif; color: #dbc483; }
.technology-flow li+li::before { position: absolute; right: calc(100% + 4px); content: "→"; color: #dbc483; }
@media(max-width:620px) {
  .technology-flow { flex-direction: column; }
  .technology-flow li+li::before { top: -24px; left: 12px; right: auto; content: "↓"; }
}
dialog.wide-modal:has(.extended-content) { width: min(780px,calc(100vw - 48px)); max-width: 780px; }
.extended-content .history-card { max-width: none; }
.extended-content > p { max-width: 660px; }
.custom-detail { max-width: 800px; margin-inline: auto; }
.custom-detail .custom-lead { font-size: 16px; line-height: 1.85; }
.custom-detail > section { margin: 22px 0; }
.custom-detail h3 { margin-bottom: 10px; }
.custom-detail h4 { margin: 0 0 4px; color: var(--gold); }
.custom-process-step { margin: 8px 0; padding: 10px 14px; border-left: 2px solid #b699505e; background: #31504b51; }
.custom-process-step p { margin: 0; line-height: 1.75; }
.custom-evidence-image { margin-top: 12px; }
.custom-evidence-image > p { margin-bottom: 6px; }
.custom-people { margin: 0; padding-inline-start: 1.25rem; line-height: 1.7; }
.city-current-titles { padding: 12px 16px; border-bottom: 1px solid #b3985148; }
.city-current-titles dl { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 8px; }
.city-current-titles dl > div { display: flex; align-items: baseline; gap: 6px; }
.city-current-titles dt { font-size: 12px; color: #bac4a8; }
.city-current-titles dd { margin: 0; color: #f1dfb3; }
.city-current-titles p { margin: 5px 0 8px; line-height: 1.65; }
.city-current-titles summary { color: #d5c18d; cursor: pointer; }
.custom-evidence-image .visual-story-card { width: min(100%, 580px); margin: 6px 0 16px; }
.primary-reading-mode { display: inline-flex; gap: 10px; align-items: center; }
.primary-evidence-edition { padding: 10px 0; border-top: 1px solid #b3985148; }
.primary-evidence-edition > p { margin: 4px 0; }
.primary-evidence-notes { margin-top: 8px; }
.primary-evidence-notes ul { list-style: none; padding: 0; margin: 8px 0 0; }
.primary-evidence-notes li { margin: 0 0 12px; padding-left: 12px; border-left: 1px solid #b3985170; }
.primary-evidence-notes li p { margin: 3px 0 0; }
.primary-parallel-row.parallel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: baseline; }
.primary-parallel-row aside { padding-left: 15px; border-left: 2px solid #bb9a61; color: #ecdfaf; }
.primary-parallel-row aside small { color: #c1caa7; }


.equipment-topics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.equipment-topics .history-card{margin:0;padding:8px}
.equipment-topics .history-card b{font-size:13px}
.equipment-explanation .history-card{margin-block:12px}
.equipment-evidence h4{margin-top:12px}
.equipment-diagram{margin:14px 0 10px;padding:13px 15px;border:1px solid #c1b38955;border-radius:6px;background:#15363c}
.equipment-diagram ol{list-style:none;display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px;padding:0}
.equipment-diagram li{display:grid;place-items:center;flex:1 1 120px;min-height:52px;padding:7px;border:1px solid #c1b38955;background:#284e51;color:#f0dfb1;text-align:center;border-radius:4px}

.extended-content .equipment-topics{grid-template-columns:repeat(auto-fit,minmax(135px,1fr))}.equipment-topics .place-row{height:100%;margin:0}

@media (max-width: 640px) {
  .court-roster .court-section .office-grid { grid-template-columns: minmax(0, 1fr); }
  .court-roster .office-card { scroll-margin-top: 130px; }
}
