/* /graph/: the Church as one graph. The page follows the reader's scheme
   like every other page: html[data-theme] when the theme control has been
   used, prefers-color-scheme otherwise. The masthead reads --bg, --ink,
   --marian and --gold from here, so both heads agree with the canvas. Chrome
   is set in the system sans, like the masthead's controls. */
:root{
  --bg:#faf9f5;--card:#ffffff;--card-warm:#f3f2ec;
  --rule:#e2e1d8;--rule-strong:#c6c5b6;
  --ink:#232a3d;--ink-muted:#46506a;--ink-subtle:#6a718a;--ink-ghost:#6b7085;
  --gold:#a8862f;--gold-deep:#7d6420;
  --marian:#27447e;--marian-deep:#1b3160;
  --rose:#9b554c;--stone:#7a7265;
  --veil:rgba(250,249,245,.82);--veil-strong:rgba(250,249,245,.94);
  --focus:rgba(39,68,126,.28);
  --g-sans:-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,"Helvetica Neue",Arial,sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --bg:#0f1420;--card:#141a2a;--card-warm:#192134;
    --rule:#26304a;--rule-strong:#394668;
    --ink:#e7e4d8;--ink-muted:#b6b8c8;--ink-subtle:#9298b0;--ink-ghost:#7d8299;
    --gold:#d8ba6a;--gold-deep:#b39440;
    --marian:#8fb0e8;--marian-deep:#a9c2ee;
    --rose:#d6a0a8;--stone:#e7e4d8;
    --veil:rgba(15,20,32,.78);--veil-strong:rgba(15,20,32,.9);
    --focus:rgba(143,176,232,.45);
    color-scheme:dark;
  }
}
html[data-theme="dark"]{
  --bg:#0f1420;--card:#141a2a;--card-warm:#192134;
  --rule:#26304a;--rule-strong:#394668;
  --ink:#e7e4d8;--ink-muted:#b6b8c8;--ink-subtle:#9298b0;--ink-ghost:#7d8299;
  --gold:#d8ba6a;--gold-deep:#b39440;
  --marian:#8fb0e8;--marian-deep:#a9c2ee;
  --rose:#d6a0a8;--stone:#e7e4d8;
  --veil:rgba(15,20,32,.78);--veil-strong:rgba(15,20,32,.9);
  --focus:rgba(143,176,232,.45);
  color-scheme:dark;
}
html,body{height:100%;margin:0}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
body{display:flex;flex-direction:column;height:100dvh;overflow:hidden;
  background:var(--bg);color:var(--ink);font-family:var(--g-sans);-webkit-font-smoothing:antialiased}
body>.ci-mast{flex:none}
#graph-frame{position:relative;flex:1 1 auto;min-height:0;overflow:hidden;background:var(--bg)}
#graph-frame:fullscreen{background:var(--bg)}
#graph-canvas{position:absolute;inset:0}
#graph-canvas canvas{outline:none}

/* Stacking: header chrome and its popovers (30), panel (20), legend (10), canvas. */
.g-top{position:absolute;inset:0 0 auto 0;z-index:30;display:flex;flex-wrap:wrap;align-items:flex-start;
  justify-content:space-between;gap:.6rem;padding:.75rem;pointer-events:none}
