/* assets/ddt-tool-page.css
 * Tool-page shell additions (Tier 1): breadcrumb + related-tools rail.
 * Auto-injected at runtime by ddt-tool-page.js for any page whose slug
 * appears in ddt-tools-data.json. Existing tool body markup is untouched.
 * Spec: docs/superpowers/specs/2026-05-29-site-redesign-design.md §5.2, §8.7
 */

/* ===== Breadcrumb (top of body, just under the fixed nav) ===== */
.rd-tp-crumb {
  max-width: var(--rd-max-width);
  margin: 0 auto;
  padding: 12px 24px;
  font-family: var(--rd-font-mono);
  font-size: 0.72rem;
  color: var(--rd-text-muted);
  border-bottom: 1px solid var(--rd-border-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
.rd-tp-crumb-trail {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Tool search in the breadcrumb line ===== */
.rd-tp-search {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 220px;
  max-width: 38vw;
  padding: 5px 10px;
  border: 1px solid var(--rd-border-soft);
  border-radius: var(--rd-radius-sm, 8px);
  background: var(--rd-bg-surface);
  transition: border-color var(--rd-trans-fast);
}
.rd-tp-search:focus-within {
  border-color: var(--rd-accent-cyan);
}
.rd-tp-search-icon {
  flex: 0 0 auto;
  color: var(--rd-text-dim);
}
.rd-tp-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--rd-text-primary);
  font-family: inherit;
  font-size: 0.74rem;
}
.rd-tp-search-input::placeholder {
  color: var(--rd-text-dim);
}
/* Hide the native search clear/decoration for a consistent look */
.rd-tp-search-input::-webkit-search-decoration,
.rd-tp-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.rd-tp-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: min(360px, 80vw);
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--rd-bg-elevated, var(--rd-bg-surface));
  border: 1px solid var(--rd-border-soft);
  border-radius: var(--rd-radius-md, 10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.rd-tp-search-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--rd-radius-sm, 8px);
  cursor: pointer;
}
.rd-tp-search-item:hover,
.rd-tp-search-item.is-active {
  background: var(--rd-bg-surface-2, rgba(0, 212, 255, 0.10));
}
.rd-tp-search-item-name {
  font-family: var(--rd-font-sans, inherit);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--rd-text-primary);
}
.rd-tp-search-item-desc {
  font-family: var(--rd-font-sans, inherit);
  font-size: 0.72rem;
  color: var(--rd-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-tp-search-empty {
  padding: 10px 12px;
  color: var(--rd-text-muted);
  font-size: 0.76rem;
}
@media (max-width: 480px) {
  .rd-tp-search {
    width: 150px;
  }
  .rd-tp-search-input {
    font-size: 16px; /* avoid iOS zoom-on-focus */
  }
}
.rd-tp-crumb a {
  color: var(--rd-text-muted);
  text-decoration: none;
  transition: color var(--rd-trans-fast);
}
.rd-tp-crumb a:hover {
  color: var(--rd-accent-cyan);
}
.rd-tp-crumb .rd-tp-crumb-cat {
  color: var(--rd-tp-cat-accent, var(--rd-accent-cyan));
}
.rd-tp-crumb .rd-tp-crumb-sep {
  margin: 0 8px;
  color: var(--rd-text-dim);
  opacity: 0.7;
}
.rd-tp-crumb .rd-tp-crumb-cur {
  color: var(--rd-text-primary);
}

@media (max-width: 599px) {
  /* On narrow viewports, collapse the trail to just "← Tools" for breathing room.
     Hide every trail item except the back link (the plain "Tools" link, category,
     current tool, and separators) so it doesn't read as "ToolsTools". */
  .rd-tp-crumb-trail > :not(.rd-tp-crumb-back) {
    display: none;
  }
  .rd-tp-crumb .rd-tp-crumb-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
}

.rd-tp-crumb-back {
  display: none; /* shown only on mobile */
}

/* ===== Related-tools rail (bottom of body, just above the footer) ===== */
.rd-tp-related {
  max-width: var(--rd-max-width);
  margin: 64px auto 0;
  padding: 32px 24px 16px;
  border-top: 1px solid var(--rd-border-soft);
}
.rd-tp-related-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.rd-tp-related-label {
  font-family: var(--rd-font-mono);
  font-size: 0.7rem;
  color: var(--rd-accent-cyan);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rd-tp-related-rule {
  flex: 1;
  height: 1px;
  background: var(--rd-border-soft);
}

.rd-tp-related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .rd-tp-related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .rd-tp-related-grid { grid-template-columns: repeat(4, 1fr); }
}

.rd-tp-related-tile {
  display: block;
  padding: 14px;
  border-radius: var(--rd-radius-md);
  background: var(--rd-bg-surface);
  border: 1px solid var(--rd-border-soft);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--rd-trans-fast), transform var(--rd-trans-fast);
}
.rd-tp-related-tile:hover {
  border-color: var(--rd-tp-cat-accent, var(--rd-accent-cyan));
  transform: translateY(-2px);
}
.rd-tp-related-tile:focus-visible {
  outline: 2px solid var(--rd-accent-cyan);
  outline-offset: 2px;
}

.rd-tp-related-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.rd-tp-related-tile-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--rd-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.10);
  color: var(--rd-tile-accent, var(--rd-accent-cyan));
}
.rd-tp-related-tile-arrow {
  opacity: 0;
  transition: opacity var(--rd-trans-fast);
  color: var(--rd-tile-accent, var(--rd-accent-cyan));
}
.rd-tp-related-tile:hover .rd-tp-related-tile-arrow {
  opacity: 1;
}
.rd-tp-related-tile-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--rd-text-primary);
  margin: 0 0 4px;
  line-height: 1.3;
}
.rd-tp-related-tile-desc {
  font-size: 0.76rem;
  color: var(--rd-text-muted);
  line-height: 1.5;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rd-tp-related-tile:hover { transform: none; }
}
