/* Full-screen search (/search/, /fr/recherche/): assets/inc/search-page.php + assets/js/search.js.
   No site header or footer: a big frosted search bar at the top, results under it, grouped by type. */

.search-body { min-height: 100vh; min-height: 100dvh; }
.search-body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: 340px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 75%);
}
.sr-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

main.search-screen { max-width: 760px; margin: 0 auto; padding: 16px 16px 64px; }
@media (min-width: 768px) { main.search-screen { padding: 40px 32px 80px; } }

/* The bar: icon, box, (Search button without JavaScript), close */
.search-bar {
  position: sticky; top: 12px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  min-height: 60px; padding: 6px 8px 6px 18px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 12px 32px -18px rgba(20, 33, 61, 0.45);
}
@supports (background: color-mix(in srgb, red, blue)) {
  .search-bar {
    background: color-mix(in srgb, var(--card) 72%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  }
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), 0 12px 32px -18px rgba(20, 33, 61, 0.45); }
.search-bar-icon { flex: none; width: 24px; height: 24px; color: var(--muted); }
.search-bar input {
  flex: 1; min-width: 0; height: 46px; padding: 0 4px;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 1.25rem; font-weight: 500; letter-spacing: -0.01em;
}
.search-bar input::placeholder { color: var(--muted); opacity: 0.8; }
.search-bar input:focus { outline: none; }   /* the whole bar shows the focus ring (above) */
.search-bar input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
@media (min-width: 768px) { .search-bar input { font-size: 1.45rem; } .search-bar { min-height: 68px; } }

.search-go {
  flex: none; height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent-soft); color: var(--ink); font: inherit; font-weight: 700;
}
.js-search .search-go { display: none; }   /* results come as you type: no button needed */
.search-close {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 999px; color: var(--ink);
}
.search-close svg { width: 22px; height: 22px; }
.search-close:hover { background: var(--accent-soft); }
.search-go:focus-visible, .search-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.search-status { margin: 18px 6px 8px; color: var(--muted); font-size: 0.92rem; min-height: 1.4em; }
.search-keys { margin: 32px 6px 0; color: var(--muted); font-size: 0.8rem; text-align: center; }
@media (hover: none), (max-width: 599px) { .search-keys { display: none; } }

/* Groups */
.sr-group { margin-top: 18px; }
.sr-group h2 {
  display: flex; align-items: center; gap: 8px; margin: 0 6px 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.sr-count { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: 0.72rem; letter-spacing: 0; }
.sr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

/* One result */
.sr-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px 10px 10px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.sr-item:hover, .sr-item.is-active { border-color: var(--accent); box-shadow: 0 6px 18px -12px rgba(20, 33, 61, 0.5); }
.sr-item.is-active { background: color-mix(in srgb, var(--accent-soft) 55%, var(--card)); }
.sr-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-thumb {
  flex: none; position: relative; width: 64px; height: 48px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 45%, var(--accent-soft)));
}
.sr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-thumb-thing img { object-fit: contain; padding: 4px; }
/* No image: a small symbol for the type */
.sr-thumb:empty::after {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.15rem; font-weight: 800; color: var(--ink); opacity: 0.75;
}
.sr-thumb-page:empty::after    { content: "↗"; }
.sr-thumb-project:empty::after { content: "◆"; }
.sr-thumb-article:empty::after { content: "¶"; }
.sr-thumb-about:empty::after   { content: "★"; }
.sr-thumb-thing:empty::after   { content: "♥"; }
.sr-body { min-width: 0; display: grid; gap: 2px; }
.sr-title { font-weight: 700; line-height: 1.3; }
.sr-meta { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.sr-text { color: var(--muted); font-size: 0.9rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-item mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-draft {
  display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 2px 7px; border-radius: 6px;
  background: #ffd84d; color: #3d2f00; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}

/* Before typing: the pages, as chips */
.sr-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sr-chips a {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.sr-chips a:hover { border-color: var(--accent); background: var(--accent-soft); }
.sr-chips a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Way in and out (transitions.css): on this page the whole screen and the bar are animated on their own,
   so the page itself (root) isn't; the bar takes over from the header's magnifying glass. */
:root { view-transition-name: none; }
main.search-screen { view-transition-name: search-screen; }
.search-bar { view-transition-name: search-field; }
::view-transition-image-pair(search-field) { animation: none; }   /* going in: the pill stays, it becomes the bar */

/* Results fade in as they change; browsers without page transitions also get the bar dropping in on arrival */
@media (prefers-reduced-motion: no-preference) {
  .sr-group { animation: sr-fade 0.18s ease-out; }
  @supports not (view-transition-class: a) {
    .search-bar { animation: sr-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
    main.search-screen { animation: sr-fade 0.24s ease-out; }
  }
}
@keyframes sr-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
@keyframes sr-fade { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .sr-item { transition: none; } }
