/* Docs reading layout.
   Loaded after each page's inline styles so it can correct them in one place.
   The pages were dense: long measure, tight paragraph spacing, and headings
   that sat as close to the paragraph above as to the one they introduce, so
   nothing signalled where a topic started. */

/* ---- measure and rhythm ---- */
main { font-size: 17px; line-height: 1.75; }
main p, main ul, main ol, main table, main .fig, main .note { max-width: 68ch; }
main p { margin: 0 0 1.15rem; }

/* ---- the page title ---- */
main .crumb { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sage); margin: 0 0 1.1rem; }
main .crumb a { color: var(--sage); }
main .crumb a:hover { color: var(--green); text-decoration: none; }
main > h2:first-of-type:not(.grp) { font-size: clamp(2rem, 3.6vw, 2.6rem); line-height: 1.1; margin: 0 0 1.4rem; }

/* ---- section headings get room to breathe ---- */
main h3 {
  font-family: var(--sans); font-size: 1.18rem; font-weight: 700; color: var(--ink);
  margin: 3.2rem 0 .9rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
  max-width: 68ch; letter-spacing: -.005em;
}
main h3:first-of-type { margin-top: 2.6rem; }
main h4 { font-family: var(--sans); font-size: 1rem; font-weight: 700; color: var(--ink); margin: 2rem 0 .6rem; }

/* ---- lists ---- */
main ul, main ol { margin: 0 0 1.3rem; padding-left: 1.35rem; }
main li { margin-bottom: .6rem; padding-left: .15rem; }
main li:last-child { margin-bottom: 0; }
main li::marker { color: var(--green); }

/* Bold is used heavily for key terms; at 700 every paragraph looked speckled. */
main strong { font-weight: 650; color: var(--ink); }

/* ---- figures, notes, tables ---- */
main .fig { margin: 1.8rem 0 2rem; border-radius: 14px; }
main .note { margin: 1.6rem 0; padding: 1rem 1.15rem; line-height: 1.65; }
/* Article tables were plain <table>: no widths, so a two-word first column
   wrapped while the second ran long. */
main > table, main table.t { width: 100%; max-width: 68ch; border-collapse: collapse; margin: 1.6rem 0 2rem; font-size: .97rem; }
main > table th, main > table td, main table.t th, main table.t td {
  text-align: left; vertical-align: top; padding: .7rem .8rem; border-bottom: 1px solid var(--line); }
main > table th, main table.t th { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--green); font-weight: 700; border-bottom: 2px solid var(--line); }
main > table td:first-child, main table.t td:first-child { width: 32%; color: var(--ink); font-weight: 600; }
main > table tr:last-child td { border-bottom: 0; }
main .fig table { margin-bottom: 1rem; }

/* ---- sidebar ---- */
.side a { padding: .38rem .6rem; line-height: 1.4; margin-bottom: 1px; }
.side h4 { margin: 1.6rem 0 .55rem; }

/* ---- the hub ---- */
main > .lede { font-size: 1.15rem; line-height: 1.7; margin-bottom: 3rem; max-width: 60ch; }
h2.grp { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--sage); margin: 3rem 0 1rem; border: 0; padding: 0; }
h2.grp:first-of-type { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; max-width: none; }
.cards .card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.15rem 1.2rem; text-decoration: none; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.cards .card:hover { text-decoration: none; border-color: var(--green); transform: translateY(-2px);
  box-shadow: 0 12px 30px -20px rgba(16,58,37,.5); }
.cards .card strong { display: block; font-size: 1.02rem; font-weight: 700; color: var(--ink); margin-bottom: .35rem; }
.cards .card span { display: block; font-size: .93rem; line-height: 1.55; color: var(--sage); }

/* ---- article spacing on small screens ---- */
@media (max-width: 900px) {
  main { padding-top: 1.4rem; }
  main h3 { margin-top: 2.4rem; padding-top: 1.3rem; }
}

