/* Reader shell: top bar, contents tree / search results, page frame.
   Look: printed service manual. Ink on paper, hairline rules, square corners,
   one signal colour (safety orange) for "you are here". */
@import url("fonts.css");
:root {
  --paper: #f3f0e8; --paper-2: #e9e4d7; --sheet: #fbfaf6; --ink: #15171a; --ink-2: #3b4046; --muted: #6b6e70;
  --hair: #d3ccbc; --signal: #e8590c; --link: #0e5a61; --mark: #ffd60a; --top: 56px;
  --f-body: "Barlow", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --f-cond: "Barlow Condensed", "Barlow", "PingFang SC", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink); overflow: hidden;
  font: 15px/1.45 var(--f-body); -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }

/* top bar */
.top {
  height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--ink); color: #fff; border-bottom: 3px solid var(--signal);
}
.brand { color: #fff; text-decoration: none; white-space: nowrap; display: flex; align-items: baseline; gap: 8px;
  font: 500 19px/1 var(--f-cond); text-transform: uppercase; letter-spacing: .06em; }
.brand b { font-weight: 700; }
.brand small { font: 500 10.5px/1 var(--f-mono); letter-spacing: .1em; color: #a9a59c; }
.icon { background: none; border: 0; color: #fff; font-size: 22px; padding: 4px 6px; display: none; line-height: 1; }
.search { flex: 1; min-width: 0; }
.search input {
  width: 100%; max-width: 620px; height: 36px; border: 0; border-radius: 0; padding: 0 12px;
  font: 15px var(--f-body); background: #fff; color: var(--ink);
}
.search input::placeholder { color: #8a8a86; }
.search input:focus { outline: 2px solid var(--signal); outline-offset: 0; }
.lang { display: flex; border: 1px solid #5c5f63; flex: none; }
.lang button { background: none; border: 0; color: #d6d3cc; padding: 7px 11px; white-space: nowrap;
  font: 500 12px/1 var(--f-mono); letter-spacing: .04em; }
.lang button + button { border-left: 1px solid #5c5f63; }
.lang button:hover { color: #fff; }
.lang button.on { background: var(--signal); color: var(--ink); font-weight: 600; }

.wrap { display: flex; height: calc(100% - var(--top)); }
#side { width: 360px; flex: none; overflow: auto; background: var(--sheet); border-right: 1px solid var(--ink); padding: 0 0 40px; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar {
  display: flex; align-items: center; gap: 12px; padding: 7px 14px; background: var(--sheet);
  border-bottom: 1px solid var(--ink); min-height: 40px;
}
#crumb { flex: 1; min-width: 0; font: 12px/1.3 var(--f-mono); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn { display: flex; flex: none; }
.pn button { background: #fff; border: 1px solid var(--ink); padding: 5px 12px 4px; font: 600 13px/1 var(--f-cond); letter-spacing: .08em; text-transform: uppercase; }
.pn button + button { border-left: 0; }
.pn button:hover:not(:disabled) { background: var(--ink); color: #fff; }
.pn button:disabled { color: #aaa69d; border-color: var(--hair); cursor: default; }
.pn button + button:disabled, .pn button:disabled + button { border-left: 1px solid var(--hair); }
#frame { flex: 1; width: 100%; border: 0; background: #fff; }

/* contents tree: guide lines show what sits under what */
.side-tools { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 10px; border-bottom: 1px solid var(--ink); }
.side-tools span { font: 700 14px/1 var(--f-cond); letter-spacing: .12em; text-transform: uppercase; }
.side-tools button { background: none; border: 0; padding: 0; color: var(--link); font: 12px var(--f-mono); text-decoration: underline; text-underline-offset: 3px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree > li { border-bottom: 1px solid var(--hair); }
.tree ul { margin-left: 19px; padding-bottom: 4px; }
.tree ul > li { position: relative; padding-left: 14px; }
.tree ul > li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid #bdb5a3; }
.tree ul > li:last-child::before { bottom: auto; height: 15px; }
.tree ul > li::after { content: ""; position: absolute; left: 0; top: 15px; width: 11px; border-top: 1px solid #bdb5a3; }
.tree li.path::after { border-top: 2px solid var(--signal); top: 14px; }
.tree .row { display: flex; align-items: flex-start; gap: 5px; padding: 4px 10px 4px 3px; cursor: pointer; }
.tree > li > .row { padding: 10px 12px 9px 10px; }
.tree .row:hover { background: var(--paper); }
.tree .tw { width: 16px; height: 19px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.tree .tw svg { width: 9px; height: 9px; transition: transform .12s; }
.tree li.open > .row .tw svg { transform: rotate(90deg); }
.tree .tw.leaf::before { content: ""; width: 4px; height: 4px; background: #9b9486; }
.tree .lab { color: var(--ink); text-decoration: none; flex: 1; min-width: 0; line-height: 19px; font-size: 14.5px; }
.tree li.folder > .row .lab { font-weight: 600; }
.tree > li > .row .lab { font: 700 16px/19px var(--f-cond); text-transform: uppercase; letter-spacing: .06em; }
.tree .n { flex: none; font: 11px/19px var(--f-mono); color: var(--muted); }
.tree .row.cur { background: var(--paper-2); }
.tree .row.cur .lab { font-weight: 700; }
.tree .row.cur .tw.leaf::before { width: 7px; height: 7px; background: var(--signal); }
.tree li:not(.open) > ul { display: none; }

/* search results */
.rhead { font: 11.5px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 10px; border-bottom: 1px solid var(--ink); }
.res { display: block; padding: 10px 14px 11px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--hair); }
.res:hover { background: var(--paper); }
.res.cur { background: var(--paper-2); box-shadow: inset 0 -2px 0 var(--signal); }
.res .t { font-weight: 600; font-size: 15px; line-height: 1.3; }
.res .z { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.res .p { font: 11px/1.4 var(--f-mono); color: var(--muted); margin-top: 3px; }
.res .s { font-size: 13px; margin-top: 5px; color: var(--ink-2); line-height: 1.4; }
.res mark { background: var(--mark); color: inherit; padding: 0 1px; }
#scrim { display: none; }

@media (max-width: 860px) {
  .icon { display: block; }
  .brand small { display: none; }
  .brand { font-size: 17px; }
  #side {
    position: fixed; top: var(--top); bottom: 0; left: 0; width: min(88vw, 380px); z-index: 20;
    transform: translateX(-102%); transition: transform .18s;
  }
  body.side-open #side { transform: none; border-right: 2px solid var(--ink); }
  body.side-open #scrim { display: block; position: fixed; inset: var(--top) 0 0 0; background: rgba(21,23,26,.45); z-index: 10; }
}
@media (max-width: 600px) {
  .top { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 8px; }
  :root { --top: 98px; }
  .brand { order: 1; flex: 1; }
  .icon { order: 0; }
  .lang { order: 2; }
  .search { order: 3; flex-basis: 100%; }
  .lang button { padding: 6px 8px; font-size: 11px; }
  .pn button { padding: 5px 9px 4px; }
}

.side-tools .tools { display: flex; gap: 14px; }

[hidden] { display: none !important; }
.tree .vt { flex: none; font: 10.5px/19px var(--f-mono); color: var(--muted); border: 1px solid var(--hair); padding: 0 4px; margin-left: 4px; white-space: nowrap; }
.tree .vt.china { color: var(--no, #b8141f); border-color: currentColor; }
