/* GENERATED by `python -m textbook.scaffold` from assets/stylesheets/layouts/*.css.
 * Do not edit: change a layout's own sheet and re-run the scaffold.
 */

/* atlas */
@layer layout {
  :root[data-style="atlas"] .masthead:has(> .masthead__lead) {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 16px 40px;
    max-width: 88rem;
    margin: 0 auto;
    padding: 36px 20px 22px;
  }

  :root[data-style="atlas"] .masthead > .masthead__lead {
    flex: 1 1 32rem;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  :root[data-style="atlas"] .masthead > .masthead__tools {
    flex: 1 1 24rem;
    max-width: 34rem;
    margin: 0;
    padding: 0;
  }

  :root[data-style="atlas"] main:has(> .band) {
    max-width: 88rem;
    padding-block: 28px 3rem;
    columns: 3 20rem;
    column-gap: 2.5rem;
    column-rule: 1px solid var(--tb-rule);
  }

  /* An inline-block is never split across columns, so a band stays whole. */
  :root[data-style="atlas"] .band {
    display: inline-block;
    width: 100%;
    margin: 0 0 30px;
  }

  :root[data-style="atlas"] .band__head {
    padding: 0 0 6px;
    border-bottom: 2px solid var(--tb-accent);
    background: transparent;
  }

  :root[data-style="atlas"] .band__title {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  :root[data-style="atlas"] .band__note {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  :root[data-style="atlas"] .band__region {
    margin-top: 2px;
  }

  :root[data-style="atlas"] .band__grid {
    display: block;
    padding: 0;
  }

  :root[data-style="atlas"] .band__grid > .companion[data-optional] {
    display: none;
  }

  :root[data-style="atlas"] .band__grid > .card {
    gap: 1px;
    padding: 10px 0 10px;
    border-top: 0;
    border-bottom: 1px solid var(--tb-rule);
  }

  :root[data-style="atlas"] .card__meta {
    gap: 2px 8px;
    line-height: 1.4;
  }

  :root[data-style="atlas"] .card__stats {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
  }

  :root[data-style="atlas"] .card__title {
    margin: 2px 0 0;
    font-size: 1.08rem;
    line-height: 1.3;
  }

  :root[data-style="atlas"] .card__body {
    margin: 0;
    font-size: 0.94rem;
    line-height: 1.45;
  }

  :root[data-style="atlas"] .card__profiles {
    margin-top: 4px;
  }

  :root[data-style="atlas"] .card__profiles a {
    font-size: 0.9rem;
  }

  :root[data-style="atlas"] .layout {
    max-width: 84rem;
    column-gap: 0;
  }

  :root[data-style="atlas"] .sidebar {
    padding-right: 18px;
    border-right: 1px solid var(--tb-rule);
  }

  :root[data-style="atlas"] .content {
    max-width: 60rem;
    margin: 22px 0 40px 28px;
    padding: 32px 40px 3rem;
    border: 1px solid var(--tb-rule);
  }

  :root[data-style="atlas"] .md-typeset > h1 {
    margin: 0 0 1.1rem;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--tb-rule);
  }

  :root[data-style="atlas"] .md-typeset > h2 {
    margin: 2.2rem 0 0.7rem;
  }

  :root[data-style="atlas"] .md-typeset .table-scroll {
    max-width: none;
  }

  :root[data-style="atlas"] .md-typeset table {
    width: 100%;
    font-variant-numeric: tabular-nums;
  }

  :root[data-style="atlas"] .md-typeset .callout {
    border-radius: 0;
  }

  :root[data-style="atlas"] .md-typeset > .chapter-list {
    max-width: none;
    margin: 1rem 0 1.6rem;
    padding: 0;
    columns: 3 14rem;
    column-gap: 2.4rem;
    column-rule: 1px solid var(--tb-rule);
    font-variant-numeric: tabular-nums;
  }

  :root[data-style="atlas"] .chapter-list > li {
    break-inside: avoid;
    margin: 0 0 0.55rem 2.4rem;
    line-height: 1.35;
  }

  :root[data-style="atlas"] .chapter-list__note {
    display: block;
    font-size: 0.85rem;
  }

  @media (max-width: 60rem) {
    :root[data-style="atlas"] .sidebar {
      padding-right: 0;
      border-right-width: 0;
    }

    :root[data-style="atlas"] .content {
      margin: 14px 0 28px;
      padding: 14px 0 3rem;
      border-left-width: 0;
      border-right-width: 0;
    }
  }

  @media (max-width: 40rem) {
    :root[data-style="atlas"] .masthead:has(> .masthead__lead) {
      padding: 28px 20px 18px;
      max-width: none;
    }

    :root[data-style="atlas"] main:has(> .band) {
      padding-inline: 20px;
    }
  }
}

/* focus */
@layer layout {
  :root[data-style="focus"] .masthead:has(> .masthead__lead) {
    padding: 72px 0 40px;
  }

  :root[data-style="focus"] .masthead > .masthead__lead,
  :root[data-style="focus"] .masthead > .masthead__tools {
    max-width: 48rem;
  }

  :root[data-style="focus"] .masthead__lead > .masthead__title {
    margin: 0 0 14px;
    font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3.3rem);
    line-height: 1.1;
  }

  :root[data-style="focus"] .masthead__lead > .masthead__description {
    font-size: 1.25rem;
    line-height: 1.6;
  }

  :root[data-style="focus"] .masthead > .masthead__tools {
    margin-top: 28px;
  }

  :root[data-style="focus"] main:has(> .band) {
    max-width: 48rem;
    padding-bottom: 5rem;
  }

  :root[data-style="focus"] .band {
    margin: 72px 0 0;
  }

  :root[data-style="focus"] .band__head {
    padding: 0 0 14px;
    border-bottom: 1px solid var(--tb-rule);
    background: transparent;
  }

  :root[data-style="focus"] .band__title {
    margin: 0 0 4px;
    font-size: 1.9rem;
    line-height: 1.2;
  }

  :root[data-style="focus"] .band__note {
    font-size: 1.0625rem;
  }

  :root[data-style="focus"] .band__region {
    margin: 6px 0 0;
  }

  :root[data-style="focus"] .band__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0;
  }

  :root[data-style="focus"] .band__grid > .companion[data-optional] {
    display: none;
  }

  :root[data-style="focus"] .band__grid > .card {
    gap: 8px;
    padding: 30px 0 32px;
    border-top: 0;
    border-bottom: 1px solid var(--tb-rule);
  }

  :root[data-style="focus"] .card__title {
    margin: 4px 0 0;
    font-size: 1.75rem;
    line-height: 1.2;
  }

  :root[data-style="focus"] .card__body {
    max-width: 60ch;
    font-size: 1.2rem;
    line-height: 1.6;
  }

  :root[data-style="focus"] .card__profiles {
    gap: 4px 22px;
    margin-top: 10px;
  }

  :root[data-style="focus"] .card__profiles a {
    font-size: 1.0625rem;
  }

  :root[data-style="focus"] .layout {
    max-width: 84rem;
  }

  :root[data-style="focus"] .content {
    max-width: 62ch;
    margin-block: 1.5rem 4rem;
  }

  :root[data-style="focus"] .md-typeset {
    font-size: 1.1875rem;
    line-height: 1.7;
  }

  :root[data-style="focus"] .md-typeset > p,
  :root[data-style="focus"] .md-typeset > ul,
  :root[data-style="focus"] .md-typeset > ol {
    margin-block: 0 1.1em;
  }

  :root[data-style="focus"] .md-typeset > h1 {
    margin: 0 0 1.6rem;
    font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.5rem);
    line-height: 1.15;
  }

  :root[data-style="focus"] .md-typeset > h2 {
    margin: 3.2rem 0 1rem;
    font-size: 1.5rem;
    line-height: 1.25;
  }

  :root[data-style="focus"] .md-typeset > h3 {
    margin: 2.4rem 0 0.8rem;
    font-size: 1.2rem;
  }

  :root[data-style="focus"] .md-typeset .contents {
    max-width: none;
    margin: 1.6rem 0 2.4rem;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  :root[data-style="focus"] .md-typeset .contents__list {
    columns: 1;
    padding-left: 1.2rem;
    font-size: 0.95rem;
  }

  :root[data-style="focus"] .md-typeset .callout {
    max-width: none;
    margin-block: 2.4rem;
    margin-inline: 0;
    padding: 0.1rem 0 0.1rem 1.4rem;
    border: 0;
    border-left: 2px solid var(--tb-rule);
    border-radius: 0;
    background: transparent;
  }

  :root[data-style="focus"] .md-typeset .table-scroll {
    margin-block: 2rem;
  }

  :root[data-style="focus"] .md-typeset table th,
  :root[data-style="focus"] .md-typeset table td {
    padding: 0.35em 0.45em;
    font-size: 0.9rem;
  }

  :root[data-style="focus"] .md-typeset .tb-figure {
    margin-block: 3.2rem;
  }

  :root[data-style="focus"] .md-typeset maths-figure {
    margin-block: 3rem;
  }

  :root[data-style="focus"] .md-typeset .pager {
    margin-top: 4rem;
  }

  @media (min-width: 60rem) {
    :root[data-style="focus"] .layout {
      grid-template-columns: 13rem minmax(0, 1fr);
      column-gap: 3rem;
    }

    :root[data-style="focus"] .content {
      justify-self: center;
      width: 100%;
    }

    :root[data-style="focus"] .sidebar .nav__link {
      font-size: 0.82rem;
    }
  }

  @media (max-width: 60rem) {
    :root[data-style="focus"] .content {
      margin-top: 0.5rem;
    }
  }

  @media (max-width: 40rem) {
    :root[data-style="focus"] .masthead:has(> .masthead__lead) {
      padding: 40px 0 28px;
    }

    :root[data-style="focus"] .band {
      margin-top: 48px;
    }

    :root[data-style="focus"] .card__title {
      font-size: 1.45rem;
    }

    :root[data-style="focus"] .card__body {
      font-size: 1.0625rem;
    }

    :root[data-style="focus"] .md-typeset {
      font-size: 1.125rem;
    }
  }
}

