.research-dock { --rd-surface:light-dark(#fffdf8,#202724); --rd-text:light-dark(#24343a,#f1f0e9); --rd-muted:light-dark(#64747a,#b7beb6); --rd-line:light-dark(#d8dede,#454c45); --rd-soft:light-dark(#f1f0e8,#303831); --rd-accent:#e6c77d; position:absolute; z-index:1100; /* over the map's zoom and location buttons (1000), under the toolbar (1200) */ left:16px; bottom:calc(var(--map-footer-height,24px) + 16px); width:min(380px,36vw); min-width:330px; max-width:calc(100% - 32px); max-height:min(640px,calc(100% - 96px)); overflow:auto; overscroll-behavior:contain; box-sizing:border-box; border:1px solid var(--rd-line); border-radius:12px; background:var(--rd-surface); color:var(--rd-text); box-shadow:0 7px 28px #0006; color-scheme:light dark; font:14px/1.45 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.research-dock[hidden] { display:none; }
.research-dock button { font:inherit; cursor:pointer; color:var(--rd-text); }
.research-dock :focus-visible { outline:2px solid var(--rd-accent); outline-offset:2px; }
.research-dock a { color:inherit; text-decoration:underline; text-underline-offset:2px; }

/* Header */
.research-dock-header { position:sticky; z-index:2; top:0; padding:8px 8px 8px 14px; background:var(--rd-surface); border-bottom:1px solid var(--rd-line); }
.research-dock-back { display:block; max-width:100%; margin:0 0 4px -6px; padding:3px 6px; border:0; border-radius:5px; background:transparent; color:var(--rd-muted) !important; font-size:12px !important; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.research-dock-back:hover { background:var(--rd-soft); color:var(--rd-text) !important; }
.research-dock-title-row { display:flex; align-items:flex-start; gap:4px; }
.research-dock-title-row h2 { flex:1; min-width:0; margin:4px 0 0; font-size:17px; line-height:1.28; font-weight:650; overflow-wrap:anywhere; }
.research-dock-title-row button { flex:none; display:grid; place-items:center; width:32px; height:32px; padding:0; border:0; border-radius:6px; background:transparent; font-size:21px; line-height:1; }
.research-dock-title-row button:hover { background:var(--rd-soft); }
.research-dock-meta { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; margin:4px 0 2px; color:var(--rd-muted); font-size:12px; }
.research-status { padding:1px 7px; border-radius:999px; border:1px solid currentColor; font-size:11px; font-weight:600; }
.research-status.is-present { color:light-dark(#2f6b45,#9fd3ae); }
.research-status.is-past { color:light-dark(#6b6f6c,#c9cdc8); border-style:dashed; }
.research-status.is-future { color:light-dark(#6d4a86,#d9b8ea); }
.research-status.is-unknown { color:var(--rd-muted); border-style:dotted; }
.research-dock-nearby { display:flex; align-items:center; gap:6px; margin-top:6px; color:var(--rd-muted); font-size:12px; }
.research-dock-nearby span { flex:1; text-align:center; }
.research-dock-nearby button, .research-gallery-frame button { position:relative; width:30px; height:28px; padding:0; border:1px solid var(--rd-line); border-radius:6px; background:transparent; }
.research-dock-nearby button::before, .research-gallery-frame button::before { content:''; position:absolute; left:50%; top:50%; width:7px; height:7px; border-left:2px solid currentColor; border-bottom:2px solid currentColor; transform:translate(-30%,-50%) rotate(45deg); }
.research-dock-next::before, .research-gallery-next::before { transform:translate(-70%,-50%) rotate(-135deg) !important; }

.research-dock-body { padding:0 14px 14px; }
.research-dock-notice { margin:10px 0 0; padding:7px 9px; border-radius:6px; background:var(--rd-soft); font-size:12px; }

/* Photo */
.research-gallery { margin:0 -14px; }
.research-gallery-frame { position:relative; height:190px; overflow:hidden; background:#111b17; }
/* Pinned to the frame: large photos scale to fit, small ones stay sharp at natural size. */
.research-gallery-frame img, .research-gallery-open { position:absolute; inset:0; display:block; width:100%; height:100%; }
.research-gallery-frame img { object-fit:scale-down; }
.research-gallery-open { cursor:zoom-in; }
.research-gallery-unavailable { position:absolute; inset:0; display:grid; place-items:center; margin:0; }
.research-gallery-frame button { position:absolute; z-index:1; top:50%; transform:translateY(-50%); width:34px; height:34px; border-color:#87938a; background:#17231ddd; color:#fff; }
.research-gallery-prev { left:8px; } .research-gallery-next { right:8px; }
.research-gallery-count, .research-photo-date { position:absolute; z-index:1; bottom:8px; padding:2px 7px; border-radius:4px; background:#17231ddd; color:#fff; font-size:11px; pointer-events:none; }
.research-gallery-count { right:8px; } .research-photo-date { left:8px; }
.research-gallery-unavailable { color:#e4e8dd; font-size:12px; }
.research-photo-caption { display:grid; gap:2px; margin:0; padding:7px 14px 0; font-size:12px; }
.research-photo-context, .research-photo-credit { color:var(--rd-muted); font-size:11px; }

/* Actions */
.research-actions { display:flex; gap:6px; margin:12px 0 10px; }
.research-action { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; padding:7px 4px 6px; border:1px solid var(--rd-line); border-radius:9px; background:transparent; font-size:12px !important; }
.research-action:hover:not(:disabled) { background:var(--rd-soft); }
.research-action:disabled { opacity:.45; cursor:default; }
.research-action svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* Tabs */
.research-tabs { position:sticky; z-index:1; top:var(--rd-header,0px); display:flex; gap:2px; margin:0 -14px; padding:0 8px; background:var(--rd-surface); border-bottom:1px solid var(--rd-line); overflow-x:auto; scrollbar-width:none; }
.research-tab { flex:none; padding:9px 8px 8px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--rd-muted) !important; font-size:12.5px !important; font-weight:600; white-space:nowrap; }
.research-tab[aria-selected=true] { color:var(--rd-text) !important; border-bottom-color:var(--rd-accent); }
.research-tab:hover { color:var(--rd-text) !important; }
.research-tabpanel { padding-top:10px; }
.research-label { display:block; margin:12px 0 3px; color:var(--rd-muted); font-size:11px; font-weight:650; letter-spacing:.04em; text-transform:uppercase; }
.research-tabpanel > :first-child .research-label, .research-tabpanel > .research-label:first-child { margin-top:2px; }
.research-state { margin:0; }
.research-why p { margin:0; }
.research-story { margin:2px 0 4px; font-size:14.5px; line-height:1.55; }
.research-today p { margin:0; }
.research-uncertainty { margin:6px 0; color:var(--rd-muted); font-size:12px; line-height:1.4; }
.research-empty { margin:6px 0; color:var(--rd-muted); font-size:13px; }
.research-keydates { display:grid; grid-template-columns:auto 1fr; gap:3px 12px; margin:12px 0 0; font-size:12.5px; }
.research-keydates dt { color:var(--rd-muted); }
.research-keydates dd { margin:0; }
.research-where { margin:10px 0 0; font-size:12.5px; }
.research-link-button { padding:2px 0; border:0; background:transparent; color:var(--rd-text) !important; font-size:12px !important; font-weight:600; text-decoration:underline; text-underline-offset:2px; }

/* Connections */
.research-chips { display:flex; flex-wrap:wrap; gap:6px; }
.research-chip { padding:4px 9px; border:1px solid var(--rd-line); border-radius:999px; background:transparent; font-size:12px !important; }
.research-chip:hover { background:var(--rd-soft); }
.research-chip[aria-pressed=true] { background:var(--rd-text); color:var(--rd-surface) !important; border-color:var(--rd-text); }
.research-chip-status { margin:8px 0 4px; color:var(--rd-muted); font-size:11.5px; }
.research-related-list { list-style:none; padding:0; margin:4px 0; }
.research-related-item { border-top:1px solid var(--rd-line); padding:8px 0; }
.research-related-item:first-child { border-top:0; }
.research-related-head { display:flex; align-items:baseline; gap:6px; }
.research-related-name { padding:0; border:0; background:transparent; text-align:left; font-weight:600 !important; text-decoration:underline; text-decoration-color:var(--rd-line); text-underline-offset:3px; }
.research-related-name:hover { text-decoration-color:currentColor; }
.research-related-flag { color:var(--rd-muted); font-size:10.5px; }
.research-related-item p { margin:4px 0; font-size:12.5px; line-height:1.4; }
.research-related-item small { display:block; color:var(--rd-muted); font-size:11px; }
.research-source-line { margin:4px 0 0 !important; color:var(--rd-muted); font-size:11px !important; }
.research-preview-connections { margin-top:4px; }

/* Timeline */
.research-timeline { list-style:none; margin:0; padding:0 0 0 14px; border-left:2px solid var(--rd-line); }
.research-timeline li { position:relative; padding:2px 0 12px 4px; }
.research-timeline li::before { content:''; position:absolute; left:-21px; top:6px; width:10px; height:10px; border-radius:50%; background:var(--rd-surface); border:2px solid var(--rd-muted); }
.research-timeline-head { display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.research-timeline strong { font-size:12.5px; font-variant-numeric:tabular-nums; }
.research-timeline span, .research-timeline small { display:block; }
.research-timeline small { color:var(--rd-muted); font-size:11.5px; }
.research-timeline-now { padding:0 0 12px 4px !important; }
.research-timeline-now::before { background:var(--rd-accent) !important; border-color:var(--rd-accent) !important; }
.research-timeline-now span { color:var(--rd-text); font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.research-sources { margin:0; padding-left:18px; }
.research-sources li { margin:3px 0; }

/* Map highlight */
.research-pulse { animation:research-pulse 1.2s ease-out 2; }
@keyframes research-pulse { from { stroke-opacity:1; } to { stroke-opacity:.15; } }
.research-relation-arrow-wrap { background:transparent; border:0; pointer-events:none; }

.research-dock-grip, .research-dock-peek { display:none; }
@media(max-width:640px) {
 .research-dock { left:8px; right:8px; bottom:calc(var(--map-footer-height,24px) + 6px); width:auto; min-width:0; max-width:none; max-height:52dvh; border-radius:14px; }
 .research-dock.is-expanded { max-height:82dvh; }
 .research-dock-header { padding:0 6px 10px 14px; touch-action:none; border-bottom:0; }
 .research-dock.is-expanded .research-dock-header { border-bottom:1px solid var(--rd-line); }
 .research-dock-grip { display:block; position:relative; width:calc(100% + 20px); height:18px; margin:0 0 0 -14px; padding:0; border:0; background:transparent; cursor:grab; }
 .research-dock-grip::before { content:''; position:absolute; left:50%; top:7px; width:38px; height:4px; margin-left:-19px; border-radius:2px; background:var(--rd-line); }
 .research-dock-title-row h2 { margin-top:2px; font-size:17.5px; }
 .research-dock-title-row button { width:40px; height:40px; margin:-6px 0 -6px; }
 /* Collapsed: a summary card. Name, status, opening lines and the actions; nothing cut off mid-photo. */
 .research-dock:not(.is-expanded) { overflow:hidden; }
 .research-dock:not(.is-expanded) .research-dock-peek { display:flex; }
 .research-dock:not(.is-expanded) .research-dock-body > :not(.research-actions):not(.research-dock-notice) { display:none; }
 .research-dock-peek { align-items:center; gap:11px; width:100%; margin:8px 0 0; padding:0; border:0; background:transparent; text-align:left; font-size:13.5px !important; line-height:1.4; }
 .research-dock-peek img { flex:0 0 64px; width:64px; height:64px; border-radius:8px; object-fit:cover; background:var(--rd-soft); }
 .research-dock-peek span { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
 .research-dock-body { display:flex; flex-direction:column; }
 .research-dock-notice { order:-2; }
 .research-actions { order:-1; margin:2px 0 12px; gap:8px; }
 .research-action { flex-direction:row; justify-content:center; gap:6px; min-height:40px; padding:6px 8px; border-radius:999px; font-size:13px !important; }
 .research-action svg { width:16px; height:16px; }
 /* Expanded: the photo leads, a little larger. */
 .research-dock.is-expanded .research-gallery { order:-3; margin-bottom:0; }
 .research-dock.is-expanded .research-actions { margin-top:12px; }
 .research-gallery-frame { height:200px; }
 .research-story { font-size:15px; line-height:1.6; }
}
@media (prefers-reduced-motion:reduce) { .research-pulse { animation:none; } }
/* Year cards: the strip of photo years, the year's line and its notes, the being-built chip (design notes, section 3) */
.research-status.is-building { color:light-dark(#7a5a1e,#e6c77d); border-style:solid; background:repeating-linear-gradient(135deg,transparent 0 3px,#e6c77d22 3px 5px); }
.research-status.is-changing { animation:research-chip-in .2s ease-out; }
@keyframes research-chip-in { from { opacity:0; } to { opacity:1; } }
.research-year-strip { display:flex; flex-wrap:wrap; align-items:center; gap:2px 4px; margin:8px 0 0 -5px; }
.research-year-button { display:inline-flex; align-items:center; gap:5px; padding:3px 6px 4px; border:0; border-bottom:2px solid transparent; border-radius:4px 4px 0 0; background:transparent; color:var(--rd-muted) !important; font-size:12px !important; font-variant-numeric:tabular-nums; }
.research-year-button:hover { background:var(--rd-soft); color:var(--rd-text) !important; }
.research-year-button[aria-current=true] { color:var(--rd-text) !important; border-bottom-color:var(--rd-accent); font-weight:650; }
.research-year-now { display:inline-flex; align-items:center; padding:3px 6px 4px; border-bottom:2px dashed var(--rd-accent); color:light-dark(#7a5a1e,#e6c77d); font-size:12px; font-weight:650; font-variant-numeric:tabular-nums; }
.research-year-mark { display:inline-block; flex:none; width:9px; height:9px; box-sizing:border-box; border:1.5px solid currentColor; border-radius:50%; }
.research-year-mark.is-here { background:currentColor; }
.research-year-mark.is-building { background:linear-gradient(transparent 50%,currentColor 50%); }
.research-year-mark.is-ended { width:8px; height:8px; border-radius:1px; }
.research-year-mark.is-unknown { border-style:dotted; }
.research-year-line { margin:7px 0 1px; font-size:13.5px; line-height:1.45; }
.research-year-name { font-weight:650; }
.research-photo-year { margin:3px 0 0; color:var(--rd-muted); font-size:12px; line-height:1.4; }
.research-photo-year::before { content:''; display:inline-block; width:9px; height:9px; margin-right:6px; border:1.5px solid currentColor; border-radius:2px; vertical-align:-1px; box-sizing:border-box; }
/* Phones: the collapsed summary carries the year's line beside the thumbnail, so the header copy hides until the card opens. */
@media(max-width:640px) { .research-dock:not(.is-expanded) .research-dock-header:has(.research-dock-peek) .research-year-line { display:none; } }
@media (prefers-reduced-motion:reduce) { .research-status.is-changing { animation:none; } }
