/* Mulstra graph renderer: structure only. Colours come from the host page's CSS variables
   (--ground, --ink, --line, --accent, --accent-ink, --surface) with the fallbacks below, so a site restyles
   it by setting those on #graph or :root. */
.g-root { --g-ground: var(--ground, #F4EFE7); --g-ink: var(--ink, #1C2831); --g-line: var(--line, #D9D0C3); --g-accent: var(--accent, #315347); --g-accent-ink: var(--accent-ink, #F4EFE7); --g-surface: var(--surface, #fff); position: relative; color: var(--g-ink); }
.g-root[data-failed] { min-height: 80px; }
.g-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-bottom: 16px; }
.g-search { position: relative; flex: 1 1 220px; max-width: 320px; order: 1; }
.g-tools { order: 2; margin-left: auto; }
.g-chips { order: 3; flex: 1 1 100%; }
.g-panel { order: 3; flex: 1 1 100%; }
.g-filter-btn { display: inline-flex; }
.g-panel { display: none; }
.g-panel--open { display: block; }
.g-n, .g-list__n { font-variant-numeric: tabular-nums; }
.g-search input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--g-accent); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 14px; }
.g-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--g-surface); border: 1px solid var(--g-line); border-radius: 8px;  }
.g-results button { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 10px; border: 0; background: none; text-align: left; font: inherit; font-size: 14px; cursor: pointer; border-radius: 6px; color: inherit; }
.g-results button:hover, .g-results button:focus-visible { background: var(--g-line); }
.g-results__t { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.g-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.g-chip, .g-btn { min-height: 44px; padding: 8px 14px; border: 1px solid var(--g-accent); border-radius: 8px; background: transparent; color: var(--g-accent); font: 600 13px/1.2 inherit; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: background 180ms ease-out; }
.g-chip:hover, .g-btn:hover { background: var(--g-line); }
.g-chip[aria-pressed="true"] { background: var(--g-accent); color: var(--g-accent-ink); }
.g-chip[aria-pressed="false"] { opacity: .75; }
.g-chip--edge[aria-pressed="true"] { background: var(--g-accent); }
.g-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid transparent; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.55); }
.g-n { font-weight: 400; opacity: .8; }
.g-tools { display: flex; gap: 8px; align-items: center; }
.g-path { min-height: 44px; padding: 8px 12px; border: 1px solid var(--g-accent); border-radius: 8px; background: transparent; color: var(--g-accent); font: inherit; font-size: 13px; max-width: 220px; }
.g-btn--primary { background: var(--g-accent); color: var(--g-accent-ink); }
.g-btn--primary:hover { background: var(--g-ink); }
.g-stage { position: relative; border: 1px solid var(--g-line); border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--g-ground) 70%, var(--g-surface)); touch-action: none; }
.g-canvas { position: absolute; inset: 0; }
.g-canvas:focus-visible { outline: 2px solid var(--g-ink); outline-offset: -4px; }
.g-tip { position: absolute; z-index: 10; pointer-events: none; max-width: 200px; background: var(--g-surface); border: 1px solid var(--g-line); border-radius: 8px; padding: 6px;  font-size: 13px; }
.g-tip__img { display: block; width: 100%; height: 100px; object-fit: cover; border-radius: 4px; margin-bottom: 6px; background: var(--g-line); opacity: 0; transition: opacity 120ms; }
.g-tip__img.is-loaded { opacity: 1; }
.g-tip__t { display: block; font-weight: 600; }
.g-hint { margin: 10px 0 0; font-size: 12px; opacity: .75; }
.g-card { position: absolute; z-index: 20; top: 12px; right: 12px; bottom: 12px; width: min(340px, calc(100% - 24px)); overflow: auto; padding: 16px; background: var(--g-surface); border: 1px solid var(--g-line); border-radius: 12px;  }
.g-card[hidden] { display: none; }
.g-card__x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--g-surface); font-size: 22px; line-height: 1; cursor: pointer; color: inherit; z-index: 2; box-shadow: 0 0 0 1px var(--g-line); }
.g-ph { margin: 0 0 12px; }
.g-ph img { display: block; width: 100%; aspect-ratio: 16/9; max-height: 24vh; object-fit: cover; border-radius: 8px; background: var(--g-line); }
.g-ph__credit { margin-top: 4px; font-size: 11px; line-height: 1.4; opacity: .85; }
.g-ph__credit a { color: inherit; }
.g-card__eb { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--g-accent); }
.g-card__h { margin: 4px 0 8px; font-family: var(--font-display, Georgia, serif); font-weight: 400; font-size: 24px; line-height: 1.2; }
.g-card__line { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.g-card__acts { display: grid; gap: 8px; margin-bottom: 14px; }
.g-link { font-size: 13px; text-align: center; color: var(--g-accent); min-height: 32px; display: flex; align-items: center; justify-content: center; }
.g-card__sec { margin-top: 12px; }
.g-card__lab { margin: 0 0 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.g-tag { margin: 0 6px 6px 0; min-height: 32px; padding: 4px 10px; border: 1px solid var(--g-line); border-radius: 999px; background: transparent; font: inherit; font-size: 12px; color: inherit; cursor: pointer; }
.g-tag:hover { background: var(--g-line); }
.g-more { font-size: 12px; opacity: .7; }
.g-pick { display: inline-block; padding: 0 8px; border: 1px solid var(--route, #B89A5A); border-radius: 999px; font-size: 10px; line-height: 1.7; letter-spacing: .1em; }
.g-list { margin-top: 16px; }
.g-list__h { margin: 56px 0 8px; font-size: 28px; }
.g-list__group { border-top: 1px solid var(--line, #D9D0C3); padding: 8px 0; }
.g-list__group summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.g-list__n { font-weight: 400; opacity: .7; }
.g-list__group ul { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 40px; }
.g-list__group li { break-inside: avoid; padding: 6px 0; font-size: 14px; }
.g-list__show { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; margin-left: 8px; border: 0; background: none; color: var(--accent, #315347); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 28px; }
@media (max-width: 700px) {
  .g-search { flex: 1 1 100%; }
  .g-chip { min-height: 40px; padding: 6px 10px; font-size: 12px; gap: 6px; }
  .g-chips { gap: 6px; }
  .g-card { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 62%; }
  .g-has-card .g-hint { display: none; }
  .g-list__group ul { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { .g-chip, .g-btn { transition: none; } }

.g-fact { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); column-gap: 8px; align-items: baseline; padding: 4px 0; font-size: 12px; border-bottom: 1px solid var(--g-line); }
.g-fact__l { font-weight: 600; opacity: .8; }
.g-fact__v { overflow-wrap: anywhere; }   /* long answers wrap (no ellipsis) */
.g-card__ask { margin: 8px 0 0; font-size: 12px; line-height: 1.5; opacity: .85; }
.g-fact__p { grid-column: 2; font-size: 11px; opacity: .85; color: var(--g-accent); }
.g-fact--unknown .g-fact__v { opacity: .6; font-style: italic; }

.g-wheel { position: absolute; z-index: 15; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; background: var(--g-ink); color: var(--g-accent-ink); font-size: 12px; pointer-events: none; }
.g-wheel[hidden] { display: none; }
@media (max-width: 700px) {
  .g-filter-btn { display: inline-flex; }
  .g-panel { display: none; }
  .g-panel--open { display: block; }
  .g-path { max-width: none; flex: 1 1 140px; min-width: 140px; }
  .g-tools { margin-left: 0; width: 100%; }
}

/* IT1: quiet toolbar (icon + word, no heavy outline) and no overflow on a phone */
.g-root { max-width: 100%; }
.g-tools { flex-wrap: wrap; gap: 4px 6px; max-width: 100%; }
.g-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--g-accent); font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; }
.g-tool:hover { background: var(--g-line); } .g-tool:focus-visible { outline: 2px solid var(--g-ink); outline-offset: 1px; }
.g-tool svg { flex: none; }
@media (max-width: 700px) { .g-tools { width: 100%; justify-content: space-between; margin-left: 0; } .g-path { flex: 1 1 100%; min-width: 0; max-width: 100%; } .g-tool { flex: 1 1 0; justify-content: center; padding: 6px 4px; min-width: 0; } .g-tool__l { white-space: nowrap; } }
@media (max-width: 520px) { .g-tool--plus .g-tool__l, .g-tool--minus .g-tool__l { display: none; } .g-tool--plus, .g-tool--minus { flex: 0 0 44px; } }

/* IT2: every control in the list fallback has a 44px hit area */
.g-list__show { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
.g-list__group li { padding: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 4px; }
.g-list__group li a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; }
@media (max-width: 700px) { .g-search { flex: 1 1 100%; max-width: none; width: 100%; } }
.g-list__group li a { min-width: 44px; justify-content: center; }

.g-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; }
.g-legend__i { display: inline-flex; align-items: center; gap: 8px; }
.g-list__group summary .g-list__n { margin-left: auto; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }

/* phone: the detail card is a bottom sheet fixed to the viewport, scrollable, with 44px controls */
@media (max-width: 700px) {
  .g-card { position: fixed; z-index: 60; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(28, 40, 49, .18); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .g-card__x { width: 44px; height: 44px; top: 4px; right: 4px; }
  .g-tag { min-height: 44px; padding: 8px 14px; }
}
