/* ── XREF BACK BAR ── */
.xref-back-bar {
  background: rgba(184,134,11,0.12);
  border-bottom: 1px solid rgba(200,169,110,0.3);
  padding: 10px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.xref-back-context {
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
  font-style: italic;
  color: rgba(212,160,23,0.75);
}
.xref-back-context span { color: var(--gold-light); font-style: normal; font-weight: 600; }
.xref-back-bar button {
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: rgba(184,134,11,0.15);
  color: var(--gold-light);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
  white-space: nowrap;
}
.xref-back-bar button:hover { background: rgba(184,134,11,0.3); color: #fff; }
body.light-mode .xref-back-bar { background: rgba(200,146,10,0.12); border-color: rgba(180,130,20,0.25); }

/* ══ CROSS REFERENCE PANEL ══ */
.xref-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.xref-panel.open {
  transform: translateX(0);
}

.xref-header {
  background: linear-gradient(180deg, #0d0a04 0%, #1e1508 100%);
  border-bottom: 2px solid var(--gold);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
body.light-mode .xref-header {
  background: linear-gradient(180deg, #2c1f0a 0%, #3d2b0e 100%);
}

.xref-title-row {
  display: flex; align-items: center; gap: 14px;
}
.xref-icon {
  font-size: 1.6rem;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 16px rgba(212,160,23,0.5);
}
.xref-heading {
  font-family: Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.1em;
}
.xref-subheading {
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  font-style: italic;
  color: rgba(212,160,23,0.9);
  margin-top: 2px;
}
.xref-close {
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding: 9px 18px;
  border: 1px solid var(--border);
  background: rgba(184,134,11,0.12);
  color: var(--gold-light);
  cursor: pointer;
  border-radius: 2px;
  white-space: nowrap;
  transition: all 0.2s;
}
.xref-close:hover { background: rgba(184,134,11,0.28); color: #fff; }

.xref-body {
  flex: 1;
  overflow-y: auto;
  padding: 36px 0 60px;
}

.xref-columns {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.xref-section-title {
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(200,169,110,0.3);
  padding-bottom: 10px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.xref-section-title .xref-dir-icon { font-size: 1rem; }

.xref-item {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(200,169,110,0.12);
}
.xref-item:last-child { border-bottom: none; margin-bottom: 0; }

.xref-ref-link {
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.06em;
  cursor: pointer;
  border-bottom: 1px dashed rgba(212,160,23,0.4);
  display: inline-block;
  margin-bottom: 6px;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-left: none;
  border-top: none;
  border-right: none;
  padding: 0;
}
.xref-ref-link:hover { color: #fff; border-bottom-color: var(--gold-light); }

.xref-ref-desc {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--parchment-dark);
}
body.light-mode .xref-ref-desc { color: var(--ink-light); }
body.light-mode .xref-theme-tag { color: #6b4f00; background: rgba(184,134,11,0.12); border-color: rgba(160,120,10,0.4); }
body.light-mode .xref-subheading { color: #8b6914; }
body.light-mode .xref-intro { color: #7a6530; }

.xref-theme-tag {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(184,134,11,0.2);
  border: 1px solid rgba(200,169,110,0.5);
  color: var(--gold-light);
  margin-bottom: 6px;
}

.xref-loading {
  text-align: center;
  padding: 80px 32px;
  font-family: Arial, sans-serif;
  font-size: 1.1rem;
  font-style: italic;
}

.xref-error {
  text-align: center;
  padding: 60px 32px;
  color: var(--red);
  font-family: Arial, sans-serif;
  font-size: 1rem;
}

.xref-intro {
  max-width: 900px;
  margin: 0 auto 32px;
  padding: 0 32px;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  font-style: italic;
  color: rgba(200,169,110,0.85);
  border-left: 2px solid rgba(200,169,110,0.4);
  padding-left: 16px;
}
