/* Documentation page.
   Layers on app.css rather than restating it: the tokens, the chamfer, the
   type scale and the aura all come from there, so the docs cannot drift away
   from the app the way a second stylesheet always eventually does. What is
   here is only the things a reading page needs and an app page does not --
   a contents rail, prose measure, and a header that is not the app sidebar. */

.docs { background: var(--color-bg); }

/* ── header ── */
.dochead {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; padding: 1.6rem 4rem;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
}
.dochead .brand { display: flex; align-items: center; text-decoration: none; color: #fff; }
.dochead .brand svg { height: 2.4rem; width: auto; }
.docnav { display: flex; align-items: center; gap: 2rem; }
.docnav a { color: var(--muted); text-decoration: none; font-size: 1.3rem; }
.docnav a:hover { color: #fff; }
.docnav .btn { color: #fff; }
.btn.-sm { height: 3.4rem; min-width: 0; padding: 0 1.6rem; font-size: 1.2rem; }

/* ── shell ── */
.docwrap {
  display: grid; grid-template-columns: 26rem minmax(0, 1fr);
  gap: 4rem; max-width: 128rem; margin: 0 auto; padding: 0 4rem 10rem;
  position: relative; z-index: 1;
}

/* ── contents rail ──
   Sticky rather than fixed: it scrolls with the page until it reaches the top
   and then holds, which keeps it from colliding with the header on short
   viewports. */
.doctoc { position: sticky; top: 9rem; align-self: start; padding-top: 4.4rem; }
.doctoc nav { display: flex; flex-direction: column; gap: .1rem; }
.doctoc a {
  padding: .8rem 1.2rem; text-decoration: none; color: var(--muted);
  font-size: 1.25rem; border-left: 2px solid transparent;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.doctoc a:hover { color: #fff; border-left-color: var(--color-primary); }

/* ── prose ──
   A measure, because documentation is read rather than scanned and a full-width
   line of monospace is punishing. */
.docmain { min-width: 0; }
.docsec { margin-bottom: 5.6rem; scroll-margin-top: 9rem; }
.docsec h2 {
  font-size: 3rem; letter-spacing: -.02em; margin-bottom: 2rem;
  padding-bottom: 1.6rem; border-bottom: 1px solid var(--line-soft);
}
.docsec h3 {
  font-size: 1.9rem; letter-spacing: -.01em; color: #fff;
  margin: 3.2rem 0 1.2rem;
}
.docsec p {
  color: var(--muted); font-size: 1.4rem; line-height: 178%;
  max-width: 76rem; margin: 0 0 1.6rem;
}
.docsec p b, .docsec li b { color: var(--bright); font-weight: 700; }

.bul { list-style: none; margin: 0 0 1.6rem; padding: 0; max-width: 76rem; }
.bul li {
  position: relative; padding-left: 2.4rem; margin-bottom: 1.2rem;
  color: var(--muted); font-size: 1.35rem; line-height: 175%;
}
.bul li::before {
  content: ""; position: absolute; left: 0; top: 1rem;
  width: .8rem; height: .8rem; background: var(--color-primary);
}

/* ── definition list ──
   Two columns where there is room, because a term and its meaning read as a
   pair; stacked where there is not. */
.deflist { display: grid; gap: 1.2rem; margin: 0 0 1.6rem; max-width: 92rem; }
.deflist > div {
  display: grid; grid-template-columns: 20rem minmax(0, 1fr); gap: 2rem;
  background: var(--card-hi); padding: 1.8rem 2rem;
  clip-path: var(--cut);
}
.deflist dt {
  color: #fff; font-family: var(--font-secondary); font-size: 1.45rem;
  letter-spacing: -.01em;
}
.deflist dd {
  margin: 0; color: var(--muted); font-size: 1.3rem; line-height: 172%;
}

.docsec .ladder { max-width: 84rem; }
.docsec .notice { max-width: 84rem; }

/* ── footer ── */
.docfoot {
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  max-width: 128rem; margin: 0 auto; padding: 3.2rem 4rem 6rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-3); font-size: 1.2rem;
  position: relative; z-index: 1;
}

@media (max-width: 1000px) {
  .docwrap { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 2rem 8rem; }
  /* The rail becomes a strip above the content: sticky columns do not work
     once there is no column beside the text. */
  .doctoc {
    position: static; padding-top: 3.2rem; margin-bottom: 2.4rem;
  }
  .doctoc nav { flex-direction: row; flex-wrap: wrap; gap: .4rem; }
  .doctoc a {
    border-left: 0; background: var(--card-hi); padding: .7rem 1.2rem;
    clip-path: var(--cut);
  }
  .dochead { padding: 1.4rem 2rem; }
  .docfoot { padding: 3.2rem 2rem 5rem; }
  .deflist > div { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
}

/* ── grouped contents ──
   The rail carries three parts now, so it needs headings of its own; a flat
   list of eighteen links is a wall rather than a map. */
.tocpart {
  margin: 2rem 0 .6rem; padding-left: 1.2rem;
  font-size: 1rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted-3);
}
.tocpart:first-child { margin-top: 0; }

/* ── tables ──
   Wrapped so a wide one scrolls inside its own box. A table that widens the
   page is how a documentation page ends up with horizontal scroll on a phone
   and nobody notices until somebody reads it on a phone. */
.tablewrap { overflow-x: auto; margin: 0 0 1.6rem; max-width: 92rem; }
.doctable {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 1.25rem; min-width: 42rem;
}
.doctable th {
  text-align: left; padding: 1.2rem 1.6rem;
  font-size: 1rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 400;
  border-bottom: 1px solid var(--line);
}
.doctable td {
  padding: 1.4rem 1.6rem; color: var(--muted); line-height: 168%;
  border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
.doctable tbody tr:last-child td { border-bottom: 0; }
.doctable td b { color: var(--bright); }
/* the first column is the label, so it reads as one */
.doctable td:first-child { color: var(--bright); white-space: nowrap; }

/* ── a formula ── */
.formula {
  margin: 0 0 1.6rem; padding: 1.8rem 2rem; max-width: 84rem;
  background: var(--card-hi); clip-path: var(--cut);
  font-family: var(--font-primary); font-size: 1.3rem; color: var(--bright);
  white-space: pre-wrap; line-height: 170%;
}

/* ── FAQ ──
   Collapsed by default: seven answers open at once is a wall, and a question
   somebody does not have is noise between them and the one they do. */
.faq { max-width: 84rem; }
.faq details {
  background: var(--card-hi); clip-path: var(--cut);
  margin-bottom: .8rem; padding: 0 2rem;
}
.faq summary {
  cursor: pointer; list-style: none; padding: 1.6rem 0;
  color: #fff; font-size: 1.4rem; font-family: var(--font-secondary);
  letter-spacing: -.01em; display: flex; align-items: center; gap: 1.2rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+"; color: var(--color-primary); font-family: var(--font-primary);
  font-size: 1.6rem; line-height: 1; flex-shrink: 0;
}
.faq details[open] summary::before { content: "\2212"; }
.faq details > div {
  padding: 0 0 1.8rem 2.8rem; color: var(--muted);
  font-size: 1.3rem; line-height: 178%;
}

/* inline code inside prose */
.docsec code {
  font-family: var(--font-primary); font-size: .92em;
  background: var(--card-hi); padding: .15em .5em; color: var(--bright);
}

@media (max-width: 1000px) {
  .tocpart { width: 100%; margin: 1.6rem 0 .4rem; padding-left: 0; }
  .doctable { min-width: 34rem; }
}
