/* The simple (2D) map: /tree/ and the persona homes (assets/tree.js). Colours come from the page's genome; each node adds its own through --node. */
body.tree { --t-orchid: #c178f9; --t-spore: #25ad81; --t-abyss: #10a9b5; --t-artery: #fa6780; --t-amber: #c58f0d; --t-x: #f961a2; }
.tree-main { display: block; padding: 0; max-width: none; }
.tree-intro { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: calc(var(--nav-h) + 20px) max(var(--gutter-r), 6vw) 40px max(var(--gutter-l), 6vw); max-width: 980px; margin: 0 auto; position: relative; z-index: 3; }
.tree-intro > * { margin: 0; }
.tree-intro h1 { font-size: clamp(44px, 11vw, 120px); line-height: 1; background: linear-gradient(100deg, var(--accent), var(--second), var(--tert)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .08em; }
.tree-switch { margin-top: 4px; }
.tree-down { align-self: flex-start; margin-top: 10px; min-height: 56px; font-size: 16px; }

.tree-stage { position: relative; z-index: 3; height: 100svh; min-height: 560px; overflow: hidden; touch-action: pan-y; -webkit-user-select: none; user-select: none; outline: none; }
.tree-viewport { position: absolute; inset: 0; overflow: hidden; }
.tree-world { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; will-change: transform; }
.tree-branches { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tree-branches path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.tree-branches .trunk { stroke: color-mix(in oklab, var(--edge) 85%, transparent); stroke-width: 3.2; }
.tree-branches .twig { stroke: color-mix(in oklab, var(--line) 90%, transparent); stroke-width: 1.6; }
.tree-nodes { position: absolute; inset: 0; }
.tree-node { --node: var(--accent); position: absolute; width: 0; height: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.tree-node i { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--node) 55%, white), var(--node) 60%, color-mix(in oklab, var(--node) 50%, var(--g0)));
  box-shadow: 0 0 26px color-mix(in oklab, var(--node) 70%, transparent); transition: transform .5s ease, opacity .5s ease; }
.tree-node.is-near i { opacity: .55; }
.tree-node:focus-visible i { outline: 3px solid var(--text); outline-offset: 4px; }
.tree-node.is-here i { transform: scale(1.5); animation: tree-pulse 2.4s ease-in-out infinite; }
.tree-node span { position: absolute; left: 0; top: 30px; transform: translateX(-50%); white-space: nowrap; font-family: var(--f-mono); font-size: 13px; letter-spacing: .08em; color: var(--text); text-shadow: 0 2px 10px var(--g0); opacity: 0; transition: opacity .5s ease; pointer-events: none; }
.tree-stage.is-overview .tree-node span { opacity: .0; }
.tree-stage.is-overview .tree-node:first-child i { animation: tree-pulse 1.8s ease-in-out infinite; }
@keyframes tree-pulse { 50% { box-shadow: 0 0 44px color-mix(in oklab, var(--node) 90%, transparent); } }
.tree-stage::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 70% 60% at 50% 38%, color-mix(in oklab, var(--tint, var(--accent)) 24%, transparent), transparent 70%); transition: background .8s ease; }

.tree-hint { position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom, 0px)); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0; text-align: center; font-family: var(--f-mono); font-size: 14px; letter-spacing: .06em; color: var(--muted); text-shadow: 0 2px 12px var(--g0); transition: opacity .4s ease; }
.tree-hint .btn { min-height: 56px; font-size: 16px; margin: 0; }
.tree-stage:not(.is-overview) .tree-hint { opacity: 0; pointer-events: none; visibility: hidden; }

.tree-card { position: absolute; z-index: 6; left: 50%; bottom: max(14px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(640px, calc(100% - 24px)); max-height: 62svh; overflow-y: auto;
  padding: 20px 22px 16px; border-radius: 22px 8px 22px 8px; background: color-mix(in oklab, var(--g1) 92%, transparent); border: 1px solid color-mix(in oklab, var(--node, var(--accent)) 65%, var(--line)); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .85); }
