
html {
  scroll-behavior: smooth;
}

.bnbp-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 22px 40px;
  color: #1f2933;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.bnbp-shell * {
  box-sizing: border-box;
}

.bnbp-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  font-size: .95rem;
}

.bnbp-breadcrumbs a {
  color: #264653;
  text-decoration: none;
}

.bnbp-breadcrumbs a:hover {
  text-decoration: underline;
}

.bnbp-hero,
.bnbp-card {
  background: #fff;
  border: 1px solid #d9e1e7;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(31, 41, 51, .06);
}

.bnbp-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  padding: 26px;
  margin-bottom: 18px;
}

.bnbp-hero-image {
  min-height: 220px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #dae4ea, #f5f7f9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bnbp-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bnbp-placeholder {
  width: 98px;
  height: 98px;
  border-radius: 999px;
  background: rgba(38, 70, 83, .08);
  color: #264653;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 700;
}

.bnbp-hero-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

.bnbp-life-line {
  margin: 0 0 14px;
  color: #51606d;
  font-size: 1.02rem;
}

.bnbp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.bnbp-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef3f6;
  border: 1px solid #dce5ea;
  padding: 6px 11px;
  font-size: .86rem;
}

.bnbp-badge-hist {
  background: #f5f0e5;
  border-color: #e6dcc4;
}

.bnbp-facts-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.bnbp-facts-strip > div {
  background: #f8fafb;
  border: 1px solid #e2e8ed;
  border-radius: 16px;
  padding: 12px 14px;
}

.bnbp-facts-strip strong {
  display: block;
  font-size: .82rem;
  color: #51606d;
  margin-bottom: 4px;
}

.bnbp-section-nav {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px;
  background: rgba(250, 250, 250, .92);
  backdrop-filter: blur(6px);
  border: 1px solid #d9e1e7;
  border-radius: 18px;
}

.bnbp-section-nav a {
  text-decoration: none;
  color: #264653;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef3f6;
  border: 1px solid #dce5ea;
  font-size: .92rem;
}

.bnbp-card {
  padding: 24px;
  margin-bottom: 18px;
}


.bnbp-card-relationships {
  background: linear-gradient(180deg, #efe2b9 0%, #e7d39d 100%);
  border-color: #d8bf80;
  padding: 22px;
  overflow: visible;
}

.bnbp-paper-sheet {
  position: relative;
  background: linear-gradient(180deg, #fff 0%, #fbf9f4 100%);
  border: 1px solid #ddd4c3;
  border-radius: 12px 20px 18px 18px;
  box-shadow: 0 12px 32px rgba(65, 52, 24, .12);
  padding: 26px 22px 22px 28px;
}

.bnbp-paper-sheet::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 0;
  width: 118px;
  height: 12px;
  background: rgba(165, 129, 66, .18);
  border-radius: 0 0 10px 10px;
}

.bnbp-paperclip {
  position: absolute;
  left: -16px;
  top: 16px;
  width: 28px;
  height: 100px;
  border: 4px solid #9098a1;
  border-right: 0;
  border-radius: 18px 0 0 18px;
  transform: rotate(-8deg);
  pointer-events: none;
}

.bnbp-paperclip::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 11px;
  width: 14px;
  height: 68px;
  border: 4px solid #c0c7cd;
  border-right: 0;
  border-radius: 14px 0 0 14px;
}

.bnbp-paper-title {
  margin: 0 0 18px;
  color: #20252a;
  font-family: "Courier New", "Courier Prime", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(1.2rem, 2.1vw, 1.7rem);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.bnbp-paper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.bnbp-paper-group {
  min-width: 0;
}

.bnbp-paper-group h3 {
  margin: 0 0 10px;
  color: #5b4833;
  font-family: "Courier New", "Courier Prime", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bnbp-relation-list-ancestry {
  gap: 8px;
}

.bnbp-relation-card-ancestry {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-radius: 10px;
  border-color: #ddd6ca;
  box-shadow: 0 1px 0 rgba(31, 41, 51, .03);
}

.bnbp-relation-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe2e7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #264653;
  font-size: .92rem;
  font-weight: 700;
}

.bnbp-relation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bnbp-relation-copy {
  min-width: 0;
}

.bnbp-relation-card-ancestry .bnbp-relation-name {
  line-height: 1.25;
  word-break: break-word;
}

.bnbp-card-head {
  margin-bottom: 18px;
}

.bnbp-card-head h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

.bnbp-card-head p {
  margin: 0;
  color: #51606d;
}

.bnbp-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 22px;
}

.bnbp-overview-grid.bnbp-overview-grid-single {
  grid-template-columns: 1fr;
}

.bnbp-bio > :first-child {
  margin-top: 0;
}

.bnbp-side-panels {
  display: grid;
  gap: 16px;
}

.bnbp-side-card {
  background: #f8fafb;
  border: 1px solid #e2e8ed;
  border-radius: 18px;
  padding: 16px;
}

.bnbp-side-card h3 {
  margin-top: 0;
}

.bnbp-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bnbp-link-list a {
  color: #264653;
  text-decoration: none;
  background: #eef3f6;
  border: 1px solid #dce5ea;
  border-radius: 999px;
  padding: 8px 12px;
}

.bnbp-link-list a:hover {
  text-decoration: underline;
}

.bnbp-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.bnbp-gallery-item {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.bnbp-gallery-item img,
.bnbp-gallery-doc {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid #d9e1e7;
  background: #f3f6f8;
}

.bnbp-gallery-item img {
  object-fit: cover;
  display: block;
}

.bnbp-gallery-doc {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #264653;
  letter-spacing: .04em;
}

.bnbp-gallery-item span {
  font-size: .94rem;
  color: #1f2933;
}

.bnbp-empty-note {
  color: #51606d;
}

.bnbp-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.bnbp-timeline::before {
  content: "";
  position: absolute;
  left: 88px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #d8dde3;
}

.bnbp-timeline-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 18px;
  position: relative;
  margin-bottom: 18px;
}

