/* Footer search: a compact neumorphic "finder" (off-white pill, soft outer shadow, inset well, dark magnifier).
   The bar sits in the site footer, aligned to the inline-end (right in LTR, left in RTL) on desktop, and is always
   visible as an inline field (no header toggle). On phones (<=860px) it spans the footer width. Results open upward
   when the bar is near the bottom of the viewport so they are not clipped by the footer or the page end
   (search.js places the list). Results come from data/search/<lang>.json (written by tools/build-pages.mjs).
   Everything is scoped under .tse-finder. Loaded after site-theme.css. Use :not(#_):not(#__) + !important to beat
   site-theme.css and the light footer rules in design.css. */
.tse-finder {
  --f-bg: #f6f5f0;
  --f-ink: #292929;
  --f-text: #5b616a;
  --f-dark: rgba(170, 170, 170, .55);
  --f-light: rgba(255, 255, 255, .9);
  position: relative; flex: none; display: flex; align-items: center;
  font-family: var(--font, "Lato", "Segoe UI", Helvetica, Arial, sans-serif);
}

/* ---------- The magnifier: a dark disc with a light lens and handle; when active the lens fills and the handle drops away.
   Sizes are in --u (1/40 of the icon), so the original 40px drawing scales to any size. ---------- */
.tse-finder__icon {
  --s: 26px; --u: calc(var(--s) / 40);
  position: relative; flex: none; display: block; width: var(--s); height: var(--s);
  border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--u) * 20) var(--f-ink);
  transition: transform .2s;
}
.tse-finder__icon::before, .tse-finder__icon::after {
  content: ""; display: block; position: absolute; box-sizing: content-box;
  transition: all .5s cubic-bezier(.68, -.55, .265, 1.55);
}
.tse-finder__icon::after {
  width: calc(var(--u) * 10); height: calc(var(--u) * 10);
  background-color: var(--f-ink); border: calc(var(--u) * 3) solid var(--f-bg); border-radius: 50%;
  top: 50%; left: 0; right: 0; margin: auto; transform: translateY(-50%);
}
.tse-finder__icon::before {
  width: calc(var(--u) * 4); height: calc(var(--u) * 13); border-radius: calc(var(--u) * 4);
  background-color: var(--f-bg); top: 50%; left: calc(var(--u) * 20);
  transform: rotateZ(45deg) translate(-50%, 0); transform-origin: 0 0;
}
.tse-finder__form.is-active .tse-finder__inner .tse-finder__icon { transform: translateY(calc(var(--u) * -3)); }
.tse-finder__form.is-active .tse-finder__inner .tse-finder__icon::after { border-width: calc(var(--u) * 10); background-color: var(--f-bg); }
.tse-finder__form.is-active .tse-finder__inner .tse-finder__icon::before {
  background-color: var(--f-ink); width: calc(var(--u) * 6); transform: rotateZ(45deg) translate(-50%, calc(var(--u) * 25));
}
.tse-finder__form.is-processing .tse-finder__inner .tse-finder__icon {
  transform-origin: 50%; animation: tse-finder-spin .3s linear infinite; animation-delay: .25s;
}
@keyframes tse-finder-spin { from { transform: rotateZ(45deg); } to { transform: rotateZ(405deg); } }

