/* The documentation page: a sticky contents column beside one long article.
   Everything takes its colours from site.css's tokens, so both themes hold. */

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  padding-bottom: 120px;
}

@media (min-width: 1100px) {
  .doc-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: clamp(48px, 5vw, 96px);
  }
}

/* ---------- contents ---------- */

.toc {
  font-size: 14.5px;
}

@media (min-width: 1100px) {
  .toc {
    position: sticky;
    top: 32px;
    align-self: start;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding-right: 8px;
  }
}

.toc-filter input {
  width: 100%;
  font: 400 14px/1 var(--body);
  color: var(--ink);
  background: var(--raise);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.toc-filter input::placeholder {
  color: var(--ink-3);
}

.toc-filter input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

@media (max-width: 1099px) {
  .toc ol {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  }
}

.toc a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.toc a:hover {
  color: var(--ink);
  background: var(--row-hover);
}

.toc a[aria-current="true"] {
  color: var(--ink);
  background: var(--raise);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* ---------- the article ---------- */

.doc {
  min-width: 0;
  max-width: 52rem;
}

.doc section {
  padding-top: 8px;
  margin-bottom: 72px;
}

.doc h2 {
  font: 500 clamp(30px, 3vw, 40px) / 1.05 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  scroll-margin-top: 24px;
}

.doc h3 {
  font: 600 18px/1.3 var(--body);
  margin: 40px 0 10px;
  scroll-margin-top: 24px;
}

.doc p,
.doc li,
.doc dd {
  color: var(--ink-2);
}

.doc p {
  margin: 0 0 16px;
  max-width: 46rem;
}

.doc strong {
  color: var(--ink);
  font-weight: 500;
}

.doc ul {
  padding-left: 20px;
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
  max-width: 46rem;
}

.doc a {
  text-decoration-color: var(--ink-3);
}

.doc pre {
  margin: 0 0 18px;
}

.doc pre .comment {
  color: var(--ink-3);
}

.anchor {
  margin-left: 10px;
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
}

.doc h2:hover .anchor,
.doc h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

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

.table-scroll {
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--raise);
}

.ref {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.ref th,
.ref td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}

.ref thead th {
  font: 400 12px/1.2 var(--mono);
  color: var(--ink-3);
  white-space: nowrap;
}

.ref tbody th {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.ref tbody tr:last-child > * {
  border-bottom: 0;
}

.ref td code {
  overflow-wrap: anywhere;
}

.ref.keys td:first-child,
.ref.keys td:first-child code {
  white-space: nowrap;
}

.ref.data .to {
  display: block;
  margin-top: 6px;
  color: var(--ink-3);
}

.ref.data .to code {
  white-space: nowrap;
}

.ref .group th {
  font: 500 12px/1.2 var(--mono);
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--wall);
  padding-block: 10px;
}

/* ---------- the architecture diagram ---------- */

.diagram {
  margin: 8px 0 28px;
}

.diagram-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--raise);
  padding: 18px;
}

.diagram svg {
  display: block;
  width: 100%;
  min-width: 700px;
  height: auto;
}

.diagram figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-3);
}

.d-bound {
  fill: none;
  stroke: var(--ink-3);
  stroke-opacity: 0.5;
  stroke-width: 1.5;
  stroke-dasharray: 6 7;
}

.d-box {
  fill: var(--wall);
  stroke: var(--rule);
  stroke-width: 1.5;
}

.d-box.strong {
  stroke: var(--ink-3);
}

.d-box.accent {
  stroke: var(--accent);
}

.d-label {
  font: 500 12px var(--mono);
  letter-spacing: 0.12em;
  fill: var(--ink-3);
}

.d-title {
  font: 600 17px var(--body);
  fill: var(--ink);
}

.d-sub {
  font: 400 13px var(--mono);
  fill: var(--ink-3);
}

.d-note {
  font: 400 12px var(--mono);
  fill: var(--ink-2);
}

.d-note.accent {
  fill: var(--accent);
}

.d-line {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.8;
}

.d-line.accent {
  stroke: var(--accent);
  stroke-width: 2.2;
}

.d-head {
  fill: var(--ink-3);
}

.d-head-accent {
  fill: var(--accent);
}

/* ---------- one refresh, in order ---------- */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 0;
  max-width: 46rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 20px 48px;
  color: var(--ink-2);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 500 13px/1 var(--mono);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--rule);
  background: var(--raise);
}

.steps li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}

.steps li:last-child {
  padding-bottom: 0;
}

.steps li:last-child::after {
  display: none;
}

/* ---------- measurements ---------- */

.machine {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 22px;
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--raise);
  font-size: 14.5px;
  max-width: 40rem;
}

.machine dt {
  font: 400 12px/1.9 var(--mono);
  color: var(--ink-3);
}

.machine dd {
  margin: 0;
  color: var(--ink);
}

.meters {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  max-width: 46rem;
}

.meter {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr) 5.5rem;
  gap: 16px;
  align-items: center;
  font-size: 14px;
}

.meter-name {
  color: var(--ink-2);
}

.meter-track {
  height: 10px;
  border-radius: 5px;
  background: var(--raise);
  box-shadow: inset 0 0 0 1px var(--rule);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: calc(var(--x) * 1%);
  min-width: 0;
  border-radius: 5px;
  background: var(--ink-2);
}

.meter-fill.accent {
  background: var(--accent);
}

.meter-value {
  font: 500 13px/1 var(--mono);
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 620px) {
  .meter {
    grid-template-columns: minmax(0, 1fr) 5rem;
  }

  .meter-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.fact-tile {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--raise);
}

.fact-value {
  font: 500 30px/1 var(--display);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.fact-label {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* ---------- security, definitions, providers ---------- */

.checks {
  list-style: none;
  padding: 0 !important;
  gap: 14px !important;
}

.checks li {
  position: relative;
  padding-left: 34px;
}

.checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
}

.checks li::after {
  content: "";
  position: absolute;
  left: 7.5px;
  top: 7px;
  width: 4px;
  height: 8px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  rotate: 45deg;
}

.defs {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 24px;
  margin: 0 0 18px;
  max-width: 46rem;
}

.defs dt {
  font: 500 14px/1.6 var(--mono);
  color: var(--ink);
}

.defs dd {
  margin: 0;
}

@media (max-width: 620px) {
  .defs {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .defs dd {
    margin-bottom: 12px;
  }
}

.faq dt {
  font-weight: 500;
  color: var(--ink);
  margin-top: 18px;
}

.faq dd {
  margin: 4px 0 0;
}

.provider-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 14px;
}

.pcard {
  padding: 20px 22px 6px;
  border: 1px solid var(--rule);
  border-top: 2px solid var(--aura, var(--ink-3));
  border-radius: 16px;
  background: var(--raise);
}

.pcard h3 {
  margin: 0 0 12px;
  font: 500 20px/1.2 var(--display);
}

.pcard p {
  font-size: 14.5px;
}
