/* Docs layout. Base type, colours, header and footer come from /site.css. */

/* Reader: page list on the left, article on the right */

.reader-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 4rem;
  align-items: start;
}

.side {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  font-size: 0.92rem;
}

.find {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  margin: 0 0 1.25rem;
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.find:hover { color: var(--text); }
main.page .find { width: auto; display: inline-block; padding: 0.4rem 0.9rem; }

.pick { display: none; }

.pages a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 0.18rem 0;
}
.pages a:hover,
.pages a[aria-current="page"] { color: var(--text); }
.pages a[aria-current="page"] { font-weight: 600; }

.item .subs { display: none; }
.item.open .subs { display: block; }
.subs > div { padding: 0.1rem 0 0.4rem 0.8rem; border-left: 1px solid var(--line); margin-left: 0.1rem; }
.subs a { font-size: 0.88rem; padding: 0.12rem 0; }
.subs a.on { color: var(--text); }

.sep {
  display: block;
  height: 1px;
  background: var(--line);
  margin: 0.7rem 0;
}

.other {
  margin-top: 1.25rem;
  padding-top: 0.7rem !important;
  border-top: 1px solid var(--line);
}

/* Article */

.doc { max-width: 680px; min-width: 0; }
.doc > h1 { font-size: clamp(1.9rem, 3.4vw, 2.4rem); margin-bottom: 0.5rem; }
.doc .sub { color: var(--muted); font-size: 1.1rem; margin-bottom: 0; }
.doc section h2 { font-size: 1.45rem; margin: 3rem 0 0.75rem; }
.doc section:first-of-type h2 { margin-top: 2.5rem; }
.doc h3 { font-size: 1.05rem; margin: 1.75rem 0 0.4rem; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.tbl td {
  border-top: 1px solid var(--line);
  padding: 0.5rem 0.75rem 0.5rem 0;
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: 1px solid var(--line); }
.tbl td:first-child { width: 34%; }

.doc .box {
  display: block;
  border: 0;
  background: var(--soft);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
}
.doc .box p:last-child { margin: 0; }

.help {
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.pager .next { margin-left: auto; text-align: right; }

/* Search dialog */

.search {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 1rem 1rem;
}
.search[hidden] { display: none; }

.sbox {
  width: 100%;
  max-width: 580px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.q { display: block; border-bottom: 1px solid var(--line); }
.q input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 0.85rem 1rem;
}

.results { overflow-y: auto; padding: 0.4rem; }
.res {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
}
.res[aria-selected="true"], .res:hover { background: var(--soft); }
.res b { font-weight: 600; display: block; }
.res span { color: var(--muted); font-size: 0.85rem; }
.res p { margin: 0.2rem 0 0; font-size: 0.88rem; color: var(--muted); }
.res mark { background: none; color: var(--text); font-weight: 600; }
.none { padding: 0.8rem; margin: 0; color: var(--muted); }

/* Small screens: the page list folds into a button above the article */

@media (max-width: 820px) {
  .reader-in {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding-top: 1.5rem;
  }
  .side { position: static; max-height: none; overflow: visible; }
  .pick {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.6rem;
    background: none;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
  }
  .pick::before { content: "Page: "; color: var(--muted); }
  .pages { display: none; padding-top: 0.75rem; }
  .pages.open { display: block; }
  .find { margin-bottom: 0.6rem; }
}
.q input::-webkit-search-cancel-button { display: none; }

/* Search button keyboard hint */
.find { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.find kbd { font-size: 0.75rem; color: var(--faint); background: var(--bg); }

/* Sidebar group label */
.pages .group {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--faint);
}

/* Breadcrumb above the page title */
.crumb { font-size: 0.88rem; color: var(--faint); margin: 0 0 0.75rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }
.crumb span { margin: 0 0.45rem; }

/* Tables: first column reads as a label */
.tbl td:first-child { font-weight: 500; }

/* Previous and next pages */
.pager { border-top: 0; padding-top: 0; }
.pager a {
  flex: 1;
  display: block;
  max-width: 50%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  text-decoration: none;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pager a:hover { border-color: var(--underline); background: var(--soft); }
.pager a span { display: block; font-size: 0.8rem; font-weight: 400; color: var(--faint); margin-bottom: 0.15rem; }

/* Docs home */
.docs-home .narrow { margin-bottom: 3rem; }
.docs-home .lead { margin-bottom: 1.75rem; }
.find.big {
  max-width: 520px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 10px;
  margin: 0;
}
.guides { margin-top: 0; gap: 3rem; align-items: start; }
.guides h2 { font-size: 1.3rem; margin: 0 0 1rem; }
.doclist { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.doclist li { margin: 0; border-bottom: 1px solid var(--line); }
.doclist a {
  display: block;
  padding: 0.85rem 0.75rem;
  margin: 0 -0.75rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.doclist a:hover { background: var(--soft); }
.doclist .t { display: block; font-weight: 500; }
.doclist .d { display: block; font-size: 0.9rem; color: var(--muted); margin-top: 0.1rem; }
.help-box { margin-top: 2rem; }
.help-box h3 { font-size: 1.05rem; }
.help-box p { margin-bottom: 0; }

/* Docs entry: pick a guide */
.entries { margin-top: 0; gap: 1.5rem; }
.entry {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}
.entry h2 { font-size: 1.4rem; margin: 0 0 0.6rem; }
.entry h2 a { text-decoration: none; }
.entry > p { color: var(--muted); }
.entry ul { list-style: none; padding: 0; margin: 0.25rem 0 0; border-top: 1px solid var(--line); }
.entry li { margin: 0; border-bottom: 1px solid var(--line); }
.entry li a { display: block; padding: 0.55rem 0; text-decoration: none; color: var(--muted); }
.entry li a:hover { color: var(--text); }
.entry .actions { margin-top: auto; padding-top: 1.5rem; }

/* Guide home: list of the guide's pages */
.guide-list { max-width: 680px; }

/* Sidebar guide label links to the guide home */
a.group { display: block; text-decoration: none; padding: 0; }
a.group:hover { color: var(--text); }

main.page .find.big { display: flex; width: 100%; max-width: 520px; }
.find.big kbd { font-size: 0.8rem; }
