/* ==========================================================================
   Desktop search, filter and icon size (js/desktop-search.js)
   In the taskbar next to Home from 900 px wide; below that, a bar at the top of the desktop.
   ========================================================================== */

/* ---------- the search box and the filter button ---------- */
#dsearch { display: flex; align-items: center; gap: 2px; flex: none; min-width: 0; }
.ds-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 170px;
  min-width: 0;
  height: 36px;
  padding-inline: 12px 5px;
  border-radius: 18px;
  background: var(--field-bg);
  border: 1px solid var(--line);
  color: var(--text-3);
  cursor: text;
}
.ds-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ds-field > .ic { width: 17px; height: 17px; }
#ds-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  -webkit-user-select: text;
  user-select: text;
}
#ds-input::placeholder { color: var(--text-3); opacity: 1; }
#ds-input::-webkit-search-cancel-button, #ds-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.ds-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
}
.ds-clear:hover { background: var(--hover-strong); color: var(--text); }
.ds-clear .ic { width: 14px; height: 14px; stroke-width: 2.2; }

#ds-filter {
  --kind: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-width: 40px;
  height: 40px;
  padding-inline: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  white-space: nowrap;
}
#ds-filter:hover, #ds-filter[aria-expanded="true"] { background: var(--hover-strong); }
.ds-fl-ic { display: grid; place-items: center; }
.ds-fl-ic .ic { width: 18px; height: 18px; }
.ds-fl-label { font-size: 13px; font-weight: 600; }
#ds-filter .ds-chev { width: 14px; height: 14px; color: var(--text-3); }
/* A kind is chosen: its sign in its color, and a frame, so it is clear the desktop is filtered */
#ds-filter.is-on { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--kind) 55%, transparent); background: color-mix(in oklab, var(--kind) 14%, transparent); }
#ds-filter.is-on:hover, #ds-filter.is-on[aria-expanded="true"] { background: color-mix(in oklab, var(--kind) 22%, transparent); }
#ds-filter.is-on .ds-fl-ic { color: var(--kind); }

/* In the taskbar: the name of the kind only on wide screens */
#taskbar > #dsearch { margin-inline-start: 2px; }
@media (min-width: 1100px) {
  #taskbar .ds-field { width: 220px; }
  #taskbar #ds-filter { padding-inline: 9px 7px; }
}
@media (max-width: 1099.98px) {
  #taskbar .ds-fl-label, #taskbar #ds-filter .ds-chev { display: none; }
}
@media (max-width: 899.98px) {
  #taskbar > #dsearch { display: none; }
}

