/*
  Modal 04 — Command Palette Dialog — standalone HTML/CSS/JS.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.
*/

:root {
  --palette-fg: oklch(0.17 0 0);
  --palette-muted: oklch(0.52 0 0);
  --palette-faint: oklch(0.7 0 0);
  --palette-line: oklch(0.92 0 0);
  --palette-soft: oklch(0.965 0 0);
  --palette-accent: #39ff14;
}

.modal04 {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.modal04[hidden] {
  display: none;
}

.modal04 p,
.modal04 h2 {
  margin: 0;
}

.modal04 svg {
  display: block;
}

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

/* A dim with the faintest blur: the page recedes, but you can still see
   where you are. */
.modal04__backdrop {
  position: fixed;
  inset: 0;
  background-color: oklch(0.22 0 0 / 0.32);
  backdrop-filter: blur(2px);
  animation: modal04-fade-in 160ms ease-out both;
}

.modal04[data-state="closing"] .modal04__backdrop {
  animation: modal04-fade-out 120ms ease-in both;
}

.modal04__positioner {
  position: relative;
  display: flex;
  min-height: 100%;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem 0.75rem;
}

/* Drops in from above — it belongs to the top of the screen. */
.modal04__panel {
  position: relative;
  width: 100%;
  max-width: 40rem;
  overflow: hidden;
  border: 1px solid var(--palette-line);
  border-radius: 1rem;
  background-color: #ffffff;
  box-shadow: 0 28px 70px -28px rgba(0, 0, 0, 0.4);
  animation: modal04-drop 200ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.modal04[data-state="closing"] .modal04__panel {
  animation: modal04-lift 120ms ease-in both;
}

.modal04__search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--palette-line);
  padding: 0 1rem;
}

/* The field keeps focus the whole time the palette is open, so its focus
   ring is a quiet underline along the search row. */
.modal04__search:has(.modal04__input:focus-visible) {
  box-shadow: inset 0 -2px 0 var(--palette-fg);
}

.modal04__search svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--palette-muted);
}

.modal04__input {
  height: 3.5rem;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 15px;
  color: var(--palette-fg);
  outline: none;
}

.modal04__input::placeholder {
  color: var(--palette-faint);
}

.modal04__kbd {
  display: none;
  flex-shrink: 0;
  border: 1px solid var(--palette-line);
  border-radius: 0.375rem;
  padding: 0.125rem 0.375rem;
  font-family: inherit;
  font-size: 11px;
  color: var(--palette-muted);
}

.modal04__list {
  max-height: min(18rem, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem;
}

.modal04__group {
  padding: 0.25rem 0;
}

.modal04__heading {
  padding: 0.375rem 0.75rem 0.25rem;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--palette-faint);
}

.modal04__option {
  position: relative;
  display: flex;
  min-height: 2.75rem;
  cursor: pointer;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.5rem;
  padding: 0 0.75rem;
}

.modal04__option[aria-selected="true"] {
  background-color: var(--palette-soft);
}

/* The active result carries a neon edge — the one place the eye should go. */
.modal04__option[aria-selected="true"]::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0;
  width: 2px;
  border-radius: 9999px;
  background-color: var(--palette-accent);
}

.modal04__icon {
  display: flex;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--palette-line);
  border-radius: 0.375rem;
  background-color: #ffffff;
  color: var(--palette-muted);
}

.modal04__option[aria-selected="true"] .modal04__icon {
  border-color: var(--palette-fg);
  background-color: var(--palette-fg);
  color: #ffffff;
}

.modal04__icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.modal04__label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--palette-fg);
}

.modal04__hint {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--palette-muted);
}

.modal04__shortcut {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
}

.modal04__shortcut kbd {
  min-width: 1.25rem;
  border: 1px solid var(--palette-line);
  border-radius: 0.25rem;
  background-color: #ffffff;
  padding: 0 0.25rem;
  text-align: center;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.25rem;
  color: var(--palette-muted);
}

.modal04__empty {
  padding: 2rem 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--palette-muted);
}

.modal04__empty strong {
  font-weight: 500;
  color: var(--palette-fg);
}

.modal04__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--palette-line);
  background-color: oklch(0.965 0 0 / 0.6);
  padding: 0.625rem 1rem;
  font-size: 11px;
  line-height: 1.5;
  color: var(--palette-muted);
}

.modal04__keys {
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.modal04__keys kbd {
  font-family: inherit;
}

.modal04__count {
  font-variant-numeric: tabular-nums;
}

@keyframes modal04-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal04-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes modal04-drop {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal04-lift {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.99);
  }
}

@media (min-width: 40rem) {
  .modal04__positioner {
    padding: 4rem 1rem 1rem;
  }
  .modal04__kbd {
    display: inline;
  }
  .modal04__shortcut,
  .modal04__keys {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal04__panel {
    animation-name: modal04-fade-in;
    animation-duration: 100ms;
  }
  .modal04[data-state="closing"] .modal04__panel {
    animation-name: modal04-fade-out;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  line-height: 1.5;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
p {
  margin: 0;
}
.modal04-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
}
.modal04-layout__app {
  position: relative;
  isolation: isolate;
  display: flex;
  width: 100%;
  max-width: 60rem;
  height: 28rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 18px 44px -20px rgba(0, 0, 0, 0.18);
  transform: translateZ(0);
}
.modal04-layout__side {
  display: none;
  width: 12rem;
  flex-shrink: 0;
  flex-direction: column;
  gap: 0.25rem;
  border-right: 1px solid oklch(0.97 0 0);
  background: oklch(0.985 0 0 / 0.7);
  padding: 0.75rem;
}
.modal04-layout__org {
  padding: 0.25rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.modal04-layout__nav {
  border-radius: 0.375rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.556 0 0);
}
.modal04-layout__nav--current {
  background: #ffffff;
  font-weight: 500;
  color: oklch(0.205 0 0);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.modal04-layout__main {
  min-width: 0;
  flex: 1;
}
.modal04-layout__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid oklch(0.97 0 0);
  padding: 0.75rem 1.25rem;
}
.modal04-layout__page {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.modal04-layout__search {
  display: flex;
  height: 2.25rem;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.556 0 0);
  cursor: pointer;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.modal04-layout__search:hover {
  background: oklch(0.985 0 0);
}
.modal04-layout__search:focus-visible {
  outline: 2px solid oklch(0.205 0 0);
  outline-offset: 2px;
}
.modal04-layout__search svg {
  display: block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.modal04-layout__search-long,
.modal04-layout__search-kbd {
  display: none;
}
.modal04-layout__search-kbd {
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  font-family: inherit;
  font-size: 11px;
  color: oklch(0.708 0 0);
}
.modal04-layout__stats {
  display: grid;
  gap: 0.75rem;
  padding: 1.25rem;
}
.modal04-layout__stat {
  border: 1px solid oklch(0.97 0 0);
  border-radius: 0.75rem;
  padding: 1rem;
}
.modal04-layout__stat-label {
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
.modal04-layout__stat-value {
  margin-top: 0.25rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: oklch(0.205 0 0);
}
.modal04-layout__status {
  padding: 0 1.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
@media (min-width: 40rem) {
  .modal04-layout__app {
    height: 29rem;
  }
  .modal04-layout__side {
    display: flex;
  }
  .modal04-layout__search-long {
    display: inline;
  }
  .modal04-layout__search-short {
    display: none;
  }
  .modal04-layout__search-kbd {
    display: inline;
  }
  .modal04-layout__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
