/* The plugin map on /plugins/: tabs, tree, web, guide. Colours come from the theme tokens. */
.pmap { margin-bottom: 40px; }
.pm-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.pm-tabs[hidden], .pm-panel[hidden], .pm-webbox[hidden] { display: none; }
.pm-tabs [role="tab"] { min-height: 44px; padding: 0 16px; background: none; border: 0; border-bottom: 3px solid transparent; font-weight: 600; font-size: 15px; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.pm-tabs [role="tab"]:hover { color: var(--ink); }
.pm-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pm-panel { margin-bottom: 32px; }
.pm-h { font-size: 22px; margin-bottom: 8px; }
.pm-panel .page-lede { margin-bottom: 16px; max-width: 68ch; }
.pm-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pm-tools .chips { margin-bottom: 0; }
.pmap.is-tabs .pm-panel .pm-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.badge--free { background: #e4f4e6; color: #15612c; }
.badge--tok { background: #fdf0e3; color: #7a4200; }
.pm-ico { --a: #8a96a3; display: inline-flex; flex: none; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: color-mix(in srgb, var(--a) 18%, #fff); color: color-mix(in srgb, var(--a) 60%, #14202b); }

/* tree */
.pm-tree, .pm-tree ul { list-style: none; margin: 0; padding: 0; }
.pm-tree { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 8px; max-width: 880px; }
.pm-grp-label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px; border-radius: 8px; cursor: default; }
.pmap.is-tabs .pm-grp-label { cursor: pointer; }
.pmap.is-tabs .pm-grp-label::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.pmap.is-tabs .pm-grp[aria-expanded="true"] > .pm-grp-label::after { transform: rotate(-135deg); }
.pm-grp-label:hover { background: var(--bg); }
.pm-grp[aria-expanded="false"] > ul { display: none; }
.pm-grp > ul { margin: 0 0 6px 20px; padding-left: 14px; border-left: 2px solid var(--rule); }
.pm-leaf a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 8px; color: var(--ink); }
.pm-leaf a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.pm-leaf-t { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.pm-leaf-t .muted { font-size: 14px; }
.pm-leaf .badge { margin-left: 0; flex: none; }
.pm-tree li:focus { outline: none; }
.pm-tree li:focus > .pm-grp-label, .pm-tree li:focus > a { outline: 2px solid var(--ink); outline-offset: -2px; }
.muted { color: var(--muted); }

/* web */
.pm-stage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.pm-canvas { position: relative; height: 620px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.pm-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.pm-svg:active { cursor: grabbing; }
.pm-zoom { position: absolute; right: 10px; top: 10px; z-index: 2; display: flex; gap: 6px; }
.pm-zoom button { min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid var(--field); background: var(--surface); font-weight: 700; font-size: 16px; cursor: pointer; }
.pm-zoom button:hover { border-color: var(--ink); }
.pm-node { cursor: pointer; transition: opacity .15s; }
.pm-node:focus { outline: none; }
.pm-node:focus-visible .pm-dot { stroke: var(--ink); stroke-width: 3.5; }
.pm-dot { --a: #8a96a3; fill: color-mix(in srgb, var(--a) 22%, #fff); stroke: color-mix(in srgb, var(--a) 70%, #14202b); stroke-width: 1.6; }
.pm-node { --a: #8a96a3; }
.pm-glyph { stroke: color-mix(in srgb, var(--a) 55%, #14202b); }
.pm-label { font-size: 13px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.pm-node.is-sel .pm-dot { stroke: var(--accent); stroke-width: 3.5; fill: color-mix(in srgb, var(--a) 40%, #fff); }
.pm-node.is-dim { opacity: .2; }
.pm-edge { fill: none; stroke: #7c8995; stroke-width: 1.3; opacity: .75; transition: opacity .15s; }
.pm-edge--hook { stroke-dasharray: 6 4; }
.pm-edge--feature { stroke-dasharray: 2 4; stroke-linecap: round; }
.pm-edge.is-dim { opacity: .07; }
.pm-edge.is-on { stroke: var(--accent); stroke-width: 2.2; opacity: 1; }
.pm-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 16px; font-size: 15px; max-height: 620px; overflow: auto; }
.pm-card > * + * { margin-top: 10px; }
.pm-card h3 { font-size: 18px; }
.pm-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 4px; }
.pm-card ul { list-style: none; margin: 0; padding: 0; }
.pm-card li { padding: 6px 0; border-top: 1px solid var(--rule); line-height: 1.4; }
.pm-card-top { display: flex; gap: 12px; align-items: center; }
.pm-card-top .badge { margin-left: 4px; }
.pm-link { background: none; border: 0; padding: 0; min-height: 24px; font-weight: 700; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.pm-link:hover { color: var(--ink); }
.pm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; margin-top: 10px; }
.lg { display: inline-block; width: 28px; border-top: 2px solid #7c8995; vertical-align: middle; }
.lg--hook { border-top-style: dashed; }
.lg--feature { border-top-style: dotted; }
.pm-text { margin-top: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 4px 16px; }
.pm-text summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.pm-conn { list-style: none; margin: 0; padding: 0 0 8px; columns: 2 340px; column-gap: 32px; }
.pm-conn > li { break-inside: avoid; padding: 10px 0; border-top: 1px solid var(--rule); }
.pm-conn h3 { font-size: 16px; }
.pm-conn h3 a { text-decoration: underline; text-underline-offset: 2px; }
.pm-conn ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.pm-conn ul a { text-decoration: underline; text-underline-offset: 2px; }

/* guide */
.pm-step { font-size: 14px; margin-bottom: 6px; }
.pm-bar { height: 6px; background: var(--rule); border-radius: 3px; max-width: 560px; margin-bottom: 20px; overflow: hidden; }
.pm-bar span { display: block; height: 100%; background: var(--accent); }
.pm-q { font-size: 24px; margin-bottom: 16px; max-width: 30ch; }
.pm-q:focus { outline: none; }
.pm-opts { display: grid; gap: 10px; max-width: 560px; }
.pm-opt { text-align: left; min-height: 56px; padding: 10px 18px; background: var(--surface); border: 1px solid var(--field); border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer; color: var(--ink); }
.pm-opt:hover { border-color: var(--ink); }
.pm-nav { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.pm-sub { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.pm-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 760px; }
ol.pm-picks { counter-reset: pick; }
.pm-pick { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px; }
.pm-pick--big { border-color: var(--ink); }
ol.pm-picks .pm-pick::before { counter-increment: pick; content: counter(pick); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.pm-pick h4 { font-size: 17px; margin: 0 0 2px; }
.pm-pick p { font-size: 15px; color: var(--muted); }
.pm-pick a { text-decoration: underline; text-underline-offset: 2px; }
.pm-share { margin-top: 24px; max-width: 560px; }
.pm-share label { display: block; font-weight: 600; margin-bottom: 6px; }
.pm-share-row { display: flex; gap: 8px; }
.pm-share-in { flex: 1; min-width: 0; min-height: 40px; padding: 0 10px; border: 1px solid var(--field); border-radius: var(--radius); background: var(--surface); }

@media (max-width: 900px) {
	.pm-stage { grid-template-columns: minmax(0, 1fr); }
	.pm-canvas { height: 360px; }
	.pm-card { max-height: none; }
}
@media (max-width: 520px) {
	.pm-tabs [role="tab"] { padding: 0 10px; font-size: 14px; }
	.pm-leaf a { flex-wrap: wrap; }
	.pm-leaf-t { flex: 1 1 60%; }
	.pm-leaf .badge { margin-left: 42px; }
	.pm-q { font-size: 21px; }
	.pm-share-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .pm-node, .pm-edge, .pmap .pm-grp-label::after { transition: none; } }
