/* ============================================================
   TOOLS / PRICES — Typeahead dropdown + URL modal
   Companion to tools-prices.css.
   Owns: dropdown rows (with BIG images), focus state, mobile
   fullscreen sheet behavior, URL modal scaffolding.
   ============================================================ */

/* ── Typeahead dropdown (desktop) ───────────────────────────── */
.tp-typeahead {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--white);
  border: var(--border);
  box-shadow: 6px 6px 0 var(--black);
  max-height: 460px;
  overflow-y: auto;
  display: none;
}
.tp-typeahead.is-open { display: block; }

.tp-typeahead-head {
  position: sticky;
  top: 0;
  background: var(--black);
  color: var(--white);
  padding: 0.5rem 0.85rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tp-ta-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--white);
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: none;
  padding: 0 0.25rem;
  line-height: 1;
}

/* Row layout — image LEFT (BIG: 64px desktop, 56px mobile) */
.tp-ta-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 2px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.08s;
}
.tp-ta-row:last-child { border-bottom: 0; }
.tp-ta-row:hover,
.tp-ta-row.is-focused { background: var(--cream); }
.tp-ta-row.is-focused {
  outline: 3px solid var(--orange);
  outline-offset: -3px;
}

.tp-ta-img {
  width: 64px;
  height: 64px;
  border: 2px solid var(--black);
  background: var(--white);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tp-ta-img img { width: 100%; height: 100%; object-fit: contain; }
.tp-ta-img.is-fallback {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
  text-transform: uppercase;
}
.tp-ta-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tp-ta-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--black);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.tp-ta-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tp-ta-price {
  font-family: 'Space Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--black);
}
.tp-ta-discount {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--orange);
  color: var(--black);
  padding: 0.12rem 0.4rem;
  border: 1.5px solid var(--black);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tp-ta-pill {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  background: transparent;
  color: var(--black);
  padding: 0.12rem 0.4rem;
  border: 1.5px solid var(--black);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tp-ta-arrow {
  flex-shrink: 0;
  font-family: 'Space Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #999;
  transition: transform 0.1s, color 0.1s;
}
.tp-ta-row:hover .tp-ta-arrow,
.tp-ta-row.is-focused .tp-ta-arrow {
  color: var(--black);
  transform: translateX(3px);
}

.tp-ta-empty,
.tp-ta-loading {
  padding: 1.75rem 1rem;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Mobile: fullscreen sheet */
@media (max-width: 768px) {
  .tp-typeahead {
    position: fixed;
    inset: 0;
    z-index: 1000;
    max-height: none;
    height: 100vh;
    height: 100dvh;
    border: 0;
    box-shadow: none;
    background: var(--white);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Account for iOS notch / Android status bar — header lives at the
       very top of the sheet, would otherwise be cropped. */
    padding-top: env(safe-area-inset-top, 0px);
  }
  body.tp-sheet-open { overflow: hidden; }
  .tp-typeahead-head {
    padding: 1rem 1.25rem;
    font-size: 0.75rem;
    border-bottom: 3px solid var(--black);
    min-height: 48px;
  }
  .tp-ta-close { display: inline-block; }
  .tp-ta-row { padding: 0.85rem 1rem; gap: 0.75rem; }
  .tp-ta-img { width: 56px; height: 56px; }
  .tp-ta-title { font-size: 0.88rem; }
}

/* ── URL modal ──────────────────────────────────────────────── */
.tp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.6);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.tp-modal-backdrop.is-open { display: flex; }
.tp-modal {
  background: var(--white);
  border: var(--border);
  box-shadow: 8px 8px 0 var(--black);
  max-width: 520px;
  width: 100%;
}
.tp-modal-head {
  padding: 1rem 1.25rem;
  border-bottom: 3px solid var(--black);
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tp-modal-body { padding: 1.25rem; }
.tp-modal-close {
  appearance: none;
  background: transparent;
  border: 0;
  font-family: 'Space Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