/* ledger */
@layer layout {
  :root[data-style="ledger"] .masthead:has(> .masthead__lead) {
    padding: 30px 0 18px;
  }

  :root[data-style="ledger"] .masthead > .masthead__lead,
  :root[data-style="ledger"] .masthead > .masthead__tools {
    max-width: 72rem;
  }

  :root[data-style="ledger"] .masthead__lead > .masthead__title {
    margin: 0 0 4px;
    font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2rem);
  }

  :root[data-style="ledger"] .masthead > .masthead__tools {
    margin-top: 12px;
  }

  :root[data-style="ledger"] main:has(> .band) {
    max-width: 72rem;
    padding-bottom: 3rem;
  }

  :root[data-style="ledger"] .band {
    margin: 30px 0 0;
  }

  :root[data-style="ledger"] .band__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 16px;
    padding: 0 0 6px;
    border-bottom: 2px solid var(--tb-rule);
    background: transparent;
  }

  :root[data-style="ledger"] .band__title {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  :root[data-style="ledger"] .band__note {
    flex: 1 1 30ch;
    font-size: 0.9rem;
  }

  :root[data-style="ledger"] .band__region {
    margin-left: auto;
    white-space: nowrap;
  }

  :root[data-style="ledger"] .band__grid {
    display: block;
    padding: 0;
  }

  :root[data-style="ledger"] .band__grid > .companion[data-optional] {
    display: none;
  }

  :root[data-style="ledger"] .band__grid > .card {
    display: grid;
    grid-template-columns: 28ch minmax(0, 1fr) 13ch;
    grid-template-rows: auto 1fr;
    grid-auto-flow: column;
    column-gap: 2rem;
    row-gap: 0;
    padding: 10px 0 11px;
    border-top: 0;
    border-bottom: 1px solid var(--tb-rule);
  }

  :root[data-style="ledger"] .band__grid > .card > .card__meta {
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    grid-row: span 2;
    padding-top: 0.25rem;
    line-height: 1.45;
  }

  :root[data-style="ledger"] .card__kicker {
    flex: 1 1 0;
  }

  :root[data-style="ledger"] .card__stats {
    flex: 1 1 100%;
    font-variant-numeric: tabular-nums;
  }

  :root[data-style="ledger"] .card__title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
  }

  :root[data-style="ledger"] .card__body {
    margin: 1px 0 0;
    font-size: 1.0625rem;
    line-height: 1.45;
  }

  :root[data-style="ledger"] .band__grid > .card > .card__profiles {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    grid-row: span 2;
    margin: 0;
  }

  :root[data-style="ledger"] .layout {
    max-width: 76rem;
  }

  :root[data-style="ledger"] .content {
    max-width: 52rem;
  }

  :root[data-style="ledger"] .md-typeset {
    line-height: 1.55;
  }

  :root[data-style="ledger"] .md-typeset > p,
  :root[data-style="ledger"] .md-typeset > ul,
  :root[data-style="ledger"] .md-typeset > ol {
    margin-block: 0 0.7em;
  }

  :root[data-style="ledger"] .md-typeset > h1 {
    margin: 0 0 0.8rem;
    font-size: 1.65rem;
    line-height: 1.2;
  }

  :root[data-style="ledger"] .md-typeset > h2 {
    margin: 1.7rem 0 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--tb-rule);
    font-size: 1.15rem;
    line-height: 1.3;
  }

  :root[data-style="ledger"] .md-typeset > h3 {
    margin: 1.3rem 0 0.35rem;
    font-size: 1.0625rem;
  }

  :root[data-style="ledger"] .md-typeset .contents {
    max-width: none;
    margin: 0.8rem 0 1rem;
    padding: 0.35rem 0;
    border: 0;
    border-top: 1px solid var(--tb-rule);
    border-bottom: 1px solid var(--tb-rule);
    border-radius: 0;
  }

  :root[data-style="ledger"] .md-typeset .contents__title {
    margin: 0 0 0.1rem;
  }

  :root[data-style="ledger"] .md-typeset .contents__list {
    display: flex;
    flex-wrap: wrap;
    column-gap: 1.4rem;
    padding-left: 0;
    list-style: none;
    line-height: 1.6;
  }

  :root[data-style="ledger"] .md-typeset .table-scroll {
    max-width: none;
  }

  :root[data-style="ledger"] .md-typeset table {
    width: 100%;
    max-width: none;
    font-variant-numeric: tabular-nums;
  }

  :root[data-style="ledger"] .md-typeset table th,
  :root[data-style="ledger"] .md-typeset table td {
    padding: 0.25em 0.6em;
  }

  :root[data-style="ledger"] .md-typeset .callout {
    margin-block: 0.9rem;
    padding: 0.45rem 0.8rem;
    border-radius: 0;
  }

  :root[data-style="ledger"] .md-typeset .tb-figure {
    margin-block: 1rem;
  }

  :root[data-style="ledger"] .chapter-list > li {
    margin: 0;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--tb-rule);
    font-variant-numeric: tabular-nums;
  }

  @media (min-width: 60rem) {
    :root[data-style="ledger"] .layout {
      grid-template-columns: 14rem minmax(0, 1fr);
      column-gap: 2.25rem;
    }

    :root[data-style="ledger"] .sidebar .nav__link {
      font-size: 0.82rem;
    }
  }

  @media (max-width: 40rem) {
    :root[data-style="ledger"] .band__head {
      flex-direction: column;
      gap: 0;
    }

    :root[data-style="ledger"] .band__region {
      margin-left: 0;
    }

    :root[data-style="ledger"] .band__note {
      flex: none;
    }

    :root[data-style="ledger"] .band__grid > .card {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    :root[data-style="ledger"] .band__grid > .card > .card__meta {
      gap: 0 9px;
      padding-top: 0;
    }

    :root[data-style="ledger"] .card__kicker,
    :root[data-style="ledger"] .card__stats {
      flex: 0 1 auto;
    }

    :root[data-style="ledger"] .band__grid > .card > .card__profiles {
      flex-direction: row;
      gap: 0 16px;
    }
  }
}

