/* Ecosystem map — builds on style.css */
.map-body { min-height: 100vh; position: relative; overflow-x: hidden; }
.map-aurora { position: fixed; height: 80vh; z-index: -1; }
.map-aurora .a { opacity: .28; }
.map-body > .grain { position: fixed; z-index: -1; opacity: .12; }

.map-nav { position: sticky; top: 0; z-index: 30; background: rgba(var(--page-rgb), .7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule); }
.map-nav-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.map-links { display: flex; gap: 22px; font-size: .9rem; color: var(--dim); }
.map-links a:hover { color: var(--ink); }

.map-main { padding: 48px 0 100px; }
.map-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.map-title { font: 400 clamp(2.4rem, 5.5vw, 4rem)/1 var(--serif); letter-spacing: -.02em; }
.map-title em { color: var(--mint); }
.map-sub { margin-top: 12px; color: var(--dim); }
.map-tools { display: flex; gap: 10px; align-items: center; }
.search input { padding: 10px 14px; font-size: .92rem; width: 220px; }
.search input::placeholder { color: var(--dim); }

/* "I want to…" */
.goals { display: flex; align-items: center; gap: 14px; margin-top: 32px; flex-wrap: wrap; }
.goals-label { font-size: .8rem; color: var(--mint); }
.goal-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.goal-btns button {
  background: rgba(var(--ink-rgb), .03); border: 1px solid var(--rule); color: var(--ink);
  font: 500 .88rem var(--sans); padding: 9px 14px; border-radius: 8px; cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.goal-btns button:hover { border-color: var(--dim); }
.goal-btns button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.goal-card {
  position: relative; display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; margin-top: 16px;
  padding: 22px 24px; border: 1px solid rgba(var(--mint-rgb), .3); border-radius: 12px;
  background: linear-gradient(120deg, rgba(var(--mint-rgb), .07), rgba(var(--sky-rgb), .03));
}
.goal-card[hidden] { display: none; }
.goal-card.flash-in { animation: cardIn .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(-6px); } }
.gc-say { font: 400 1.5rem/1.25 var(--serif); }
.gc-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gc-picks button {
  display: grid; grid-template-columns: 10px auto; column-gap: 8px; align-items: center; text-align: left;
  background: rgba(var(--page-rgb), .6); border: 1px solid var(--rule); color: var(--ink); font: inherit;
  padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: border-color .2s;
}
.gc-picks button:hover { border-color: var(--c); }
.gc-picks i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.gc-picks b { font-weight: 600; font-size: .92rem; }
.gc-picks span { grid-column: 2; font-size: .78rem; color: var(--dim); }
.gc-tip { border-left: 1px solid var(--rule); padding-left: 24px; padding-right: 20px; }
.gc-tip .mono { font-size: .72rem; color: var(--sand); }
.gc-tip p { margin-top: 6px; font-size: .92rem; color: rgba(var(--ink-rgb), .85); }
.gc-x { position: absolute; top: 10px; right: 14px; background: none; border: 0; color: var(--dim); font-size: 1.4rem; cursor: pointer; }
.gc-x:hover { color: var(--ink); }