.g-top>*{pointer-events:auto}
.g-lead{display:flex;flex-direction:column;gap:.5rem;max-width:min(92vw,26rem)}
.g-search{position:relative;display:block}
.g-search input{width:100%;box-sizing:border-box;min-height:44px;padding:.5rem 2.4rem .5rem 2.3rem;
  border:1px solid var(--rule);border-radius:8px;background:var(--veil);color:var(--ink);
  font:inherit;font-size:max(.92rem,16px);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.g-search input::placeholder{color:var(--ink-ghost)}
.g-search input:focus{outline:none;border-color:var(--marian);box-shadow:0 0 0 3px var(--focus)}
.g-search-ico{position:absolute;left:.8rem;top:50%;width:15px;height:15px;transform:translateY(-50%);color:var(--ink-subtle);pointer-events:none}
.g-search kbd{position:absolute;right:.7rem;top:50%;transform:translateY(-50%);padding:.05rem .35rem;
  border:1px solid var(--rule-strong);border-radius:4px;color:var(--ink-ghost);font:600 .7rem var(--g-sans);pointer-events:none}
.g-search-list{position:absolute;left:0;right:0;top:calc(100% + 4px);margin:0;padding:.25rem 0;list-style:none;
  border:1px solid var(--rule);border-radius:8px;background:var(--veil-strong);
  box-shadow:0 12px 32px rgba(0,0,0,.35);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.g-search-list button{display:flex;align-items:center;gap:.5rem;width:100%;min-height:40px;padding:.3rem .75rem;
  border:0;background:none;color:var(--ink);font:inherit;font-size:.88rem;text-align:left;cursor:pointer}
.g-search-list button:hover,.g-search-list button:focus-visible{background:color-mix(in srgb,var(--ink) 8%,transparent);outline:none}
.g-search-list i,.g-legend i,.g-panel-dot,.g-lens i{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}
.g-search-list span{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.g-search-list small{color:var(--ink-ghost);font-size:.72rem;white-space:nowrap}

.g-lensbar{display:flex;flex-wrap:wrap;gap:.35rem}
.g-lens{display:inline-flex;align-items:center;gap:.4rem;min-height:36px;padding:0 .7rem;
  border:1px solid var(--rule);border-radius:999px;background:var(--veil);color:var(--ink-subtle);
  font:500 .78rem var(--g-sans);cursor:pointer;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.g-lens:hover{color:var(--ink)}
.g-lens:focus-visible{outline:none;box-shadow:0 0 0 3px var(--focus)}
.g-lens.is-on{color:var(--ink);border-color:var(--rule-strong);background:color-mix(in srgb,var(--ink) 10%,var(--veil))}
.g-lens i{opacity:.35}.g-lens.is-on i{opacity:1}
.g-lens--provinces i{background:var(--marian)}.g-lens--conferences i{background:var(--gold)}
.g-lens--seats i{background:var(--stone)}.g-lens--shepherds i{background:var(--rose)}

.g-side{display:flex;flex-direction:column;align-items:flex-end;gap:.5rem}
.g-counts{padding:.5rem .75rem;border:1px solid var(--rule);border-radius:8px;background:var(--veil);
  font-size:.78rem;color:var(--ink-subtle);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.g-counts b{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
.g-counts-sub{margin-top:.15rem;font-size:.7rem;color:var(--ink-ghost)}
.g-full{min-height:36px;padding:0 .7rem;border:1px solid var(--rule);border-radius:999px;background:var(--veil);
  color:var(--ink-subtle);font:500 .78rem var(--g-sans);cursor:pointer}
.g-full:hover{color:var(--ink)}.g-full:focus-visible{outline:none;box-shadow:0 0 0 3px var(--focus)}

.g-legend{position:absolute;left:.75rem;bottom:.75rem;z-index:10;width:15.5rem;padding:.6rem .75rem;
  border:1px solid var(--rule);border-radius:8px;background:var(--veil);font-size:.76rem;color:var(--ink-subtle);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.g-legend-h{margin:.2rem 0 .25rem;font-size:max(.68rem,11px);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-ghost)}
.g-legend ul{margin:0 0 .4rem;padding:0;list-style:none}
.g-legend li{display:flex;align-items:center;gap:.5rem;min-height:22px}
.g-legend li span{margin-left:auto;padding-left:.75rem;color:var(--ink-ghost);font-variant-numeric:tabular-nums}
.g-legend i.g-line{width:12px;height:2px;border-radius:1px}
.g-legend-note{margin:.35rem 0 0;font-size:.7rem;line-height:1.4;color:var(--ink-ghost)}

.g-panel{position:absolute;top:5.9rem;right:.75rem;bottom:.75rem;z-index:20;width:22rem;overflow-y:auto;
  border:1px solid var(--rule);border-radius:8px;background:var(--veil-strong);color:var(--ink);
  box-shadow:0 12px 32px rgba(0,0,0,.35);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  overscroll-behavior:contain}
.g-panel[hidden]{display:none}
.g-panel-head{position:sticky;top:0;display:flex;align-items:flex-start;gap:.6rem;padding:.75rem;
  border-bottom:1px solid var(--rule);background:var(--veil-strong)}
.g-panel-mark{flex:none;width:28px;height:28px;border-radius:50%;background:var(--card)}
.g-panel-dot{width:10px;height:10px;margin-top:.45rem}
.g-panel-title{flex:1 1 auto;min-width:0}
.g-panel-title h2{margin:0;font-size:1rem;font-weight:600;line-height:1.25}
.g-panel-kind{margin-top:.15rem;font-size:.76rem;color:var(--ink-subtle)}
.g-panel-kept{display:inline-block;margin-top:.25rem;font-size:.74rem;color:var(--ink-ghost)}
.g-panel-link{display:inline-flex;align-items:center;min-height:32px;margin-top:.1rem;color:var(--marian);
  font-size:.78rem;text-decoration:none}
.g-panel-link:hover{text-decoration:underline}
.g-panel-close{flex:none;width:36px;height:36px;border:0;border-radius:8px;background:none;color:var(--ink-subtle);
  font-size:1.3rem;line-height:1;cursor:pointer}
.g-panel-close:hover{color:var(--ink)}.g-panel-close:focus-visible{outline:none;box-shadow:0 0 0 3px var(--focus)}
.g-panel-group h3{display:flex;align-items:center;gap:.5rem;margin:0;padding:.55rem .75rem .25rem;
  font-size:.64rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-ghost)}
.g-panel-group h3 i{display:inline-block;width:12px;height:2px;border-radius:1px}
.g-panel-group h3 span{margin-left:auto;font-variant-numeric:tabular-nums}
.g-panel-group ul{margin:0;padding:0 0 .25rem;list-style:none}
.g-panel-group li button{display:flex;align-items:center;gap:.5rem;width:100%;min-height:36px;padding:.25rem .75rem;
  border:0;background:none;color:var(--ink);font:inherit;font-size:.86rem;text-align:left;cursor:pointer}
.g-panel-group li button:hover,.g-panel-group li button:focus-visible{background:color-mix(in srgb,var(--ink) 8%,transparent);outline:none}
.g-panel-group li img{flex:none;width:16px;height:16px;border-radius:50%}

.g-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:5;
  font-size:.88rem;color:var(--ink-subtle);pointer-events:none}
.g-status[hidden]{display:none}

@media (max-width:640px){
  .g-top{padding:.5rem}
  .g-lead{max-width:none;width:100%}
  .g-side{width:100%;flex-direction:row;align-items:center;justify-content:space-between}
  .g-lensbar{flex-wrap:nowrap;overflow-x:auto;padding-bottom:.15rem;scrollbar-width:none}
  .g-lensbar::-webkit-scrollbar{display:none}
  .g-lens,.g-full{flex:none;min-height:44px}
  .g-legend{display:none}
  .g-counts-sub{display:none}
  .g-panel{top:auto;left:0;right:0;bottom:0;width:auto;max-height:46dvh;border-radius:12px 12px 0 0;border-bottom:0}
}
@media (pointer:coarse){.g-lens,.g-full{min-height:44px}}
@media (prefers-reduced-motion:reduce){.g-search-list,.g-panel{transition:none}}
