/* The hero's journal, laid out like the mock book Sam approved (10 Nov, "Bob's Journal"; owner, 13 Nov: "this is
   not the journal based on the paper we made"). A worn book open on a dark desk: every page is one of the stored era
   papers (static/img/journal/paper, varied page to page), the writing is in a stored hand of the era
   (static/fonts/hands), the pencil sits IN the paper (multiply), his notes go in the margin beside a drawing, never on
   it, and what was picked up is tucked in on its own loose paper. Sizes are in cqw of the page, so a page looks the
   same at any size. wf-journal.js cuts the writing into pages (both sides of every leaf) and turns the leaves. */
.wfj { position: fixed; inset: 0; z-index: 80; display: none; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 14px 12px;
  background: radial-gradient(120% 90% at 50% 35%, #2a2019, #17120e 70%); color: #c9b49a;
  font-family: "IM Fell English", Georgia, serif; }
.wfj.is-on { display: flex; }
.wfj-x { position: absolute; top: 8px; right: 14px; background: none; border: 0; font-size: 30px; color: #c9b49a;
  cursor: pointer; opacity: .75; z-index: 5; }
.wfj-x:hover { opacity: 1; }

/* the book: leather boards, the pages inside */
.wfj-book { --hand: "Hand Cedarville Cursive", "Caveat", cursive; --note: "Hand Zeyada", "Caveat", cursive;
  --ink: #2a1d14; --graphite: #45413f; --edge: rgba(70,40,15,.35);
  position: relative; padding: 10px; border-radius: 6px 10px 10px 6px;
  background: linear-gradient(90deg, #2c1c12, #3b2618 6%, #3b2618 94%, #2c1c12);
  box-shadow: 0 30px 60px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.04); }
.wfj-book.is-spread::after { content: ""; position: absolute; top: 10px; bottom: 10px; left: 50%; width: 40px;
  transform: translateX(-50%); pointer-events: none; z-index: 4;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.28) 45%, rgba(0,0,0,.4) 50%, rgba(0,0,0,.28) 55%, transparent); }
/* a notepad: bound at the top, card back, no boards */
.wfj-book.is-pad { padding: 0; border-radius: 3px; background: #2b2b2b; border-top: 14px solid #1e1e1e;
  box-shadow: 0 24px 50px rgba(0,0,0,.6); }

.wfj-stage { position: relative; perspective: 2400px; }
.wfj-pg, .wfj-face { position: absolute; top: 0; overflow: hidden; container-type: inline-size;
  background: #c9a877 center / cover no-repeat; color: var(--ink); }
.wfj-pg::before, .wfj-face::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 6cqw var(--edge); }          /* handled edges */
.wfj-left::before { box-shadow: inset -2cqw 0 4cqw rgba(0,0,0,.18), inset 0 0 6cqw var(--edge); }
.wfj-right::before { box-shadow: inset 2cqw 0 4cqw rgba(0,0,0,.18), inset 0 0 6cqw var(--edge); }
.wfj-pg:empty { display: none; }
.wfj-pgin { position: absolute; overflow: hidden; }
.wfj-flow { position: absolute; left: 0; top: 0; }
.wfj-measure { position: absolute; visibility: hidden; pointer-events: none; container-type: inline-size; }
.wfj-num { position: absolute; bottom: 2.4cqw; left: 0; right: 0; text-align: center; font-family: var(--hand);
  font-size: 3.4cqw; opacity: .5; z-index: 1; }

/* his hand */
/* the contents and the tucked-in papers start a page; the days run on, a new day only a dated line (the mock book) */
.wfj-sec { break-before: column; }
.wfj-sec:first-child, .wfj-sec.is-run + .wfj-sec.is-run { break-before: auto; }
.wfj-sec.is-run + .wfj-sec.is-run .wfj-date { margin-top: 3cqw; }
/* no clearing between days: the next day's writing runs on beside a drawing rather than leave paper blank */
.wfj-head { font-family: var(--hand); font-weight: 400; font-size: 4.8cqw; margin: 1cqw 0 1cqw;
  text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .25em; break-after: avoid-column; }
