/* Reads like the nav links, framed by four crop marks instead of a box (the blueprint corners). */
.palette-trigger {
  --mark: color-mix(in srgb, currentColor 55%, transparent);
  position: relative;
  align-self: center;
  padding: 7px 10px;
  margin-block: -7px;
  border: 0;
  background:
    linear-gradient(var(--mark) 0 0) top left / 5px 1px, linear-gradient(var(--mark) 0 0) top left / 1px 5px,
    linear-gradient(var(--mark) 0 0) top right / 5px 1px, linear-gradient(var(--mark) 0 0) top right / 1px 5px,
    linear-gradient(var(--mark) 0 0) bottom left / 5px 1px, linear-gradient(var(--mark) 0 0) bottom left / 1px 5px,
    linear-gradient(var(--mark) 0 0) bottom right / 5px 1px, linear-gradient(var(--mark) 0 0) bottom right / 1px 5px;
  background-repeat: no-repeat;
  color: inherit;
  cursor: pointer;
  pointer-events: auto;
}
.palette-trigger::before { content: ''; position: absolute; inset: -5px -3px; }
.palette-trigger:hover, .palette-trigger:focus-visible { --mark: currentColor; }
.palette-trigger:focus-visible { outline: none; }
.palette-trigger kbd { font: 400 12px/1 'Geist Mono', monospace; white-space: nowrap; letter-spacing: .3em; margin-right: -.3em; }
html.forming .palette-trigger { visibility: hidden; }

.command-palette {
  --palette-quiet: color-mix(in srgb, var(--ink) 83%, var(--paper));
  --palette-edge: color-mix(in srgb, var(--ink) 19%, var(--paper));
  --palette-wash: rgb(255 252 244 / 68%);
  --palette-rim: rgb(255 255 255 / 65%);
  --lg-edge: rgb(56 49 38 / 20%);
  --lg-rim-shine: .5;
  position: fixed;
  inset: clamp(48px, 17dvh, 160px) 0 auto;
  width: min(480px, calc(100% - 32px));
  max-height: min(465px, calc(100dvh - clamp(48px, 17dvh, 160px) - 16px));
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  box-shadow: 0 18px 56px #0004;
  font: 400 14px/1.4 'Geist', sans-serif;
}
:root[data-theme="dark"] .command-palette {
  --palette-wash: rgb(31 28 23 / 65%);
  --palette-rim: rgb(255 246 219 / 24%);
  --lg-edge: rgb(235 222 197 / 19%);
  --lg-rim-shine: .38;
}
.command-palette[open] { display: flex; flex-direction: column; animation: palette-in .15s var(--ease); }
.command-palette::backdrop { background: rgb(11 10 8 / 30%); }
html:has(.command-palette[open]) { overflow: hidden; }
@keyframes palette-in { from { translate: 0 -5px; } }

.palette-material, .palette-material > .lg-glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.palette-material { z-index: -1; }
.palette-material:empty { background: var(--paper); box-shadow: inset 0 0 0 1px var(--palette-edge); }
.palette-material > .lg-glass {
  --lg-glass: var(--palette-wash);
  --lg-blur: 10px;
  --lg-glass-bend: 1.45;
  --lg-glass-dispersion: .48;
  --lg-saturate: 1.2;
}
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  .palette-material:empty {
    background: var(--palette-wash);
    box-shadow: inset 0 1px 0 var(--palette-rim), inset 0 0 0 1px var(--palette-edge);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    backdrop-filter: blur(10px) saturate(1.2);
  }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more), (forced-colors: active) {
  .palette-material:empty {
    background: var(--paper);
    border: 1px solid var(--palette-edge);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.palette-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
}
.palette-search kbd, .palette-return {
  color: var(--palette-quiet);
  font: 400 13px/1 'Geist Mono', monospace;
}
.palette-search input {
  flex: 1;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  outline: none;
  background: none;
  color: inherit;
  font: 400 16px/1.4 'Geist', sans-serif;
}
.palette-search input::placeholder { color: var(--palette-quiet); }
.palette-close {
  padding: 4px 7px;
  border: 1px solid var(--palette-edge);
  border-radius: 4px;
  background: none;
  color: var(--palette-quiet);
  font: 400 11px/1.2 'Geist Mono', monospace;
  cursor: pointer;
}
.palette-close:hover { color: var(--ink); }

.palette-result-area { position: relative; display: flex; min-height: 0; }
.palette-results { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 7px; }
.palette-results.has-ruler { scrollbar-width: none; }
.palette-results.has-ruler::-webkit-scrollbar { display: none; }
.palette-result-area > .ruler { position: absolute; right: 2px; z-index: 1; width: 26px; }
.palette-result-area:has(> .ruler:not([hidden])) .palette-results { padding-inline-end: 30px; }
.palette-group + .palette-group { margin-top: 5px; padding-top: 4px; border-top: 1px solid var(--rule); }
.palette-group-label {
  margin: 5px 9px 3px;
  color: var(--palette-quiet);
  font: 400 11px/1.4 'Geist Mono', monospace;
}
.palette-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
}
.palette-option[aria-selected="true"] { background: color-mix(in srgb, var(--iris) 23%, transparent); }
.palette-detail { margin-left: auto; color: var(--palette-quiet); font-size: 12px; text-align: right; }
.palette-return { margin-left: auto; visibility: hidden; }
.palette-detail + .palette-return { margin-left: 0; }
.palette-option[aria-selected="true"] .palette-return { visibility: visible; }
.palette-status { margin: 0; }
.palette-status:not(:empty) { padding: 8px 16px; border-top: 1px solid var(--rule); color: var(--palette-quiet); }
.palette-empty { padding: 10px; color: var(--palette-quiet); }

@media (max-width: 820px) {
  .chrome-nav { right: max(var(--gutter), 32px); }
}
@media (max-width: 480px) {
  .chrome-nav { gap: 8px; }
  .palette-trigger kbd { display: none; }
  .palette-trigger { width: 24px; }
  .palette-trigger::after { content: '⌘'; font: 400 12px/1 system-ui, sans-serif; }
}
@media (max-width: 380px) {
  .chrome-nav { left: var(--gutter); top: 58px; gap: 5px; justify-content: space-between; }
}
@media (forced-colors: active) {
  .palette-option[aria-selected="true"] { outline: 1px solid Highlight; }
}
