:root {
  --bg:     #ffffff;
  --ink:    #000000;
  --muted:  #565656;
  --rule:   #e2e2e2;
  --accent: #0040c0;
  --code:   #f4f4f4;
  --thumb:  #bcbcbc;
}

:root[data-theme="dark"] {
  --bg:     #000000;
  --ink:    #ffffff;
  --muted:  #a0a0a0;
  --rule:   #333333;
  --accent: #7fb0ff;
  --code:   #242424;
  --thumb:  #4a4a4a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:     #000000;
    --ink:    #ffffff;
    --muted:  #a0a0a0;
    --rule:   #333333;
    --accent: #7fb0ff;
    --code:   #242424;
    --thumb:  #4a4a4a;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);

  font: clamp(15px, 0.18vw + 14.4px, 18px)/1.65 ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  display: grid;
  grid-template-columns: clamp(160px, 14vw, 240px) minmax(0, 1fr) clamp(196px, 17vw, 290px);
  gap: clamp(26px, 3.2vw, 64px);

  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.6vw, 44px);
}

nav, aside {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 40px 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

nav .scroller {
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-height: 1100px) {
  nav {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  nav > * { flex: 0 0 auto; }

  nav .scroller {
    flex: 1 1 auto;
    min-height: 8rem;
  }
}

nav .scroller::-webkit-scrollbar { width: 8px; }

nav b, aside b {
  display: block;
  font: 600 0.62rem/1 ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 26px 0 10px;
}

nav .home {
  display: block;
  border: 0;
  padding: 0 0 10px;
}

nav .home .logo {
  display: block;
  width: 100%;
  max-width: 186px;
  height: auto;
  color: var(--ink);
}

nav a, aside a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  padding: 3px 0 3px 11px;
  border-left: 2px solid var(--rule);
}

nav a:hover, aside a:hover { color: var(--accent); border-left-color: var(--accent); }
nav a[aria-current] { border-left-color: var(--ink); font-weight: 600; }
aside a { color: var(--muted); }
aside { font-size: 0.8rem; }

main {
  padding: 40px 0 120px;
  min-width: 0;
}

h1 {
  font-size: clamp(26px, 1.6vw + 18px, 40px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  text-wrap: balance;
}

h2 {
  font-size: 1.06rem;
  margin: 44px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  text-wrap: balance;
}

.lede { color: var(--muted); margin: 0 0 34px; font-size: 1.04rem; }
p { margin: 0 0 14px; }

code {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.86em;
  background: var(--code);
  padding: 0.1em 0.32em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

pre {
  background: var(--code);
  border: 1px solid var(--rule);
  padding: 15px 17px;
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.6;
  margin: 0 0 16px;
}

pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.cmt { color: var(--muted); }

ul { margin: 0 0 16px; padding-left: 18px; }
li { margin-bottom: 7px; }
a { color: var(--accent); }

figure { margin: 0 0 26px; }
figure svg { display: block; width: 100%; height: auto; }

.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--rule);
             cursor: zoom-in; }

#z {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vmin;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

#z img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  object-fit: contain;
  border: 1px solid var(--rule);
}
.shot figcaption { color: var(--muted); font-size: 0.8rem; padding-top: 8px; }
.shot.missing img { display: none; }
.shot.missing figcaption {
  border: 1px dashed var(--rule);
  padding: 26px 20px;
  text-align: center;
  font-size: 0.82rem;
}
.shot.missing figcaption::after {
  content: attr(data-want);
  display: block;
  color: var(--muted);
  padding-top: 6px;
}

.shot.missing figcaption::before {
  content: "SCREENSHOT WANTED";
  display: block;
  font: 600 0.62rem/1 ui-monospace, monospace;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding-bottom: 8px;
}

.next {
  border-top: 1px solid var(--rule);
  margin-top: 52px;
  padding-top: 18px;
  font-size: 0.9rem;
}

.member {
  border-top: 1px solid var(--rule);
  padding: 18px 0 4px;
}

.member-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.member-head b { font-size: 1rem; }
.member-head b.cpp { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 0.9rem; }

.member-head span {
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--muted);
}

.member-decl {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--muted);
  background: var(--code);
  border-left: 2px solid var(--rule);
  padding: 7px 11px;
  margin: 9px 0 10px;
  overflow-x: auto;
  white-space: pre-wrap;

  padding-left: 2.6em;
  text-indent: -1.5em;
}

.member p { font-size: 0.94rem; margin-bottom: 10px; }
.member p:last-child { margin-bottom: 14px; }

.badge {
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 2px 6px;
  color: var(--muted);
}

.member-head .un {
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
  color: var(--muted);
  opacity: 0.65;
}

h3.cat {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 30px 0 -6px;
  font-weight: 600;
}

h2 em, h3.cat em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78em;
  margin-left: 6px;
}

