@layer components {
  /* The guide at /docs: a list of pages, then each page beside that list. */
  .doc-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr)); gap: 1.2rem; margin: 2.4rem 0 0; padding: 0; list-style: none; }
  .doc-card { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1.2rem; height: 100%; padding: 1.8rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink-2); text-decoration: none; }
  .doc-card:hover { border-color: var(--line-strong); }
  .doc-card-step { grid-row: span 2; font-family: var(--mono); font-size: 1.3rem; color: var(--ink-3); }
  .doc-card strong { color: var(--ink); font-size: 1.6rem; font-weight: 600; }
  .doc-card span:last-child { grid-column: 2; font-size: 1.4rem; }

  .doc-layout { display: grid; grid-template-columns: 24rem minmax(0, 76rem); gap: 4.8rem; margin-top: 2.4rem; }
  .doc-nav { position: sticky; top: 2.4rem; align-self: start; font-size: 1.4rem; }
  .doc-nav ol { margin: 1.2rem 0 0; padding: 0; list-style: none; }
  .doc-nav-home { font-weight: 600; color: var(--ink); text-decoration: none; }
  .doc-nav-link { display: block; padding: .6rem 1.2rem; border-left: 2px solid var(--line); color: var(--ink-2); text-decoration: none; }
  .doc-nav-link:hover { color: var(--ink); }
  .doc-nav-link[aria-current="page"] { border-left-color: var(--focus); color: var(--ink); font-weight: 600; }

  .doc-title { margin: 0 0 .8rem; font-size: 3.6rem; font-weight: 300; line-height: 1.15; }
  .doc-body { font-size: 1.6rem; line-height: 1.65; color: var(--ink); }
  .doc-body > * + * { margin-top: 1.6rem; }
  .doc-body h2 { margin-top: 4rem; font-size: 2.2rem; font-weight: 600; line-height: 1.25; }
  .doc-body h3 { margin-top: 2.8rem; font-size: 1.7rem; font-weight: 600; }
  .doc-body :is(h2, h3) .anchor { margin-left: .6rem; color: var(--ink-3); text-decoration: none; opacity: 0; }
  .doc-body :is(h2, h3) .anchor::after { content: "#"; }
  .doc-body :is(h2, h3):hover .anchor, .doc-body .anchor:focus-visible { opacity: 1; }
  .doc-body :is(ul, ol) { padding-left: 2.4rem; }
  .doc-body li + li { margin-top: .6rem; }
  .doc-body a { color: var(--focus); }
  .doc-body pre { overflow-x: auto; padding: 1.4rem 1.6rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--code-bg); color: var(--code-ink); font-size: 1.35rem; line-height: 1.55; }
  .doc-body pre code { padding: 0; border: 0; background: none; font-size: inherit; }
  .doc-body blockquote { margin-left: 0; padding: 1.2rem 1.6rem; border-left: 3px solid var(--focus); background: var(--surface); color: var(--ink-2); }
  .doc-body table { width: 100%; border-collapse: collapse; font-size: 1.45rem; }
  .doc-body :is(th, td) { padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
  .doc-body th { font-weight: 600; color: var(--ink-2); }

  /* Illustrations are drawn from the editor's own parts, so they follow the product and the theme. */
  .doc-illustration { margin: 3.2rem 0; padding: 2.8rem 2rem 2.4rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--canvas, var(--surface-2)); overflow-x: auto; }
  .doc-illustration figcaption { margin-top: 2rem; font-size: 1.35rem; line-height: 1.5; color: var(--ink-3); text-align: center; }
  .doc-journey { min-width: 66rem; gap: 2rem 2.8rem; padding: 0; font-size: 1.25rem; line-height: 1.4; --dx: 0px; --dy: 0px; --r: 0deg; }
  .doc-journey .is-col-1 { --col: 1; } .doc-journey .is-col-2 { --col: 2; } .doc-journey .is-col-3 { --col: 3; } .doc-journey .is-col-4 { --col: 4; }
  .doc-journey .is-row-1 { --row: 1; } .doc-journey .is-row-2 { --row: 2; }
  .doc-journey .node[data-wire="enter_pin"] { margin-top: 0; }
  .doc-journey { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); }
  .doc-journey :is(ul, ol) { padding-left: 0; }
  .doc-journey li + li { margin-top: 0; }
  .doc-journey .port .port-label { overflow: visible; white-space: normal; text-overflow: clip; }

  .doc-illustration p { margin: 0; }
  .doc-phone { display: grid; grid-template-columns: 24rem minmax(0, 1fr); gap: 3.6rem; align-items: center; }
  /* The handset keeps its own proportions and is scaled as a whole, so nothing inside it is squashed. */
  .doc-phone-device { zoom: .8; }
  .doc-phone-device .device-screen { height: 58rem; }
  .doc-phone-entry { display: block; text-align: left; }
  .doc-phone .ussd-button { text-align: center; }
  .doc-notes { display: grid; gap: 1.6rem; margin: 0; padding: 0; list-style: none; counter-reset: note; font-size: 1.45rem; line-height: 1.5; color: var(--ink-2); }
  .doc-notes li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: 1rem; counter-increment: note; }
  .doc-notes li::before { content: counter(note); display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); font-size: 1.2rem; font-weight: 650; color: var(--ink); }
  .doc-notes li + li { margin-top: 0; }
  .doc-notes strong { display: block; color: var(--ink); }
  .doc-steps .deploy-focus { text-align: left; }
  .doc-steps li + li { margin-top: 0; }
  .doc-names { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr); gap: 2rem; align-items: start; font-size: 1.4rem; }
  .doc-names-side { display: grid; gap: .8rem; }
  .doc-names-field { min-height: 7rem; font-family: var(--mono); line-height: 1.5; }
  .doc-names .list-available { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
  .doc-names-arrow { align-self: center; color: var(--ink-3); }
  .doc-names-arrow .icon { width: 2.4rem; height: 2.4rem; }
  .doc-answers { display: grid; gap: 1.2rem; font-size: 1.4rem; }
  .doc-answers :is(ul, ol) { margin: 0; padding-left: 0; }
  .doc-answers .call-json { max-width: 32rem; }
  @media (max-width: 860px) {
    .doc-phone, .doc-names { grid-template-columns: minmax(0, 1fr); }
    .doc-names-arrow { justify-self: center; transform: rotate(90deg); }
  }

  /* Rouge's token classes, in the YAML editor's colours. */
  .highlight :is(.na, .nt, .nl, .py) { color: var(--tok-key); }
  .highlight :is(.s, .s1, .s2, .sb, .sh) { color: var(--tok-str); }
  .highlight :is(.m, .mi, .mf, .kc, .no) { color: var(--tok-num); }
  .highlight :is(.p, .pi, .o) { color: var(--tok-punct); }
  .highlight :is(.c, .c1, .cm) { color: var(--ink-3); font-style: italic; }
  .highlight :is(.k, .kd, .nb) { color: var(--tok-expr); }

  .doc-turn { display: flex; justify-content: space-between; gap: 1.2rem; margin-top: 5.6rem; padding-top: 2.4rem; border-top: 1px solid var(--line); }
  .doc-turn-link { display: grid; gap: .2rem; color: var(--ink); text-decoration: none; }
  .doc-turn-link span { font-size: 1.3rem; color: var(--ink-3); }
  .doc-turn-link.is-next { margin-left: auto; text-align: right; }
  .doc-turn-link:hover strong { text-decoration: underline; }

  /* Drawings for the writing: a round trip, a dropped session, and the two kinds of retry. */
  .ill-trip { display: grid; gap: 1.6rem; justify-items: center; }
  .trip-chain { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: .8rem; margin: 0; padding: 0; list-style: none; }
  .trip-stop { display: grid; align-content: center; justify-items: center; gap: .6rem; width: 11rem; padding: 1.2rem .8rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); text-align: center; }
  .trip-stop.is-flow { border-color: var(--focus); }
  .trip-icon { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--surface-2); }
  .trip-name { margin: 0; font-size: 1.3rem; line-height: 1.3; }
  .trip-hop { align-self: center; width: 2.4rem; height: 1px; background: var(--line-strong); }
  .trip-budget { display: flex; align-items: center; gap: .6rem; margin: 0; color: var(--ink-3); font-size: 1.35rem; }

  .ill-dropped { display: grid; gap: 2rem; }
  .dropped-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.2rem; margin: 0; padding: 0; list-style: none; }
  .dropped-moment { padding-top: 1.2rem; border-top: 2px solid var(--line); }
  .dropped-moment.is-slow { border-top-color: var(--warn, var(--line-strong)); }
  .dropped-moment.is-gone { border-top-color: var(--error, var(--ink)); }
  .dropped-mark { display: block; width: .8rem; height: .8rem; margin-bottom: .8rem; border-radius: 50%; background: var(--line-strong); }
  .dropped-moment.is-gone .dropped-mark { background: var(--error, var(--ink)); }
  .dropped-when { margin: 0; font-family: var(--mono); font-size: 1.25rem; color: var(--ink-3); }
  .dropped-what { margin: .4rem 0 0; font-size: 1.35rem; line-height: 1.45; }
  .dropped-after { padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
  .dropped-redial { margin: 0 0 1.2rem; font-size: 1.4rem; font-weight: 600; }
  .dropped-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 1.2rem; margin: 0; }
  .dropped-keys dt { color: var(--ink-3); font-size: 1.2rem; text-transform: uppercase; letter-spacing: .04em; }
  .dropped-keys dd { margin: .3rem 0 0; font-size: 1.35rem; }
  .dropped-keys .is-was { text-decoration: line-through; color: var(--ink-3); }

  .ill-retries { display: grid; grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr)); gap: 1.6rem; }
  .retry-case { padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
  .retry-kind { margin: 0; font-size: 1.45rem; font-weight: 600; }
  .retry-what { margin: .4rem 0 1.2rem; color: var(--ink-2); font-size: 1.35rem; }
  .retry-arrives { margin: 0 0 1.2rem; font-size: 1.3rem; }
  .retry-answer { display: flex; gap: .6rem; margin: 0; font-size: 1.35rem; line-height: 1.45; }
  .retry-tick { color: var(--focus); flex: none; }

  /* Writing at /writing: the guide's prose, dated and listed newest first. */
  .writing-list { max-width: 76rem; margin: 3.2rem 0 0; padding: 0; list-style: none; }
  .writing-list li + li { margin-top: 3.2rem; padding-top: 3.2rem; border-top: 1px solid var(--line); }
  .writing-when { margin: 0; color: var(--ink-3); font-family: var(--mono); font-size: 1.3rem; }
  .writing-title { margin: .4rem 0 .6rem; font-size: 2.2rem; font-weight: 600; line-height: 1.25; }
  .writing-title a { color: var(--ink); text-decoration: none; }
  .writing-title a:hover { text-decoration: underline; }
  .writing-end { margin-top: 4.8rem; padding-top: 2.4rem; border-top: 1px solid var(--line); }

  /* On the public site there is no .wrap to hold the guide, so it takes the marketing container. */
  .is-marketing .doc-wrap { max-width: 124rem; margin: 0 auto; padding: 4rem 2.4rem 8rem; }

  @media (max-width: 860px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 2.4rem; }
    .doc-nav { position: static; }
  }
}
