/*!
 * Waarning search + command palette
 * Loaded after site.css. Uses the site's parchment / ink / rust tokens with
 * conservative fallbacks so the palette still renders if those tokens move.
 */

.ws-root,
.ws-overlay {
  --ws-paper: var(--paper, #efe6d4);
  --ws-paper-2: var(--paper-2, #f8f2e3);
  --ws-paper-3: var(--paper-3, #e6dac4);
  --ws-warm: #fffaf0;
  --ws-ink: var(--ink, #17231d);
  --ws-ink-2: var(--ink-2, #2b3a31);
  --ws-muted: var(--muted, #657064);
  --ws-soft: var(--soft, #8b9182);
  --ws-line: var(--line, rgba(23, 35, 29, .18));
  --ws-line-strong: var(--line-strong, rgba(23, 35, 29, .38));
  --ws-rust: var(--rust, #b7472a);
  --ws-rust-dark: var(--rust-dark, #8e321d);
  --ws-display: var(--display, "Bricolage Grotesque", "Trebuchet MS", sans-serif);
  --ws-sans: var(--sans, "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif);
  --ws-mono: var(--mono, "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace);
}

/* ------------------------------------------------------------------ */
/* Header: desktop trigger + narrow-screen inline field                */
/* ------------------------------------------------------------------ */

.ws-root {
  display: flex;
  align-items: center;
  flex: none;
  min-width: 0;
}

.ws-ui {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ws-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--ws-line-strong);
  border-radius: 8px;
  background: rgba(248, 242, 227, .55);
  color: var(--ws-ink-2);
  font: 700 8.5px/1 var(--ws-mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.ws-trigger:hover {
  background: var(--ws-warm);
  border-color: var(--ws-rust);
  color: var(--ws-rust);
}

.ws-trigger:active {
  transform: translateY(1px);
}

.ws-trigger .ws-ico {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--ws-rust);
}

.ws-trigger-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 17px;
  padding: 0 4px;
  border: 1px solid var(--ws-line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--ws-paper-2);
  color: var(--ws-muted);
  font: 600 7px/1 var(--ws-mono);
  letter-spacing: 0;
}

.ws-inline {
  display: none;
  align-items: center;
  gap: 5px;
  height: 34px;
  min-width: 0;
  max-width: 240px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--ws-line-strong);
  border-radius: 8px;
  background: var(--ws-warm);
  transition: border-color .14s ease, box-shadow .14s ease;
}

.ws-inline:focus-within {
  border-color: var(--ws-rust);
  box-shadow: 0 0 0 3px rgba(183, 71, 42, .14);
}

.ws-inline .ws-ico {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--ws-muted);
}

.ws-inline-input {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ws-ink);
  font: 600 13px/1 var(--ws-sans);
  letter-spacing: .01em;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
}

.ws-inline-input::placeholder {
  color: #7c8172;
  opacity: 1;
}

.ws-inline-input::-webkit-search-cancel-button,
.ws-inline-input::-webkit-search-decoration {
  -webkit-appearance: none;
  display: none;
}

/* ------------------------------------------------------------------ */
/* Dialog shell                                                       */
/* ------------------------------------------------------------------ */

.ws-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: start center;
  padding: clamp(12px, 6vh, 64px) 16px 16px;
  background: rgba(23, 35, 29, .46);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow: auto;
  overscroll-behavior: contain;
}

.ws-overlay[hidden] {
  display: none;
}

.ws-overlay:not(.is-open) {
  pointer-events: none;
}

.ws-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: 660px;
  max-height: min(720px, calc(100dvh - clamp(12px, 6vh, 64px) - 16px));
  overflow: hidden;
  background: var(--ws-paper-2);
  border: 1px solid var(--ws-line-strong);
  border-radius: 18px;
  box-shadow:
    0 34px 90px rgba(49, 38, 20, .34),
    0 1px 0 rgba(255, 255, 255, .72) inset;
  opacity: 0;
  transform: translateY(-8px) scale(.988);
  transition: opacity .16s ease, transform .16s ease;
}

.ws-overlay.is-open .ws-panel {
  opacity: 1;
  transform: none;
}

html.ws-lock,
body.ws-lock {
  overflow: hidden !important;
}

/* ------------------------------------------------------------------ */
/* Search bar                                                         */
/* ------------------------------------------------------------------ */

.ws-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 13px 14px;
  border-bottom: 1px solid var(--ws-line);
  background: linear-gradient(180deg, var(--ws-warm), var(--ws-paper-2));
}

.ws-bar:focus-within {
  box-shadow: inset 0 -2px 0 var(--ws-rust);
}

.ws-bar-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--ws-rust);
}

.ws-input {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--ws-ink);
  font: 500 17px/1.3 var(--ws-sans);
  letter-spacing: -.01em;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
}

.ws-input::placeholder {
  color: #7c8172;
  opacity: 1;
}

.ws-input::-webkit-search-cancel-button,
.ws-input::-webkit-search-decoration {
  -webkit-appearance: none;
  display: none;
}

.ws-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 9px;
  background: transparent;
  color: var(--ws-ink-2);
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.ws-close:hover {
  background: var(--ws-paper-3);
  border-color: var(--ws-line-strong);
  color: var(--ws-rust);
}

.ws-close .ws-ico {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------------ */
/* Results                                                            */
/* ------------------------------------------------------------------ */

.ws-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 35, 29, .26) transparent;
}

