:root {
  --bg: #070816; --fg: #eef0ff; --muted: #9aa0c3; --line: rgba(190,200,255,.16); --card: rgba(255,255,255,.05);
  --accent: #a5b4fc; --code: rgba(165,180,252,.12);
  --seed: #facc15; --growing: #38bdf8; --evergreen: #4ade80;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--fg); font: 16px/1.65 "Avenir Next", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(60rem 40rem at 50% -8%, rgba(99,102,241,.28), transparent 70%),
    radial-gradient(40rem 30rem at 92% 38%, rgba(225,29,116,.11), transparent 70%),
    radial-gradient(44rem 30rem at 4% 62%, rgba(13,148,136,.13), transparent 70%),
    var(--bg); background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .55; background-size: 420px 420px;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 27% 72%, #cfd6ff, transparent),
    radial-gradient(1.5px 1.5px at 41% 33%, #fff, transparent), radial-gradient(1px 1px at 58% 86%, #fff, transparent),
    radial-gradient(1px 1px at 73% 14%, #dfe4ff, transparent), radial-gradient(1.5px 1.5px at 88% 57%, #fff, transparent),
    radial-gradient(1px 1px at 8% 90%, #fff, transparent), radial-gradient(1px 1px at 66% 47%, #fff, transparent); }
.top, main, .side, .shell { position: relative; z-index: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:root { --top: 3.5rem; --side: 16rem; }
.top { display: flex; align-items: center; gap: 1rem; height: var(--top); padding: 0 1.25rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(7,8,22,.72); backdrop-filter: blur(10px); z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: .85rem; color: var(--fg); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { display: block; border-radius: 6px; }
#navbtn { font: inherit; font-size: 1.2rem; line-height: 1; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); color: var(--fg); cursor: pointer; }
#q { margin-left: auto; min-width: 0; flex: 1 1 6rem; max-width: 18rem; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); color: var(--fg); font: inherit; }
#results { position: sticky; top: var(--top); z-index: 4; max-width: 44rem; margin: 0 auto; background: #0d0f24; border: 1px solid var(--line); border-radius: .6rem; box-shadow: 0 8px 24px rgb(0 0 0 / .12); }
#results em { font-style: normal; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-left: .4rem; }
#results a { display: block; padding: .6rem .9rem; color: var(--fg); border-bottom: 1px solid var(--line); }
#results a:last-child { border-bottom: 0; }
#results span { display: block; color: var(--muted); font-size: .9rem; }
main { width: 100%; max-width: 44rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
h1 { font-size: 2rem; font-weight: 400; line-height: 1.25; margin: .5rem 0; }
.lede, .meta, .empty { color: var(--muted); }
.cards, .tags, .refs ul { list-style: none; padding: 0; margin: 0; }
.card { border: 1px solid var(--line); background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); border-radius: 1rem; backdrop-filter: blur(6px); padding: .9rem 1.1rem; margin: .8rem 0; }
.card .title { font-weight: 600; font-size: 1.1rem; }
.card p { margin: .25rem 0 .5rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.tags a { font-size: .85rem; padding: .1rem .55rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); }
.tags.big a { font-size: 1rem; padding: .25rem .8rem; }
.status { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-left: .5rem; }
.status.seed { color: var(--seed); } .status.growing { color: var(--growing); } .status.evergreen { color: var(--evergreen); }
.body h2 { margin-top: 2rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); font-weight: 500; }
.body img, .body iframe, .body video { max-width: 100%; border-radius: .5rem; }
.body iframe { width: 100%; min-height: 24rem; border: 1px solid var(--line); }
.body pre { background: var(--code); padding: .9rem 1rem; border-radius: .5rem; overflow-x: auto; }
.body code { background: var(--code); padding: .1em .35em; border-radius: .3rem; font-size: .9em; }
.body pre code { padding: 0; background: none; }
.body table { border-collapse: collapse; display: block; overflow-x: auto; }
.body th, .body td { border: 1px solid var(--line); padding: .35rem .7rem; }
.body blockquote { margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--line); color: var(--muted); }
.wikilink { border-bottom: 1px dotted var(--accent); }
.refs { margin-top: 2.5rem; border-top: 1px solid var(--line); }
.refs li { margin: .4rem 0; }
.refs li span { color: var(--muted); font-size: .9rem; margin-left: .4rem; }
main.wide { max-width: 72rem; }
.figure { margin: 1.5rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--card); }
.figure figcaption { color: var(--muted); font-size: .9rem; margin-top: .5rem; }
.figure svg { max-width: 100%; height: auto; }
.callout { border-left: 3px solid var(--accent); background: var(--card); padding: .6rem 1rem; border-radius: 0 .5rem .5rem 0; margin: 1rem 0; }

/* ---- sidebar + categories ---- */
.side { display: none; font-size: .95rem; }
.side-top { display: flex; justify-content: space-between; padding: .4rem .6rem; border-radius: .5rem; color: var(--fg); font-weight: 600; }
.side-top.on { background: var(--card); color: var(--accent); }
.side small { color: var(--muted); font-weight: 400; margin-left: .5rem; }
.side details { margin: .15rem 0; }
.side summary { display: flex; align-items: center; justify-content: space-between; padding: .4rem .6rem; border-radius: .5rem; cursor: pointer; list-style: none; }
.side summary::-webkit-details-marker { display: none; }
.side summary::before { content: '\25B8'; color: var(--muted); font-size: .8rem; margin-right: .45rem; transition: transform .12s; }
.side details[open] > summary::before { transform: rotate(90deg); }
.side summary a { flex: 1; color: var(--fg); font-weight: 600; }
.side summary:hover { background: var(--card); }
.side ul { list-style: none; margin: .1rem 0 .4rem 1.1rem; padding: 0 0 0 .6rem; border-left: 1px solid var(--line); }
.side li a { display: block; padding: .28rem .6rem; border-radius: .4rem; color: var(--muted); }
.side li a:hover { color: var(--fg); background: var(--card); text-decoration: none; }
.side li a.on { color: var(--accent); background: var(--card); font-weight: 600; }
.crumb { margin: 0; font-size: .85rem; }
.crumb a { color: var(--muted); }
.cat { margin-top: 2rem; }
.cat h2 { margin: 0; font-size: 1.25rem; }
.cat h2 a { color: var(--fg); }
.cat h2 small { color: var(--muted); font-weight: 400; font-size: .9rem; }
.catdesc { margin: .1rem 0 0; color: var(--muted); }
.catlabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-left: .6rem; }

@media (min-width: 64rem) {
  .shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
  .side { display: block; position: sticky; top: var(--top); align-self: start; height: calc(100vh - var(--top)); overflow-y: auto; padding: 1rem .75rem; border-right: 1px solid var(--line); }
  #navbtn { display: none; }
}
@media (max-width: 63.99rem) {
  body.nav-open .side { display: block; position: fixed; top: var(--top); left: 0; bottom: 0; width: min(18rem, 85vw); z-index: 3; overflow-y: auto; padding: 1rem .75rem; background: #0a0c1e; border-right: 1px solid var(--line); box-shadow: 8px 0 24px rgb(0 0 0 / .4); }
}