/* matrix */
/* Matrix: a framed, hairline grid with monospaced labels and square corners.
 *
 * Geometry only, under the layout contract in assets/AGENTS.md ("Layouts"): the paint
 * these hooks need lives in portal.css and extra.css, so a bundle is audited once and
 * looks right in every layout. The matrix lines are drawn by each cell's top and left
 * border, pulled one pixel over its neighbour, so no cell has to know its column.
 */
@layer layout {
  /* The portal: one frame around the masthead and the bands; a prose page frames its masthead. */
  :root[data-style="matrix"] .masthead:has(> .masthead__lead) {
    display: flex;
    flex-wrap: wrap;
    width: min(72.5rem, 100% - 1.5rem);
    margin: 26px auto 0;
    padding: 0;
    border: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .masthead > .masthead__lead {
    flex: 999 1 30rem;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 28px 30px 26px;
  }

  :root[data-style="matrix"] .masthead > .masthead__tools {
    display: grid;
    flex: 1 1 22rem;
    grid-template-columns: minmax(0, 1fr) auto 0;
    align-content: start;
    align-items: center;
    column-gap: 12px;
    min-width: 0;
    max-width: none;
    margin: -1px 0 0 -1px;
    padding: 0;
    border-top: 1px solid var(--tb-rule);
    border-left: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .masthead__tools > .masthead__tools-label {
    margin: 0;
    padding: 14px 0 14px 20px;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .masthead__tools > .masthead__search {
    grid-column: 1 / -1;
    max-width: none;
    margin: 0;
    padding: 16px 20px 18px;
    border-top: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .masthead__lead > .masthead__eyebrow {
    margin: 0 0 10px;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--tb-accent);
  }

  :root[data-style="matrix"] .masthead__lead > .masthead__title {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 1.2rem + 2vw, 2.35rem);
  }

  :root[data-style="matrix"] .masthead__lead > .masthead__description {
    line-height: 1.5;
  }

  :root[data-style="matrix"] main:has(> .band > .band__grid) {
    width: min(72.5rem, 100% - 1.5rem);
    max-width: none;
    margin: 0 auto 42px;
    padding: 0;
    border: 1px solid var(--tb-rule);
    border-top-width: 0;
  }

  :root[data-style="matrix"] .band {
    margin: 0;
    container-name: matrix-band;
    container-type: inline-size;
  }

  :root[data-style="matrix"] .band + .band {
    border-top: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .band__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 18px;
    margin: 0;
    padding: 10px 28px;
    border-bottom: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .band__title {
    margin: 0;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.5;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--tb-ink);
  }

  :root[data-style="matrix"] .band__note {
    flex: 1 1 24ch;
    max-width: none;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
  }

  :root[data-style="matrix"] .band__region {
    margin: 0 0 0 auto;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    line-height: 1.5;
    text-transform: uppercase;
    white-space: nowrap;
  }

  :root[data-style="matrix"] .band__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: -1px 0 0 -1px;
    padding: 0;
  }

  :root[data-style="matrix"] .band__grid > .card,
  :root[data-style="matrix"] .band__grid > .companion {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    margin: 0;
    padding: 20px 28px 18px;
    border: 0;
    border-top: 1px solid var(--tb-rule);
    border-left: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .band__grid > .companion[data-optional] {
    display: none;
  }

  @container matrix-band (min-width: 64ch) {
    :root[data-style="matrix"] .band__grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    :root[data-style="matrix"] .band__grid:has(> .card:nth-of-type(odd):last-of-type) > .companion[data-optional] {
      display: flex;
    }
  }

  :root[data-style="matrix"] .card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 9px;
    margin: 0 0 12px;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    line-height: 1.5;
  }

  :root[data-style="matrix"] .card__swatch {
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 0;
  }

  :root[data-style="matrix"] .card__kicker {
    font-weight: 600;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .card__stats {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
  }

  :root[data-style="matrix"] .card__title {
    margin: 0 0 7px;
    font-size: 1.12rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.25;
  }

  :root[data-style="matrix"] .card__body {
    margin: 0 0 16px;
    font-size: 0.94rem;
    line-height: 1.5;
  }

  :root[data-style="matrix"] .card__profiles {
    gap: 2px 16px;
    margin: auto 0 0;
    font-family: var(--tb-font-mono);
  }

  :root[data-style="matrix"] .card__profiles a {
    font-size: 0.85rem;
    text-decoration-line: none;
  }

  :root[data-style="matrix"] .card__profiles a:hover,
  :root[data-style="matrix"] .card__profiles a:focus-visible {
    text-decoration-line: underline;
  }

  :root[data-style="matrix"] .card__profile--primary {
    font-weight: 700;
  }

  :root[data-style="matrix"] .companion__kicker {
    margin: 0 0 12px;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    line-height: 1.5;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .companion__title {
    margin: 0 0 7px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
  }

  :root[data-style="matrix"] .companion__body {
    margin: 0 0 16px;
    font-size: 0.94rem;
    line-height: 1.5;
  }

  :root[data-style="matrix"] .companion__link {
    align-self: flex-start;
    margin-top: auto;
    font-family: var(--tb-font-mono);
    font-size: 0.85rem;
    text-decoration-line: none;
  }

  :root[data-style="matrix"] .companion__link:hover,
  :root[data-style="matrix"] .companion__link:focus-visible {
    text-decoration-line: underline;
    color: var(--tb-accent);
  }

  /* A book: the masthead's labels, the contents rail and a framed reading column. */
  :root[data-style="matrix"] .masthead__book {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .masthead__brand > .masthead__section {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
  }

  :root[data-style="matrix"] .masthead__home {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 0;
  }

  :root[data-style="matrix"] .layout {
    max-width: 80rem;
    column-gap: 0;
  }

  :root[data-style="matrix"] .sidebar {
    padding-right: 18px;
    border-right: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .sidebar summary {
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: none;
  }

  :root[data-style="matrix"] .nav__link--current {
    padding-left: 0.6rem;
    border-left: 2px solid var(--tb-accent);
    color: var(--tb-ink);
  }

  :root[data-style="matrix"] .content {
    max-width: none;
    margin: 22px 0 40px;
    padding: 32px 38px 3rem;
    border: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .md-typeset > h1 {
    max-width: none;
    margin: 0 0 1.1rem;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--tb-rule);
    font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.05rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  :root[data-style="matrix"] .md-typeset > h1 .page-kind {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.16rem 0.42rem;
    border: 1px solid var(--tb-rule);
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1.5;
    text-transform: uppercase;
    color: var(--tb-accent);
  }

  :root[data-style="matrix"] .md-typeset > h2 {
    margin: 2.4rem 0 0.7rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--tb-rule);
    font-size: 1.22rem;
    letter-spacing: -0.01em;
  }

  :root[data-style="matrix"] .md-typeset > h3 {
    font-size: 1.1rem;
  }

  :root[data-style="matrix"] .md-typeset .contents {
    max-width: none;
    margin: 1.2rem 0 1.5rem;
    padding: 0.65rem 0;
    border: 0;
    border-top: 1px solid var(--tb-rule);
    border-bottom: 1px solid var(--tb-rule);
    border-radius: 0;
  }

  :root[data-style="matrix"] .md-typeset .contents__title {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
  }

  :root[data-style="matrix"] .md-typeset .contents__list {
    padding-left: 0.35rem;
    list-style: none;
  }

  :root[data-style="matrix"] .md-typeset .callout {
    max-width: none;
    margin: 1.5rem 0;
    padding: 1rem 1.15rem 1.05rem;
    border: 1px solid var(--tb-rule);
    border-top: 2px solid var(--tb-accent);
    border-radius: 0;
    background: transparent;
  }

  :root[data-style="matrix"] .md-typeset .callout > p {
    max-width: var(--tb-measure);
  }

  :root[data-style="matrix"] .md-typeset .callout > :first-child > strong:first-child {
    display: block;
    margin-bottom: 0.32rem;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tb-accent);
  }

  :root[data-style="matrix"] .md-typeset .table-scroll {
    border: 1px solid var(--tb-rule);
    border-radius: 0;
  }

  :root[data-style="matrix"] .md-typeset table {
    border: 0;
    border-radius: 0;
  }

  :root[data-style="matrix"] .md-typeset table th {
    padding: 0.42rem 0.7rem;
    border-bottom: 1px solid var(--tb-rule);
    background: transparent;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .md-typeset table td {
    padding: 0.5rem 0.7rem;
    border-top: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .md-typeset table tr:first-child td {
    border-top-width: 0;
  }

  :root[data-style="matrix"] .md-typeset maths-figure {
    border-radius: 0;
  }

  :root[data-style="matrix"] .md-typeset .tb-figure figcaption {
    padding-top: 0.55rem;
    border-top: 1px solid var(--tb-rule);
  }

  :root[data-style="matrix"] .md-typeset .tb-figure__number {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .md-typeset .pager {
    gap: 0;
    padding-top: 0;
  }

  :root[data-style="matrix"] .md-typeset .pager__link {
    border: 1px solid var(--tb-rule);
    border-radius: 0;
    background: transparent;
  }

  :root[data-style="matrix"] .md-typeset .pager__link + .pager__link {
    border-top-width: 0;
  }

  :root[data-style="matrix"] .md-typeset .pager__eyebrow {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  :root[data-style="matrix"] .md-typeset .pager__title {
    font-size: 0.95rem;
  }

  :root[data-style="matrix"] .md-typeset .method-index-nav,
  :root[data-style="matrix"] .md-typeset .method-index__group > summary,
  :root[data-style="matrix"] .md-typeset .method-index__group[open] > summary,
  :root[data-style="matrix"] .md-typeset .method-index__names {
    border-radius: 0;
  }

  :root[data-style="matrix"] .md-typeset .method-index-nav {
    max-width: none;
  }

  :root[data-style="matrix"] .md-typeset .method-index__letter {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
  }

  :root[data-style="matrix"] .md-typeset .prove {
    border-left-width: 1px;
    border-radius: 0;
    background: transparent;
  }

  /* A book's home: the chapters as the same two-column matrix, numbered by the list. */
  :root[data-style="matrix"] .md-typeset > .chapter-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    max-width: none;
    margin: 1.2rem 0 1.6rem;
    padding: 0;
    border-top: 1px solid var(--tb-rule);
    border-left: 1px solid var(--tb-rule);
    list-style: decimal-leading-zero inside;
  }

  :root[data-style="matrix"] .chapter-list > li {
    margin: 0;
    padding: 14px 16px;
    border-right: 1px solid var(--tb-rule);
    border-bottom: 1px solid var(--tb-rule);
    line-height: 1.3;
  }

  :root[data-style="matrix"] .chapter-list > li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  :root[data-style="matrix"] .chapter-list > li::marker {
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--tb-accent);
  }

  :root[data-style="matrix"] .chapter-list > li > a {
    font-weight: 600;
    text-decoration-line: none;
    color: var(--tb-ink);
  }

  :root[data-style="matrix"] .chapter-list > li > a:hover,
  :root[data-style="matrix"] .chapter-list > li > a:focus-visible {
    text-decoration-line: underline;
    text-underline-offset: 3px;
  }

  :root[data-style="matrix"] .chapter-list__note {
    display: block;
    margin: 0.3rem 0 0 4ch;
    font-family: var(--tb-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    line-height: 1.5;
    text-transform: uppercase;
  }

  @media (min-width: 44rem) {
    :root[data-style="matrix"] .md-typeset .pager__link + .pager__link {
      border-top-width: 1px;
      border-left-width: 0;
    }
  }

  @media (max-width: 60rem) {
    :root[data-style="matrix"] .sidebar {
      padding-right: 0;
      border-right-width: 0;
    }

    :root[data-style="matrix"] .nav-drawer {
      border-bottom-width: 0;
    }

    :root[data-style="matrix"] .nav-drawer__summary {
      padding-inline: 0.75rem;
      border: 1px solid var(--tb-rule);
    }

    :root[data-style="matrix"] .md-typeset table.table--cards td {
      padding: 0.3rem 0;
      border-top-width: 0;
    }

    :root[data-style="matrix"] .content {
      margin: 14px 0 28px;
      padding: 14px 0 3rem;
      border-left-width: 0;
      border-right-width: 0;
    }
  }
}

/* notebook */
@layer layout {
  :root[data-style="notebook"] .masthead:has(> .masthead__lead) {
    padding: 56px 0 34px;
  }

  :root[data-style="notebook"] .masthead__lead > .masthead__eyebrow {
    font-family: var(--tb-font-body);
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
  }

  :root[data-style="notebook"] .masthead__lead > .masthead__title {
    font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3.1rem);
  }

  :root[data-style="notebook"] .masthead__tools > .masthead__tools-label {
    font-family: var(--tb-font-body);
    font-size: 0.9rem;
    letter-spacing: 0;
    text-transform: none;
  }

  :root[data-style="notebook"] main:has(> .band) {
    max-width: 68rem;
    padding-bottom: 4rem;
  }

  :root[data-style="notebook"] .band {
    margin: 56px 0 0;
  }

  :root[data-style="notebook"] .band__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 18px;
    padding: 0;
    background: transparent;
  }

  :root[data-style="notebook"] .band__title {
    flex: 1 1 100%;
    font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.3rem);
    line-height: 1.15;
  }

  :root[data-style="notebook"] .band__note {
    flex: 1 1 30ch;
    font-size: 1.0625rem;
  }

  :root[data-style="notebook"] .band__region {
    font-family: var(--tb-font-body);
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
  }

  :root[data-style="notebook"] .band__grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 20px;
    padding: 20px 0 0;
  }

  :root[data-style="notebook"] .band__grid > .card,
  :root[data-style="notebook"] .band__grid > .companion {
    gap: 6px;
    padding: 20px 22px 18px;
    border: 1px solid var(--tb-rule);
    border-left: 6px solid var(--card-accent-active);
    border-radius: var(--tb-radius);
  }

  :root[data-style="notebook"] .band__grid > .companion {
    border-left-color: var(--tb-rule);
  }

  :root[data-style="notebook"] .card__meta {
    gap: 2px 8px;
    font-family: var(--tb-font-body);
    font-size: 0.9rem;
    letter-spacing: 0;
  }

  :root[data-style="notebook"] .card__swatch {
    border-radius: var(--tb-radius);
  }

  :root[data-style="notebook"] .card__kicker {
    text-transform: none;
  }

  :root[data-style="notebook"] .card__title {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  :root[data-style="notebook"] .card__body,
  :root[data-style="notebook"] .companion__body {
    font-size: 1.0625rem;
    line-height: 1.55;
  }

  :root[data-style="notebook"] .card__profiles {
    margin-top: auto;
    padding-top: 12px;
  }

  :root[data-style="notebook"] .card__profiles a {
    font-size: 1rem;
  }

  :root[data-style="notebook"] .companion__kicker {
    font-family: var(--tb-font-body);
    font-size: 0.9rem;
    letter-spacing: 0;
    text-transform: none;
  }

  :root[data-style="notebook"] .companion__title {
    font-size: 1.3rem;
  }

  :root[data-style="notebook"] .layout {
    max-width: 80rem;
  }

  :root[data-style="notebook"] .content {
    max-width: 50rem;
    margin-block: 0.5rem 3rem;
  }

  :root[data-style="notebook"] .md-typeset > h1 {
    max-width: none;
    margin: 0 0 1.4rem;
    font-family: var(--tb-font-display);
    font-size: clamp(2.1rem, 1.5rem + 1.6vw, 2.75rem);
    line-height: 1.12;
  }

  :root[data-style="notebook"] .md-typeset > h2 {
    margin: 2.8rem 0 0.9rem;
    font-family: var(--tb-font-display);
    font-size: 1.75rem;
    line-height: 1.2;
  }

  :root[data-style="notebook"] .md-typeset > h3 {
    margin: 2rem 0 0.7rem;
    font-family: var(--tb-font-display);
    font-size: 1.35rem;
  }

  :root[data-style="notebook"] .md-typeset .contents {
    padding: 1rem 1.25rem;
    border-left: 6px solid var(--tb-rule);
  }

  :root[data-style="notebook"] .md-typeset .contents__title {
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
  }

  :root[data-style="notebook"] .md-typeset .contents__list {
    font-size: 0.95rem;
  }

  :root[data-style="notebook"] .md-typeset .callout {
    margin-block: 1.8rem;
    margin-inline: 1.5rem 0;
    padding: 1.1rem 1.4rem 1.2rem;
    border: 0;
    border-left: 6px solid var(--tb-accent);
    border-radius: var(--tb-radius);
  }

  :root[data-style="notebook"] .md-typeset .worked-example {
    margin-block: 1.6rem;
    margin-inline: 1.5rem 0;
    padding-left: 1.2rem;
    border-left: 6px solid var(--tb-accent);
  }

  :root[data-style="notebook"] .md-typeset .prove {
    margin-inline: 1.5rem 0;
    padding: 1rem 1.4rem;
    border-left-width: 6px;
    border-radius: var(--tb-radius);
  }

  :root[data-style="notebook"] .md-typeset .table-scroll {
    border-radius: var(--tb-radius);
  }

  :root[data-style="notebook"] .md-typeset .tb-figure {
    margin-block: 2rem;
  }

  :root[data-style="notebook"] .md-typeset .pager__link {
    border-radius: var(--tb-radius);
  }

  :root[data-style="notebook"] .chapter-list > li {
    margin-block: 0.35rem;
  }

  @media (max-width: 40rem) {
    :root[data-style="notebook"] .md-typeset .worked-example {
      margin-inline: 0;
      padding-left: 0.5rem;
      border-left-width: 4px;
    }

    :root[data-style="notebook"] .md-typeset .callout,
    :root[data-style="notebook"] .md-typeset .prove {
      margin-inline: 0.5rem 0;
      padding: 0.9rem 1rem;
    }

    :root[data-style="notebook"] .band {
      margin-top: 40px;
    }
  }
}
