/* ════════════════════════════════════════════
   Breadcrumb navigation bar
════════════════════════════════════════════ */

.breadcrumb-bar {
  background: white;
  border-bottom: 1px solid var(--border-medium);
  padding: 0 16px;
  display: flex;
  margin-bottom: 10px;
  align-items: stretch;
  min-height: 48px;
  position: sticky;
  top: 0;
  z-index: 300;
}

/* ── Back button ── */
.bc-back {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 0 14px 0 0;
  margin-right: 4px;
  border: none;
  border-right: 1px solid var(--border-medium);
  background: none;
  font-family: var(--font-family-main);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
  transition: color 0.15s;
}
.bc-back:hover:not(:disabled),
.bc-back:focus:not(:disabled) { color: var(--primary-light); }
.bc-back:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.bc-back svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ── Current title (in the slim bar) ── */
.bc-current-title {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 12px;
  align-self: center;
}

/* ── Ancestor panel (desktop right column) ── */
.bc-ancestor-panel {
  display: none;
  flex-direction: column;
  background: white;
  border-left: 1px solid var(--border-medium);
  height: 100%;
  min-height: 100vh;
}

.bc-ancestor-panel-hd {
  padding: 8px 12px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--standard-lighter-text);
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-medium);
  position: sticky;
  top: 48px;
}

.bc-ancestor-panel-scroll {
  padding: 6px 0;
}

.bc-ap-row {
  position: relative;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: white;
  width: 100%;
  text-align: left;
}
.bc-ap-row:hover:not(.bc-ap-current),
.bc-ap-row:focus:not(.bc-ap-current) { background: var(--bg-light); }

/* Hover preview card */
.bc-ap-preview {
  display: none;
  position: absolute;
  right: calc(100% + 8px);
  top: 0;
  width: 300px;
  max-height: 260px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px 12px;
  z-index: 100;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--standard-text);
  pointer-events: none;
}
.bc-ap-row:hover .bc-ap-preview { display: block; }

.bc-ap-current { cursor: default; }

.bc-ap-title {
  font-size: 0.72rem;
  color: var(--standard-lighter-text);
  line-height: 1.35;
}
.bc-ap-current .bc-ap-title {
  color: var(--primary-dark);
  font-weight: 700;
}

.bc-ap-here {
  font-size: 0.62rem;
  font-weight: 400;
  opacity: 0.55;
}

/* Connector between rows */
.bc-ap-connector {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 6px;
  gap: 0;
}

.bc-ap-line {
  width: 1.5px;
  height: 6px;
  margin-left: 3px;
}

.bc-ap-pill-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bc-ap-arrow { flex-shrink: 0; }

.bc-ap-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 0.58rem;
  font-weight: 700;
  border: 1.5px solid;
}

/* Colour modifiers */
.bc-ap-connector.supports .bc-ap-line { background: var(--support-color); }
.bc-ap-connector.supports .bc-ap-pill {
  background: #e6f5ef;
  border-color: var(--support-color);
  color: #065f46;
}
.bc-ap-connector.attacks .bc-ap-line  { background: var(--attack-color); }
.bc-ap-connector.attacks .bc-ap-pill  {
  background: #f5e8e6;
  border-color: var(--attack-color);
  color: #7c2d12;
}
.bc-ap-connector.cited .bc-ap-line    { background: var(--cited-color); }
.bc-ap-connector.cited .bc-ap-pill    {
  background: #e6eaf0;
  border-color: var(--cited-color);
  color: var(--cited-color);
}

/* ── Desktop: show ancestor panel, hide breadcrumb bar and mobile elements ── */
@media (min-width: 768px) {
  .breadcrumb-bar    { display: none; }

  .bc-ancestor-panel
  {
    margin-left: 10px;
    display: flex;
  }
  .bc-mobile-trigger { display: none; }
  .bc-mobile-drawer  { display: none; }
}

/* ── Mobile drawer + trigger ── */
.bc-mobile-trigger { display: none; }
.bc-mobile-drawer  { display: none; }