.ws-body::-webkit-scrollbar {
  width: 10px;
}

.ws-body::-webkit-scrollbar-thumb {
  background: rgba(23, 35, 29, .22);
  border: 3px solid var(--ws-paper-2);
  border-radius: 10px;
}

.ws-list[hidden] {
  display: none;
}

.ws-group {
  padding: 2px 0 5px;
}

.ws-group + .ws-group {
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px solid var(--ws-line);
}

.ws-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 4px;
  color: var(--ws-rust);
  font: 700 8px/1.2 var(--ws-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.ws-group-count {
  color: var(--ws-muted);
  font-weight: 600;
  letter-spacing: .04em;
}

.ws-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}

.ws-opt + .ws-opt {
  margin-top: 2px;
}

.ws-opt.is-active {
  background: #f3e6cf;
  border-color: rgba(183, 71, 42, .34);
  box-shadow: inset 3px 0 0 var(--ws-rust);
}

.ws-opt:hover {
  background: rgba(243, 230, 207, .62);
}

.ws-opt.is-active:hover {
  background: #f3e6cf;
}

.ws-opt-body {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.ws-opt-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--ws-ink);
  font: 600 13.5px/1.3 var(--ws-display);
  letter-spacing: -.012em;
  overflow-wrap: anywhere;
}

.ws-opt-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  margin-top: 2px;
  color: var(--ws-muted);
  font: 500 9px/1.35 var(--ws-mono);
  letter-spacing: .01em;
}

.ws-opt-meta > span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-opt-meta-page {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 10px/1.4 var(--ws-sans);
  letter-spacing: 0;
}

.ws-dot {
  width: 2px;
  height: 2px;
  flex: none;
  border-radius: 50%;
  background: var(--ws-soft);
}

.ws-pri {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 20px;
  flex: none;
  padding: 0 5px;
  border-radius: 4px;
  color: #fff8ec;
  font: 800 8.5px/1 var(--ws-mono);
  letter-spacing: .05em;
}

