/* Nerddi search launcher
 * A guest surface: it borrows SkyMind's structural tokens but carries its own
 * accent so it reads as a different engine living inside the app.
 */

:root {
  --nd-accent: #0ea5e9;
  --nd-accent-2: #6366f1;
  --nd-glow: rgba(14, 165, 233, .28);
}
[data-theme='dark'] {
  --nd-accent: #38bdf8;
  --nd-accent-2: #818cf8;
  --nd-glow: rgba(56, 189, 248, .3);
}

.nd-launcher {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}
.nd-launcher.open { display: block; }

.nd-scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--text) 42%, transparent);
  backdrop-filter: blur(6px) saturate(1.2);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  animation: nd-fade .18s var(--ease, ease) both;
}

.nd-panel {
  position: absolute;
  left: 50%;
  top: 10vh;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(15, 17, 26, .4), 0 0 0 1px var(--line);
  overflow: hidden;
  animation: nd-rise .26s cubic-bezier(.32, .72, 0, 1) both;
}

/* A hairline of Nerddi accent along the very top — the guest signature. */
.nd-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--nd-accent), var(--nd-accent-2));
}

/* -------------------------------------------------------------- header */

.nd-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 12px;
}
.nd-brand-mark {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--nd-accent) 12%, var(--panel2));
  display: grid; place-items: center;
  overflow: hidden;
}
.nd-brand-mark img { width: 30px; height: 30px; object-fit: contain; }
.nd-brand-mark .logo-fallback {
  display: none;
  width: 30px; height: 30px;
  place-items: center;
  color: var(--nd-accent);
  font-weight: 800;
}
.nd-brand-mark.logo-missing img { display: none; }
.nd-brand-mark.logo-missing .logo-fallback { display: grid; }

.nd-title-wrap { flex: 1; min-width: 0; }
.nd-eyebrow {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--nd-accent);
}
.nd-title-wrap h2 {
  margin: 1px 0 0;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -.02em;
  color: var(--text);
}
.nd-close {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.nd-close:hover { color: var(--text); background: var(--panel2); }

.nd-i { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------- input */

.nd-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  transition: border-color .16s, box-shadow .16s;
}
.nd-input-wrap:focus-within {
  border-color: var(--nd-accent);
  box-shadow: 0 0 0 4px var(--nd-glow);
  background: var(--panel);
}
.nd-input-icon { color: var(--muted); display: grid; }
.nd-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.nd-input::placeholder { color: var(--muted); }
.nd-clear {
  border: 0; background: transparent; color: var(--muted);
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; display: grid; place-items: center;
}
.nd-clear:hover { background: var(--line); color: var(--text); }

/* -------------------------------------------------------------- scopes */

.nd-scopes {
  display: flex;
  gap: 6px;
  padding: 12px 18px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nd-scopes::-webkit-scrollbar { display: none; }
.nd-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 560;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.nd-scope .nd-i { width: 15px; height: 15px; }
.nd-scope:hover { color: var(--text); background: var(--panel2); }
.nd-scope.active {
  color: #fff;
  background: linear-gradient(135deg, var(--nd-accent), var(--nd-accent-2));
  border-color: transparent;
}

/* ---------------------------------------------------------------- body */

.nd-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
  min-height: 120px;
}
.nd-group {
  padding: 12px 8px 5px;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.nd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.nd-row.active, .nd-row:hover { background: var(--panel2); }
.nd-row.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nd-accent) 40%, transparent); }
.nd-row-icon {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--panel2);
  color: var(--nd-accent);
  display: grid; place-items: center;
}
.nd-row.active .nd-row-icon { background: color-mix(in srgb, var(--nd-accent) 16%, var(--panel2)); }
.nd-row.muted .nd-row-icon { color: var(--muted); }
.nd-row-label { flex: 1; font-size: 14px; line-height: 1.35; }
.nd-row-label strong { font-weight: 680; }
.nd-row-go { color: var(--muted); opacity: 0; transition: opacity .12s, transform .12s; }
.nd-row.active .nd-row-go, .nd-row:hover .nd-row-go { opacity: 1; }
.nd-row.active .nd-row-go { color: var(--nd-accent); transform: translateX(2px); }

.nd-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 8px 8px; }
.nd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.nd-chip .nd-i { width: 14px; height: 14px; color: var(--nd-accent); }
.nd-chip:hover { color: var(--text); background: var(--panel2); border-color: color-mix(in srgb, var(--nd-accent) 30%, var(--line)); }

/* -------------------------------------------------------------- footer */

.nd-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.nd-foot-note { font-size: 11.5px; color: var(--muted); }
.nd-go {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--nd-accent), var(--nd-accent-2));
  color: #fff;
  font-size: 13.5px;
  font-weight: 640;
  cursor: pointer;
  transition: transform .12s, box-shadow .16s;
}
.nd-go:hover { transform: translateY(-1px); box-shadow: 0 8px 22px var(--nd-glow); }
.nd-go:active { transform: none; }
.nd-go .nd-i { width: 16px; height: 16px; }

/* Themed glasses mark reuses the tab pair rules if present; ensure locally too. */
[data-theme='light'] .nd-brand-mark .logo-dark { display: none; }
[data-theme='dark'] .nd-brand-mark .logo-light { display: none; }
.nd-brand-mark .logo-derived-dark { filter: invert(1) hue-rotate(180deg); }

/* ------------------------------------------------------- mobile sheet */

@media (max-width: 640px) {
  .nd-panel {
    left: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 88vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: nd-sheet .3s cubic-bezier(.32, .72, 0, 1) both;
  }
  .nd-panel::after {
    content: '';
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 38px; height: 4px;
    border-radius: 4px;
    background: var(--line);
  }
  .nd-head { padding-top: 22px; }
  .nd-input { font-size: 16px; } /* keeps iOS from zooming */
  .nd-foot { position: sticky; bottom: 0; }
}

@keyframes nd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nd-rise { from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.98); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
@keyframes nd-sheet { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .nd-scrim, .nd-panel { animation: none; }
  .nd-go:hover { transform: none; }
}