.cat-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.cat-row .cat-chips { margin-top: 0; }
.row-actions { display: flex; align-items: center; gap: 18px; }
.saved-chip { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--rule); color: var(--dim); font: 500 .82rem var(--sans); padding: 6px 12px; border-radius: 10px; cursor: pointer; transition: color .2s, border-color .2s; }
.saved-chip b { color: var(--sand); font-weight: 400; }
.saved-chip:hover, .saved-chip.on { color: var(--ink); border-color: var(--sand); }
.saved-chip.on { background: rgba(var(--sand-rgb), .08); }
#dSave.on { color: var(--sand); border-color: rgba(var(--sand-rgb), .45); }
#mapSvg .node.saved circle.dot { stroke: var(--sand); stroke-width: 2.5; }
.cmp-open { background: none; border: 0; color: var(--ink); font: 500 .88rem var(--sans); cursor: pointer; border-bottom: 1px solid var(--rule); padding: 0 0 2px; }
.cmp-open:hover { border-color: var(--ink); }
.cmp-open::before { content: "⇄ "; color: var(--mint); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.cat-chip { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--rule); color: var(--dim); font: 500 .82rem var(--sans); padding: 6px 12px; border-radius: 10px; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.cat-chip i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.cat-chip:hover, .cat-chip.on { color: var(--ink); border-color: var(--c); }
.cat-chip.on { background: rgba(var(--ink-rgb), .04); }

/* map stage */
.stage { margin-top: 24px; border: 1px solid var(--rule); border-radius: 14px; background: radial-gradient(60% 60% at 50% 50%, rgba(var(--mint-rgb), .05), transparent 70%), rgba(var(--page-rgb), .45); overflow: hidden; }
#mapSvg { display: block; width: 100%; height: auto; }

#mapSvg .orbit { fill: none; stroke: var(--rule); stroke-dasharray: 2 6; }
#mapSvg .spoke { fill: none; stroke: rgba(var(--ink-rgb), .14); stroke-width: 1; transition: stroke .3s, opacity .3s; }
#mapSvg .flow { fill: none; stroke-width: 1.6; stroke-dasharray: 4 120; animation: flowdash 3.2s linear infinite; opacity: .9; }
@keyframes flowdash { from { stroke-dashoffset: 124; } to { stroke-dashoffset: 0; } }
#mapSvg .leaf { fill: none; stroke: rgba(var(--ink-rgb), .12); transition: stroke .3s, opacity .3s; }

#mapSvg .core circle.halo { fill: url(#coreGlow); }
#mapSvg .core circle.ring { fill: var(--card); stroke: var(--mint); stroke-opacity: .6; }
#mapSvg .core text { fill: var(--ink); text-anchor: middle; }
#mapSvg .core .t1 { font: 400 22px var(--serif); }
#mapSvg .core .t2 { font: 400 10px var(--mono); fill: var(--dim); letter-spacing: .14em; }

#mapSvg .cat rect { fill: var(--card); stroke-width: 1; }
#mapSvg .cat text { font: 600 13px var(--sans); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
#mapSvg .cat { cursor: pointer; transition: opacity .3s; }

#mapSvg .node { cursor: pointer; outline: none; transition: opacity .3s; }
#mapSvg .node circle.dot { stroke: var(--bg); stroke-width: 3; transition: r .2s; }
#mapSvg .node circle.hit { fill: transparent; }
#mapSvg .node circle.pulse { fill: none; stroke-width: 1.5; opacity: 0; }
#mapSvg .node text { font: 500 14px var(--sans); fill: var(--ink); dominant-baseline: central; transition: fill .2s; }
#mapSvg .node text.sub { font: 400 10.5px var(--mono); fill: var(--dim); }
#mapSvg .node:hover circle.dot, #mapSvg .node:focus-visible circle.dot { r: 9; }
#mapSvg .node:hover circle.pulse, #mapSvg .node:focus-visible circle.pulse { animation: ping 1.2s ease-out infinite; }
@keyframes ping { 0% { r: 8; opacity: .8; } 100% { r: 22; opacity: 0; } }
#mapSvg .node:focus-visible text:not(.sub) { fill: var(--mint); }

/* focus / dim states */
#mapSvg.focusing .node:not(.hl), #mapSvg.focusing .cat:not(.hl) { opacity: .18; }
#mapSvg.focusing .leaf:not(.hl), #mapSvg.focusing .spoke:not(.hl) { opacity: .15; }
#mapSvg .leaf.hl { stroke: rgba(var(--ink-rgb), .45); }

/* entrance */
#mapSvg .pop { opacity: 0; animation: pop .6s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
#mapSvg .node.pop, #mapSvg .cat.pop, #mapSvg .core.pop { transform-box: fill-box; transform-origin: center; }

/* list view */
.list-view { margin-top: 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.list-view[hidden], .stage[hidden] { display: none; }
.lv-cat { border: 1px solid var(--rule); border-radius: 12px; padding: 20px; background: rgba(var(--page-rgb), .5); }
.lv-cat h3 { display: flex; align-items: center; gap: 10px; font: 400 1.5rem var(--serif); }
.lv-cat h3 i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.lv-cat > p { font-size: .85rem; color: var(--dim); margin: 4px 0 12px; }
.lv-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--rule); color: inherit; font: inherit; padding: 14px 0; cursor: pointer; }
.lv-item:hover b { color: var(--mint); }
.lv-item b { font-weight: 600; transition: color .2s; }
.lv-item small { grid-column: 1; color: var(--dim); font-size: .85rem; }
.lv-item .arrow { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--dim); }
.lv-empty { grid-column: 1 / -1; padding: 40px 0; color: var(--dim); text-align: center; }

