/* Short lexical units retain their source spaces when selected or copied. */
:is(.bw-reading, .native-book-page) .wrap-prose-unit { white-space: nowrap; }
:is(.bw-reading, .native-book-page) p.wrap-prose { text-wrap: pretty; }
/* Atomic inline layout also keeps the right column edge exact in WebKit. */
:is(.bw-reading,.native-book-page) p.wrap-prose .wrap-prose-unit {
  display: inline-block;
  max-inline-size: 100%;
  white-space: normal;
}
/* Preserve the reading measure when the viewport is narrower than a small phone. */
@media (max-width: 19rem) {
  .bw-reading { padding-inline: clamp(8px, calc(50vw - 131px), 16px); }
}
@media (max-width: 17.375rem) {
  :is(.bw-reading,.native-book-page) p.wrap-prose {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 10 4 4;
  }
}

/* Fill each available line at the selected reading size. Heading words stay
   in their original text run, including across the cover's change of face. */
.bw-reading { container: edition-reader / inline-size; }
.bw-reading :is(h1,h2,h3,.nr-link-title,.nr-list a,.nr-bar > a),
.native-book-page :is(h1,h2,h3,.native-subtitle,.native-action),
.native-book-page.native-writing .native-scene h2,
.book-shelf .shelf-book.is-edition h2 {
  text-wrap: wrap;
  word-break: normal;
  overflow-wrap: normal;
}
.native-book-page.native-theory .native-scene { container-type: inline-size; }
.native-book-page.native-theory .native-scene h2#height {
  font-size: clamp(1.26em, 6.54cqi, clamp(1.4em, 2.4vw, 1.95em));
}
.native-book-page .edition-quantity { white-space: nowrap; }
/* Keep the large type setting usable at very narrow measures. */
@container edition-reader (max-width: 14em) {
  .bw-reading h1:not(.record-part-title) {
    font-size: clamp(1.27em, 11.6cqi, 1.6em);
  }
}
.book-shelf .shelf-book.is-edition .wrap-prose-unit { white-space: nowrap; }

@container edition-reader (max-width: 12em) {
  .bw-reading .nr-chapter h2.nr-src-pub-h2 { font-size: min(1.18em, 9.45cqi); }
  .bw-reading .nr-list { padding-inline: .42em; }
  .bw-reading .nr-list ol ol { margin-inline-start: .3em; padding-inline-start: .42em; }
}
@media (max-width: 19rem) {
  .native-book-page .native-scene h2 { font-size: clamp(1.2em, 10.4vw, 1.4em); }
}

/* Keep the full wordmark and the three original touch targets on narrow screens. */
@media (max-width: 19.75rem) {
  .site-header:has(#home-language) {
    padding-inline: clamp(4px, calc(25vw - 66px), 13px) !important;
    column-gap: 1px !important;
  }
  .site-header #home-language .lang-ink-drawing svg {
    height: clamp(20px, calc(25vw - 50px), 26px) !important;
  }
}

