/* On the scheme element, not :root: Material defines its colours there, and a
   custom property resolves where it is declared. */
[data-md-color-scheme] {
  --brain-bg: var(--md-default-bg-color);
  --brain-line: var(--md-default-fg-color--lightest);
  --brain-muted: var(--md-default-fg-color--light);
}
.brain-unresolved { color: var(--brain-muted); border-bottom: 1px dashed var(--brain-muted); cursor: help; }
.brain-panel { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--brain-line); font-size: .7rem; }
/* Material styles every <details> in page content as an admonition. */
.md-typeset .brain-panel details, .md-typeset .brain-controls details { margin: .4rem 0 0; padding: 0; overflow: visible; font-size: inherit; background: none; border: 0; border-radius: 0; box-shadow: none; }
.md-typeset .brain-panel summary, .md-typeset .brain-controls summary { margin: 0; padding: .15rem 0; font-weight: 700; cursor: pointer; background: none; border: 0; }
.md-typeset .brain-panel summary::before, .md-typeset .brain-panel summary::after, .md-typeset .brain-controls summary::before, .md-typeset .brain-controls summary::after { display: none; }
.brain-panel ul { list-style: none; margin: 0 0 .6rem; padding: 0; }
.md-typeset .brain-panel ul li { margin: .15rem 0; }
.brain-origin { color: var(--brain-muted); margin-left: .5em; font-size: .9em; }
.brain-source { color: var(--brain-muted); margin: 0 0 .4rem; }
.brain-more { color: var(--brain-muted); }

.brain-local { margin: .6rem .6rem 0; border: 1px solid var(--brain-line); border-radius: .2rem; position: relative; height: 220px; overflow: hidden; }
.brain-local-title { font-size: .6rem; font-weight: 700; color: var(--brain-muted); margin: .8rem .6rem 0; }
.brain-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.brain-canvas.is-dragging { cursor: grabbing; }

.brain-view { position: relative; }
.brain-view[data-brain-view="graph"], .brain-view[data-brain-view="canvas"] { height: 72vh; min-height: 420px; border: 1px solid var(--brain-line); border-radius: .2rem; overflow: hidden; background: var(--brain-bg); }
.brain-controls { position: absolute; top: .5rem; left: .5rem; z-index: 2; width: 13rem; max-width: calc(100% - 1rem); max-height: calc(100% - 1rem); overflow: auto; padding: .5rem .6rem; font-size: .62rem; background: var(--brain-bg); border: 1px solid var(--brain-line); border-radius: .2rem; }
.brain-controls input[type=search] { width: 100%; box-sizing: border-box; padding: .25rem .35rem; color: inherit; background: transparent; border: 1px solid var(--brain-line); border-radius: .15rem; }
.brain-controls label { display: flex; align-items: center; gap: .35rem; margin-top: .3rem; }
.brain-controls input[type=range] { flex: 1; min-width: 0; }
.brain-swatch { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; flex: none; }
.brain-stats { margin-top: .4rem; color: var(--brain-muted); }

.brain-preview { position: fixed; z-index: 10; width: 20rem; max-width: calc(100vw - 2rem); padding: .6rem .7rem; font-size: .68rem; line-height: 1.45; color: var(--md-default-fg-color); background: var(--brain-bg); border: 1px solid var(--brain-line); border-radius: .2rem; box-shadow: var(--md-shadow-z2); pointer-events: none; }
.brain-preview strong { display: block; margin-bottom: .2rem; font-size: .75rem; }
.brain-preview small { display: block; margin-top: .3rem; color: var(--brain-muted); }

