/* Readable defaults and equivalent text access; no accessibility overlay. */
:root { color-scheme: dark; }
body { overflow-wrap: break-word; }
:focus-visible { outline: 3px solid var(--rose-accent, #f2b6dc); outline-offset: 3px; }
#experience :is(button,a,input,select,summary,[tabindex]):focus-visible,
.drawer :is(button,a,input,select,summary,[tabindex]):focus-visible {
  outline: 3px solid var(--paper-text, #fff); outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--panel, #25283e);
}
body > .skip:focus { position: fixed; inset: 8px auto auto 8px; z-index: 10000; width: auto; height: auto; clip-path: none; background: #1c2134; color: #fff; padding: 12px 16px; font-size: 1rem; }
.access-skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#experience .access-options { display: flex; gap: 6px; pointer-events: auto; }
#experience .access-options button { flex: 1; min-height: 40px; padding: 8px; border: 1px solid var(--control-edge, #aa93b8); border-radius: 6px; background: var(--control-bg, #25283e); color: var(--paper-text, #f2ebf4); font: 600 .875rem/1.3 Arial,sans-serif; }
#experience .access-options button[aria-pressed=true] { background: var(--rose-accent, #f2b6dc); color: #182133; }
#experience .life-panel :is(.event-text, .identity > p, #person-subtitle) { font-size: 1rem; line-height: 1.65; max-width: none; }
#experience .life-panel :is(.kind,.precision-flag,.text-link,.story-photo-credit,.deck-hint,#card-photo-sources),
#experience .life-panel .deck-count label { font-size: .875rem; line-height: 1.5; }
#experience .life-panel :is(.evidence-button,.deck-button,.deck-go),
#experience :is(.map-field select,#atlas-q,#atlas-search button) { font-size: 1rem; }
#experience .life-panel :is(.evidence-button,.deck-button,.deck-go,.photo-paging button),
#experience .map-field select { min-height: 44px; }
#experience .life-panel .text-link, #experience #precision-note { min-height: 32px; padding-block: 6px; }
#experience .life-panel .identity { padding-bottom: 18px; margin-bottom: 18px; }
#experience .story-inner { grid-template-columns: minmax(0,1fr); }
#experience .time-event { font-size: 1rem; min-height: 48px; }
#experience .time-event small { font-size: .875rem; line-height: 1.45; }
#experience .atlas-footer, #experience .legend-body, #experience .legend-body small,
#experience :is(#edit-filters,#clear-selection,#fit-web,#list-personal-links) { font-size: .875rem; }
#experience .atlas-footer :is(a,button) { display: inline-flex; align-items: center; min-height: 28px; }
#experience #map:focus-visible { outline: 4px solid var(--rose-accent, #f2b6dc); outline-offset: -6px; }
#experience .story-photo-credit { max-width: none; }
.drawer { max-width: min(760px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 20px; }
.drawer.wide { max-width: min(1100px,calc(100vw - 24px)); }
.drawer :is(p,li,label,input,select) { font-size: 1rem; line-height: 1.65; }
.drawer :is(.overline,small,.source-button,.person-choice small) { font-size: .875rem; }
.drawer #close-drawer { min-width: 44px; min-height: 44px; }
.drawer #drawer-title { scroll-margin-top: 20px; }
.drawer #drawer-title:focus { outline: none; box-shadow: none; }
#accessible-places small { display: block; margin-top: 4px; }
.place-search-label { display: block; margin: 12px 0 6px; }
#place-search { width: 100%; min-height: 44px; border: 1px solid var(--control-edge,#baa2be); border-radius: 6px; padding: 10px; background: var(--panel,#25283e); color: var(--paper-text,#f2ebf4); }
#place-search-count { margin-block: 10px; }
#map-layers-panel { max-height: calc(100dvh - 24px); overflow: auto; max-width: calc(100vw - 24px); }
#map-layers-panel :is(button,input) { min-height: 32px; min-width: 32px; }
#map-layers-panel :is(.layer-help,#layers-status) { font-size: .875rem; line-height: 1.5; }
/* Supporting research pages retain their existing content and filter logic. */
.refine .help, .hit :is(.meta,.reason,.source), .fields label, .sort, #page-number { font-size: .875rem; }
.refine :is(input,select,button), #pages button, .questions button { min-height: 44px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  button, select, input, summary { border: 1px solid ButtonText !important; }
  #experience :is(.person-symbol,.site-symbol) { fill: CanvasText !important; stroke: Canvas !important; }
  :focus-visible { outline: 3px solid Highlight !important; }
}

@media (max-width: 1100px), (max-height: 700px) {

#experience { display: flex !important; flex-direction: column; gap: 16px; height: auto !important; min-height: 100svh; overflow: visible !important; padding: 16px; }
#experience .hud { order: 0; position: relative !important; inset: auto !important; transform: none; height: auto !important; margin: 0 !important; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; width: 100%; }
#experience .hud .brand { max-width: 100%; }
#experience .view-navigation { position: static; transform: none; width: auto; min-width: 0; align-self: start; }
#experience .hud-right { grid-column: 1 / -1; width: 100%; justify-items: stretch; }
#experience .map-finders { width: 100%; grid-template-columns: repeat(3,minmax(0,1fr)); }
#experience .map-field { min-width: 0; }
#experience .map-field select { width: 100%; }
#experience .research-tools { width: 100%; flex-wrap: wrap; }
#experience .research-tools #atlas-search { flex: 1 1 200px; }
#experience .atlas { order: 1; position: relative; inset: auto; width: 100%; height: 45svh; min-height: 300px; border: 1px solid var(--control-edge,#a790b2); border-radius: 8px; overflow: hidden; }
#experience .map-rail { order: 2; position: static !important; margin: 0 !important; max-height: none; width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
#experience .rail-top { justify-content: end; }
#experience .map-tools { position: static; display: flex; justify-content: end; }
#experience .map-tools button { min-width: 44px; min-height: 44px; }
#experience .life-panel { order: 4; position: relative !important; inset: auto !important; width: 100%; max-width: none; max-height: none !important; margin: 0 !important; overflow: visible !important; }
#experience .life-panel .card-face { padding: 24px; }
#experience .life-panel h1, #experience .life-panel .identity h1 { max-width: 100%; font-size: clamp(2rem,6vw,3rem); }
#experience .life-panel .story h2 { font-size: 1.8rem; }
#experience .bottom-hud { order: 6; position: relative !important; inset: auto !important; margin: 0 !important; width: 100%; }
#experience #timeline { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); height: auto; overflow: visible; white-space: normal; gap: 8px; padding: 12px; }
#experience #timeline::before, #experience .time-event i { display: none; }
#experience .time-event { width: auto; max-width: none; min-width: 0; padding: 12px; text-align: left; }
#experience .atlas-footer { padding-inline: 12px; }
#experience .relationship-stage { order: 5; position: static !important; margin: 0; width: 100%; }
#experience .connections { position: static !important; max-height: none; overflow: visible; width: 100%; padding: 20px; }
#experience .opening-story, #experience #opening-story { order: 3; position: static; width: 100%; max-width: none; max-height: none; margin: 0; }
#experience #empty-selection { order: 3; position: static; transform: none; max-width: 100%; }

}

html[data-reading="true"] #experience { display: flex !important; flex-direction: column; gap: 16px; height: auto !important; min-height: 100svh; overflow: visible !important; padding: 16px; }
html[data-reading="true"] #experience .hud { order: 0; position: relative !important; inset: auto !important; transform: none; height: auto !important; margin: 0 !important; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; width: 100%; }
html[data-reading="true"] #experience .hud .brand { max-width: 100%; }
html[data-reading="true"] #experience .view-navigation { position: static; transform: none; width: auto; min-width: 0; align-self: start; }
html[data-reading="true"] #experience .hud-right { grid-column: 1 / -1; width: 100%; justify-items: stretch; }
html[data-reading="true"] #experience .map-finders { width: 100%; grid-template-columns: repeat(3,minmax(0,1fr)); }
html[data-reading="true"] #experience .map-field { min-width: 0; }
html[data-reading="true"] #experience .map-field select { width: 100%; }
html[data-reading="true"] #experience .research-tools { width: 100%; flex-wrap: wrap; }
html[data-reading="true"] #experience .research-tools #atlas-search { flex: 1 1 200px; }
html[data-reading="true"] #experience .atlas { order: 1; position: relative; inset: auto; width: 100%; height: 45svh; min-height: 300px; border: 1px solid var(--control-edge,#a790b2); border-radius: 8px; overflow: hidden; }
html[data-reading="true"] #experience .map-rail { order: 2; position: static !important; margin: 0 !important; max-height: none; width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
html[data-reading="true"] #experience .rail-top { justify-content: end; }
html[data-reading="true"] #experience .map-tools { position: static; display: flex; justify-content: end; }
html[data-reading="true"] #experience .map-tools button { min-width: 44px; min-height: 44px; }
html[data-reading="true"] #experience .life-panel { order: 4; position: relative !important; inset: auto !important; width: 100%; max-width: none; max-height: none !important; margin: 0 !important; overflow: visible !important; }
html[data-reading="true"] #experience .life-panel .card-face { padding: 24px; }
html[data-reading="true"] #experience .life-panel h1, html[data-reading="true"] #experience .life-panel .identity h1 { max-width: 100%; font-size: clamp(2rem,6vw,3rem); }
html[data-reading="true"] #experience .life-panel .story h2 { font-size: 1.8rem; }
html[data-reading="true"] #experience .bottom-hud { order: 6; position: relative !important; inset: auto !important; margin: 0 !important; width: 100%; }
html[data-reading="true"] #experience #timeline { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); height: auto; overflow: visible; white-space: normal; gap: 8px; padding: 12px; }
html[data-reading="true"] #experience #timeline::before, html[data-reading="true"] #experience .time-event i { display: none; }
html[data-reading="true"] #experience .time-event { width: auto; max-width: none; min-width: 0; padding: 12px; text-align: left; }
html[data-reading="true"] #experience .atlas-footer { padding-inline: 12px; }
html[data-reading="true"] #experience .relationship-stage { order: 5; position: static !important; margin: 0; width: 100%; }
html[data-reading="true"] #experience .connections { position: static !important; max-height: none; overflow: visible; width: 100%; padding: 20px; }
html[data-reading="true"] #experience .opening-story, html[data-reading="true"] #experience #opening-story { order: 3; position: static; width: 100%; max-width: none; max-height: none; margin: 0; }
html[data-reading="true"] #experience #empty-selection { order: 3; position: static; transform: none; max-width: 100%; }

html[data-reading="true"] #experience { max-width: 1100px; margin-inline: auto; }
html[data-reading="true"] #experience :is(.atlas,.map-rail,#opening-story) { display: none !important; }
html[data-reading="true"] #experience .life-panel { box-shadow: none; }
@media (max-width: 600px) {
 #experience .hud { grid-template-columns: minmax(0,1fr); }
 #experience .view-navigation { width: 100%; }
 #experience .map-finders { grid-template-columns: minmax(0,1fr); gap: 12px; }
 #experience .map-rail { grid-template-columns: minmax(0,1fr); }
 #experience .hud .brand { font-size: 1.1rem; }
 #experience #timeline { grid-template-columns: minmax(0,1fr); }
 #experience .life-panel .card-face, #experience .connections { padding: 16px; }
 #experience .deck-count { flex-wrap: wrap; }
 .drawer { padding: 14px; }
}

html[data-reading="true"] #experience .map-field:has(#map-base) { display: none; }
html[data-reading="true"] #experience .map-finders { grid-template-columns: repeat(2,minmax(0,1fr)); }
html[data-reading="true"] #experience .card-face p { max-width: 72ch; }
#reading-overview { order: 3; padding: 24px; background: var(--panel,#25283e); border: 1px solid var(--control-edge,#aa93b8); border-radius: 8px; }
#reading-overview p { margin-block: 12px; font-size: 1rem; }
@media (max-width:600px) { html[data-reading="true"] #experience .map-finders { grid-template-columns: minmax(0,1fr); } }

#experience .mode-switch button { font-size: .875rem; min-height: 44px; padding: 8px 12px; }
#experience .map-field > span { font-size: .875rem; }
@media (max-width:600px) {
 html[data-reading="true"] #experience .hud { grid-template-columns: minmax(0,1fr); }
 html[data-reading="true"] #experience .view-navigation { width: 100%; }
 html[data-reading="true"] #experience .life-panel .card-face { padding: 16px; }
}
/* In document layouts the chat launcher must not cover reading or keyboard controls. */
html[data-reading="true"] #memorial-chat-bubble { position: static; margin: 16px auto; max-width: calc(100% - 32px); }
@media (max-width:1100px), (max-height:700px) {
 #memorial-chat-bubble { position: static; margin: 16px auto; max-width: calc(100% - 32px); }
}