:is(.bw-reading,.native-book-page) :is(.wrap-inset-math,.wrap-inset-word) {white-space:nowrap}
.bw-reading .nr-chapter :is(blockquote.record-hand, p.theory-pen),
.native-theory h2.theory-question {
  container: manuscript / inline-size;
  box-sizing: border-box;
  inline-size: calc(100% + .28em);
  max-inline-size: 30.28em;
  margin-inline-start: -.28em;
  padding-inline: .28em .12em;
  /* Keep compact notes at the requested reading size when the original wide
     handwriting would otherwise send a short phrase to an extra line. */
  font-size: clamp(1em, min(calc(.99em + .53cqi), 6.02cqi), 1.38em);
  line-height: 1.45;
  text-align: start;
  text-wrap: wrap;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
/* Retain one readable body-size step on very small screens so a negated
   verb can travel as a unit even at the largest reader setting. */
@container edition-reader (max-width: 12em) {
  .bw-reading .nr-chapter :is(blockquote.record-hand,p.theory-pen) {
    font-size: clamp(.98em, 8.2cqi, 1.06em);
  }
}
.native-theory h2.theory-question,
.bw-reading .nr-chapter p.theory-question {
  font-size: clamp(1.22em, calc(1.08em + .9cqi), 1.6em);
}
.bw-reading .nr-chapter p.nr-src-personal-lines {
  container: manuscript / inline-size;
  box-sizing: border-box;
  padding-inline-end: .36em;
  font-size: clamp(1.03em, calc(.96em + .55cqi), 1.28em);
  font-family: "Beforeword Ballpoint", cursive;
  text-wrap: wrap;
  line-height: 1.48;
}
.hand-word-pair,.hand-phrase {
  --hand-phrase-display: inline;
  display: var(--hand-phrase-display);
  inline-size: max-content;
  max-inline-size: 100%;
  vertical-align: baseline;
  white-space: normal;
}
/* The same phrase can run on, move intact to the next line, or flow word
   by word. This measure is relative to the note's own font, including zoom. */
@container manuscript (min-width: 4em) { .hand-fit-4 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 4.5em) { .hand-fit-4-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 5em) { .hand-fit-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 5.5em) { .hand-fit-5-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 6em) { .hand-fit-6 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 6.5em) { .hand-fit-6-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 7em) { .hand-fit-7 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 7.5em) { .hand-fit-7-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 8em) { .hand-fit-8 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 8.5em) { .hand-fit-8-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 9em) { .hand-fit-9 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 9.5em) { .hand-fit-9-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 10em) { .hand-fit-10 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 10.5em) { .hand-fit-10-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 11em) { .hand-fit-11 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 11.5em) { .hand-fit-11-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 12em) { .hand-fit-12 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 12.5em) { .hand-fit-12-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 13em) { .hand-fit-13 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 13.5em) { .hand-fit-13-5 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 14em) { .hand-fit-14 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 15em) { .hand-fit-15 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 16em) { .hand-fit-16 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 17em) { .hand-fit-17 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 18em) { .hand-fit-18 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 19em) { .hand-fit-19 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 20em) { .hand-fit-20 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 21em) { .hand-fit-21 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 22em) { .hand-fit-22 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 23em) { .hand-fit-23 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 24em) { .hand-fit-24 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 25em) { .hand-fit-25 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 26em) { .hand-fit-26 { --hand-phrase-display: inline-block; } }
@container manuscript (min-width: 27em) { .hand-fit-27 { --hand-phrase-display: inline-block; } }
.bw-reading .nr-chapter :is(figcaption,.nr-src-example > p:not(.nr-src-example-label),.nr-src-scene-result,.nr-src-scene-unchanged-rule),
.native-book-page .native-reading-note > p {text-wrap:pretty}
.bw-reading .nr-chapter .record-photo-pair > figure {grid-template-columns:minmax(0,1fr)}
.bw-reading .nr-chapter .record-photo-pair figcaption {min-inline-size:0;text-wrap:balance}
@container record-reading (max-width:12.2em) {
  .bw-reading .nr-chapter .record-photo-pair {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:none;
    grid-auto-flow:row;
    gap:1.05em;
  }
  .bw-reading .nr-chapter .record-photo-pair > figure {display:block;grid-row:auto}
  .bw-reading .nr-chapter .record-photo-pair figcaption {margin-bottom:.4em}
}
/* The ascenders, leading strokes and descenders extend beyond the metrics of
   the former display face. Keep them inside the box painted with ink. */
.bw-reading .nr-chapter h1.record-part-title {
  box-sizing: border-box;
  container: manuscript / inline-size;
  padding: .08em .12em;
  font-size: clamp(1.58em, 9.7cqi, 2.65em);
  line-height: 1.48;
  text-wrap: wrap;
}
.bw-reading .nr-chapter .theory-pen.theory-name-list {
  padding-block: .12em;
  line-height: 1.45;
  row-gap: .18em;
}

/* Give each phrase an actual inline box. The text can reflow if even that
   phrase exceeds its column, including the narrow cells beneath photographs. */
:is(.bw-reading,.native-book-page,.book-shelf) .wrap-prose-unit {
  display:inline-block;
  inline-size:max-content;
  max-inline-size:100%;
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
}

/* Give the dedication space for the long strokes of the author's handwriting.
   On narrow screens each sentence fills the column; the second sentence
   regains its original line endings once the full original line fits. */
.bw-reading .nr-chapter figure.record-dedication {
  container: book-dedication manuscript / inline-size;
  inline-size: 100%;
  max-inline-size: 22em;
  margin: clamp(1.25rem, 4vw, 2.5rem) 0 clamp(1.65rem, 5vw, 3rem);
  font-size: clamp(.925em, min(calc(.98em + .5cqi), 5.47cqi), 1.38em);
}
.bw-reading .nr-chapter .record-dedication > p {
  inline-size: auto;
  max-inline-size: none;
  margin: 0;
  font-size: 1em;
  line-height: 1.64;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  white-space: normal;
  text-wrap: wrap;
}
.bw-reading .nr-chapter .record-dedication > p + p {
  margin-block-start: .85em;
}
.bw-reading .nr-chapter .record-dedication .dedication-line { display: inline; }
.bw-reading .nr-chapter .record-dedication > p + p .dedication-line:first-child {
  display: block;
  text-wrap: balance;
}
.bw-reading .nr-chapter .record-dedication > p { text-wrap: pretty; }
@container book-dedication (min-width: 18.1em) {
  .bw-reading .nr-chapter .record-dedication .dedication-line {
    display: block;
  }
}

/* The title and disclosure occupy the same two cells whether the index is open or closed. */
.bw-reading .nr-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 .75rem;
}
.bw-reading .nr-bar > a {
  grid-area: 1 / 1;
  width: fit-content;
  min-width: 0;
}
.bw-reading .nr-contents,
.bw-reading .nr-contents[open],
.bw-reading .nr-contents[open]::details-content { display: contents; }
.bw-reading .nr-contents:not([open]) > .nr-list { display: none; }
.bw-reading .nr-contents > summary {
  grid-area: 1 / 2;
  justify-self: end;
  white-space: nowrap;
}
.bw-reading .nr-contents .nr-list {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: .65rem;
  min-width: 0;
}
/* Both directions keep their own column even when titles are several lines long. */
.bw-reading .nr-pagination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  column-gap: clamp(.75rem, 3vw, 2.4rem);
  row-gap: .65rem;
  padding-top: .75rem;
  margin-top: clamp(1.75rem, 6vw, 3rem);
}
.bw-reading .nr-pagination .nr-step[data-step] {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: max-content auto;
  grid-template-areas: "arrow label" "title title";
  column-gap: .36em;
  row-gap: .24em;
  align-content: start;
  align-items: baseline;
  text-align: start;
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 48px;
  padding-block: .25em;
  line-height: 1.34;
}
.bw-reading .nr-pagination .nr-step[data-step=forward] {
  grid-area: 1 / 2;
  grid-template-columns: minmax(0, 1fr) max-content;
  grid-template-areas: "label arrow" "title title";
  text-align: end;
}
.bw-reading .nr-step .nr-step-arrow {
  grid-area: arrow;
  color: var(--nr-accent);
  font-size: .98em;
  line-height: 1;
}
.bw-reading .nr-step .nr-dir {
  grid-area: label;
  color: var(--nr-muted);
  font-weight: 400;
  font-size: .84em;
  line-height: 1.25;
}
.bw-reading .nr-step .nr-link-title {
  grid-area: title;
  min-width: 0;
  font-size: .96em;
  text-wrap: wrap;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.bw-reading .nr-pagination .nr-book-position {
  display: flex;
  grid-row: 2;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: .3em 1em;
  padding-top: .3rem;
  margin-top: 0;
}
.bw-reading .nr-book-position .nr-page-position {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-inline-start: auto;
}
.bw-reading .nr-pagination .nr-book-position .nr-jump-contents {
  display: block;
  align-content: center;
  width: fit-content;
  min-height: 44px;
}
/* A large reading size or small phone can leave less than nine em per title.
   Use two full-size direction links here; their names still speak each destination.
   At the ends, show the actual exit ("About the book" or "All books"). */
@container edition-reader (max-width: 18.1em) {
  .bw-reading .nr-pagination .nr-step[data-step] {
    grid-template-rows: auto;
    align-content: center;
    align-items: center;
  }
  .bw-reading .nr-pagination .nr-step[data-step=back] {grid-template-areas: "arrow label"}
  .bw-reading .nr-pagination .nr-step[data-step=forward] {grid-template-areas: "label arrow"}
  .bw-reading .nr-pagination .nr-step[rel] .nr-link-title,
  .bw-reading .nr-pagination .nr-step:not([rel]) .nr-dir {display: none}
  .bw-reading .nr-pagination .nr-step .nr-dir,
  .bw-reading .nr-pagination .nr-step:not([rel]) .nr-link-title {
    grid-area: label;
    color: var(--nr-accent);
    font-size: 1em;
    text-decoration: underline;
    text-decoration-thickness: max(1px,.055em);
    text-underline-offset: .17em;
    text-decoration-skip-ink: none;
  }
}

/* Text links paint one underline per rendered line. The touch target can grow
   independently of the text without turning words into flex items. */
.native-book-page a,
.bw-reading :is(.nr-list a,.nr-bar > a,.nr-bar summary,.nr-chapter a,.nr-jump-contents),
.bw-reading .nr-pagination .nr-step .nr-link-title {
  text-decoration: underline;
  text-decoration-thickness: max(1px,.055em);
  text-underline-offset: .17em;
  text-decoration-skip-ink: none;
}
.bw-reading .nr-pagination a.nr-step {text-decoration:none}
.native-book-page .native-action:not([hidden]),
.native-book-page .native-editions a,
.native-book-page .native-links a {
  display: inline-block;
  align-content: center;
  box-sizing: border-box;
  max-inline-size: 100%;
  min-block-size: 44px;
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: wrap;
}
.native-book-page .ink-entry-actions {
  align-items: center;
  gap: 0 1.1em;
  margin-block: .45em .1em;
}
.native-book-page .ink-entry-actions .native-action {
  flex: none;
  inline-size: max-content;
  margin: 0;
}
.native-book-page .native-editions {margin-block-start:0;align-items:center}
.native-book-page .native-editions a {white-space:nowrap}
.native-book-page :is(h1,h2,h3) {overflow-wrap:normal;word-break:normal}
.bw-reading .nr-bar > a,.bw-reading .nr-list a {
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: wrap;
}
.bw-reading .nr-pagination .nr-book-position .nr-jump-contents {
  display:block;
  align-content:center;
  text-decoration:underline;
  text-decoration-skip-ink:none;
}
@media print {
  .native-book-page .native-action:not([hidden]),.native-book-page .ink-enlarge {display:none}
}

@font-palette-values --player-ink-day {font-family:"Beforeword Ballpoint Ink Day";base-palette:0;}
@font-palette-values --player-ink-night {font-family:"Beforeword Ballpoint Ink Night";base-palette:1;}
@font-palette-values --player-ink-graphite {font-family:"Beforeword Ballpoint Ink Graphite";base-palette:2;}
@font-palette-values --player-ink-chalk {font-family:"Beforeword Ballpoint Ink Chalk";base-palette:3;}
@font-face {
  font-family: "Beforeword Ballpoint Degree";
  src: url("/assets/bw-native-books/ballpoint-degree-71e29655c004.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+00B0;
}
@font-face {font-family:"Beforeword Ballpoint Ink Day";src:url("/assets/bw-native-books/player-ink-day-f9bba6c0048e.woff2") format("woff2") tech(color-CBDT), url("/assets/bw-native-books/player-ink-webkit-day-90189bb8eccc.woff2") format("woff2") tech(color-sbix), url("/assets/bw-native-books/player-ink-layers-ea25270005d3.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
@font-face {font-family:"Beforeword Ballpoint Ink Night";src:url("/assets/bw-native-books/player-ink-night-87fa3259e2e0.woff2") format("woff2") tech(color-CBDT), url("/assets/bw-native-books/player-ink-webkit-night-45a71c7767f0.woff2") format("woff2") tech(color-sbix), url("/assets/bw-native-books/player-ink-layers-ea25270005d3.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
@font-face {font-family:"Beforeword Ballpoint Ink Graphite";src:url("/assets/bw-native-books/player-ink-graphite-353fc50a4f07.woff2") format("woff2") tech(color-CBDT), url("/assets/bw-native-books/player-ink-webkit-graphite-602b861ed352.woff2") format("woff2") tech(color-sbix), url("/assets/bw-native-books/player-ink-layers-ea25270005d3.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
@font-face {font-family:"Beforeword Ballpoint Ink Chalk";src:url("/assets/bw-native-books/player-ink-chalk-88de7a0c836c.woff2") format("woff2") tech(color-CBDT), url("/assets/bw-native-books/player-ink-webkit-chalk-227f94429144.woff2") format("woff2") tech(color-sbix), url("/assets/bw-native-books/player-ink-layers-ea25270005d3.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
/* Character shapes, spacing and contextual alternates come from the music player. */
:is(main.bw-reading,main.native-book-page) {
  --book-pen-face: "Beforeword Ballpoint Ink Day";
  --book-pen-palette: --player-ink-day;
  --book-neutral-face: "Beforeword Ballpoint Ink Graphite";
  --book-neutral-palette: --player-ink-graphite;
}
html:is([data-theme=dark],[data-appearance=dark]) :is(main.bw-reading,main.native-book-page) {
  --book-pen-face: "Beforeword Ballpoint Ink Night";
  --book-pen-palette: --player-ink-night;
  --book-neutral-face: "Beforeword Ballpoint Ink Chalk";
  --book-neutral-palette: --player-ink-chalk;
}
main.bw-reading .nr-chapter :is(.record-hand,.record-part-title,.record-dedication > p,.nr-src-personal-lines,.theory-pen),
main.native-book-page :is(.theory-pen,h1 .native-ink) {
  font-palette: var(--book-pen-palette);
  font-family: var(--book-pen-face), "Beforeword Ballpoint", "Beforeword Ballpoint Degree", cursive;
  font-style: normal;
  font-weight: 400;
  font-synthesis: none;
  font-variant-ligatures: common-ligatures contextual;
  letter-spacing: normal;
}
main.bw-reading .nr-chapter .record-hand.record-black-ink {
  font-palette: var(--book-neutral-palette);
  font-family: var(--book-neutral-face), "Beforeword Ballpoint", cursive;
}
@media (forced-colors: active) {
  :is(main.bw-reading,main.native-book-page) {
    --book-pen-face: "Beforeword Ballpoint";
    --book-neutral-face: "Beforeword Ballpoint";
  }
}