.ws-pri-P0 { background: #b23a2b; }
.ws-pri-P1 { background: #c27a1e; color: #221a10; }
.ws-pri-P2 { background: #2f6f68; }
.ws-pri-P3 { background: #3d5d8a; }
.ws-pri-P4 { background: #5b5e52; }

.ws-pri-none {
  border: 1px dashed var(--ws-line-strong);
  background: transparent;
  color: var(--ws-muted);
}

.ws-opt-tile {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--ws-line);
  border-radius: 8px;
  background: var(--ws-paper-3);
  color: var(--ws-ink-2);
}

.ws-opt-tile .ws-ico {
  width: 15px;
  height: 15px;
}

.ws-opt-go {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--ws-rust);
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity .12s ease, transform .12s ease;
}

.ws-opt.is-active .ws-opt-go {
  opacity: .9;
  transform: none;
}

/* ------------------------------------------------------------------ */
/* Notes, empty and loading states                                    */
/* ------------------------------------------------------------------ */

.ws-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 3px 4px 6px;
  padding: 6px 8px;
  border: 1px solid var(--ws-line);
  border-radius: 8px;
  background: rgba(230, 218, 196, .38);
  color: var(--ws-muted);
  font: 500 9px/1.45 var(--ws-mono);
  letter-spacing: .01em;
}

.ws-note-icon {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--ws-rust);
}

.ws-note-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ws-note-link {
  margin-left: auto;
  color: var(--ws-rust);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.ws-note-error {
  border-color: rgba(183, 71, 42, .35);
  background: rgba(183, 71, 42, .08);
  color: var(--ws-rust-dark);
}

.ws-note-empty {
  background: transparent;
  border-style: dashed;
}

.ws-state {
  padding: 26px 18px 30px;
  text-align: center;
}

.ws-state-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  background: var(--ws-paper-3);
  color: var(--ws-rust);
}

.ws-state-icon .ws-ico {
  width: 20px;
  height: 20px;
}

.ws-state-title {
  display: block;
  margin-bottom: 4px;
  color: var(--ws-ink);
  font: 600 18px/1.2 var(--ws-display);
  letter-spacing: -.02em;
}

.ws-state-text {
  max-width: 44ch;
  margin: 0 auto;
  color: var(--ws-muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.ws-state-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.ws-state-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--ws-line-strong);
  border-radius: 8px;
  color: var(--ws-ink);
  font: 700 8px/1 var(--ws-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.ws-state-link:hover {
  background: var(--ws-ink);
  border-color: var(--ws-ink);
  color: var(--ws-paper-2);
}

.ws-spinner {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto 11px;
  border: 2px solid var(--ws-line-strong);
  border-top-color: var(--ws-rust);
  border-radius: 50%;
  animation: ws-spin .8s linear infinite;
}

@keyframes ws-spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/* Footer                                                             */
/* ------------------------------------------------------------------ */

.ws-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px 12px;
  flex: none;
  padding: 8px 13px;
  border-top: 1px solid var(--ws-line);
  background: rgba(230, 218, 196, .48);
  color: var(--ws-muted);
  font: 500 8px/1.5 var(--ws-mono);
  letter-spacing: .01em;
}

.ws-feed-note {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ws-keys {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  color: var(--ws-muted);
}

.ws-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 1px solid var(--ws-line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--ws-paper-2);
  color: var(--ws-ink-2);
  font: 600 8px/1 var(--ws-mono);
}

.ws-keys-text {
  margin-right: 4px;
  font-size: 7px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.ws-foot-link {
  color: var(--ws-rust);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.ws-foot-link:hover {
  color: var(--ws-rust-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Accessibility helpers                                              */
/* ------------------------------------------------------------------ */

.ws-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1120px) {
  .ws-trigger-label {
    display: none;
  }

  .ws-trigger {
    padding: 0 7px;
  }
}

@media (max-width: 980px) {
  .topbar .ws-root {
    order: 1;
    flex: 1 1 0;
    justify-content: flex-end;
    min-width: 0;
  }

  .topbar .ws-ui {
    flex: 1 1 0;
    justify-content: flex-end;
    min-width: 0;
  }

  .ws-trigger {
    display: none;
  }

  .ws-inline {
    display: flex;
    flex: 1 1 0;
    width: min(240px, 100%);
  }

  .ws-inline-input {
    font-size: 16px;
    font-weight: 600;
  }
}

@media (max-width: 620px) {
  .ws-overlay {
    padding: 8px;
  }

  .ws-panel {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .ws-bar {
    gap: 8px;
    padding: 10px 10px 10px 12px;
  }

  .ws-bar-icon {
    width: 17px;
    height: 17px;
  }

  .ws-input {
    font-size: 16px;
  }

  .ws-close {
    width: 40px;
    height: 40px;
  }

  .ws-opt {
    gap: 9px;
    padding: 8px 8px;
  }

  .ws-opt-title {
    font-size: 13.5px;
  }

  .ws-opt-go {
    display: none;
  }

  .ws-foot {
    padding: 8px 11px;
  }

  .ws-keys {
    display: none;
  }

  .ws-state {
    padding: 22px 14px 26px;
  }
}

@media (max-width: 380px) {
  .ws-inline {
    padding: 0 7px;
  }

  .ws-inline .ws-ico {
    display: none;
  }

  .ws-opt-meta {
    font-size: 8.5px;
  }

  .ws-pri {
    min-width: 27px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-panel,
  .ws-opt,
  .ws-opt-go,
  .ws-trigger,
  .ws-close,
  .ws-state-link,
  .ws-inline {
    transition: none !important;
  }

  .ws-spinner {
    animation: none !important;
  }
}

@media print {
  .ws-root,
  .ws-overlay {
    display: none !important;
  }
}

/* Fallback trigger when a page has no .topbar to attach to. */
.ws-root-float {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 45;
}

.ws-root-float .ws-trigger {
  display: inline-flex;
  box-shadow: 0 10px 30px rgba(49, 38, 20, .22);
}

.ws-root-float .ws-inline {
  display: none;
}
