/* The reference pages' own layout (with base.css: the docs' look). Made for scripts/gen-reference.mjs. */
.ref-searchbar { position: sticky; top: var(--top); z-index: 5; background: rgba(53,60,47,.97); box-shadow: 0 1px 0 var(--bevel-lo); }
.ref-searchbar .wrap { width: min(1400px, 100% - 32px); margin: 0 auto; padding: 10px 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; position: relative; }
.ref-q { flex: 1 1 320px; min-width: 0; font: 500 16px/1.2 var(--text); color: var(--bone); background: #2b3125; box-shadow: var(--sunken); border: 0; border-radius: 2px; padding: 9px 10px; }
.ref-q::placeholder { color: var(--faint); opacity: .85; }
.ref-filters { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 14px; color: var(--dim); }
.ref-filters select { font: 500 14px var(--text); color: var(--bone); background: #2b3125; box-shadow: var(--sunken); border: 0; border-radius: 2px; padding: 5px 6px; max-width: 12em; }
.ref-filters label { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.ref-results-box { position: absolute; left: 0; right: 0; top: 100%; z-index: 6; max-height: min(70vh, 560px); overflow-y: auto; background: var(--side); box-shadow: var(--raised), 0 14px 40px rgba(0,0,0,.4); border-radius: 0 0 3px 3px; }
.ref-results-box ul { list-style: none; margin: 0; padding: 4px 0; }
.ref-results-box [role=option] { display: grid; grid-template-columns: auto auto 1fr; gap: 0 8px; align-items: baseline; padding: 6px 14px; cursor: pointer; border-left: 3px solid transparent; }
.ref-results-box [role=option][aria-selected="true"], .ref-results-box [role=option]:hover { background: var(--panel); border-left-color: var(--signal); }
.r-name { color: var(--bone); font-weight: 700; }
.r-where { color: var(--faint); font-size: 13px; justify-self: end; }
.r-sum { grid-column: 1 / -1; color: var(--dim); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-count { flex-basis: 100%; margin: 0; color: var(--faint); font-size: 13px; min-height: 1.2em; }

.ref-layout { width: min(1400px, 100% - 32px); margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr) 200px; gap: 32px; align-items: start; }
.ref-side, .ref-toc { position: sticky; top: calc(var(--top) + 110px); max-height: calc(100vh - var(--top) - 130px); overflow-y: auto; margin: 18px 0 40px; scrollbar-width: thin; }
.ref-side { background: var(--side); box-shadow: var(--raised); border-radius: 3px; padding: 8px 0 10px; }
.ref-side details { margin: 0; }
.ref-side summary { list-style: none; cursor: pointer; display: flex; justify-content: flex-start; align-items: baseline; gap: 0; padding: 4px 14px; color: var(--dim); font-weight: 700; font-size: 15px; }
.ref-side summary::-webkit-details-marker { display: none; }
.ref-side summary::before { content: "▸"; color: var(--faint); margin-right: 6px; transition: transform .15s; }
.ref-side details[open] > summary::before { transform: rotate(90deg); }
.ref-side summary .n { margin-left: auto; color: var(--faint); font-weight: 500; font-size: 13px; }
.ref-side summary a { color: inherit; text-decoration: none; }
.ref-side ul { list-style: none; margin: 0 0 4px; padding: 0; }
.ref-side li a { display: block; padding: 2px 14px 2px 32px; color: var(--faint); text-decoration: none; font-size: 15px; line-height: 1.3; border-left: 3px solid transparent; }
.ref-side li a:hover { color: var(--bone); }
.ref-side .here > summary { color: var(--bone); }
.ref-side li a[aria-current="page"] { color: var(--bone); border-left-color: var(--signal); background: var(--panel); }
.ref-toc p { margin: 0 0 6px; color: var(--faint); font-size: 14px; font-weight: 700; }
.ref-toc ul { list-style: none; margin: 0; padding: 0; box-shadow: inset 1px 0 0 var(--bevel-lo); }
.ref-toc a { display: block; padding: 2px 10px; color: var(--faint); text-decoration: none; font-size: 14px; line-height: 1.35; border-left: 2px solid transparent; }
.ref-toc a:hover, .ref-toc a.on { color: var(--bone); }
.ref-toc a.on { border-left-color: var(--signal); }
.ref-menu-btn { display: none; }

main.ref-main { padding: 18px 0 64px; min-width: 0; }
main.ref-main h1 { margin-top: 2px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; line-height: 1; padding: 3px 6px; border-radius: 2px; background: var(--panel-2); color: var(--bone); text-transform: capitalize; vertical-align: middle; }
.k-event { background: #7a2f2f; } .k-value { background: #2f5a3a; } .k-flow { background: #4a4a4a; } .k-action { background: #2f4a6a; } .k-point { background: #4a3f6a; } .k-brush { background: #6a4a2f; } .k-component { background: #2f5a5a; }

/* the overview grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 14px 0 26px; }
.mini { display: block; text-decoration: none; background: var(--panel); box-shadow: var(--raised); border-radius: 3px; padding: 10px 12px; color: var(--dim); min-height: 84px; }
.mini:hover, .mini:focus-visible { background: var(--panel-2); }
.mini b { display: block; color: var(--bone); margin-bottom: 2px; }
.mini span.s { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.35; }
.mini .badge { float: right; margin-left: 6px; }

/* a node or entity card */
.card { background: var(--panel); box-shadow: var(--raised); border-radius: 3px; padding: 14px 16px; margin: 0 0 14px; scroll-margin-top: calc(var(--top) + 120px); }
.card:target { box-shadow: var(--raised), 0 0 0 2px var(--signal); }
.card > header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card h3 { margin: 0; font-size: 21px; }
.card h3 a { color: var(--bone); text-decoration: none; }
.card .id { color: var(--faint); font: 13px ui-monospace, Menlo, Consolas, monospace; }
.copy-link { margin-left: auto; font: 600 13px var(--text); color: var(--dim); background: var(--panel-2); box-shadow: var(--raised); border: 0; border-radius: 2px; padding: 4px 8px; cursor: pointer; }
.copy-link:hover { color: var(--bone); }
.card .what { margin: 8px 0 6px; color: var(--bone); }
.card details { margin: 4px 0; border-top: 1px solid rgba(0,0,0,.18); }
.card summary { cursor: pointer; padding: 6px 0; color: var(--dim); font-weight: 700; font-size: 15px; }
.card summary .n { color: var(--faint); font-weight: 500; }
.card dl { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 3px 14px; margin: 0 0 8px; font-size: 16px; }
.card dt { color: var(--bone); font-weight: 600; }
.card dd { margin: 0; color: var(--dim); }
.ty { color: var(--faint); font-weight: 500; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.chip { font-size: 14px; text-decoration: none; color: var(--bone); background: var(--panel-2); border-radius: 12px; padding: 2px 10px; }
.chip:hover { background: #6b7d5e; }
.chips .lbl { color: var(--faint); font-size: 14px; }

/* the node, drawn like the Studio's */
.gfx { display: inline-block; min-width: 220px; max-width: 100%; margin: 8px 0 4px; background: #1f2419; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.35); overflow: hidden; font-size: 14px; }
.gfx-title { padding: 4px 10px; font-weight: 700; color: #fff; background: var(--hc, #4a5568); }
.gfx-pins { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; padding: 6px 10px 8px; }
.gfx-pins ul { list-style: none; margin: 0; padding: 0; }
.gfx-pins .out { text-align: right; }
.gfx-pins li { white-space: nowrap; color: #d8ded3; line-height: 1.7; }
.pin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c, #ccc); vertical-align: -1px; margin: 0 6px 0 0; }
.out .pin { margin: 0 0 0 6px; }
.pin.exec { width: 0; height: 0; border-radius: 0; border: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid #f2f2f2; vertical-align: -1px; }

@media (max-width: 1180px) { .ref-layout { grid-template-columns: 240px minmax(0, 1fr); } .ref-toc { display: none; } }
@media (max-width: 860px) {
  .ref-layout { grid-template-columns: 1fr; gap: 0; }
  .ref-menu-btn { display: flex; justify-content: space-between; width: 100%; margin: 10px 0 0; padding: 10px 12px; font: 700 16px var(--text); color: var(--bone); background: var(--panel); box-shadow: var(--raised); border: 0; border-radius: 3px; cursor: pointer; }
  .ref-side { display: none; position: static; max-height: none; margin: 4px 0 0; }
  .ref-side.open { display: block; }
  .ref-filters select { max-width: 9em; }
  .card dl { grid-template-columns: 1fr; }
  .card dd { margin-bottom: 6px; }
  .ref-searchbar .wrap { padding: 8px 0; }
}
@media (prefers-reduced-motion: reduce) { .ref-side summary::before { transition: none; } }
.ref-rail { align-self: stretch; }
.gfx li::before, .ref-side li::before, .ref-toc li::before { display: none !important; }
.gfx ul, .ref-side ul, .ref-toc ul { padding-left: 0; }
.ref-filter-box { position: relative; }
.ref-filter-box > summary { cursor: pointer; list-style: none; font: 600 14px var(--text); color: var(--dim); background: var(--panel); box-shadow: var(--raised); border-radius: 2px; padding: 6px 10px; }
.ref-filter-box > summary::-webkit-details-marker { display: none; }
.ref-filter-box[open] > summary { color: var(--bone); }
.ref-filter-box .ref-filters { position: absolute; right: 0; top: calc(100% + 6px); z-index: 7; width: max-content; max-width: calc(100vw - 32px); background: var(--side); box-shadow: var(--raised), 0 10px 30px rgba(0,0,0,.4); border-radius: 3px; padding: 10px 12px; display: grid; gap: 8px; }
/* themed scrollbars (thin, dark track, muted thumb) */
* { scrollbar-width: thin; scrollbar-color: #5a6a50 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #5a6a50; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #6b7d5e; }
::-webkit-scrollbar-corner { background: transparent; }
/* the section switcher: the three references and the guides, always there */
.ref-switch { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px 8px; margin-bottom: 4px; box-shadow: inset 0 -1px 0 var(--bevel-lo); }
.ref-switch a { flex: 1 1 auto; text-align: center; font-size: 13px; font-weight: 700; color: var(--dim); text-decoration: none; padding: 5px 6px; border-radius: 2px; background: var(--bg); box-shadow: var(--sunken); white-space: nowrap; }
.ref-switch a:hover { color: var(--bone); }
.ref-switch a[aria-current="true"] { color: var(--ink); background: var(--signal); box-shadow: inset 1px 1px 0 rgba(255,255,230,.55), inset -1px -1px 0 #6e6526; }
/* cards wrap cleanly at any width */
.grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.mini { min-width: 0; overflow-wrap: anywhere; }
.mini b { overflow-wrap: anywhere; }
/* the cards' sections: the same marker as the sidebar */
.card summary { list-style: none; }
.card summary::-webkit-details-marker { display: none; }
.card summary::before { content: "▸"; display: inline-block; color: var(--faint); margin-right: 6px; transition: transform .15s; }
.card details[open] > summary::before { transform: rotate(90deg); }
.card summary:focus-visible, .ref-side summary:focus-visible, .ref-filter-box > summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.card .what { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .card summary::before { transition: none; } }
/* the switcher stays one line: four equal segments */
.ref-switch { flex-wrap: nowrap; }
.ref-switch a { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 5px 4px; }
.ref-all { display: none; }
@media (max-width: 860px) {
  /* phones: the menu holds the switcher, the current category (its list scrolls) and one button for the rest */
  .ref-side:has(.ref-all):not(.all) details:not(.here) { display: none; }
  .ref-side details.here > ul { max-height: 45vh; overflow-y: auto; }
  .ref-all { display: block; width: calc(100% - 20px); margin: 6px 10px 10px; padding: 8px 10px; font: 700 14px var(--text); color: var(--bone); background: var(--panel); box-shadow: var(--raised); border: 0; border-radius: 3px; cursor: pointer; text-align: left; }
  .ref-all::after { content: " ▸"; color: var(--faint); }
  .ref-side.all .ref-all::after { content: " ▾"; }
}
/* pin types (the Studio's look, studio.css): a file is a square, an array a grid, a map a diamond,
   a color a rainbow ring; # marks a whole number, a letter an entity handle */
.k-type { background: #5a4a2f; }
.pin.file { border-radius: 2px; }
.pin.array { border-radius: 2px; background-image: linear-gradient(90deg, transparent 40%, var(--c) 40% 60%, transparent 60%), linear-gradient(transparent 40%, var(--c) 40% 60%, transparent 60%); }
.pin.map { border-radius: 1px; transform: rotate(45deg) scale(.85); }
.pin.rainbow { border-color: transparent; background: conic-gradient(#ff5a5a, #ffd23f, #6be36a, #4dc3ff, #b06bff, #ff5a5a) border-box; -webkit-mask: radial-gradient(circle, transparent 2.5px, #000 3px); mask: radial-gradient(circle, transparent 2.5px, #000 3px); }
.pwhole, .pbadge { display: inline-block; font: 700 10px/1 var(--text); padding: 1px 3px; margin-left: 4px; border-radius: 3px; vertical-align: 1px; color: var(--dim); border: 1px solid var(--bevel-lo, #555); }
.pbadge { color: #4dd0c8; border-color: #4dd0c8; }
.card dt a.ty { color: var(--faint); text-decoration: underline dotted; text-underline-offset: 2px; }
.card dt a.ty:hover { color: var(--bone); }
.type-card h3 .pin { margin-right: 8px; vertical-align: 0; }
.type-card h3 a { color: inherit; text-decoration: none; }
.type-card dd .chip { display: inline-block; white-space: nowrap; margin: 0 4px 4px 0; }
.card p.note { font-size: 15px; color: var(--dim); }
/* a sidebar row with nothing to open: no triangle (its name still lines up with the others) */
.ref-side details.leaf > summary { cursor: default; }
.ref-side details.leaf > summary::before { visibility: hidden; }
/* keyboard focus in the sidebar: inside the row (the sidebar clips anything outside it) */
.ref-side summary:focus-visible, .ref-side a:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
/* the map editor page: a card per tool or command */
.ed-os { display: flex; align-items: center; gap: 4px; margin: 0 0 18px; font-size: 14px; color: var(--faint); }
.ed-os span { margin-right: 6px; }
.ed-os button { font: 700 13px var(--text); color: var(--dim); background: var(--bg); box-shadow: var(--sunken); border: 0; border-radius: 2px; padding: 5px 10px; cursor: pointer; }
.ed-os button[aria-pressed="true"] { color: var(--ink); background: var(--signal); box-shadow: inset 1px 1px 0 rgba(255,255,230,.55), inset -1px -1px 0 #6e6526; }
.ed-os button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.ed-group { margin-bottom: 8px; }
.ed-intro { color: var(--dim); margin: -4px 0 14px; }
.ed-card .what { margin-bottom: 10px; }
.card dl.ed-facts { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 6px 14px; margin: 0 0 10px; }
.card dl.ed-facts dt { color: var(--faint); font-weight: 700; font-size: 14px; padding-top: 3px; }
.card dl.ed-facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.crumbs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 5px; font-size: 14px; font-weight: 600; color: var(--bone); background: var(--bg); box-shadow: var(--sunken); border-radius: 2px; padding: 3px 8px; }
.crumbs .sep { color: var(--faint); font-weight: 400; }
.keys { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; color: var(--faint); font-size: 13px; }
.keys kbd { font: 600 13px/1 ui-monospace, Menlo, Consolas, monospace; color: var(--bone); background: var(--panel-2, #3a4433); box-shadow: var(--raised); border-radius: 3px; padding: 4px 6px; min-width: 1.6em; text-align: center; }
.k-mac { display: none; }
:root[data-os="mac"] .k-mac { display: inline-flex; gap: 2px; }
:root[data-os="mac"] .k-win { display: none; }
.k-win { display: inline-flex; gap: 2px; align-items: center; }
.ed-facts .or, .ed-actions .or { color: var(--faint); font-size: 13px; }
.alt-keys { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: 13px; }
.ed-facts .none { color: var(--faint); font-size: 14px; }
.ed-actions { list-style: none; margin: 0 0 10px; padding: 0; border-top: 1px solid rgba(255,255,255,.06); }
.ed-actions li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.ed-actions li::before { display: none !important; }
.ed-act b { color: var(--bone); margin-right: 8px; }
.ed-act span { color: var(--dim); }
.ed-act-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: flex-end; }
.ed-card .good { color: var(--dim); font-size: 15px; margin: 4px 0 10px; }
.ed-card .good b { color: var(--bone); }
.chip.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
@media (max-width: 640px) {
  .ed-actions li { grid-template-columns: 1fr; }
  .ed-act-meta { justify-content: flex-start; }
  .card dl.ed-facts { grid-template-columns: 1fr; gap: 2px; }
  .card dl.ed-facts dt { padding-top: 6px; }
}
.ed-group h2 { scroll-margin-top: calc(var(--top) + 120px); }
