/*
  PONDELTA /docs - the manual.

  A different shell from the terminal pages: nav on the left, one reading column
  in the middle, a table of contents on the right. The page renders into the
  same #view as /pools, so EVERY rule here is scoped under .docs-shell. An
  unscoped `h2` or `code` rule in this file would reach the app surfaces.

  The terminal is dense on purpose; this is not. The reading column is capped in
  `ch` rather than pixels so the measure follows the type at any viewport, and
  the vertical rhythm is roughly double what a table row gets.

  No raw colours: every value is a token from tokens.css, so the page flips with
  the theme like everything else.
*/

/* ----------------------------------------------------------------- shell */

.docs-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 188px;
  gap: 0 48px;
  align-items: start;
}

.docs-shell .sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
  padding: 30px 0 48px;
}

.docs-shell .content {
  min-width: 0;
  max-width: 68ch;
  padding: 26px 0 140px;
  font-size: 15.5px;
  line-height: 1.78;
  color: var(--ink-2);
}

.docs-shell .toc {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
  padding: 32px 0 48px;
}

/* ------------------------------------------------------------------- nav */

.docs-shell .navgroup {
  margin-bottom: 26px;
}
.docs-shell .navgroup:last-child {
  margin-bottom: 0;
}
.docs-shell .glabel {
  font-family: var(--f-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
  padding: 0 10px;
}
.docs-shell .navgroup ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.docs-shell .navlink {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink-2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.docs-shell .navlink:hover {
  color: var(--ink-bright);
  background: var(--raised);
  text-decoration: none;
}
.docs-shell .navlink.active {
  color: var(--lime);
  background: var(--lime-tint);
  font-weight: 600;
}

/* ------------------------------------------------------------------- toc */

.docs-shell .toc .tk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.docs-shell .toc ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-left: 1px solid var(--line);
}
.docs-shell .toc a {
  display: block;
  padding: 1px 0 1px 13px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-3);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.docs-shell .toc a:hover {
  color: var(--ink);
  text-decoration: none;
}
.docs-shell .toc a.active {
  color: var(--lime);
  border-left-color: var(--lime);
}

/* -------------------------------------------------------------- headings */

.docs-head {
  margin-bottom: 60px;
}
.docs-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.docs-eyebrow .brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-bright);
}
.docs-eyebrow .brand-word {
  font-weight: 700;
  letter-spacing: 0.3em;
}
.docs-title {
  font-family: var(--f-display);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.022em;
  color: var(--ink-bright);
  text-wrap: balance;
  margin-bottom: 16px;
}
.docs-lede {
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 56ch;
}

/* Sections are far enough apart that the eye never has to ask which heading a
   paragraph belongs to. scroll-margin keeps the sticky topbar off the heading
   after a jump from the nav or the contents. */
.docs-section {
  padding-top: 12px;
  margin-top: 68px;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.docs-section:first-of-type {
  margin-top: 0;
}

.docs-section h2 {
  font-family: var(--f-display);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.018em;
  color: var(--ink-bright);
  margin-bottom: 18px;
}
.docs-section h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--ink-bright);
  text-transform: none;
  margin: 42px 0 12px;
}

.docs-section p {
  margin-bottom: 16px;
}
.docs-section p:last-child {
  margin-bottom: 0;
}
.docs-section b {
  color: var(--ink-bright);
  font-weight: 600;
}
.docs-section i {
  color: var(--ink);
  font-style: italic;
}

.docs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.docs-list li {
  position: relative;
  padding-left: 18px;
}
.docs-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--lime);
}

.docs-shell code {
  font-family: var(--f-mono);
  font-size: 0.86em;
  color: var(--lime);
  background: var(--lime-tint);
  border: 1px solid var(--lime-dim);
  border-radius: 5px;
  padding: 1px 5px;
  white-space: nowrap;
}

.docs-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 24px 0 0;
  padding: 13px 15px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-left: 2px solid var(--lime);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink-2);
}
.docs-note svg {
  flex: 0 0 auto;
  margin-top: 3px;
  color: var(--lime);
}

/* A read that failed, or a mismatch between this page and the code it
   documents. Loud on purpose: silence would read as "nothing to see". */
.docs-fail {
  color: var(--neg);
  font-size: 13px;
  line-height: 1.55;
}

/* ---------------------------------------------------------------- shapes */

.shape-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 26px 0 18px;
}
.shape-card {
  background-color: var(--panel);
  background-image: var(--card-wash);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
}
.shape-card h3 {
  margin: 0 0 6px;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--lime);
}
.shape-blurb {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0 0 16px;
  max-width: 54ch;
}

/* Capped rather than full-bleed: the figure's viewBox is 260 units wide, so a
   full column stretches a 74 unit tall diagram to nearly 180px and the bars
   stop reading as a profile. */
