/* ============================================================ catalogue search */
/* A command palette, not a dropdown. The query can be a model code, a Georgian
   category, a Russian trade name or a description of the job — so the surface has
   to be big enough to show what KIND of thing each answer is, which a dropdown
   under a header field never is. */

.dg-srch{position:fixed;inset:0;z-index:80;display:flex;justify-content:center;
  padding:10vh var(--sp-4) var(--sp-4);pointer-events:none}
.dg-srch[hidden]{display:none}

.dg-srch__scrim{position:absolute;inset:0;pointer-events:auto;
  background:rgba(20,20,22,.42);opacity:0;
  -webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);
  transition:opacity var(--dur-backdrop) linear}
.dg-srch.is-open .dg-srch__scrim{opacity:1}

.dg-srch__panel{position:relative;pointer-events:auto;
  display:flex;flex-direction:column;width:100%;max-width:680px;max-height:80vh;
  background:var(--white);border:1px solid var(--grey-200);border-radius:var(--radius-lg);
  box-shadow:0 24px 64px -16px rgba(20,20,22,.34),0 2px 8px rgba(20,20,22,.08);
  overflow:hidden;
  opacity:0;transform:translateY(-14px) scale(.97);
  transition:opacity var(--dur-base) linear,
             transform var(--dur-panel) cubic-bezier(.2,.9,.28,1.06)}
.dg-srch.is-open .dg-srch__panel{opacity:1;transform:none}
/* Out is quicker than in and does not overshoot — an exit that bounces reads as
   the thing refusing to leave. */
.dg-srch.is-closing .dg-srch__panel{transition-duration:var(--dur-base);
  transition-timing-function:var(--ease-exit)}

/* --------------------------------------------------------------------- the bar */
.dg-srch__bar{display:flex;align-items:center;gap:var(--sp-3);flex:none;
  padding:0 var(--sp-4);height:66px;border-bottom:1px solid var(--grey-200)}
.dg-srch__ico{display:inline-flex;color:var(--grey-400);flex:none;
  transition:color var(--dur-base) var(--ease-standard)}
.dg-srch__bar:focus-within .dg-srch__ico{color:var(--ink)}
.dg-srch__input{flex:1;min-width:0;height:100%;border:0;background:none;padding:0;
  font-family:inherit;font-size:var(--fs-h3);line-height:1;color:var(--ink);
  caret-color:var(--amber-600)}
.dg-srch__input:focus{outline:none}
.dg-srch__input::placeholder{color:var(--grey-400)}
.dg-srch__input::-webkit-search-cancel-button{display:none}

.dg-srch__clear{display:inline-flex;align-items:center;justify-content:center;
  width:28px;height:28px;flex:none;padding:0;cursor:pointer;
  border:0;border-radius:50%;background:var(--grey-100);color:var(--text-2);
  animation:dg-srch-pop var(--dur-base) var(--ease-enter) both;
  transition:background-color var(--dur-instant) linear,color var(--dur-instant) linear}
.dg-srch__clear:hover{background:var(--grey-200);color:var(--ink)}
.dg-srch__clear[hidden]{display:none}
@keyframes dg-srch-pop{from{opacity:0;transform:scale(.5)}to{opacity:1;transform:none}}

.dg-srch__esc{display:inline-flex;align-items:center;flex:none;padding:0;
  border:0;background:none;cursor:pointer}
.dg-srch kbd{display:inline-flex;align-items:center;justify-content:center;
  min-width:22px;height:22px;padding:0 6px;border-radius:var(--radius-sm);
  background:var(--grey-100);border:1px solid var(--grey-200);border-bottom-width:2px;
  font-family:var(--font-mono);font-size:10px;line-height:1;color:var(--text-3);
  transition:background-color var(--dur-instant) linear,color var(--dur-instant) linear}
.dg-srch__esc:hover kbd{background:var(--grey-200);color:var(--ink)}