@media (max-width: 767px) {

  /* Show the mobile trigger */
  .bc-mobile-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    padding: 0 12px 0 14px;
    cursor: pointer;
    align-self: stretch;
    transition: background 0.15s;
    border: none;
    background: transparent;
    text-align: left;
  }
  .bc-mobile-trigger:hover,
  .bc-mobile-trigger:focus { background: var(--bg-very-light); }
  .bc-mobile-trigger.open  { background: rgba(26, 58, 95, 0.05); }

  /* Hide trigger entirely at root (no ancestors) */
  .bc-mobile-trigger--root { display: none; }

  /* "via N arguments" label */
  .bc-via-text {
    font-size: 0.72rem;
    color: var(--standard-lighter-text);
    font-weight: 500;
  }
  .bc-via-text strong {
    color: var(--primary-dark);
    font-weight: 700;
  }

  /* Round chevron */
  .bc-expand-arrow {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
  }
  .bc-expand-arrow svg {
    width: 12px;
    height: 12px;
    color: var(--neutral);
    transition: transform 0.2s, color 0.2s;
  }
  .bc-mobile-trigger.open .bc-expand-arrow {
    background: var(--primary-dark);
  }
  .bc-mobile-trigger.open .bc-expand-arrow svg {
    color: white;
    transform: rotate(180deg);
  }

  /* Hide current title when mobile trigger is visible (trigger replaces it) */
  .bc-current-title { display: none; }

  /* Drawer */
  .bc-mobile-drawer {
    display: block;
    background: white;
    border-bottom: 2px solid var(--border-medium);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s ease;
  }
  .bc-mobile-drawer.open {
    max-height: 400px;
    margin-bottom: 10px;
    margin-top: -10px;
  }

  /* Drawer rows */
  .bc-drawer-row {
    display: flex;
    align-items: flex-start;
    padding: 8px 16px;
    gap: 10px;
    cursor: pointer;
    transition: background 0.12s;
    border: none;
    background: white;
    width: 100%;
    text-align: left;
  }
  .bc-drawer-row:hover,
  .bc-drawer-row:focus          { background: var(--bg-light); }
  .bc-drawer-current            { background: rgba(26, 58, 95, 0.05); cursor: default; }
  .bc-drawer-current:hover      { background: rgba(26, 58, 95, 0.05); }

  /* Left column: dot + vertical line */
  .bc-drawer-col-l {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 18px;
    flex-shrink: 0;
    padding-top: 3px;
  }
  .bc-drawer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--neutral-light);
    background: white;
    flex-shrink: 0;
  }
  .bc-drawer-visited .bc-drawer-dot {
    background: var(--neutral-light);
    border-color: var(--neutral);
  }
  .bc-drawer-current .bc-drawer-dot {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
  }
  .bc-drawer-vert {
    width: 1.5px;
    flex: 1;
    min-height: 14px;
    background: var(--border-medium);
    margin-top: 3px;
  }

  /* Right column: title + relationship */
  .bc-drawer-col-r  { flex: 1; min-width: 0; }
  .bc-drawer-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--standard-lighter-text);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .bc-drawer-current .bc-drawer-title {
    color: var(--primary-dark);
    font-weight: 700;
  }

  /* Relationship line + pill below each ancestor title */
  .bc-drawer-rel {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
  }
  .bc-drawer-rel-line {
    width: 10px;
    height: 1px;
  }
  .bc-drawer-rel-pill {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 20px;
    font-size: 0.55rem;
    font-weight: 700;
    border: 1.5px solid;
  }

  /* Relationship colour modifiers */
  .bc-drawer-rel--supports .bc-drawer-rel-line { background: var(--support-color); }
  .bc-drawer-rel--supports .bc-drawer-rel-pill {
    background: #e6f5ef;
    border-color: var(--support-color);
    color: #065f46;
  }
  .bc-drawer-rel--attacks .bc-drawer-rel-line  { background: var(--attack-color); }
  .bc-drawer-rel--attacks .bc-drawer-rel-pill  {
    background: #f5e8e6;
    border-color: var(--attack-color);
    color: #7c2d12;
  }
  .bc-drawer-rel--cited .bc-drawer-rel-line    { background: var(--cited-color); }
  .bc-drawer-rel--cited .bc-drawer-rel-pill    {
    background: #e6eaf0;
    border-color: var(--cited-color);
    color: var(--cited-color);
  }
}
