/* ════════════════════════════════════════════════════════════════
 * /cross-reference standalone tool — public page styles
 * Spec: docs/superpowers/specs/2026-05-24-parts-cross-reference-search-design.md
 *
 * Class namespace: .xref-*
 * No imports from the app — this file is fully self-contained.
 * ════════════════════════════════════════════════════════════════ */

:root {
  --xref-bg: #0a0f1e;
  --xref-card: #11182b;
  --xref-border: rgba(255, 255, 255, 0.06);
  --xref-text: #f1f5f9;
  --xref-muted: #94a3b8;
  --xref-dim: #64748b;
  --xref-accent: #22d3a6;
  --xref-accent-2: #0EA5E9;
  --xref-accent-grad: linear-gradient(90deg, #0EA5E9, #22d3a6);
  --xref-danger: #ef4444;
  --xref-warning: #fbbf24;
}

* { box-sizing: border-box; }

.xref-body {
  margin: 0;
  background: var(--xref-bg);
  color: var(--xref-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────── */
.xref-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--xref-border);
}
.xref-header__logo {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--xref-text); text-decoration: none;
  font-weight: 700; font-size: 1.1rem;
}
.xref-header__bolt { color: var(--xref-accent); }
.xref-header__wordmark {
  background: var(--xref-accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.xref-header__nav { display: flex; gap: 18px; }
.xref-header__nav-link {
  color: var(--xref-muted); text-decoration: none; font-size: 0.9rem;
  transition: color 0.15s;
}
.xref-header__nav-link:hover { color: var(--xref-accent); }

/* ── Main + Hero ───────────────────────────────────────────────── */
.xref-main {
  flex: 1;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
.xref-hero { text-align: center; margin-bottom: 32px; }
.xref-hero__title {
  font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 0.8rem;
}
.xref-hero__sub {
  color: var(--xref-muted); font-size: 1rem; line-height: 1.55;
  max-width: 640px; margin: 0 auto 1.5rem;
}
.xref-hero__sub strong { color: var(--xref-accent); }

/* ── Form ──────────────────────────────────────────────────────── */
.xref-form {
  display: flex; gap: 8px; max-width: 720px; margin: 0 auto;
  background: var(--xref-card); border: 1px solid var(--xref-border);
  border-radius: 12px; padding: 6px;
}
.xref-form__input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; color: var(--xref-text);
  font-size: 1rem; padding: 10px 14px; outline: none;
  font-family: ui-monospace, Consolas, monospace;
}
.xref-form__input::placeholder { color: var(--xref-dim); }
.xref-form__btn {
  background: var(--xref-accent-grad); border: 0; color: #0a0f1e;
  font-weight: 700; padding: 10px 18px; border-radius: 8px;
  cursor: pointer; font-size: 0.95rem;
}
.xref-form__btn:hover { opacity: 0.93; }
.xref-form__hint {
  color: var(--xref-dim); font-size: 0.78rem; margin-top: 10px;
  text-align: center;
}

@media (max-width: 600px) {
  .xref-hero__title { font-size: 1.5rem; }
  .xref-form { flex-direction: column; gap: 6px; padding: 8px; }
  .xref-form__btn { width: 100%; }
}

/* ── Loading + empty + error ──────────────────────────────────── */
.xref-loading {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 48px 20px;
}
.xref-loading__spinner {
  width: 32px; height: 32px; border: 3px solid var(--xref-border);
  border-top-color: var(--xref-accent); border-radius: 50%;
  animation: xref-spin 0.9s linear infinite;
}
@keyframes xref-spin { to { transform: rotate(360deg); } }
.xref-loading__text { color: var(--xref-muted); font-size: 0.9rem; }

.xref-empty, .xref-error {
  background: var(--xref-card); border: 1px solid var(--xref-border);
  border-radius: 12px; padding: 28px 24px; text-align: center;
}
.xref-empty h2 { margin-top: 0; font-size: 1.15rem; color: var(--xref-text); }
.xref-empty p { color: var(--xref-muted); margin-bottom: 0; }
.xref-empty code, .xref-results__head code {
  font-family: ui-monospace, Consolas, monospace;
  background: rgba(34,211,166,0.08); color: var(--xref-accent);
  padding: 2px 8px; border-radius: 4px;
}
.xref-error {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.05);
  display: flex; flex-direction: column; gap: 6px;
}
.xref-error strong { color: var(--xref-danger); }
.xref-error span { color: var(--xref-muted); font-size: 0.9rem; }

/* ── Results grid ─────────────────────────────────────────────── */
.xref-results__head { text-align: center; margin: 8px 0 20px; }
.xref-results__head h2 { font-size: 1.3rem; margin: 0 0 0.4rem; }
.xref-results__sub { color: var(--xref-muted); font-size: 0.88rem; }

.xref-results__grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 720px) {
  .xref-results__grid { grid-template-columns: repeat(2, 1fr); }
}