.tree-card[hidden] { display: none; }
.tree-card > * { margin: 0 0 10px; }
.tree-count { font-family: var(--f-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--node, var(--accent)); }
.tree-card h2 { display: block; font-family: var(--f-display); font-weight: 420; text-transform: none; letter-spacing: -.01em; font-size: clamp(26px, 5vw, 36px); line-height: 1.1; color: var(--text); }
.tree-card h2:focus { outline: none; }
.tree-text { font-size: 18px; line-height: 1.55; color: var(--text); }
.tree-steps { list-style: none; counter-reset: s; padding: 0; display: grid; gap: 10px; }
.tree-steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 18px; line-height: 1.45; }
.tree-steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-mono); font-size: 15px; color: var(--g0); background: var(--node, var(--accent)); }
.tree-subs { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tree-subs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--edge); font-family: var(--f-mono); font-size: 14px; text-decoration: none; color: var(--text); }
.tree-subs a:hover, .tree-subs a:focus-visible { border-color: var(--node, var(--accent)); color: var(--node, var(--accent)); }
.tree-actions { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; }
.tree-actions .btn { margin: 0; min-height: 56px; font-size: 16px; width: 100%; }
.tree-actions .btn.solid { background: var(--node, var(--accent)); border-color: var(--node, var(--accent)); }
.tree-actions [disabled] { opacity: .35; }
.tree-card.is-guide .tree-actions { grid-template-columns: 1fr 1.4fr; }
.tree-card.is-guide .tree-open { display: none; }
/* (the simple view tints plain buttons dark; this one must stay filled, so it is named more precisely than that rule) */
html .hp .tree-card.is-guide .tree-next, html.fx-lite .hp .tree-card.is-guide .tree-next { background-color: var(--node, var(--accent)); border-color: var(--node, var(--accent)); color: var(--g0); font-weight: 500; }
.tree-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 0; }
.tree-link { font: inherit; font-family: var(--f-mono); font-size: 14px; letter-spacing: .04em; background: none; border: 0; padding: 12px 0; min-height: 44px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; text-align: left; }
.tree-link:hover, .tree-link:focus-visible { color: var(--text); }
.tree-dots { display: inline-flex; gap: 6px; flex: none; }
.tree-dots b { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in oklab, var(--line) 90%, transparent); }
.tree-dots b.on { background: var(--node, var(--accent)); }

.tree-list { position: relative; z-index: 3; max-width: 760px; margin: 0 auto; padding: 36px max(var(--gutter-r), 6vw) 70px max(var(--gutter-l), 6vw); }
.tree-list h2 { margin-bottom: 14px; }
.tree-list ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.tree-list a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--edge); background: color-mix(in oklab, var(--g1) 86%, transparent); text-decoration: none; color: var(--text); min-height: 56px; }
.tree-list a small { color: var(--muted); font-size: 14px; }
.tree-list a:hover, .tree-list a:focus-visible { border-color: var(--accent); }

/* leaving: the picture leans into the node while a wash of its colour opens; arriving back reverses it */
.tree-wash { position: fixed; inset: 0; z-index: 90; pointer-events: none; visibility: hidden; --r: 0; --x: 50vw; --y: 40vh; --c: var(--accent);
  background: radial-gradient(circle at var(--x) var(--y), color-mix(in oklab, var(--c) 92%, white) 0, var(--c) 18%, color-mix(in oklab, var(--c) 40%, var(--g0)) 100%); clip-path: circle(calc(var(--r) * 1px) at var(--x) var(--y)); }
.tree-wash.on { visibility: visible; }
html.motion-off .tree-node i, html.motion-off .tree-world { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { .tree-node i { animation: none !important; } }
@media (max-width: 700px) { .tree-card { bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 64px); max-height: 56svh; } }
@media (max-width: 600px) { .tree-actions { grid-template-columns: 1fr 1fr; } .tree-actions .tree-open { grid-column: 1 / -1; order: -1; } .tree-card { padding: 16px 16px 12px; max-height: 56svh; } }

/* the map hands over to the next page with its own wash (above), so the browser's cross-fade stays out of it */
@view-transition { navigation: auto; }