.bnbp-timeline-year {
  font-weight: 700;
  color: #264653;
  padding-top: 4px;
  text-align: right;
}

.bnbp-timeline-content {
  position: relative;
  background: #f8fafb;
  border: 1px solid #e2e8ed;
  border-radius: 16px;
  padding: 14px 16px;
}

.bnbp-timeline-content::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #264653;
  box-shadow: 0 0 0 4px #fff;
}

.bnbp-timeline-label {
  font-weight: 700;
  margin-bottom: 4px;
}

.bnbp-timeline-meta {
  color: #51606d;
  font-size: .95rem;
  margin-bottom: 4px;
}

.bnbp-map,
.bnbp-fan-chart {
  width: 100%;
  border: 1px solid #d9e1e7;
  border-radius: 20px;
  background: linear-gradient(180deg, #f7fbfd, #fcfdfd);
  overflow: hidden;
  position: relative;
}

.bnbp-map {
  min-height: 440px;
}

.bnbp-map svg {
  width: 100%;
  height: auto;
  display: block;
}

.bnbp-fan-chart {
  padding: 14px;
}

.bnbp-fan-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bnbp-fan-hint {
  color: #51606d;
  font-size: .94rem;
}

.bnbp-fan-controls {
  display: inline-flex;
  gap: 8px;
}

.bnbp-fan-button {
  appearance: none;
  border: 1px solid #dce5ea;
  background: #fff;
  color: #264653;
  border-radius: 999px;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}

.bnbp-fan-button:hover {
  background: #eef3f6;
}

.bnbp-fan-button:disabled {
  opacity: .45;
  cursor: default;
}

.bnbp-fan-button-reset {
  font-size: .95rem;
}

.bnbp-fan-viewport {
  position: relative;
  height: clamp(420px, 58vw, 640px);
  border: 1px solid #d9e1e7;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbfd, #fcfdfd);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.bnbp-fan-viewport.is-dragging {
  cursor: grabbing;
}

.bnbp-fan-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.bnbp-fan-stage svg {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

.bnbp-svg-note {
  padding: 18px;
  color: #51606d;
}

.bnbp-map-legend {
  border-top: 1px solid #e2e8ed;
  background: #fff;
  padding: 14px 16px;
}

.bnbp-map-legend ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
}

.bnbp-map-legend li {
  color: #344250;
}

.bnbp-family-tree {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.bnbp-tree-row {
  display: grid;
  gap: 16px;
}

.bnbp-tree-row:nth-child(2) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.bnbp-tree-group {
  background: #f8fafb;
  border: 1px solid #e2e8ed;
  border-radius: 18px;
  padding: 16px;
}

.bnbp-tree-focus {
  background: #f3f7f8;
}

.bnbp-tree-label {
  display: block;
  font-size: .85rem;
  color: #51606d;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.bnbp-relation-list {
  display: grid;
  gap: 10px;
}

.bnbp-relation-card {
  background: #fff;
  border: 1px solid #d9e1e7;
  border-radius: 14px;
  padding: 11px 12px;
}

.bnbp-focus-card {
  border-color: #aac2cc;
  box-shadow: inset 0 0 0 1px rgba(38, 70, 83, .05);
}

.bnbp-relation-name {
  font-weight: 700;
}

.bnbp-relation-name a {
  color: #264653;
  text-decoration: none;
}

.bnbp-relation-name a:hover {
  text-decoration: underline;
}

.bnbp-relation-life,
.bnbp-relation-sub,
.bnbp-path-life {
  color: #51606d;
  font-size: .92rem;
  margin-top: 2px;
}

.bnbp-family-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bnbp-path-list {
  margin: 0;
  padding-left: 0 !important;
  list-style: none !important;
  counter-reset: none;
  display: grid;
  gap: 14px;
}

.bnbp-path-item {
  list-style: none !important;
}

.bnbp-path-list li::marker {
  content: '';
  font-size: 0;
}

.bnbp-path-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.bnbp-path-step {
  font-weight: 800;
  color: #264653;
  min-width: 2rem;
}

.bnbp-path-name {
  font-weight: 700;
}

.bnbp-map-point-label {
  font-size: 13px;
  font-weight: 700;
  fill: #0f172a;
}

.bnbp-map-point-number {
  font-size: 12px;
  font-weight: 700;
  fill: #fff;
}

.bnbp-fan-name-line {
  font-size: 11px;
  font-weight: 700;
  fill: #0f172a;
}

.bnbp-fan-life-line {
  font-size: 10px;
  fill: #51606d;
}

.bnbp-fan-root-name {
  font-size: 14px;
  font-weight: 700;
  fill: #0f172a;
}

.bnbp-fan-root-life {
  font-size: 12px;
  fill: #51606d;
}

@media (max-width: 980px) {
  .bnbp-fan-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bnbp-fan-controls {
    justify-content: flex-start;
  }

  .bnbp-hero {
    grid-template-columns: 1fr;
  }

  .bnbp-overview-grid,
  .bnbp-family-grid,
  .bnbp-tree-row:nth-child(2),
  .bnbp-paper-grid {
    grid-template-columns: 1fr;
  }

  .bnbp-section-nav {
    position: static;
  }

  .bnbp-card-relationships {
    padding: 14px;
  }

  .bnbp-paper-sheet {
    padding: 22px 16px 18px 18px;
  }

  .bnbp-paperclip {
    display: none;
  }

  .bnbp-timeline::before {
    left: 24px;
  }

  .bnbp-timeline-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .bnbp-timeline-year {
    text-align: left;
  }
}