.wfj-hand { font-family: var(--hand); font-size: 4.3cqw; line-height: 1.42; }
.wfj-scrap { margin: 0 0 .9cqw; break-inside: avoid-column; }
.wfj-scrap s { text-decoration-thickness: .12em; opacity: .85; }
.wfj-scrap.is-memory { padding-left: 3cqw; opacity: .86; font-style: italic; margin: 2cqw 0 1.6cqw; }
/* the player's own lines: the book's hand and ink, like every other line in it (owner, 13 Nov: anything else
   breaks the immersion) - set a little in from the margin where they were added */
.wfj-note { font-family: var(--hand); font-size: 4.3cqw; line-height: 1.42; color: var(--ink);
  margin: .4cqw 0 1cqw 3cqw; transform: rotate(-.6deg); break-inside: avoid-column; }
.wfj-pg { cursor: text; }
.wfj-pg button { cursor: pointer; }
.wfj-penbox { position: absolute; z-index: 6; display: flex; align-items: flex-end; gap: 6px; }
.wfj-penbox textarea { flex: 1; resize: none; overflow: hidden; background: rgba(255,255,255,.18); border: 0;
  border-bottom: 1px dashed rgba(60,40,20,.45); outline: none; color: var(--ink); padding: 2px 4px;
  font-family: var(--hand); font-size: 22px; line-height: 1.3; }
.wfj-penbox button { font: 400 .85rem "IM Fell English", Georgia, serif; color: #f1e6d2; background: #3b2618;
  border: 0; border-radius: 999px; padding: .25rem .8rem; cursor: pointer; }
