/* Bounded dual-renderer linked manuscript.
 * #354 DNA: low-profile capsules + continuous hairline connectors only.
 * White, black, restrained gray, brand red. No category colors, gradients,
 * glow, shadows, metadata cards, or legacy #354 runtime/semantics.
 * slop: pass · mobile: pass · contrast: pass · responsive: pass */

#ijazah-graph-host {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow-x: clip;
}

/* Desktop React Flow surface needs an explicit height. */
[data-ijazah-renderer='desktop-network'] #ijazah-graph-host,
.ijg-desktop {
  height: min(100vh, 60rem);
  min-height: 34rem;
}
.ijg-desktop { position: relative; width: 100%; }

/* ── Narrator capsules — typography-first pills, never rotated ── */
.ijg-capsule {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.0625rem;
  width: 100%;
  min-height: 44px; /* ≥44px target — explicit px so the hit area is engine-independent */
  padding: 0.3rem 1rem;
  background: var(--obs-paper);
  color: var(--obs-ink);
  border: 1px solid color-mix(in srgb, var(--obs-ink) 46%, transparent);
  border-radius: 999px;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, opacity 0.2s ease;
}
.ijg-capsule__name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ijg-capsule__name[lang='ar'] {
  font-family: 'Amiri', serif;
  font-size: 1.18rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}
.ijg-capsule__arabic {
  font-family: 'Amiri', serif;
  font-size: 1.02rem;
  line-height: 1.35;
  color: color-mix(in srgb, var(--obs-ink) 82%, transparent);
  overflow-wrap: anywhere;
}
.ijg-capsule:hover { border-color: color-mix(in srgb, var(--obs-ink) 62%, transparent); }
.ijg-capsule:focus-visible { outline: 2px solid var(--obs-ink); outline-offset: 2px; }
.ijg-capsule--focused {
  border-color: #c0392b;
  border-width: 2px;
}
.ijg-capsule--focused .ijg-capsule__name { font-weight: 700; }
.ijg-capsule--related { border-color: color-mix(in srgb, var(--obs-ink) 60%, transparent); }
.ijg-capsule--dimmed { opacity: 0.32; }
.ijg-capsule--linked { outline: 2px solid #c0392b; outline-offset: 2px; }
.ijg-capsule--origin {
  border: 2px solid #c0392b;
  outline: 1px solid color-mix(in srgb, var(--obs-ink) 54%, transparent);
  outline-offset: 4px;
  padding-block: 0.55rem;
}
.ijg-capsule--origin .ijg-capsule__name {
  font-size: 1.28rem;
  font-weight: 700;
}
.ijg-capsule--dimmed.ijg-capsule--origin { opacity: 0.72; }
.ijg-desktop .ijg-capsule { height: 100%; }

/* ── Expansion / cross-link chips — exact counts, clearly tappable ── */
.ijg-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* ≥44px — explicit px so the hit area is engine-independent */
  padding: 0.3rem 0.8rem;
  background: var(--obs-paper);
  color: color-mix(in srgb, var(--obs-ink) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--obs-ink) 38%, transparent);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.ijg-chip:hover, .ijg-chip:focus-visible { border-color: var(--obs-ink); color: var(--obs-ink); outline: none; }
.ijg-chip:focus-visible { outline: 2px solid var(--obs-ink); outline-offset: 2px; }
.ijg-chip--link { white-space: normal; text-align: start; }
.ijg-chip--active { border-style: solid; border-color: var(--obs-ink); color: var(--obs-ink); }

/* React Flow handles are structural only — invisible. */
.ijg-handle { opacity: 0; width: 1px; height: 1px; min-width: 0; min-height: 0; border: 0; background: transparent; pointer-events: none; }

/* ── Desktop view controls ── */
.ijg-controls {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  gap: 0.4rem;
  z-index: 5;
}
.ijg-controls button {
  min-width: 44px;
  min-height: 44px; /* explicit px hit area — floors the ≥44 bar in every engine */
  height: 44px;
  padding: 0 0.7rem;
  background: var(--obs-paper);
  color: var(--obs-ink);
  border: 1px solid color-mix(in srgb, var(--obs-ink) 40%, transparent);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.ijg-controls button:hover, .ijg-controls button:focus-visible { border-color: var(--obs-ink); outline: none; }
.ijg-controls button:focus-visible { outline: 2px solid var(--obs-ink); outline-offset: 2px; }
.ijg-desktop .react-flow__attribution a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: color-mix(in srgb, var(--obs-ink) 62%, transparent);
}

/* ── Mobile lineage blocks ── */
.ijg-mobile { width: 100%; min-width: 0; overflow-x: clip; overflow-y: visible; }
.ijg-mblock { display: flex; min-width: 0; flex-direction: column; gap: 0.5rem; }
.ijg-mchips {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  padding-top: 0.75rem;
}
.ijg-mchips::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 50%;
  width: 1px;
  height: 1.25rem;
  background: color-mix(in srgb, var(--obs-ink) 46%, transparent);
  transform: translateX(-0.5px);
}
.ijg-mblock--spine > .ijg-capsule { border-color: color-mix(in srgb, var(--obs-ink) 55%, transparent); }
.ijg-mblock--origin { padding-block: 0.25rem; }
.ijg-mblock--origin > .ijg-capsule { border-color: #c0392b; }

@media (prefers-reduced-motion: reduce) {
  .ijg-capsule, .ijg-chip, .ijg-controls button { transition: none; }
}
