/* Pikoc website: the standard library reference (reference.html), on top of style.css. */

.ref-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  max-width: 1320px;
  margin: 0 auto;
  min-height: calc(100vh - 57px);
}

/* Sidebar: search and the module tree */
.ref-side {
  position: sticky; top: 57px; align-self: start;
  height: calc(100vh - 57px);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow: clip;
}
.ref-search { position: relative; padding: 18px 16px 12px; }
.ref-search input {
  width: 100%;
  padding: 9px 36px 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 15px var(--sans);
  outline: none;
}
.ref-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ref-search kbd {
  position: absolute; right: 26px; top: 26px;
  font: 12px var(--mono); color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 5px;
}
.ref-tree { overflow-y: auto; padding: 0 8px 32px 16px; font-size: 14px; }
.ref-tree details { margin: 0; }
.ref-tree summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 6px;
  color: var(--text); font-weight: 600;
}
.ref-tree summary::-webkit-details-marker { display: none; }
.ref-tree summary::before {
  content: ""; width: 6px; height: 6px; flex: none;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s; margin-right: 2px;
}
.ref-tree details[open] > summary::before { transform: rotate(45deg); }
.ref-tree summary:hover, .ref-tree a:hover { background: var(--bg-alt); }
.ref-tree summary .count { margin-left: auto; color: var(--muted); font: 400 12px var(--mono); }
.ref-tree ul { list-style: none; margin: 0 0 6px; padding: 0 0 0 14px; }
.ref-tree li > details > summary { font-weight: 400; }
.ref-tree a {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 6px; border-radius: 6px;
  color: var(--text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ref-tree summary a { padding: 0; flex: 1; min-width: 0; }
.ref-tree summary a:hover { background: none; }
.ref-tree a.current, .ref-tree summary.current { color: var(--accent); background: var(--accent-soft); }
.ref-tree .name { overflow: hidden; text-overflow: ellipsis; }

/* Kind badges */
.k {
  flex: none;
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 5px;
  font: 600 10.5px var(--mono);
  color: #fff; background: var(--muted);
}
.k-function, .k-method { background: #3f7f96; }
.k-constructor { background: #5a6fb0; }
.k-class { background: var(--brand); }
.k-struct { background: #7a3fa6; }
.k-interface, .k-type { background: #9b4f87; }
.k-enum { background: #8d6a1f; }
.k-constant { background: #b5532a; }
.k-field, .k-property { background: #6d8a3f; }
.k-module { background: var(--accent); }
@media (prefers-color-scheme: dark) {
  .k { color: #1b1613; }
  .k-class { background: #c9a0ff; }
  .k-function, .k-method { background: #8fc4d9; }
  .k-constructor { background: #a9b6ec; }
  .k-struct { background: #d59bff; }
  .k-interface, .k-type { background: #e6a0c8; }
  .k-enum { background: #e7c26b; }
  .k-constant { background: #f0a35e; }
  .k-field, .k-property { background: #b9d38a; }
}

/* Content */
.ref-main { padding: 40px 48px 96px; min-width: 0; }
.ref-browse { display: none; }
.ref-loading, .ref-empty { color: var(--muted); }
.ref-crumbs { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.ref-crumbs a { color: var(--muted); text-decoration: none; }
.ref-crumbs a:hover { color: var(--accent); }
.ref-title {
  font: 650 clamp(30px, 3.4vw, 42px)/1.15 var(--serif);
  letter-spacing: -.015em; color: var(--brand); margin: 0 0 12px;
}
.ref-about { color: var(--muted); font-size: 17px; max-width: 46em; }
.ref-about p { margin: 0 0 10px; }
.ref-import {
  display: inline-block; margin: 8px 0 0;
  padding: 8px 14px; border-radius: 10px;
  background: var(--code-bg); color: var(--code-text);
  font: 14px var(--mono);
}
.ref-toc {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 2px 18px; margin: 28px 0 8px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px;
}
.ref-toc a { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 2px 0; min-width: 0; }
.ref-toc a:hover { color: var(--accent); }
.ref-toc .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ref-item {
  margin: 28px 0 0; padding: 24px 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  scroll-margin-top: 80px;
}
.ref-item:target, .ref-item.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ref-item h2, .ref-item h3 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; font: 650 22px/1.3 var(--serif);
}
.ref-item h3 { font-size: 18px; }
.ref-item h2 a.anchor, .ref-item h3 a.anchor { color: var(--border); text-decoration: none; font: 400 16px var(--sans); }
.ref-item h2:hover a.anchor, .ref-item h3:hover a.anchor { color: var(--muted); }
.ref-item .kind-label { font: 500 13px var(--sans); color: var(--muted); }
.ref-item .ref-src { margin-left: auto; font: 500 13px var(--sans); color: var(--muted); text-decoration: none; }
.ref-item .ref-src:hover { color: var(--accent); }
.ref-sig {
  margin: 0 0 14px; padding: 11px 14px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  font: 13.5px/1.6 var(--mono); color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.ref-sig .t-kw { color: var(--accent); }
.ref-sig .t-str { color: #5f7f2a; }
.ref-sig .t-num { color: #8d6a1f; }
.ref-sig .t-type, .ref-sig a { color: var(--brand); }
.ref-sig .t-fn { color: #2f6f86; }
.ref-sig .t-com { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .ref-sig .t-str { color: var(--tok-str); }
  .ref-sig .t-num { color: var(--tok-num); }
  .ref-sig .t-fn { color: var(--tok-fn); }
}
.ref-sig a { text-decoration: none; border-bottom: 1px dotted currentColor; }
.ref-doc { max-width: 52em; }
.ref-doc p { margin: 0 0 10px; }
.ref-doc ul { margin: 0 0 10px; padding-left: 22px; }
.ref-doc pre { background: var(--bg-alt); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.ref-doc table { border-collapse: collapse; margin: 6px 0 12px; font-size: 14px; }
.ref-doc th, .ref-doc td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.ref-nodoc { color: var(--muted); font-style: italic; }

.ref-example { margin: 16px 0 0; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.ref-example .window-bar { display: flex; align-items: center; gap: 6px; }
.ref-example .window-bar b { flex: 1; }
.ref-copy {
  border: 1px solid #4a3b31; background: transparent; color: var(--code-dim);
  font: 12px var(--sans); padding: 2px 9px; border-radius: 6px; cursor: pointer;
}
.ref-copy:hover { color: var(--code-text); border-color: var(--code-dim); }
.ref-example pre.code { padding: 16px 18px; font-size: 13.5px; }

.ref-members { margin: 22px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.ref-members > .ref-item { margin: 16px 0 0; padding: 18px 20px; background: var(--bg); }
.ref-members-title { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 0; }

/* Search results */
.ref-results { list-style: none; margin: 20px 0 0; padding: 0; }
.ref-results li a {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 4px 12px;
  padding: 12px 14px; border-radius: 10px;
  color: var(--text); text-decoration: none;
}
.ref-results li a:hover, .ref-results li a.sel { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.ref-results .k { margin-top: 3px; }
.ref-results .r-name { font: 600 15px var(--mono); }
.ref-results .r-name mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; }
.ref-results .r-where { color: var(--muted); font-size: 13px; margin-left: 8px; font-family: var(--sans); font-weight: 400; }
.ref-results .r-sig { grid-column: 2; color: var(--muted); font: 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ref .footer { position: relative; z-index: 1; }

@media (max-width: 900px) {
  .ref-layout { grid-template-columns: minmax(0, 1fr); }
  .ref-side {
    display: none; position: static;
    height: auto; max-height: 70vh;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .ref-side.open { display: flex; }
  .ref-main { padding: 20px 16px 72px; }
  .ref-browse {
    display: block; margin: 16px 16px 0; padding: 8px 14px;
    position: sticky; top: 66px; z-index: 5; justify-self: start;
    box-shadow: var(--shadow);
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text); font: 500 14px var(--sans);
  }
  .ref-item { padding: 18px 16px; scroll-margin-top: 124px; }
  .ref-members { padding-left: 10px; }
  .ref-members > .ref-item { padding: 14px 12px; }
  .ref-search kbd { display: none; }
}