/* At the top of the desktop (below 900 px) */
#desktop > #dsearch {
  position: absolute;
  z-index: 4;
  top: 8px;
  inset-inline: 8px;
  max-width: 560px;
  margin-inline: auto;
  height: 46px;
  padding: 4px;
  gap: 4px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.7);
}
#desktop > #dsearch .ds-field { flex: 1; width: auto; height: 36px; border-radius: 10px; }
#desktop > #dsearch #ds-filter { height: 36px; border-radius: 10px; padding-inline: 10px 8px; }
#desktop.ds-top #icon-layer { top: 58px; }
/* A phone on its side: a thinner bar, so more icons fit */
@media (max-height: 500px) {
  #desktop > #dsearch { top: 5px; height: 40px; padding: 2px; }
  #desktop > #dsearch .ds-field, #desktop > #dsearch #ds-filter { height: 34px; }
  #desktop.ds-top #icon-layer { top: 48px; }
}
:root[data-theme="light"] #desktop > #dsearch { box-shadow: 0 12px 30px -18px rgba(10, 20, 40, 0.4); }
/* Phones zoom into a field with text smaller than 16 px */
@media (pointer: coarse) { #ds-input { font-size: 16px; } }

/* ---------- the menu of the filter button ---------- */
#ds-menu {
  width: min(272px, calc(100vw - 16px));
  max-height: calc(100vh - var(--taskbar-h) - 80px);
  max-height: calc(100dvh - var(--taskbar-h) - 80px);
  overflow-y: auto;
  padding: 6px;
}
.ds-opt {
  --kind: var(--accent);
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: start;
  font-size: 13.5px;
}
.ds-opt:hover { background: var(--hover-strong); }
.ds-opt:focus-visible { background: var(--hover-strong); outline-offset: -2px; }
.ds-opt[aria-checked="true"] { background: var(--hover); }
.ds-opt[aria-checked="true"] .ds-opt-name { font-weight: 650; }
.ds-opt-ic {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--kind) 18%, transparent);
  color: var(--kind);
}
.ds-opt-ic .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.ds-opt-name { flex: 1; min-width: 0; }
.ds-opt-n { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ds-opt-on { display: grid; place-items: center; flex: none; width: 18px; color: var(--accent); }
.ds-opt-on .ic { width: 16px; height: 16px; stroke-width: 2.4; }
:root[data-theme="light"] .ds-opt-ic { color: color-mix(in oklab, var(--kind) 70%, #10203a); }

.ds-sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 4px 4px; }
.ds-size {
  display: grid;
  grid-template-rows: 24px auto;
  justify-items: center;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
}
.ds-size:hover { background: var(--hover); color: var(--text); }
.ds-size:focus-visible { outline-offset: 1px; }
.ds-size[aria-checked="true"] { border-color: var(--accent); background: rgba(71, 198, 232, 0.12); color: var(--text); font-weight: 600; }
.ds-size-pic {
  display: block;
  border-radius: 4px;
  background: linear-gradient(160deg, var(--accent), color-mix(in oklab, var(--accent) 55%, #061020));
}
.ds-pic-sm { width: 12px; height: 12px; border-radius: 3px; }
.ds-pic-md { width: 16px; height: 16px; }
.ds-pic-lg { width: 22px; height: 22px; border-radius: 6px; }

/* ---------- nothing found ---------- */
#ds-empty {
  position: absolute;
  z-index: 4;
  top: 16%;
  inset-inline: 16px;
  max-width: 420px;
  margin-inline: auto;
  padding: 22px 20px 18px;
  border-radius: 16px;
  text-align: center;
  background: var(--flyout-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
#desktop.ds-top #ds-empty { top: calc(58px + 8%); }
:root[data-theme="light"] #ds-empty { box-shadow: 0 24px 60px -26px rgba(10, 20, 40, 0.35); }
.ds-empty-text { margin: 0 0 14px; font-size: 15px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.ds-empty-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ds-act {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--hover);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.ds-act:hover { background: var(--hover-strong); }
a.ds-act { border-color: transparent; background: transparent; color: var(--accent); }
a.ds-act:hover { background: var(--hover); }

/* ---------- icon sizes (the grid itself is in desktop.js metrics()) ---------- */
#icon-layer.ds-instant .d-icon { transition: none; }
#desktop.icons-sm .d-icon { gap: 6px; padding: 7px 3px 5px; }
#desktop.icons-sm .d-icon .tile { width: 40px; height: 40px; border-radius: 12px; }
#desktop.icons-sm .d-icon .tile .ic { width: 22px; height: 22px; }
#desktop.icons-sm .d-label { font-size: 11.5px; }
#desktop.icons-sm .d-badge, #desktop.icons-sm .d-kind { top: 2px; width: 18px; height: 18px; }
#desktop.icons-sm .d-badge { inset-inline-end: calc(50% - 31px); }
#desktop.icons-sm .d-kind { inset-inline-start: calc(50% - 31px); }
#desktop.icons-sm .d-badge .ic, #desktop.icons-sm .d-kind .ic { width: 10px; height: 10px; }

#desktop.icons-lg .d-icon { gap: 8px; padding: 11px 5px 7px; }
#desktop.icons-lg .d-icon .tile { width: 64px; height: 64px; border-radius: 18px; }
#desktop.icons-lg .d-icon .tile .ic { width: 34px; height: 34px; }
#desktop.icons-lg .d-label { font-size: 13.5px; }
#desktop.icons-lg .d-badge, #desktop.icons-lg .d-kind { top: 4px; width: 22px; height: 22px; }
#desktop.icons-lg .d-badge { inset-inline-end: calc(50% - 45px); }
#desktop.icons-lg .d-kind { inset-inline-start: calc(50% - 45px); }
#desktop.icons-lg .d-badge .ic, #desktop.icons-lg .d-kind .ic { width: 13px; height: 13px; }