/* ---------- The footer bar (always visible; any leftover toggle is hidden) ---------- */
.tse-finder__toggle:not(#_):not(#__) { display: none !important; }
.tse-finder__panel, .tse-finder__panel[hidden] { display: contents; }
.tse-finder__input:focus-visible { outline: none !important; }
.tse-finder__form {
  width: 100%; margin: 0; padding: 4px; border: 1px solid #fff; border-radius: 12px; background-color: var(--f-bg);
  box-shadow: 5px 5px 10px rgba(160, 160, 160, .45), -5px -5px 10px rgba(255, 255, 255, .7);
}
.tse-finder__outer {
  display: flex; padding: 3px 12px; border-radius: 9px;
  box-shadow: inset 7px 7px 10px -7px #c3c3c3, inset -7px -7px 10px -7px #ffffff;
}
.tse-finder__inner { display: flex; align-items: center; gap: 10px; position: relative; flex: 1; min-width: 0; }
.tse-finder__inner .tse-finder__icon { --s: 22px; }
.tse-finder .tse-finder__input:not(#_):not(#__) {
  flex: 1; min-width: 0; height: 28px; margin: 0; padding: 0; border: none !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important; outline: none;
  font: 400 .9rem/1.2 var(--font, sans-serif) !important; letter-spacing: .4px; color: var(--f-ink) !important;
  -webkit-appearance: none; appearance: none; text-overflow: ellipsis;
}
.tse-finder__input::placeholder { color: #8b8f95; opacity: 1; }
.tse-finder__input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.tse-finder__input:read-only { cursor: progress; }
.tse-finder__form:focus-within .tse-finder__outer { box-shadow: inset 7px 7px 10px -7px #bdbdbd, inset -7px -7px 10px -7px #ffffff, 0 0 0 2px rgba(200, 16, 46, .28); }

/* ---------- Footer placement: inline-end on desktop (margin-inline-start:auto so RTL goes left), full width on phones.
   Overflow is forced visible so the upward results are not clipped by design.css's .site-footer { overflow: hidden }. ---------- */
.site-footer:not(#_):not(#__), .site-footer .footer-inner:not(#_):not(#__) { overflow: visible !important; }
.site-footer .footer-inner > .tse-finder:not(#_):not(#__) {
  position: relative; z-index: 6;
  flex: 0 1 280px; width: min(280px, 100%); min-width: 200px;
  margin-inline-start: auto;
}
/* The bar sits at the top of the footer: on the logo's row at the inline-end on desktop, right under the logo on phones. */
.site-footer .footer-inner > *:not(#_):not(#__) { order: 2; }
.site-footer .footer-inner > .footer-brand:not(#_):not(#__) { order: 0; }
.site-footer .footer-inner > .tse-finder:not(#_):not(#__) { order: 1; }
@media (max-width: 860px) {
  .site-footer .footer-inner > .tse-finder:not(#_):not(#__) {
    flex: 1 1 100%; width: 100%; min-width: 0; margin-inline-start: 0; align-self: stretch;
  }
  .tse-finder__form { box-shadow: 6px 6px 12px rgba(160, 160, 160, .4), -6px -6px 12px rgba(255, 255, 255, .6); }
}

/* ---------- Results (search.js sets position:fixed and the top/bottom/left/width so the list can open up or down) ---------- */
.tse-finder .tse-finder__list:not(#_):not(#__), .tse-finder .tse-finder__empty:not(#_):not(#__) {
  z-index: 80; list-style: none; margin: 0 !important; padding: 7px !important; max-height: min(60vh, 440px); overflow-y: auto;
  overscroll-behavior: contain; scrollbar-width: thin;
  border: 1px solid #fff; border-radius: 15px; background: var(--f-bg);
  box-shadow: 9px 9px 16px rgba(160, 160, 160, .4), -9px -9px 16px rgba(255, 255, 255, .5), 0 18px 44px rgba(22, 32, 48, .16);
  animation: tse-finder-in .2s cubic-bezier(.2, .75, .2, 1);
}
.tse-finder.is-up .tse-finder__list, .tse-finder.is-up .tse-finder__empty { animation-name: tse-finder-in-up; }
@keyframes tse-finder-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes tse-finder-in-up { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.tse-finder__list[hidden], .tse-finder__empty[hidden] { display: none !important; }
.tse-finder .tse-finder__list > li:not(#_):not(#__) { margin: 0 !important; padding: 0; letter-spacing: 0; color: var(--f-text) !important; }
.tse-finder .tse-finder__opt:not(#_):not(#__) {
  display: block; padding: 9px 12px; border-radius: 10px; text-decoration: none !important;
  border-inline-start: 3px solid transparent; color: var(--f-text) !important;
}
.tse-finder .tse-finder__opt[aria-selected="true"]:not(#_):not(#__), .tse-finder .tse-finder__opt:hover:not(#_):not(#__) {
  background: #ecebe4; border-inline-start-color: var(--red, #c8102e);
  box-shadow: inset 3px 3px 6px rgba(190, 190, 190, .45), inset -3px -3px 6px rgba(255, 255, 255, .8);
}
.tse-finder .tse-finder__opt-title:not(#_):not(#__) {
  display: block; font: 700 .9rem/1.3 var(--font, sans-serif) !important; color: var(--f-ink) !important; letter-spacing: 0;
}
.tse-finder .tse-finder__opt-path:not(#_):not(#__) { display: block; margin-top: 1px; font: 400 .68rem/1.3 var(--font, sans-serif) !important; color: #8b8f95 !important; direction: ltr; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[dir="rtl"] .tse-finder .tse-finder__opt-path:not(#_):not(#__) { text-align: right; }
.tse-finder .tse-finder__opt-snip:not(#_):not(#__) {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 3px;
  font: 400 .78rem/1.45 var(--font, sans-serif) !important; color: var(--f-text) !important; letter-spacing: 0;
}
.tse-finder mark:not(#_):not(#__) { background: rgba(200, 16, 46, .13) !important; color: inherit !important; border-radius: 3px; padding: 0 1px; }
.tse-finder .tse-finder__empty:not(#_):not(#__) {
  padding: 14px 16px !important; font: 400 .85rem/1.4 var(--font, sans-serif) !important; color: var(--f-text) !important; overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .tse-finder__list, .tse-finder__empty { animation: none !important; }
  .tse-finder__icon, .tse-finder__icon::before, .tse-finder__icon::after { transition: none !important; animation: none !important; }
  .tse-finder__form.is-processing .tse-finder__inner .tse-finder__icon { animation: none !important; opacity: .55; }
}