/* ------------------------------------------------------------------- the scopes */
.dg-srch__scopes{display:flex;align-items:center;gap:var(--sp-1);flex:none;
  padding:10px var(--sp-4);border-bottom:1px solid var(--grey-200);
  overflow-x:auto;scrollbar-width:none}
.dg-srch__scopes::-webkit-scrollbar{display:none}
.dg-srch__scope{display:inline-flex;align-items:center;gap:6px;flex:none;
  height:30px;padding:0 12px;cursor:pointer;
  border:1px solid transparent;border-radius:100px;background:none;
  font-family:inherit;font-size:var(--fs-meta);font-weight:600;color:var(--text-3);
  transition:background-color var(--dur-instant) linear,color var(--dur-instant) linear,
             border-color var(--dur-instant) linear,opacity var(--dur-base) var(--ease-standard)}
.dg-srch__scope:hover{background:var(--grey-100);color:var(--ink)}
.dg-srch__scope.is-on{background:var(--ink);color:var(--white);border-color:var(--ink)}
.dg-srch__scope b{font-family:var(--font-mono);font-size:10px;font-weight:700;
  font-variant-numeric:tabular-nums;opacity:.65}
.dg-srch__scope b:empty{display:none}
/* Empty, not gone: a tab that disappears mid-type moves every other tab under
   the pointer. */
.dg-srch__scope.is-void{opacity:.38;pointer-events:none}
.dg-srch__scope.is-void.is-on{opacity:1;pointer-events:auto}

/* -------------------------------------------------------------------- the body */
.dg-srch__body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  padding:var(--sp-2) 0 var(--sp-3);scrollbar-width:thin}
.dg-srch__group + .dg-srch__group{margin-top:2px;
  padding-top:var(--sp-2);border-top:1px solid var(--grey-100)}
.dg-srch__gh{display:flex;align-items:baseline;justify-content:space-between;gap:var(--sp-3);
  padding:var(--sp-3) var(--sp-4) 6px;
  font-size:10px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;
  color:var(--text-3)}
.dg-srch__more{font-family:var(--font-mono);letter-spacing:0;color:var(--grey-400)}

/* ---------------------------------------------------------------------- a row */
.dg-srch__row{position:relative;display:flex;align-items:center;gap:var(--sp-3);
  padding:9px var(--sp-4);text-decoration:none;color:var(--text);
  transition:background-color var(--dur-instant) linear}
/* The rail is the keyboard cursor. It grows out of nothing rather than appearing,
   so holding ↓ reads as one object moving down the list. */
.dg-srch__row::before{content:"";position:absolute;inset-inline-start:0;top:6px;bottom:6px;
  width:3px;border-radius:0 3px 3px 0;background:var(--accent);
  transform:scaleY(0);transform-origin:center;
  transition:transform var(--dur-base) var(--ease-enter)}
.dg-srch__row.is-active{background:var(--tint-saved)}
.dg-srch__row.is-active::before{transform:scaleY(1)}
.dg-srch__row:focus-visible{outline:none;background:var(--tint-saved)}
.dg-srch__row:focus-visible::before{transform:scaleY(1)}

.dg-srch__thumb{display:flex;align-items:center;justify-content:center;flex:none;
  width:44px;height:44px;border-radius:var(--radius-sm);overflow:hidden;
  background:var(--white);border:1px solid var(--grey-200)}
.dg-srch__thumb img{width:100%;height:100%;object-fit:contain;padding:3px;display:block}
.dg-srch__thumb.is-logo img{width:auto;height:16px;padding:0}
.dg-srch__thumb.is-ico{background:var(--grey-100);border-color:transparent;position:relative}
/* A folder corner, drawn rather than shipped: it marks the row as a place, not a
   product, and costs no request. */
.dg-srch__thumb.is-ico::after{content:"";width:18px;height:14px;border-radius:2px;
  border:2px solid var(--grey-400);border-top-width:5px;
  border-top-left-radius:1px;border-top-right-radius:6px}
.dg-srch__noimg{width:100%;height:100%;background:var(--grey-100);display:block}