.shape-fig {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  overflow: visible;
}
.sf-floor {
  stroke: var(--line-2);
  stroke-width: 1;
}
/* Bins below the current price are funded and solid; bins above it are the same
   ladder seen from the other side, so they read as the same colour at lower
   weight rather than as a second, unrelated series. */
.sf-bar {
  fill: var(--lime);
}
.sf-below {
  opacity: 0.9;
}
.sf-above {
  opacity: 0.38;
}
.sf-both {
  fill: none;
  stroke: var(--lime);
  stroke-width: 1;
}
.sf-now {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.shape-stat {
  margin: 10px 0 0;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.shape-stat .sep {
  padding: 0 5px;
  color: var(--line-3);
}

.shape-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.shape-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.shape-legend .sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--lime);
  flex: 0 0 auto;
}
/* Each swatch mirrors its bar in the figures above, so the three rules here
   track .sf-below / .sf-above / .sf-both exactly. */
.shape-legend .sw-below {
  opacity: 0.9;
}
.shape-legend .sw-above {
  opacity: 0.38;
}
.shape-legend .sw-both {
  background: none;
  border: 1px solid var(--lime);
}

/* ---------------------------------------------------------------- tables */

.docs-shell .table-wrap {
  overflow-x: auto;
  margin: 8px 0 20px;
}
.docs-shell table.ref {
  width: 100%;
  border-collapse: collapse;
  min-width: 380px;
}
.docs-shell table.ref th {
  text-align: left;
  font-family: var(--f-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 16px 9px 0;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.docs-shell table.ref td {
  padding: 13px 16px 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  vertical-align: top;
}
.docs-shell table.ref tr:last-child td {
  border-bottom: none;
}
.docs-shell table.ref td:last-child {
  padding-right: 0;
}
.docs-shell table.ref td.mono {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
}
.docs-shell table.ref td.num {
  font-family: var(--f-mono);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--lime);
  white-space: nowrap;
}
.docs-shell table.ref td.name {
  color: var(--ink-bright);
  font-weight: 600;
}
.docs-shell table.ref td.name .role {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-3);
  max-width: 44ch;
}

/* ------------------------------------------------------------- addresses */

.addr-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* The label is abbreviated by design; the button carries the full address in a
   data attribute, so a copy is never a truncated one. */
.addr-copy {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.addr-copy:hover {
  color: var(--lime);
}
.addr-copy::after {
  content: '';
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--lime);
}
.addr-copy.copied::after {
  content: '  copied';
}
.addr-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.addr-icon:hover {
  color: var(--lime);
  border-color: var(--lime);
  text-decoration: none;
}
.addr-none {
  color: var(--ink-dim);
  font-family: var(--f-mono);
  font-size: 12px;
}

/* --------------------------------------------------------- network facts */

.docs-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  margin: 20px 0 26px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.docs-facts > div {
  background: var(--panel);
  padding: 12px 14px;
}
.docs-facts dt {
  font-family: var(--f-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.docs-facts dd {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink-bright);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------- faq */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}
details.faq {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
details.faq summary {
  position: relative;
  cursor: pointer;
  list-style: none;
  padding: 14px 44px 14px 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink-bright);
}
details.faq summary::-webkit-details-marker {
  display: none;
}
details.faq summary::after {
  content: '+';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 15px;
  color: var(--lime);
}
/* U+2212 MINUS SIGN, not a hyphen: at this size a hyphen reads as a stray dot
   next to the plus it replaces. */
details.faq[open] summary::after {
  content: '\2212';
}
details.faq p {
  margin: 0;
  padding: 0 16px 16px;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--ink-2);
}

/* ------------------------------------------------------------ responsive */

/* The contents column is the first thing to go: it duplicates the nav, so
   losing it costs nothing but width. */
@media (max-width: 1180px) {
  .docs-shell {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 0 40px;
  }
  .docs-shell .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  /* The nav becomes a scrolling strip above the article. It stops being sticky
     because a sticky strip plus a sticky topbar eats a third of a phone. */
  .docs-shell .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 16px 0 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
  }
  .docs-shell .navgroup {
    margin-bottom: 0;
  }
  .docs-shell .glabel {
    display: none;
  }
  .docs-shell .navgroup ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .docs-shell .navlink {
    border: 1px solid var(--line-2);
    border-radius: var(--r-full);
    padding: 5px 12px;
    font-size: 12.5px;
  }
  .docs-shell .content {
    padding-top: 22px;
    font-size: 15px;
  }
  .docs-section {
    margin-top: 52px;
  }
}

/* The last paragraph of the docs column ended flush against the bottom tab bar
   on mobile - a two pixel overlap, but a reader scrolled to the end sees text
   touching a solid bar. A closing gap of its own, so this does not depend on
   the shell's padding staying exactly where it is. */
.docs-shell .content > :last-child {
  margin-bottom: 2rem;
}