.xref-card {
  background: var(--xref-card); border: 1px solid var(--xref-border);
  border-radius: 12px; padding: 14px;
  display: grid; grid-template-columns: 80px 1fr auto;
  gap: 14px; align-items: center;
  transition: border-color 0.15s, transform 0.15s;
}
.xref-card:hover {
  border-color: rgba(34,211,166,0.3);
  transform: translateY(-1px);
}
.xref-card__image {
  width: 80px; height: 80px; background: #fff; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.xref-card__image img { width: 100%; height: 100%; object-fit: contain; }
.xref-card__tier {
  position: absolute; top: 4px; right: 4px;
  background: rgba(34,211,166,0.95); color: #0a0f1e;
  font-size: 0.55rem; padding: 1px 5px; border-radius: 3px;
  font-weight: 700; text-transform: uppercase;
}
.xref-card__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.xref-card__brand {
  color: var(--xref-muted); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.xref-card__name {
  color: var(--xref-text); font-weight: 600; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xref-card__article {
  color: var(--xref-dim); font-size: 0.75rem;
  font-family: ui-monospace, Consolas, monospace;
}
.xref-card__fits { color: var(--xref-muted); font-size: 0.78rem; margin-top: 2px; }
.xref-card__buy {
  background: rgba(34,211,166,0.1); color: var(--xref-accent);
  border: 1px solid rgba(34,211,166,0.3); border-radius: 8px;
  padding: 8px 14px; font-size: 0.82rem; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.xref-card__buy:hover { background: rgba(34,211,166,0.15); }

@media (max-width: 600px) {
  .xref-card { grid-template-columns: 64px 1fr; }
  .xref-card__image { width: 64px; height: 64px; }
  .xref-card__buy { grid-column: 1 / -1; text-align: center; }
}

/* ── Upgrade modal ────────────────────────────────────────────── */
.xref-upgrade-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(7,12,22,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: xref-fade-in 0.2s ease;
}
@keyframes xref-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
.xref-upgrade {
  background: var(--xref-card); border: 1px solid rgba(34,211,166,0.3);
  border-radius: 16px; padding: 32px 28px; max-width: 420px; width: 100%;
  text-align: center; position: relative;
}
.xref-upgrade__x {
  position: absolute; top: 8px; right: 12px;
  background: none; border: 0; color: var(--xref-muted);
  font-size: 1.4rem; cursor: pointer; line-height: 1;
}
.xref-upgrade__icon { font-size: 2.2rem; margin-bottom: 12px; }
.xref-upgrade__title {
  font-size: 1.25rem; margin: 0 0 8px; color: var(--xref-text);
}
.xref-upgrade__desc {
  color: var(--xref-muted); margin: 0 0 24px; line-height: 1.55;
}
.xref-upgrade__ctas {
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.xref-upgrade__cta {
  background: var(--xref-accent-grad); color: #0a0f1e;
  text-decoration: none; padding: 12px 18px; border-radius: 8px;
  font-weight: 700; font-size: 0.95rem;
}
.xref-upgrade__alt {
  color: var(--xref-muted); text-decoration: none;
  font-size: 0.85rem; padding: 8px;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.xref-upgrade__alt:hover { color: var(--xref-accent); }

/* ── Header: primary "Back to App" CTA ──────────────────────── */
.xref-header__nav-link--primary {
  background: rgba(34, 211, 166, 0.08);
  border: 1px solid rgba(34, 211, 166, 0.3);
  color: var(--xref-accent) !important;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.xref-header__nav-link--primary:hover {
  background: rgba(34, 211, 166, 0.15);
  border-color: rgba(34, 211, 166, 0.5);
}

/* ── Below-fold SEO content body ─────────────────────────────── */
.xref-content {
  max-width: 800px;
  margin: 64px auto 0;
  padding: 0 4px;
  line-height: 1.7;
}
.xref-content__section { margin-bottom: 48px; }
.xref-content__section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--xref-text);
  scroll-margin-top: 80px;
}
.xref-content__section p {
  color: var(--xref-muted);
  margin: 0 0 14px;
  font-size: 0.95rem;
}
.xref-content__section p strong {
  color: var(--xref-text);
  font-weight: 600;
}
.xref-content__section a {
  color: var(--xref-accent);
  text-decoration: underline;
  text-decoration-color: rgba(34, 211, 166, 0.4);
  text-underline-offset: 3px;
}
.xref-content__section a:hover { text-decoration-color: var(--xref-accent); }
.xref-content__section code {
  font-family: ui-monospace, Consolas, monospace;
  background: rgba(34, 211, 166, 0.08);
  color: var(--xref-accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.xref-content__list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.xref-content__list li {
  color: var(--xref-muted);
  padding-left: 20px;
  position: relative;
  font-size: 0.95rem;
}
.xref-content__list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--xref-accent);
  font-weight: 700;
}
.xref-content__list li strong { color: var(--xref-text); font-weight: 600; }

/* ── FAQ section (native <details>) ──────────────────────────── */
.xref-faq__item {
  background: var(--xref-card);
  border: 1px solid var(--xref-border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.xref-faq__item:hover {
  border-color: rgba(34, 211, 166, 0.2);
}
.xref-faq__item[open] {
  border-color: rgba(34, 211, 166, 0.3);
}
.xref-faq__item summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  color: var(--xref-text);
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.xref-faq__item summary::-webkit-details-marker { display: none; }
.xref-faq__item summary::after {
  content: "+";
  color: var(--xref-accent);
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.xref-faq__item[open] summary::after { content: "−"; }
.xref-faq__item p {
  padding: 0 18px 16px;
  margin: 0;
  color: var(--xref-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}
.xref-faq__item a {
  color: var(--xref-accent);
  text-decoration: underline;
  text-decoration-color: rgba(34, 211, 166, 0.4);
}

/* ── Related tools grid ──────────────────────────────────────── */
.xref-related__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 700px) {
  .xref-related__grid { grid-template-columns: repeat(3, 1fr); }
}
.xref-related__card {
  background: var(--xref-card);
  border: 1px solid var(--xref-border);
  border-radius: 12px;
  padding: 20px 18px;
  text-decoration: none !important;
  color: var(--xref-text);
  transition: border-color 0.15s, transform 0.15s;
  display: block;
}
.xref-related__card:hover {
  border-color: rgba(34, 211, 166, 0.3);
  transform: translateY(-2px);
}
.xref-related__icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.xref-related__card h3 {
  font-size: 1rem;
  margin: 0 0 6px;
  color: var(--xref-text);
}
.xref-related__card p {
  color: var(--xref-muted);
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.55;
}

/* ── Footer ───────────────────────────────────────────────────── */
.xref-footer {
  padding: 20px;
  margin-top: 64px;
  border-top: 1px solid var(--xref-border);
  color: var(--xref-dim); font-size: 0.82rem;
  display: flex; justify-content: center; align-items: center;
  gap: 10px; flex-wrap: wrap;
}
.xref-footer a {
  color: var(--xref-muted); text-decoration: none;
}
.xref-footer a:hover { color: var(--xref-accent); }

/* "Example" tag on the static placeholder result grid (anon visitors) */
.xref-example__tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--xref-accent, #22d3a6);
    background: rgba(34, 211, 166, 0.12);
    border: 1px solid rgba(34, 211, 166, 0.35);
    border-radius: 999px;
    padding: 3px 10px;
    margin-bottom: 10px;
}
.xref-footer__sep { opacity: 0.4; }