.brain-switcher { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 1rem; background: rgba(0, 0, 0, .45); }
.brain-switcher-box { width: 34rem; max-width: 100%; background: var(--brain-bg); color: var(--md-default-fg-color); border-radius: .25rem; box-shadow: var(--md-shadow-z3); overflow: hidden; }
.brain-switcher input { width: 100%; box-sizing: border-box; padding: .7rem .8rem; font-size: .85rem; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--brain-line); outline: none; }
.brain-switcher ul { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.brain-switcher li { padding: .45rem .8rem; font-size: .72rem; cursor: pointer; }
.brain-switcher li.is-active { background: var(--md-accent-fg-color--transparent); }
.brain-switcher li span { color: var(--brain-muted); margin-left: .5em; }

.md-header__button.brain-button { cursor: pointer; }
.brain-table-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.brain-table-tools input, .brain-table-tools select { padding: .25rem .35rem; font-size: .68rem; color: inherit; background: var(--brain-bg); border: 1px solid var(--brain-line); border-radius: .15rem; }
.brain-table-scroll { overflow-x: auto; }
.md-typeset .brain-table { display: table; width: 100%; font-size: .66rem; }
.md-typeset .brain-table th { cursor: pointer; white-space: nowrap; }

@media print { .brain-panel, .brain-local, .brain-local-title { display: none; } }

/* ---- graph explorer (sigma) ------------------------------------------------ */
.brain-view[data-brain-view="graph"] { height: 78vh; min-height: 480px; }
.brain-stage { position: absolute; inset: 0; }
.brain-local .brain-stage, .brain-local > div { width: 100%; height: 100%; }
.sigma-brain-halos, .sigma-brain-names { inset: 0; pointer-events: none; overflow: hidden; }
.brain-halo { position: absolute; border-radius: 50%; }
.brain-name { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 700; letter-spacing: .02em; color: var(--md-default-fg-color--light); text-shadow: 0 0 6px var(--md-default-bg-color), 0 0 2px var(--md-default-bg-color); }
.brain-toggle, .brain-depth { display: inline-flex; margin-top: .45rem; border: 1px solid var(--brain-line); border-radius: .2rem; overflow: hidden; }
.brain-toggle button, .brain-depth button { padding: .2rem .45rem; font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
.brain-toggle button + button, .brain-depth button + button { border-left: 1px solid var(--brain-line); }
.brain-toggle button[aria-pressed="true"], .brain-depth button[aria-pressed="true"] { color: var(--md-primary-bg-color); background: var(--md-primary-fg-color); }
.brain-find { position: relative; }
.brain-suggest { position: absolute; left: 0; right: 0; z-index: 3; margin: .15rem 0 0; padding: 0; list-style: none; background: var(--brain-bg); border-radius: .2rem; box-shadow: var(--md-shadow-z2); }
.brain-suggest:empty { display: none; }
.brain-suggest li { display: flex; align-items: center; gap: .35rem; padding: .3rem .45rem; cursor: pointer; }
.brain-suggest li span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-suggest li small { color: var(--brain-muted); }
.brain-suggest li.is-active { background: var(--md-accent-fg-color--transparent); }
.brain-groups label { gap: .3rem; }
.brain-group-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-count { color: var(--brain-muted); font-variant-numeric: tabular-nums; }
.brain-card { position: absolute; top: .5rem; right: .5rem; z-index: 2; width: 17rem; max-width: calc(100% - 1rem); max-height: calc(100% - 1rem); overflow: auto; padding: .6rem .7rem; font-size: .64rem; line-height: 1.45; background: var(--brain-bg); border: 1px solid var(--brain-line); border-radius: .2rem; box-shadow: var(--md-shadow-z1); }
.brain-card[hidden] { display: none; }
.md-typeset .brain-card h3 { margin: .2rem 0 .3rem; font-size: .8rem; line-height: 1.3; }
.brain-card-where { display: flex; align-items: center; gap: .35rem; color: var(--brain-muted); }
.brain-card-summary { margin: 0 0 .35rem; }
.brain-card-meta, .brain-card-hint { margin: 0 0 .35rem; color: var(--brain-muted); }
.brain-card-hint:empty { display: none; }
.brain-card-actions { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.md-typeset .brain-card .md-button { margin: 0; padding: .15rem .6rem; font-size: .62rem; }
.brain-card-close { position: absolute; top: .3rem; right: .4rem; font-size: .9rem; line-height: 1; color: var(--brain-muted); background: none; border: 0; cursor: pointer; }
.md-typeset .brain-card details { margin: .3rem 0 0; padding: 0; font-size: inherit; background: none; border: 0; box-shadow: none; }
.md-typeset .brain-card summary { padding: .1rem 0; font-weight: 700; background: none; }
.md-typeset .brain-card summary::before, .md-typeset .brain-card summary::after { display: none; }
.brain-near, .brain-route { list-style: none; margin: .2rem 0 0; padding: 0; }
.md-typeset .brain-near li, .md-typeset .brain-route li { margin: .1rem 0; }
.brain-near button { padding: 0; font: inherit; text-align: left; color: var(--md-typeset-a-color); background: none; border: 0; cursor: pointer; }
.brain-route li { display: flex; align-items: center; gap: .35rem; }
.brain-unsupported { padding: 1rem; color: var(--brain-muted); }
.brain-local-title { display: flex; align-items: center; justify-content: space-between; }
.brain-depth { margin: 0; font-weight: 400; }

/* ---- atlas -------------------------------------------------------------------- */
.brain-view[data-brain-view="atlas"] { display: flex; justify-content: center; }
.atlas { display: block; width: 100%; max-width: 42rem; height: auto; }
.atlas a { outline: none; }
.atlas-arc { stroke: var(--md-default-bg-color); stroke-width: 1; transition: opacity .15s; }
.atlas.is-focused .atlas-arc { opacity: .55; }
.atlas.is-focused .atlas-arc.is-active { opacity: 1; stroke: var(--md-default-fg-color); stroke-width: 1.5; }
/* The wedge with the keyboard focus wears a ring in the accent colour, thick enough to find. */
.atlas a:focus-visible .atlas-arc { opacity: 1; stroke: var(--md-accent-fg-color); stroke-width: 3; }
.atlas-label { font-size: 11px; font-weight: 700; fill: #fff; pointer-events: none; paint-order: stroke; stroke: rgba(0, 0, 0, .25); stroke-width: 2px; }
/* views.label_ink picks dark text where white would not reach 4.5:1 on the wedge. */
.atlas-label--dark { fill: #111; stroke: rgba(255, 255, 255, .3); }
.atlas-centre { font-size: 22px; font-weight: 700; fill: var(--md-default-fg-color); }
.atlas-sub { font-size: 13px; fill: var(--md-default-fg-color--light); }
.md-typeset .atlas-emblem { display: block; float: right; width: 15rem; max-width: 45%; margin: 0 0 1rem 1.2rem; }
.md-typeset .atlas-emblem figcaption { font-size: .6rem; color: var(--brain-muted); }
.atlas-emblem .atlas-centre { font-size: 26px; }
.atlas-emblem .atlas-sub { font-size: 16px; }
@media screen and (max-width: 44.9375em) { .md-typeset .atlas-emblem { float: none; width: 100%; max-width: 18rem; margin: 0 auto 1rem; } }
.brain-wide { position: absolute; right: .5rem; bottom: .5rem; z-index: 2; width: 1.6rem; height: 1.6rem; padding: .2rem; color: var(--brain-muted); background: var(--brain-bg); border: 1px solid var(--brain-line); border-radius: .2rem; cursor: pointer; }
.brain-wide:hover { color: var(--md-accent-fg-color); }
.brain-view:fullscreen { height: 100vh; border: 0; border-radius: 0; }
.md-typeset .brain-card ul, .md-typeset .brain-card ol { margin-left: 0; }
.md-typeset .brain-card li { margin-left: 0; list-style: none; }
