/* One search for everything: the Storybook (memories, chat, time capsules) and Family History
   (people, documents, stories). The screen's basics (.search-view, .search-top, .search-grid…)
   are in app.css; this adds the groups, rows and highlights. Loaded by search.js if index.html
   doesn't link it. */

/* just under the family tree (45), so "Show in the tree" from a person found here comes up on top;
   still over the Storybook (30) and Family History (40) it's opened from */
section.search-view { z-index: 44; }

.search-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; }
.search-tabs::-webkit-scrollbar { display: none; }
.search-tabs .tab { flex: none; }
.search-tips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 16px 12px; color: var(--muted); font-size: 13px; }
.search-tips[hidden] { display: none; }
.search-tip { border: 1px dashed var(--line); background: none; color: var(--fg); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.search-results { padding-bottom: calc(var(--safe-b) + 30px); }
.search-results .search-grid { padding-bottom: 0; }
.search-half { margin: 14px 16px 2px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.search-half:first-child { margin-top: 2px; }
.search-group { margin-bottom: 10px; }
.search-group-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 16px 8px; }
.search-group-head h3 { margin: 0; font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.search-group-head .n { font-size: 12.5px; color: var(--muted); }   /* (at .8 opacity it was under 4.5:1) */

.search-rows { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }
.search-row { display: flex; gap: 12px; align-items: flex-start; width: 100%; border: 0; border-radius: 14px; padding: 10px 12px; background: var(--chip); color: var(--fg); text-align: left; }
.search-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 17px; line-height: 1; }
.search-ico svg { width: 18px; height: 18px; }
.search-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.search-txt b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-txt small { color: var(--muted); font-size: 12.5px; }
.search-snip { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.search-results mark, .search-peek mark { background: var(--accent); color: var(--accent-fg); border-radius: 3px; padding: 0 1px; }
.search-more { display: block; margin: 8px 12px 0; width: calc(100% - 24px); border: 0; border-radius: 12px; padding: 10px; background: none; color: var(--fg); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.search-group.memories .search-more { margin-top: 6px; }
.search-note { padding: 0 16px; }

/* a chat message with the ones around it */
.search-peek { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; margin: 4px 0 14px; padding: 2px; }
.peek-msg { align-self: flex-start; max-width: 85%; background: var(--chip); border-radius: 14px; padding: 7px 11px; overflow-wrap: anywhere; }
.peek-msg.me { align-self: flex-end; background: color-mix(in srgb, var(--send) 18%, var(--chip)); }
.peek-msg small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 1px; }
.peek-msg.found { outline: 2px solid var(--accent); }

/* the message search jumped to, in the chat (chat.js adds .talk-found when opened with hooks.focus) */
.talk-msg.talk-found { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; animation: talk-found 2.4s ease forwards; }
@keyframes talk-found { 0%, 70% { outline-color: var(--accent); } 100% { outline-color: transparent; } }
