/* ============================================================
   discovery-shared.css — loaded on EVERY page
   - Category color dots (sidebar)
   - Command palette (⌘K) — global keyboard shortcut
   - Tool page pin button
   - Contextual sidebar additions
   - Topbar + iOS no-zoom mobile bits

   Hub/all/home-only styles live in discovery.css and are
   conditionally loaded by Base.astro (scope !== 'tool').
   ============================================================ */

/* ── Category dot (shared) ─────────────────────────────────── */
.cat-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-dot[data-cat="converter"] { background: var(--cat-converter); }
.cat-dot[data-cat="image"]     { background: var(--cat-image); }
.cat-dot[data-cat="text"]      { background: var(--cat-text); }
.cat-dot[data-cat="developer"] { background: var(--cat-developer); }
.cat-dot[data-cat="color"]     { background: var(--cat-color); }
.cat-dot[data-cat="pdf"]       { background: var(--cat-pdf); }
.cat-dot[data-cat="marketing"] { background: var(--cat-marketing); }
.cat-dot[data-cat="mockup"]    { background: var(--cat-mockup); }
.cat-dot[data-cat="health"]    { background: var(--cat-health); }
.cat-dot[data-cat="finance"]   { background: var(--cat-finance); }
.cat-dot[data-cat="business"]  { background: var(--cat-business); }
.cat-dot[data-cat="education"]  { background: var(--cat-education); }

/* ============================================================
   Command palette (⌘K)
   ============================================================ */

/* Ensure [hidden] always wins — many of our overrides use display: flex */
[hidden] { display: none !important; }

.cmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
}

.cmd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 42, 40, 0.45);
  backdrop-filter: blur(2px);
}

.cmd-panel {
  position: relative;
  width: 100%;
  max-width: 580px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  animation: cmd-pop 0.12s ease-out;
}

@keyframes cmd-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cmd-input-icon {
  color: var(--text-3);
  flex-shrink: 0;
}

.cmd-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
}

.cmd-input::placeholder {
  color: var(--text-3);
}

.cmd-esc {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  background: var(--bg-soft);
  flex-shrink: 0;
}

.cmd-results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}

.cmd-section-label {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 12px 18px 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmd-section-label .count {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
}

.cmd-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 18px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background 0.08s;
}

.cmd-row:hover,
.cmd-row.active {
  background: var(--bg-soft);
  text-decoration: none;
}

.cmd-row.active {
  background: var(--bg-hover);
}

.cmd-row-emoji {
  font-size: 16px;
  line-height: 1;
}

.cmd-row-body {
  min-width: 0;
}

.cmd-row-name {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-row-name b {
  color: var(--accent);
  font-weight: 700;
}

.cmd-row-desc {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-row-cat {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  padding: 2px 7px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.cmd-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.cmd-footer {
  border-top: 1px solid var(--border);
  padding: 8px 18px;
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-soft);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cmd-footer .kbd {
  font-family: var(--font-mono);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  margin-right: 4px;
}

@media (max-width: 640px) {
  .cmd-overlay {
    padding-top: 0;
    align-items: stretch;
  }
  .cmd-panel {
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
  .cmd-footer { font-size: 10px; gap: 10px; }
  .cmd-input {
    font-size: 16px; /* iOS no-zoom */
  }
}

/* ============================================================
   Tool page — pin star button
   ============================================================ */
.tool-pin {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.tool-pin:hover {
  background: var(--bg-hover);
  border-color: var(--text-3);
  color: var(--text);
}

.tool-pin.pinned {
  color: var(--accent);
  border-color: var(--accent);
  background: #fdf5f3;
}

.tool-pin .star-icon {
  font-size: 14px;
}

/* ============================================================
   Contextual sidebar additions
   ============================================================ */
.sidebar-pinned {
  padding: 0.25rem 0 0;
}

.sidebar-pinned-title {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-2);
  padding: 0.5rem 1.25rem 0.375rem;
}

.sidebar-pinned-title .pin-mark {
  color: var(--accent);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.375rem 1.25rem 0.5rem;
}

.sidebar-back-link {
  display: block;
  padding: 7px 1.25rem;
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
}

.sidebar-back-link:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

/* Verticals list (sidebar on home) */
.sidebar-verticals .sidebar-vertical-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 7px 1.25rem;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.sidebar-verticals .sidebar-vertical-link:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar-verticals .sidebar-vertical-link.active {
  background: var(--bg-soft);
  color: var(--accent);
  font-weight: 500;
}

.sidebar-verticals .sidebar-vertical-link .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

/* Hub subcategory nav (sidebar when on a hub) */
.sidebar-hub-subs {
  display: flex;
  flex-direction: column;
}

.sidebar-hub-sub {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 1.25rem;
  font-size: 12.5px;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.sidebar-hub-sub:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar-hub-sub.active {
  background: var(--bg-soft);
  color: var(--accent);
  font-weight: 500;
  border-right: 2px solid var(--accent);
}

.sidebar-hub-sub .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

/* ============================================================
   Topbar search trigger (button styled like input)
   ============================================================ */
.topbar-search-trigger {
  position: relative;
  flex: 1;
  max-width: 480px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.topbar-search-trigger:hover {
  background: var(--bg);
  border-color: var(--text-3);
}

.topbar-search-trigger .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.topbar-search-trigger .topbar-search-placeholder {
  flex: 1;
  color: var(--text-3);
}

.topbar-search-trigger .search-kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.4;
  pointer-events: none;
}

@media (max-width: 640px) {
  .topbar-search-trigger .topbar-search-placeholder { display: none; }
  .topbar-search-trigger { max-width: 120px; }
}

/* ============================================================
   Mobile shared bits (topbar + tool-pin + iOS no-zoom)
   ============================================================ */

@media (max-width: 768px) {
  .topbar {
    gap: 0.625rem;
    padding: 0 0.875rem;
  }
  .topbar-logo {
    font-size: 1.125rem;
    gap: 0.375rem;
  }
  .topbar-search-trigger {
    flex: 1;
    max-width: none;
    height: 36px;
    padding: 0 12px 0 32px;
  }
  .topbar-search-trigger .search-kbd {
    display: none;
  }

  .tool-pin {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }
}

/* iOS no-zoom for inputs */
@media (hover: none) and (pointer: coarse) {
  input[type="search"],
  input[type="text"],
  textarea {
    font-size: 16px !important;
  }
}