.wfj-pen { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; font-style: italic;
  color: #8a7864; font-size: .95rem; }

.wfj-empty { font-family: var(--hand); font-size: 4.6cqw; opacity: .8; margin-top: 30cqw; text-align: center; }

/* contents, in his hand */
.wfj-toc { list-style: none; padding: 0; margin: 2cqw 0 0; }
.wfj-toc button { background: none; border: 0; color: var(--ink); font-family: var(--hand); font-size: 4.3cqw;
  cursor: pointer; padding: .4cqw 0; text-align: left; line-height: 1.3; }
.wfj-toc button span { opacity: .62; font-size: 3.6cqw; }

/* drawings sit IN the page, to one side, the writing running on beside them; his notes under the drawing, never on it */
.wfj-sketch { float: left; width: 46cqw; margin: 1cqw 3.5cqw 1.5cqw -1cqw; break-inside: avoid-column; }
/* a map page: the whole width of the page, the book's hand on its names (core/survey_map draws it from the record) */
.wfj-map { margin: 1.5cqw -1cqw 2cqw; break-inside: avoid-column; --map-hand: var(--hand); mix-blend-mode: multiply; }
.wfj-map svg { display: block; width: 100%; height: auto; max-height: calc(var(--pg-h, 900px) * .5); }
.wfj-map .wfj-label { display: inline-block; margin: .4cqw 2cqw 0 0; }
.wfj-sketch.is-right { float: right; margin: 1cqw -1cqw 1.5cqw 3.5cqw; }
.wfj-sketch img { display: block; width: 100%; height: auto; max-height: calc(var(--pg-h, 900px) * .45);
  object-fit: contain; mix-blend-mode: multiply; filter: grayscale(.4) contrast(1.05); }
.wfj-sketch-wait { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-family: var(--note);
  font-size: 4.2cqw; color: var(--graphite); border: 1px dashed rgba(60,40,20,.35); }
.wfj-label { display: block; font-family: var(--note); color: var(--graphite); font-size: 3.9cqw; line-height: 1.1;
  margin: .6cqw 0 0 2cqw; }
.wfj-sketch.is-right .wfj-label { text-align: right; margin: .6cqw 2cqw 0 0; }
.wfj-sketch .wfj-note { margin: 1cqw 0 0 2cqw; }
/* the hero drawn by someone close (core/drawn_by): their note in their own hand, a hand the bond picks */
.wfj-by { display: block; margin: 1cqw 1cqw 0 2cqw; font-size: 4cqw; line-height: 1.25; color: #3b2f4a;
  transform: rotate(-1.5deg); font-family: "Hand Kalam", var(--note); }
.wfj-sketch.is-right .wfj-by { text-align: right; margin: 1cqw 2cqw 0 1cqw; transform: rotate(1.2deg); }
.wfj-by-love { font-family: "Hand Dancing Script", var(--note); font-size: 4.6cqw; }
.wfj-by-comrade { font-family: "Hand Rock Salt", var(--note); font-size: 3.4cqw; color: #2f2a26; }
.wfj-by-friend { font-family: "Hand Homemade Apple", var(--note); font-size: 3.5cqw; }
.wfj-by-companion { font-family: "Hand Kalam", var(--note); }
.wfj-by-child { font-family: "Hand Gochi Hand", var(--note); font-size: 4.4cqw; }
.wfj-label-0 { transform: rotate(-2deg); } .wfj-label-1 { transform: rotate(1.6deg); }
.wfj-label-2 { transform: rotate(-1deg); } .wfj-label-3 { transform: rotate(2.2deg); }

/* things tucked in: their own paper, laid on the page */
.wfj-tuck { position: relative; margin: 4cqw 2cqw 5cqw; padding: 6cqw; background: #e8dcc0 center / cover no-repeat;
  box-shadow: 0 1.2cqw 3cqw rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.06); break-inside: avoid-column; color: #241a12; }
.wfj-tuck b { display: block; font-family: "Hand Just Another Hand", var(--note); font-weight: 400; font-size: 6cqw;
  line-height: 1; margin-bottom: 1.5cqw; }
.wfj-tuck span { display: block; font-family: "Hand Kalam", var(--note); font-size: 3.9cqw; line-height: 1.35; }
.wfj-tuck:nth-child(odd) { transform: rotate(-2.2deg); }
.wfj-tuck:nth-child(even) { transform: rotate(1.8deg); margin-left: 6cqw; }

/* the controls on the desk under the book */
.wfj-foot { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.wfj-foot button { font: 400 1rem "IM Fell English", Georgia, serif; color: #c9b49a;
  background: rgba(255,255,255,.04); border: 1px solid rgba(201,180,154,.28); border-radius: 999px;
  padding: .45rem 1.1rem; cursor: pointer; }
.wfj-foot button:hover { background: rgba(255,255,255,.09); }
.wfj-foot button:disabled { opacity: .35; cursor: default; }
.wfj-count { font-style: italic; color: #8a7864; font-variant-numeric: tabular-nums; min-width: 9ch; text-align: center; }
/* the turning leaf: front and back each carry a page; over the spine (a book) or up over the top (a pad) */
.wfj-leaf { position: absolute; top: 0; display: none; transform-style: preserve-3d; pointer-events: none; z-index: 3; }
.wfj-leaf.is-on { display: block; }
.wfj-face { left: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 0 22px rgba(0,0,0,.25); }
.wfj-back { transform: rotateY(180deg); }
.wfj-leaf.is-fwd, .wfj-leaf.is-back { transform-origin: left center; animation: .7s cubic-bezier(.45,.05,.3,1) forwards; }
.wfj-leaf.is-fwd { animation-name: wfj-fwd; }
.wfj-leaf.is-back { animation-name: wfj-bk; }
@keyframes wfj-fwd { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes wfj-bk { from { transform: rotateY(-180deg); } to { transform: rotateY(0); } }
.wfj-leaf.is-pad .wfj-back { transform: rotateX(180deg); }
.wfj-leaf.is-pad.is-fwd { transform-origin: center top; animation-name: wfj-up; }
.wfj-leaf.is-pad.is-back { transform-origin: center top; animation-name: wfj-down; }
@keyframes wfj-up { from { transform: rotateX(0); } to { transform: rotateX(180deg); } }
@keyframes wfj-down { from { transform: rotateX(180deg); } to { transform: rotateX(0); } }
.wfj-leaf.is-fwd .wfj-front, .wfj-leaf.is-back .wfj-back { animation: wfj-shade .7s ease-in-out; }
@keyframes wfj-shade { 50% { filter: brightness(.8); } }
@media (prefers-reduced-motion: reduce) { .wfj-leaf { display: none !important; } }
.wfj-art { font-style: normal; display: inline-flex; gap: 4px; align-items: center; }
.wfj-art button { font: 400 .9rem "IM Fell English", Georgia, serif; color: #c9b49a; background: rgba(255,255,255,.04);
  border: 1px solid rgba(201,180,154,.28); border-radius: 999px; padding: .15rem .8rem; cursor: pointer; }
.wfj-art button[aria-checked="true"] { background: #c9b49a; color: #2a1d14; border-color: #c9b49a; }

/* the index at the back of the book (core/hero_journal.index_terms): in his hand, a letter over each run of names */
.wfj-ixl { font-family: var(--hand); font-size: 5cqw; margin: 2.4cqw 0 .4cqw; opacity: .8; break-after: avoid-column; }
.wfj-ix { font-family: var(--hand); font-size: 3.9cqw; line-height: 1.3; margin: 0 0 .3cqw 2cqw; break-inside: avoid-column; }
.wfj-ix span { opacity: .75; }
.wfj-ix button { background: none; border: 0; padding: 0 .2em; color: var(--ink); font: inherit; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: .2em; }

/* papers laid in on their day (core/tucked): a letter in its writer's hand, the hero's label over it in his own;
   printed things in the type of their era (core/print_type, fonts/print) */
.wfj-tuck.is-hand span { font-family: var(--tuck-hand), var(--note); font-size: 4.2cqw; line-height: 1.35;
  margin-bottom: .6cqw; }
.wfj-tuck.is-hand b { font-family: var(--hand); font-size: 4.4cqw; opacity: .8; }
.wfj-tk-love_letter span { font-size: 4.8cqw; }
.wfj-tk-note { padding: 4cqw 5cqw; margin-right: 10cqw; }
.wfj-tk-child_drawing { margin: 3cqw 6cqw 4cqw; padding: 3cqw; }
.wfj-tk-child_drawing svg { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.wfj-tk-child_drawing figcaption { font-family: var(--tuck-hand), var(--note); font-size: 5cqw; color: #1f6fb2;
  transform: rotate(-3deg); margin: .5cqw 0 0 4cqw; }
/* printed: the headline in the era's display face, the text in its body face, all ink on the sheet */
.wfj-pr { text-align: center; color: #1b130d; }
.wfj-pr b { font-weight: 400; line-height: 1; margin-bottom: 2cqw; letter-spacing: .02em; }
.wfj-pr span { font-size: 3.7cqw; line-height: 1.35; margin-bottom: .8cqw; }
.wfj-pr-blackletter b { font-family: "Print Texturina", "IM Fell English", serif; font-size: 7.5cqw; }
.wfj-pr-blackletter span { font-family: "IM Fell English", "Print Old Standard", Georgia, serif; }
.wfj-pr-woodtype b { font-family: "Print Rye", "Print Old Standard", serif; font-size: 8.5cqw; text-transform: uppercase; }
.wfj-pr-woodtype span { font-family: "Print Old Standard", Georgia, serif; }
.wfj-pr-press b { font-family: "Print Old Standard", Georgia, serif; font-weight: 700; font-size: 6.4cqw; text-transform: uppercase; }
.wfj-pr-press span { font-family: "Print Old Standard", Georgia, serif; }
.wfj-pr-typewriter { text-align: left; }
.wfj-pr-typewriter b, .wfj-pr-typewriter span { font-family: "Hand Special Elite", "Courier New", monospace; }
.wfj-pr-typewriter b { font-size: 4.4cqw; text-transform: uppercase; }
.wfj-pr-typewriter span { font-size: 3.6cqw; }
.wfj-tk-wanted_poster b { font-size: 11cqw; }

/* the player's own pages (core/hero_journal.player_page): in the book's hand and ink, like every other line */
.wfj-chapter { font-size: 6.4cqw; text-align: center; text-decoration: none; margin: 4cqw 0 .4cqw; }
.wfj-chdate { font-family: var(--hand); font-size: 3.6cqw; text-align: center; opacity: .65; margin: 0 0 3cqw; }
.wfj-table { margin: 1.5cqw 0 2.5cqw; break-inside: avoid-column; }
.wfj-table figcaption { font-family: var(--hand); font-size: 4.3cqw; margin-bottom: .6cqw; text-decoration: underline;
  text-decoration-thickness: .05em; text-underline-offset: .2em; }
.wfj-table table { border-collapse: collapse; font-family: var(--hand); font-size: 3.8cqw; line-height: 1.25;
  color: var(--ink); }
.wfj-table th, .wfj-table td { border: 1px solid rgba(42,29,20,.55); padding: .5cqw 1.6cqw; text-align: left;
  vertical-align: top; font-weight: 400; }
.wfj-table th { border-bottom-width: 2px; }
.wfj-drawing { float: left; width: 46cqw; margin: 1cqw 3.5cqw 1.5cqw -1cqw; break-inside: avoid-column; }
.wfj-drawing.is-right { float: right; margin: 1cqw -1cqw 1.5cqw 3.5cqw; }
.wfj-drawing svg { display: block; width: 100%; height: auto; max-height: calc(var(--pg-h, 900px) * .45);
  fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; mix-blend-mode: multiply; }
.wfj-drawing figcaption { font-family: var(--hand); font-size: 3.9cqw; text-align: center; transform: rotate(-1deg); }

/* the pen's modes: a note in the margin, a chapter, a table, a drawing */
.wfj-penbox { flex-wrap: wrap; background: rgba(233,220,195,.92); padding: 6px 8px 8px; border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.wfj-pen-modes { flex: 0 0 100%; display: flex; gap: 4px; margin-bottom: 4px; }
.wfj-pen-modes button { font: 400 .8rem "IM Fell English", Georgia, serif; color: #3b2618; background: transparent;
  border: 1px solid rgba(59,38,24,.35); border-radius: 999px; padding: .1rem .7rem; cursor: pointer; }
.wfj-pen-modes button[aria-selected="true"] { background: #3b2618; color: #f1e6d2; border-color: #3b2618; }
.wfj-pen-title { flex: 0 0 100%; background: rgba(255,255,255,.25); border: 0; border-bottom: 1px dashed rgba(60,40,20,.45);
  outline: none; color: var(--ink); font-family: var(--hand); font-size: 24px; padding: 2px 4px; margin-bottom: 4px; }
.wfj-pen-title[hidden] { display: none; }

/* the drawing pad, over the book */
.wfj-pad { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; background: rgba(15,11,8,.82); }
.wfj-pad-sheet { background: #c9a877 center / cover no-repeat; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.wfj-pad-sheet canvas { display: block; cursor: crosshair; touch-action: none; mix-blend-mode: multiply; }
.wfj-pad-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.wfj-pad-row input { font: 400 1rem "IM Fell English", Georgia, serif; padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid rgba(201,180,154,.4); background: rgba(255,255,255,.06); color: #f1e6d2; min-width: 14ch; }
.wfj-pad-row button, .wfj-side button { font: 400 .95rem "IM Fell English", Georgia, serif; color: #c9b49a;
  background: rgba(255,255,255,.04); border: 1px solid rgba(201,180,154,.28); border-radius: 999px;
  padding: .35rem 1rem; cursor: pointer; }
.wfj-pad-row button.is-main { background: #c9b49a; color: #2a1d14; }

/* double-click a word: the menu in a side panel */
.wfj-side { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); z-index: 8; padding: 22px 20px;
  background: #1f1712; border-left: 1px solid rgba(201,180,154,.2); box-shadow: -18px 0 40px rgba(0,0,0,.45);
  transform: translateX(105%); transition: transform .25s ease; overflow-y: auto; color: #e3d3b9; }
.wfj-side.is-on { transform: none; }
.wfj-side h4 { font: 400 1.6rem "IM Fell English", Georgia, serif; margin: 8px 0 2px; color: #f1e6d2; }
.wfj-side-x { position: absolute; top: 8px; right: 10px; border: 0 !important; font-size: 1.6rem !important; padding: 0 .4rem !important; }
.wfj-side-kind { font-style: italic; color: #a8957c; margin: 0 0 10px; }
.wfj-side-label { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: #8a7864; margin: 14px 0 6px; }
.wfj-side-pages { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.wfj-side-pages button { padding: .15rem .7rem; }
.wfj-side-none { font-style: italic; color: #8a7864; margin: 0; }
.wfj-side-menu { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.wfj-side-menu button { width: 100%; text-align: left; }
@media (prefers-reduced-motion: reduce) { .wfj-side { transition: none; } }

/* the way to the book's second edition, the manga (wf-manga.js; shown only when its switch is on) */
.wfj-manga { margin-left: 12px; background: none; border: 1px solid currentColor; color: inherit; border-radius: 3px;
  padding: 2px 9px; font: inherit; cursor: pointer; opacity: .85; }
.wfj-manga:hover { opacity: 1; }
.wfj-manga[hidden] { display: none; }