/* The docs nav sets a link colour on every anchor inside it, which outranks
   .btn and left the green CTA with dark text and no icon. */
.nav-right a.btn { color: #fff; }
.nav-right a.btn:hover { color: #fff; }
.nav-right a.btn svg { width: 18px; height: 18px; flex: none; }

/* On a phone the sidebar ran 13 links deep before the article began. Collapse
   it into a summary line there; it stays a normal sidebar on a wide screen. */
@media (max-width: 900px) {
  .side { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0; }
  .side::before { content: "All docs"; display: block; padding: .85rem 1rem; font-weight: 650; color: var(--ink); cursor: pointer; }
  .side::after { content: "\203A"; position: absolute; right: 1.1rem; margin-top: -2.35rem; color: var(--sage); font-size: 1.2rem; transform: rotate(90deg); }
  .side { position: relative; max-height: 3.2rem; overflow: hidden; transition: max-height .35s ease; }
  .side.open { max-height: 40rem; overflow: auto; padding-bottom: .8rem; }
  .side.open::after { transform: rotate(-90deg); }
  .side .find, .side h4, .side a { margin-left: 1rem; margin-right: 1rem; }
  .side .find { width: calc(100% - 2rem); }
}

/* Mobile: the shell's desktop top padding left a dead band above the article. */
@media (max-width: 900px) {
  .shell { padding-top: 1rem; }
  main { padding-top: 1.1rem; }
  main > h2:first-of-type:not(.grp) { font-size: 1.9rem; }
}

/* ---- on this page ---- */
.onpage { margin: 0 0 2.4rem; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; max-width: 68ch; }
.onpage p { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sage); margin: 0 0 .55rem; }
.onpage ul { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 1.6rem; }
.onpage li { margin: 0 0 .35rem; break-inside: avoid; }
.onpage a { font-size: .95rem; color: var(--ink-soft); }
.onpage a:hover { color: var(--green); }
@media (max-width: 620px) { .onpage ul { columns: 1; } }

/* ---- reading comfort ---- */
main p, main li { text-wrap: pretty; }
main h2, main h3 { text-wrap: balance; }
main p { max-width: 66ch; }
main h3 { scroll-margin-top: 88px; }

/* ---- screenshots ---- */
/* A screenshot sits beside the paragraph it illustrates, and drops under it on
   a narrow screen, rather than being dumped in a gallery away from the text. */
.shot-side { float: right; width: 210px; margin: .2rem 0 1.2rem 1.6rem; }
.shot-side + .shot-side { clear: right; }
.shot-side img { width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; box-shadow: 0 14px 34px -22px rgba(16,58,37,.55); }
.shot-side figcaption { margin-top: .45rem; font-size: .82rem; color: var(--sage); text-align: center; }
main h3 { clear: both; }
@media (max-width: 760px) { .shot-side { float: none; width: 60%; margin: 1.2rem auto 1.6rem; } }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.1rem;
  margin: 1.6rem 0 2.2rem; max-width: none; padding: 0; }
.shot { margin: 0; }
.shot img { width: 100%; height: auto; border-radius: 18px; border: 1px solid var(--line);
  background: #fff; box-shadow: 0 14px 34px -22px rgba(16,58,37,.55); }
.shot figcaption { margin-top: .5rem; font-size: .85rem; color: var(--sage); text-align: center; }
@media (max-width: 720px) { .shots { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; } }

/* ---- cropped screenshots ---- */
/* A crop of the exact control the paragraph is describing, not the whole
   screen: the reader should not have to hunt the phone for the thing. */
figure.crop { margin: 1.4rem 0 1.8rem; max-width: 68ch; }
figure.crop img { width: 100%; height: auto; display: block; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; box-shadow: 0 10px 26px -20px rgba(16,58,37,.5); }
figure.crop figcaption { margin-top: .5rem; font-size: .88rem; color: var(--sage); }
