/* ============================================================
   The family charts of the chapters (read/ and family/), on screen (24 Nov 2026).
   The charts were too small to read, and the frame stood too close to the words on the left.
   1. Each chart stands on a mat as the photographs do (book-look figure.fig: cream and a gilt rule in the light theme,
      navy and a gilt rule in the dark), with 12-14px inside it. The chart sits on its own white paper with 14px round
      the drawing (12px on a phone), so no frame touches the chart's words or the caption.
   2. The chart is drawn as large as the column (it was held at 374px, the printed 5.2in, so its smallest words came
      out at 6-7px). On a narrow screen it keeps at least 600px and scrolls sideways in its own box, with a hint.
   3. The chart is a link to its own drawing (works with no script); with assets/chart-view.js the link opens a viewer
      over the page (zoom with + and -, pinch, or ctrl and the wheel; drag to move; Esc, x or Back close it).
   Print is untouched: everything here is screen only (chapter-paper.css sets the printed chapter).
   ============================================================ */
@media screen {
  /* 1. the mat */
  .bk-wrap figure.map.chart:not(#_) {
    position: relative; margin-left: 0; margin-right: 0; max-width: none;
    padding: 12px 14px 12px; background: #fffaf0; border: 1px solid rgba(190, 150, 70, 0.55); border-radius: 5px;
  }
  html.theme-dark .bk-wrap figure.map.chart:not(#_) { background: #101826; border-color: rgba(216, 179, 102, 0.55); }
  .bk-wrap figure.map.chart > figcaption:not(#_) { margin-top: 0.55rem; padding: 0; }

  /* the link round the chart (a.chart-box) and the paper the chart lies on (.chart-pane) */
  .bk-wrap figure.map.chart a.chart-box:not(#_) { display: block; color: inherit; text-decoration: none; border: 0; cursor: zoom-in; }
  .bk-wrap figure.map.chart .chart-pane:not(#_) {
    display: block; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    background: #ffffff; border: 1px solid #d8c8a8; border-radius: 2px;
  }
  html.theme-dark .bk-wrap figure.map.chart .chart-pane:not(#_) { border-color: rgba(216, 179, 102, 0.6); }
  .bk-wrap figure.map.chart .chart-pane > img:not(#_) {
    display: block; box-sizing: border-box; width: 100%; min-width: 600px; height: auto; max-width: none; max-height: none;
    margin: 0; padding: 14px; background: #ffffff; outline: 0; border: 0; filter: none; box-shadow: none;
  }
  @media (max-width: 640px) { .bk-wrap figure.map.chart .chart-pane > img:not(#_) { padding: 12px; } }

  /* the row under the chart: the hint (narrow screens) and "Enlarge" */
  .bk-wrap figure.map.chart .chart-row:not(#_) {
    display: flex; align-items: center; gap: 0.4rem 0.8rem; margin-top: 0.5rem; font-size: 0.86rem; line-height: 1.3;
  }
  .bk-wrap figure.map.chart .chart-hint:not(#_) { display: none; font-style: italic; color: #5a4c38; }
  html.theme-dark .bk-wrap figure.map.chart .chart-hint:not(#_) { color: #c8b896; }
  @media (max-width: 660px) { html:not(.cv-js) .bk-wrap figure.map.chart .chart-hint:not(#_) { display: block; } }
  html.cv-js .bk-wrap figure.map.chart.cv-over .chart-hint:not(#_) { display: block; }
  .bk-wrap figure.map.chart .chart-cue:not(#_) {
    margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; box-sizing: border-box;
    padding: 0.25rem 0.9rem; border: 1px solid rgba(28, 42, 63, 0.4); border-radius: 999px; background: #ffffff;
    color: #1c2a3f; font-weight: 700; font-style: normal; letter-spacing: 0.01em;
  }
  .bk-wrap figure.map.chart .chart-cue svg:not(#_) { width: 1.05em; height: 1.05em; flex: 0 0 auto; }
  html.theme-dark .bk-wrap figure.map.chart .chart-cue:not(#_) { background: transparent; border-color: rgba(232, 205, 138, 0.65); color: #e8cd8a; }
  .bk-wrap figure.map.chart a.chart-box:hover .chart-cue:not(#_) { background: #1c2a3f; border-color: #1c2a3f; color: #ffffff; }
  html.theme-dark .bk-wrap figure.map.chart a.chart-box:hover .chart-cue:not(#_) { background: #e8cd8a; border-color: #e8cd8a; color: #141f30; }
  .bk-wrap figure.map.chart a.chart-box:focus-visible:not(#_) { outline: 3px solid #b8741a; outline-offset: 3px; border-radius: 3px; }
  html.theme-dark .bk-wrap figure.map.chart a.chart-box:focus-visible:not(#_) { outline-color: #e8cd8a; }

  /* the dark theme's light-brown caption on the navy mat (site-repairs.css 8 gave it the light theme's browns while the
     figure kept a paper ground; the paper is now only under the chart) */
  html.theme-dark .bk-wrap figure.map.chart > figcaption:not(#_) { color: #e9dfc8 !important; }
  html.theme-dark .bk-wrap figure.map.chart > figcaption > b:first-child:not(#_) { color: #e8cd8a !important; }
  html.theme-dark .bk-wrap figure.map.chart > figcaption strong:not(#_) { color: #f6f1e7 !important; }
  html.theme-dark .bk-wrap figure.map.chart > figcaption .credit:not(#_) { color: #c8b896 !important; }
  html.theme-dark .bk-wrap figure.map.chart > figcaption a:not(#_) { color: #e8cd8a !important; }
}

/* ---- the viewer (assets/chart-view.js): dark in both themes, the chart on white paper ---- */
dialog.cv-dlg {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #141f30; color: #f6f1e7; overflow: hidden;
}
dialog.cv-dlg[open] { display: flex; flex-direction: column; }
dialog.cv-dlg::backdrop { background: rgba(10, 14, 22, 0.85); }
.cv-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.6rem 0.45rem 0.9rem; background: #1c2a3f; border-bottom: 1px solid rgba(216, 179, 102, 0.45); }
.cv-ttl { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1rem; font-weight: 700; color: #e8cd8a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-bar button {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 0 0.7rem; border-radius: 6px; border: 1px solid rgba(216, 179, 102, 0.55);
  background: transparent; color: #f6f1e7; font: inherit; font-size: 1.05rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.cv-bar button:hover { background: rgba(216, 179, 102, 0.2); }
.cv-bar button:focus-visible, .cv-stage:focus-visible { outline: 3px solid #e8cd8a; outline-offset: 2px; }
.cv-stage:focus-visible { outline-offset: -3px; }
.cv-bar button.cv-x { font-size: 1.5rem; font-weight: 400; }
.cv-stage { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; touch-action: pan-x pan-y; overscroll-behavior: contain; cursor: grab; }
.cv-stage.cv-drag { cursor: grabbing; }
.cv-stage img {
  display: block; flex: 0 0 auto; margin: auto; box-sizing: border-box; padding: 16px; background: #ffffff; max-width: none; max-height: none;
  border-radius: 2px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); user-select: none; -webkit-user-select: none; -webkit-user-drag: none; filter: none;
}
.cv-help { flex: 0 0 auto; margin: 0; padding: 0.4rem 0.9rem; font-size: 0.85rem; text-align: center; color: #c8b896; background: #1c2a3f; border-top: 1px solid rgba(216, 179, 102, 0.3); }
@media (max-width: 520px) { .cv-ttl { font-size: 0.92rem; } .cv-bar { gap: 0.3rem; padding-left: 0.6rem; } }
@media (prefers-reduced-motion: no-preference) { dialog.cv-dlg[open] { animation: cv-in 0.15s ease-out; } }
@keyframes cv-in { from { opacity: 0; } to { opacity: 1; } }
@media print { dialog.cv-dlg { display: none !important; } .bk-wrap figure.map.chart .chart-row { display: none !important; } }   /* the printed chapter shows the chart and its caption only */
