/* ============================================================
   DN Portfolio — command-palette.css
   Pairs with assets/js/command-palette.js. Uses tokens from styles.css.
   ============================================================ */

/* --- Nav triggers --- */
.nav.dnp-has-trigger .nav__links { margin-left: auto; } /* keep links right-aligned next to the pill */

.dnp-trigger {
  display: none;
  align-items: center;
  margin-left: 40px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 0.5px solid rgba(245,243,238,0.24);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.dnp-trigger:hover { color: var(--warm-white); border-color: rgba(245,243,238,0.48); }
.dnp-trigger:focus-visible { outline: 1px solid var(--warm-white); outline-offset: 3px; }

@media (pointer: fine) and (min-width: 900px) {
  .dnp-trigger { display: inline-flex; }
}

.dnp-menu-item { display: none; }
.dnp-menu-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: 0;
  padding: 0 0 2px;
  cursor: pointer;
}
.dnp-menu-btn:hover { color: var(--warm-white); }
.dnp-menu-btn:focus-visible { outline: 1px solid var(--warm-white); outline-offset: 4px; }
@media (max-width: 768px) {
  .dnp-menu-item { display: list-item; }
}

/* --- Palette shell --- */
.dnp[hidden] { display: none; }
.dnp {
  position: fixed;
  inset: 0;
  z-index: 2000;
  font-family: var(--font-body);
  color: var(--warm-white);
}
.dnp__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 160ms ease-out;
}
.dnp__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: calc(100% - 48px);
  max-width: 640px;
  max-height: calc(100vh - 14vh - 48px);
  max-height: calc(100dvh - 14vh - 48px);
  margin: 14vh auto 0;
  background: var(--surface-darker);
  border: 0.5px solid var(--gray-mid);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}
.dnp.is-open .dnp__backdrop { opacity: 1; transition: opacity 280ms var(--ease); }
.dnp.is-open .dnp__panel {
  opacity: 1;
  transform: none;
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
}

/* --- Input row --- */
.dnp__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 0.5px solid var(--gray-mid);
  flex-shrink: 0;
}
.dnp__input {
  flex: 1;
  min-width: 0;
  height: 60px;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  color: var(--warm-white);
  background: transparent;
  border: 0;
  outline: none;
  caret-color: var(--warm-white);
}
.dnp__input::placeholder { color: var(--text-muted); opacity: 1; }

.dnp kbd {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-muted);
  border: 0.5px solid var(--gray-mid);
  border-radius: 2px;
  padding: 3px 6px;
}
.dnp__esc { cursor: pointer; flex-shrink: 0; }

/* --- Results --- */
.dnp__list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 0;
}
.dnp__list[hidden] { display: none; }
.dnp__group + .dnp__group { margin-top: 8px; }
.dnp__group-label {
  padding: 10px 20px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.dnp__option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 20px;
  cursor: pointer;
}
.dnp__option[aria-selected="true"] { background: var(--surface-dark); }
.dnp__option[aria-selected="true"]::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--blaze-orange); /* the palette's only orange */
}
.dnp__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dnp__title { font-size: 15px; font-weight: 400; color: var(--warm-white); }
.dnp__hint {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dnp__key { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.dnp__option.is-copied .dnp__key { color: var(--warm-white); }

.dnp__empty {
  padding: 28px 20px;
  font-size: 14px;
  color: var(--text-muted);
}
.dnp__empty[hidden] { display: none; }

/* --- Footer --- */
.dnp__foot {
  display: flex;
  gap: 20px;
  padding: 10px 20px;
  border-top: 0.5px solid var(--gray-mid);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dnp__foot span { display: inline-flex; align-items: center; gap: 4px; }
.dnp__foot kbd { padding: 2px 5px; }

.dnp__sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Mobile --- */
@media (max-width: 639px) {
  .dnp__panel {
    width: calc(100% - 32px);
    margin-top: 16px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
  }
  .dnp__bar { padding: 0 16px; }
  .dnp__input { height: 56px; }
  .dnp__option { min-height: 56px; padding: 8px 16px; }
  .dnp__group-label { padding-left: 16px; padding-right: 16px; }
  .dnp__foot { display: none; } /* key hints are noise on touch */
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .dnp__backdrop,
  .dnp__panel,
  .dnp.is-open .dnp__backdrop,
  .dnp.is-open .dnp__panel { transition: none; transform: none; }
}