.dg-srch__text{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.dg-srch__t{font-size:var(--fs-sm);line-height:1.35;font-weight:600;color:var(--ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dg-srch__t mark{background:none;color:var(--amber-800);font-weight:800;
  box-shadow:inset 0 -.42em 0 var(--tint-saved);border-radius:2px}
.dg-srch__m{display:flex;align-items:center;gap:6px;min-width:0;
  font-size:var(--fs-micro);line-height:1.3;color:var(--text-3)}
.dg-srch__m i{font-style:normal;color:var(--grey-300)}
.dg-srch__cat{flex:none;font-weight:700;color:var(--amber-800)}
.dg-srch__spec{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-family:var(--font-mono);font-variant-numeric:tabular-nums}
.dg-srch__price{flex:none;font-size:var(--fs-micro);color:var(--text-3);
  font-variant-numeric:tabular-nums}
.dg-srch__n{flex:none;min-width:26px;height:20px;display:inline-flex;
  align-items:center;justify-content:center;padding:0 7px;border-radius:10px;
  background:var(--grey-100);color:var(--text-2);
  font-family:var(--font-mono);font-size:10px;font-weight:700;
  font-variant-numeric:tabular-nums}

/* The arrow only exists once the row is the one you are on. */
.dg-srch__go{flex:none;width:16px;height:16px;position:relative;
  opacity:0;transform:translateX(-4px);
  transition:opacity var(--dur-base) var(--ease-standard),
             transform var(--dur-base) var(--ease-standard)}
.dg-srch__go::before,.dg-srch__go::after{content:"";position:absolute;background:var(--amber-800)}
.dg-srch__go::before{top:7px;left:1px;width:12px;height:2px;border-radius:2px}
.dg-srch__go::after{top:3px;right:1px;width:8px;height:8px;border-radius:2px;
  border:2px solid var(--amber-800);border-left:0;border-bottom:0;
  transform:rotate(45deg);background:none}
.dg-srch__row.is-active .dg-srch__go{opacity:1;transform:none}

/* -------------------------------------------------------------------- the chips */
.dg-srch__chips{display:flex;flex-wrap:wrap;gap:8px;padding:2px var(--sp-4) var(--sp-3)}
.dg-srch__chip{display:inline-flex;align-items:center;gap:6px;
  height:32px;padding:0 12px;border-radius:100px;text-decoration:none;
  background:var(--grey-100);border:1px solid transparent;
  font-size:var(--fs-meta);font-weight:600;color:var(--text-2);
  transition:background-color var(--dur-instant) linear,color var(--dur-instant) linear,
             border-color var(--dur-instant) linear,
             transform var(--dur-base) var(--ease-standard)}
.dg-srch__chip:hover{background:var(--white);border-color:var(--grey-300);
  color:var(--ink);transform:translateY(-1px)}
.dg-srch__chip button{border:0;background:none;padding:0;cursor:pointer;
  font:inherit;color:inherit}
.dg-srch__chip b{font-family:var(--font-mono);font-size:10px;font-weight:700;
  color:var(--grey-400);font-variant-numeric:tabular-nums}
.dg-srch__chipx{width:16px;height:16px;display:inline-flex;align-items:center;
  justify-content:center;border-radius:50%;font-size:14px;line-height:1;
  color:var(--grey-400)}
.dg-srch__chipx:hover{background:var(--grey-300);color:var(--ink)}

/* ----------------------------------------------------------- empty and loading */
.dg-srch__empty{display:flex;flex-direction:column;align-items:center;text-align:center;
  gap:var(--sp-2);padding:var(--sp-7) var(--sp-5)}
.dg-srch__empty-i{width:48px;height:48px;border-radius:50%;background:var(--tint-saved);
  position:relative;margin-bottom:var(--sp-2)}
.dg-srch__empty-i::before{content:"";position:absolute;inset:14px 14px auto auto;
  width:16px;height:16px;border:2px solid var(--amber-800);border-radius:50%}
.dg-srch__empty-i::after{content:"";position:absolute;left:16px;bottom:14px;
  width:9px;height:2px;background:var(--amber-800);border-radius:2px;
  transform:rotate(45deg)}
.dg-srch__empty h3{margin:0;font-size:var(--fs-card);color:var(--ink)}
.dg-srch__empty p{margin:0;max-width:38ch;font-size:var(--fs-meta);
  line-height:var(--lh-meta);color:var(--text-3)}

.dg-srch__skel{display:flex;align-items:center;gap:var(--sp-3);padding:9px var(--sp-4);
  animation:dg-srch-shim 1.1s var(--ease-standard) infinite}
.dg-srch__skel-t{width:44px;height:44px;flex:none;border-radius:var(--radius-sm);
  background:var(--grey-100)}
.dg-srch__skel-l{flex:1;display:flex;flex-direction:column;gap:6px}
.dg-srch__skel-l i{display:block;height:9px;width:62%;border-radius:5px;background:var(--grey-100)}
.dg-srch__skel-l b{display:block;height:7px;width:34%;border-radius:5px;background:var(--grey-100)}
@keyframes dg-srch-shim{0%,100%{opacity:.55}50%{opacity:1}}

/* -------------------------------------------------------------------- the foot */
.dg-srch__foot{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-4);
  flex:none;padding:9px var(--sp-4);border-top:1px solid var(--grey-200);
  background:var(--grey-100)}
.dg-srch__keys{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.dg-srch__keys em{font-style:normal;font-size:10px;color:var(--text-3);
  margin-inline-end:var(--sp-3)}
.dg-srch__res{display:flex;align-items:center;gap:5px;flex:none;
  font-size:10px;color:var(--text-3)}
.dg-srch__res b{font-family:var(--font-mono);font-size:11px;font-weight:700;color:var(--ink);
  font-variant-numeric:tabular-nums}
.dg-srch__res b[hidden]{display:none}
.dg-srch__res b[hidden] + em{display:none}

/* The ⌘K hint on the header field itself — the only place anyone will discover it.
   Absolutely placed, like the magnifier on the other side: .dg-search is a flex
   row whose input is width:100%, so as a flex sibling this was pushed past the
   field's right edge and floated outside the box. */
.dg-search__k{position:absolute;inset-inline-end:14px;top:50%;
  transform:translateY(-50%);z-index:1;
  display:inline-flex;align-items:center;justify-content:center;
  height:22px;padding:0 7px;border-radius:var(--radius-sm);
  background:var(--white);border:1px solid var(--grey-200);
  font-family:var(--font-mono);font-size:10px;line-height:1;color:var(--grey-400);
  pointer-events:none;transition:opacity var(--dur-base) var(--ease-standard)}
/* Room for it, so a long query does not run underneath the chip. */
.dg-header .dg-search input[type="search"]{padding-inline-end:64px}
.dg-search:focus-within .dg-search__k{opacity:0}

/* Body does not scroll behind an open palette. */
:root.has-srch body{overflow:hidden}

@media (max-width:640px){
  /* On a phone it is the page, not a panel floating on one. */
  .dg-srch{padding:0}
  .dg-srch__panel{max-width:none;max-height:none;height:100%;border:0;border-radius:0;
    transform:translateY(12px)}
  .dg-srch__bar{height:60px;padding:0 var(--sp-3)}
  .dg-srch__input{font-size:16px}   /* 16px or iOS zooms the whole page on focus */
  .dg-srch__esc{display:none}
  .dg-srch__keys{display:none}
  .dg-srch__foot{justify-content:flex-end}
  .dg-search__k{display:none}
}

@media (prefers-reduced-motion:reduce){
  .dg-srch__scrim,.dg-srch__panel,.dg-srch__row::before,.dg-srch__go,
  .dg-srch__chip,.dg-srch__clear{transition-duration:1ms;animation:none}
  .dg-srch__panel{transform:none}
  .dg-srch__skel{animation:none}
}