.map-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; font-size: .85rem; color: var(--dim); }
.map-notes b { color: var(--ink); font-weight: 600; }

/* drawer */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(var(--page-rgb), .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(460px, 100%);
  background: var(--card); border-left: 1px solid var(--rule); padding: 32px 30px 40px; overflow-y: auto;
  transform: translateX(100%); transition: transform .4s cubic-bezier(.2, .7, .2, 1); visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer .x { position: absolute; top: 18px; right: 20px; background: none; border: 0; color: var(--dim); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.drawer .x:hover { color: var(--ink); }
.d-cat { display: inline-flex; align-items: center; gap: 8px; font: .75rem var(--mono); color: var(--dim); letter-spacing: .06em; text-transform: uppercase; }
.d-cat i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.drawer h2 { font: 400 2.6rem/1.05 var(--serif); margin-top: 10px; max-width: none; }
.d-by { color: var(--dim); font-size: .9rem; margin-top: 4px; }
.d-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.badge { font: .72rem var(--mono); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--rule); color: var(--dim); }
.badge.official { color: var(--mint); border-color: rgba(var(--mint-rgb), .35); }
.d-tag { margin-top: 18px; font-size: 1.15rem; color: var(--ink); }
.d-actions { display: flex; gap: 8px; margin-top: 18px; }
.d-actions button { flex: 1; background: rgba(var(--ink-rgb), .04); border: 1px solid var(--rule); color: var(--ink); font: 500 .85rem var(--sans); padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: border-color .2s, background .2s; }
.d-actions button:hover { border-color: var(--dim); background: rgba(var(--ink-rgb), .07); }
.d-sec { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--rule); }
.d-sec h3 { font: 500 .78rem var(--sans); color: var(--dim); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .08em; }
.d-sec p { color: rgba(var(--ink-rgb), .82); }
.d-steps { list-style: none; counter-reset: s; display: grid; gap: 12px; }
.d-steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; color: rgba(var(--ink-rgb), .82); }
.d-steps li::before { content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 2px; border: 1px solid var(--rule); font: .72rem var(--mono); color: var(--mint); margin-top: 1px; }
.two-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.d-good, .d-watch { list-style: none; display: grid; gap: 10px; font-size: .9rem; color: rgba(var(--ink-rgb), .82); }
.d-good li, .d-watch li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; }
.d-good li::before { content: "✓"; color: var(--mint); }
.d-watch li::before { content: "!"; color: var(--sand); font-weight: 700; text-align: center; }
.d-tier { display: flex; gap: 12px; align-items: flex-start; }
.d-tier .risk { flex-shrink: 0; }
.d-tier p { font-size: .9rem; }
.d-links { display: flex; gap: 8px; flex-wrap: wrap; }
.d-links button { background: none; border: 1px solid var(--rule); color: var(--ink); font: 500 .85rem var(--sans); padding: 7px 12px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.d-links button i { width: 7px; height: 7px; border-radius: 2px; background: var(--c); }
.d-links button:hover { border-color: var(--dim); }
.d-cts { display: grid; gap: 8px; }
.d-ct { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px; border: 1px solid rgba(var(--mint-rgb), .3); border-radius: 8px; background: rgba(var(--mint-rgb), .04); }
.d-ct b { font-size: .88rem; }
.d-ct code { grid-column: 1; font: .76rem var(--mono); color: var(--mint); word-break: break-all; }
.d-ct button { grid-column: 2; grid-row: 1 / 3; align-self: center; background: none; border: 1px solid var(--rule); color: var(--ink); font: 500 .78rem var(--sans); padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.d-ct button:hover { border-color: var(--mint); }
.d-ct p { grid-column: 1 / -1; font-size: .76rem; color: var(--dim) !important; }
.live-tag { margin-left: 6px; font: 600 .6rem var(--mono); color: var(--rose); border: 1px solid rgba(var(--rose-rgb), .4); padding: 1px 5px; border-radius: 4px; letter-spacing: .06em; }
.d-fakes { list-style: none; display: grid; gap: 4px; }
.d-fakes li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; background: rgba(var(--rose-rgb), .05); border: 1px solid rgba(var(--rose-rgb), .18); }
.d-fakes .mono { font-size: .78rem; color: var(--rose); text-decoration: line-through; text-decoration-color: rgba(var(--rose-rgb), .5); word-break: break-all; }
.d-fakes em { font-style: normal; font-size: .7rem; color: var(--dim); white-space: nowrap; }
.d-refs { display: grid; gap: 6px; }
.d-refs a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; transition: border-color .2s, background .2s; }
.d-refs a:hover { border-color: var(--mint); background: rgba(var(--mint-rgb), .04); }
.d-refs b { font-weight: 600; font-size: .9rem; }
.d-refs span { font: .75rem var(--mono); color: var(--mint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-refs-note { margin-top: 10px; font-size: .8rem; color: var(--dim) !important; }
.d-note { margin-top: 30px; font-size: .78rem; color: var(--dim); }

/* compare modal */
.cmp-modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(var(--page-rgb), .7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.cmp-modal[hidden] { display: none; }
.cmp-card { width: min(900px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 26px 28px 30px; animation: cardIn .3s ease; }
.cmp-top { display: flex; justify-content: space-between; align-items: center; }
.cmp-top h2 { font: 400 2rem var(--serif); max-width: none; }
.cmp-top .x { background: none; border: 0; color: var(--dim); font-size: 1.7rem; cursor: pointer; }
.cmp-top .x:hover { color: var(--ink); }
.cmp-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin: 18px 0 8px; margin-left: 150px; }
.cmp-pick .mono { font-size: .8rem; color: var(--dim); }
.cmp-pick select { padding: 10px 34px 10px 12px; font-size: .92rem; }
.cmp-row { display: grid; grid-template-columns: 138px 1fr 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); font-size: .92rem; color: rgba(var(--ink-rgb), .85); }
.cmp-row.head { border-bottom-color: var(--rule); padding-top: 22px; }
.cmp-label { font-size: .75rem; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding-top: 3px; }
.cmp-name { display: flex; align-items: center; gap: 10px; font: 400 1.7rem/1.1 var(--serif); color: var(--ink); }
.cmp-name i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.cmp-row small { display: block; color: var(--dim); font-size: .82rem; margin-top: 4px; }
.cmp-row .risk { width: 22px; height: 22px; font-size: .75rem; margin-right: 6px; vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  .goal-card.flash-in, .cmp-card { animation: none; }
  #mapSvg .flow, #mapSvg .pop, #mapSvg .node:hover circle.pulse { animation: none; opacity: 1; }
  .drawer { transition: none; }
}

@media (max-width: 760px) {
  .stage { display: none; }
  #viewTabs { display: none; }
  .list-view { display: grid !important; grid-template-columns: 1fr; }
  .map-tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .map-notes { grid-template-columns: 1fr; }
  .two-lists { grid-template-columns: 1fr; }
  .goals { gap: 10px; }
  .goal-btns { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; }
  .goal-btns button { white-space: nowrap; }
  .goal-card { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .gc-tip { border-left: 0; border-top: 1px solid var(--rule); padding: 14px 0 0; }
  .gc-say { font-size: 1.3rem; padding-right: 20px; }
  .cmp-card { padding: 20px 18px 24px; }
  .cmp-pick { margin-left: 0; grid-template-columns: 1fr; gap: 6px; }
  .cmp-pick .mono { text-align: center; }
  .cmp-row { grid-template-columns: 1fr 1fr; gap: 6px 16px; }
  .cmp-label { grid-column: 1 / -1; }
  .cmp-row.head .cmp-label { display: none; }
  .cmp-name { font-size: 1.3rem; }
  .drawer { top: auto; height: 88vh; width: 100%; border-left: 0; border-top: 1px solid var(--rule); border-radius: 14px 14px 0 0; transform: translateY(100%); padding: 28px 22px 40px; }
  .drawer h2 { font-size: 2.1rem; }
}