.refhead {
  border: 1px solid var(--rule);
  padding: 16px 18px 4px;
  margin-bottom: 34px;
}
.refhead .path {
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.refhead dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 18px;
  font-size: 0.86rem;
  margin: 12px 0 14px;
}
.refhead dt { color: var(--muted); }
.refhead dd { margin: 0; font-family: ui-monospace, monospace; font-size: 0.8rem; }

#t {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 2;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  font: 600 0.62rem/1 ui-monospace, monospace;
  letter-spacing: 0.1em;
  padding: 7px 10px;
  cursor: pointer;
}

#t:hover { background: var(--bg); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#s { position: relative; margin: 0 0 1.2rem 0; }

#q {
  width: 100%; box-sizing: border-box; padding: .38rem 1.6rem .38rem .5rem;
  font: inherit; font-size: .78rem;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 3px;
}
#q:focus { outline: none; border-color: var(--accent); }
#q::placeholder { color: var(--muted); }

#s kbd {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  padding: 0 .3rem; pointer-events: none;
  font: inherit; font-size: .66rem; line-height: 1.5;
  color: var(--muted); background: var(--code);
  border: 1px solid var(--rule); border-radius: 3px;
}
#q:focus ~ kbd, #q:not(:placeholder-shown) ~ kbd { display: none; }

#q::-webkit-search-cancel-button { margin-left: .3rem; }

#r {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 60vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 3px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
}
:root[data-theme="dark"] #r { box-shadow: 0 6px 20px rgba(0, 0, 0, .6); }

#r b { display: block; padding: .4rem .5rem .2rem;
       font-size: .62rem; letter-spacing: .09em; text-transform: uppercase;
       color: var(--muted); font-weight: 600; }

#r a { display: block; padding: .26rem .5rem; font-size: .76rem; line-height: 1.35;
       color: var(--ink); text-decoration: none; }
#r a small { display: block; color: var(--muted); font-size: .66rem; }
#r a:hover, #r a[aria-selected="true"] { background: var(--code); }
#r a em { font-style: normal; color: var(--accent); font-weight: 600; }

#r p { padding: .5rem; margin: 0; font-size: .74rem; color: var(--muted); }

@media (max-width: 1080px) {
  .wrap { grid-template-columns: clamp(150px, 22vw, 220px) minmax(0, 1fr); }
  aside { grid-column: 1 / -1; order: 3; position: static; max-height: none;
          border-top: 1px solid var(--rule); padding-top: 22px; }
}

@media (max-width: 720px) {
  .wrap { grid-template-columns: 1fr; gap: 0; }
  nav { position: static; max-height: none; padding: 22px 0 20px;
        border-bottom: 1px solid var(--rule); }
  nav b { margin-top: 18px; }
  main { padding: 26px 0 80px; max-width: none; }
  aside { padding-bottom: 40px; }
  #t { top: auto; bottom: 12px; right: 12px; }
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--thumb) transparent;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }

::-webkit-scrollbar-thumb {
  background: var(--thumb);
  border-radius: 6px;

  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover { background-color: var(--muted); background-clip: content-box; }

aside details { margin: 0; }

aside details > summary {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1.35;
  cursor: pointer;
  list-style: none;
  padding: 3px 0 3px 11px;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

aside details > summary::-webkit-details-marker { display: none; }

aside details > summary::before {
  content: "+";
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  width: 8px;
  flex: none;
  color: var(--muted);
}

aside details[open] > summary::before { content: "-"; }
aside details > summary:hover { color: var(--accent); border-left-color: var(--accent); }
aside details > summary a { display: inline; padding: 0; border: 0; color: inherit; }
aside details > summary em { font-style: normal; font-size: 0.78em; opacity: 0.6; }

aside details.t > summary {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--ink);
}

aside details.s { margin-left: 9px; }
aside details.c { margin-left: 9px; }
aside details.s > a, aside details.c > a { margin-left: 9px; font-size: 0.94em; }

h2.type {
  border-top: 2px solid var(--ink);
  padding-top: 26px;
  margin-top: 60px;
}

h2.type em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-left: 10px;
}

.member-decl .macro { color: var(--muted); opacity: 0.75; }

.xref {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.xref:hover { text-decoration-thickness: 2px; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 14px;
  font-size: 0.82rem;
  margin: 0 0 12px;
  color: var(--muted);
}

.facts dt { font-family: ui-monospace, monospace; font-size: 0.94em; }
.facts dd { margin: 0; }

.features {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  margin: 0 0 24px;
  font-size: 0.92rem;
}

.features dt { font-weight: 600; }
.features dd { margin: 0; color: var(--muted); }

@media (max-width: 900px) {
  .features { grid-template-columns: 1fr; gap: 3px 0; }
  .features dd { margin: 0 0 12px; }
}

.badge.mod {
  font-family: ui-monospace, monospace;
  border-style: dashed;
}
