/* The booklet builder (/journeys/<slug>/booklet/, content/booklet-page.js). Loaded after
   worksheet-print.css, worksheet-night.css and print-names.css, which give the paper its
   .ws-* / cw-* / wsr-* / dfn-* / scr-* look and the .ws-page (A4) / .ws-half (A5) boxes.
   Two parts: the night builder around the paper (screen), and the paper (screen preview and
   print). Printed pages are black on white; every page is drawn full size with @page margin 0
   so the footer URL is part of the page and is never clipped. */

/* ── The builder (screen) ──────────────────────────────────────────────────── */
@media screen {
.bk .bk-main { max-width: 980px; margin: 0 auto; padding: 26px 18px 80px; font-family: var(--font-body, 'Nunito Sans', system-ui, sans-serif); color: #E4D9FF; }
.bk .bk-title { font-family: var(--font-display, 'Baloo 2', cursive); font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 800; color: #fff; margin: 0 0 4px; line-height: 1.15; }
.bk .bk-lede { margin: 0 0 18px; font-size: 1.05rem; color: #C4B5FD; }
.bk .bk-lede strong { color: #fff; }
.bk .bk-status { color: #9B8AC4; font-weight: 700; }
.bk .bk-wrap { display: grid; gap: 16px; }
.bk .bk-card {
    background: #33255A; border: 1px solid rgba(255,255,255,.12); border-radius: 20px;
    padding: 16px 20px 18px; box-shadow: 0 20px 44px rgba(11,16,32,.3);
}
.bk .bk-card-h { font-family: var(--font-display, 'Baloo 2', cursive); font-size: 1.15rem; font-weight: 800; color: #fff; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.bk .bk-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #FBBF24; color: #241a3c; font-size: .85rem; }
.bk .bk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.bk .bk-select, .bk .bk-text, .bk .bk-num-in {
    padding: 9px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18);
    background: rgba(16,8,34,.45); color: #fff; font: 600 1rem var(--font-body, system-ui);
}
.bk .bk-select { min-width: min(100%, 360px); }
.bk .bk-text { flex: 1 1 200px; min-width: 0; }
.bk .bk-num-in { width: 5.2em; }
.bk .bk-custom { display: inline-flex; align-items: center; gap: 6px; color: #E4D9FF; font-weight: 700; }
.bk .bk-custom[hidden] { display: none; }
.bk .bk-select:focus-visible, .bk .bk-text:focus-visible, .bk .bk-num-in:focus-visible { outline: 3px solid #FBBF24; outline-offset: 1px; }
.bk .bk-radio, .bk .bk-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #fff; cursor: pointer; }
.bk .bk-radio input, .bk .bk-check input { accent-color: #FBBF24; width: 16px; height: 16px; }
.bk .bk-note { font-size: .88rem; font-weight: 600; color: #9B8AC4; margin: 6px 0 0; }
.bk .bk-quiet { font-size: .85rem; font-weight: 700; color: #FBBF24; margin: 8px 0 0; }
.bk .bk-tip { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.35); border-radius: 14px; padding: 10px 14px; color: #fff; font-weight: 700; margin: 0; }
.bk .bk-link { background: none; border: 0; padding: 2px 0; font: inherit; font-weight: 800; color: #C4B5FD; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.bk .bk-link:hover { color: #fff; }
.bk .bk-link:focus-visible, .bk .bk-btn:focus-visible, .bk summary:focus-visible { outline: 3px solid #FBBF24; outline-offset: 2px; }
.bk .bk-btn { display: inline-block; padding: 9px 16px; border-radius: 14px; border: 0; background: #7C2BF5; color: #fff; font: 800 1rem var(--font-display, system-ui); text-decoration: none; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.bk .bk-btn--quiet { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); box-shadow: none; }
.bk .bk-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bk .bk-file:focus-visible + .bk-btn { outline: 3px solid #FBBF24; outline-offset: 2px; }

.bk .bk-kinds { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 8px; color: #E4D9FF; font-size: .92rem; }
.bk .bk-kind b { margin-right: 6px; color: #fff; }
.bk .bk-kind.is-on b { color: #FBBF24; }
.bk .bk-count { margin: 0 0 10px; font-weight: 800; color: #fff; font-size: 1.05rem; }
.bk .bk-list { max-height: 440px; overflow: auto; border-radius: 14px; background: rgba(16,8,34,.35); border: 1px solid rgba(255,255,255,.08); }
.bk .bk-mod { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.bk .bk-mod.is-marked { background: rgba(251,191,36,.1); }
.bk .bk-mod.is-off .bk-mod-t, .bk .bk-mod.is-dev .bk-mod-t { color: #9B8AC4; }
.bk .bk-mod.is-off { opacity: .6; }
.bk .bk-mod--range { padding-left: 34px; font-style: italic; color: #C4B5FD; background: rgba(124,43,245,.12); }
.bk .bk-mod-n { flex: none; min-width: 1.8em; font-weight: 800; color: #9B8AC4; }
.bk .bk-mod-t { flex: 1; min-width: 0; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk .bk-chips { display: flex; align-items: center; gap: 8px; flex: none; }
.bk .bk-chip { border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; font: 700 .8rem var(--font-body, system-ui); padding: 3px 10px; cursor: pointer; }
.bk .bk-chip:hover { background: rgba(255,255,255,.18); }
.bk .bk-chip--dev { cursor: default; color: #9B8AC4; }
.bk .bk-add { position: relative; font-size: .85rem; font-weight: 800; color: #C4B5FD; }
.bk .bk-add summary { cursor: pointer; list-style: none; }
.bk .bk-add summary::-webkit-details-marker { display: none; }
.bk .bk-add-menu { position: absolute; right: 0; z-index: 5; display: grid; gap: 4px; min-width: 210px; padding: 10px 12px; background: #241a3c; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.4); text-align: left; }

.bk .bk-names .bk-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 10px; }
.bk .bk-pick-n { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px; background: rgba(16,8,34,.45); color: #fff; font-weight: 700; cursor: pointer; }
.bk .bk-pick-n input { accent-color: #FBBF24; }
.bk .bk-pick-n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk .bk-editor { margin-top: 12px; }

.bk .bk-formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bk .bk-format { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 10px 8px; border-radius: 16px; border: 2px solid rgba(255,255,255,.12); background: rgba(16,8,34,.35); color: #fff; font-weight: 800; font-size: .9rem; cursor: pointer; }
.bk .bk-format.is-on { border-color: #FBBF24; background: rgba(251,191,36,.1); }
.bk .bk-format input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bk .bk-format:focus-within { outline: 3px solid #FBBF24; outline-offset: 2px; }

.bk .bk-line { margin: 0 0 10px; font-weight: 700; color: #E4D9FF; }
.bk .bk-out-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bk .bk-out-row .ws-print-btn:disabled { background: rgba(255,255,255,.08); color: #9B8AC4; cursor: default; transform: none; }
.bk .bk-msg { margin: 10px 0 0; min-height: 1.2em; font-weight: 700; color: #FBBF24; }
.bk .bk-account { margin-top: 12px; padding: 14px 16px; border-radius: 16px; border: 1px solid rgba(251,191,36,.4); background: rgba(251,191,36,.08); }
.bk .bk-offer-t { margin: 0 0 4px; font-family: var(--font-display, system-ui); font-weight: 800; font-size: 1.1rem; color: #fff; }
.bk .bk-share { margin: 12px 0 0; color: #9B8AC4; font-weight: 700; }

.bk .bk-preview-wrap { }
.bk .bk-preview { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; max-height: 720px; overflow: auto; padding: 14px; border-radius: 18px; background: rgba(0,0,0,.25); }
.bk .bk-pv { zoom: .34; box-shadow: 0 6px 24px rgba(0,0,0,.45); background: #fff; display: flex; }
.bk .bk-pv--a5, .bk .bk-pv--spread.bk-pv--a5 { zoom: .5; }
.bk .bk-pv--spread { gap: 0; }
.bk .bk-pg--empty { width: 210mm; height: 297mm; background: transparent; }
.bk .bk-pv--a5 .bk-pg--empty { width: 148.5mm; height: 210mm; }
.bk .bk-about { margin: 22px 0 0; color: #9B8AC4; font-weight: 600; font-size: .92rem; }
.bk .bk-faq { margin-top: 18px; color: #E4D9FF; }
.bk .bk-faq h2 { font-family: var(--font-display, system-ui); font-size: 1.2rem; color: #fff; }
.bk .bk-faq details { border-top: 1px solid rgba(255,255,255,.1); padding: 8px 0; }
.bk .bk-faq summary { cursor: pointer; font-weight: 800; color: #fff; }
.bk .bk-faq p { margin: 6px 0 0; }
@media (max-width: 640px) {
    .bk .bk-main { padding: 18px 16px 60px; }
    .bk .bk-card { padding: 14px 14px 16px; }
    .bk .bk-mod-t { white-space: normal; }
}
}

/* ── The paper (preview and print) ─────────────────────────────────────────── */
.bk-out { display: none; }
.bk-pg {
    position: relative; flex: none; width: 210mm; height: 297mm; overflow: hidden; background: #fff;
    color: #1a1a2e; font-family: var(--ws-font); text-align: left; box-sizing: border-box;
}
.bk-pg .bk-box { position: absolute; left: 16mm; top: 16mm; --ws-accent: #1a1a2e; }
.bk-pg .bk-run, .bk-pg .bk-foot {
    position: absolute; left: 16mm; right: 16mm; display: flex; justify-content: space-between; gap: 8mm;
    font-size: 8pt; color: #6b7280; line-height: 1.2;
}
.bk-pg .bk-run { top: 8mm; }
.bk-pg .bk-foot { bottom: 9mm; }
.bk-pg .bk-run-who { font-weight: 700; color: #1a1a2e; }
.bk-pg--bound .bk-box.bk-box--bound { width: 168mm; }
.bk-pg--bound.bk-pg--front .bk-box { left: 26mm; }
.bk-pg--bound.bk-pg--front .bk-run, .bk-pg--bound.bk-pg--front .bk-foot { left: 26mm; right: 16mm; }
.bk-pg--bound.bk-pg--back .bk-box { left: 16mm; }
.bk-pg--bound.bk-pg--back .bk-run, .bk-pg--bound.bk-pg--back .bk-foot { left: 16mm; right: 26mm; }
.bk-pg--a5 { width: 148.5mm; height: 210mm; }
.bk-pg--a5 .bk-box { left: 8.5mm; top: 12mm; }
.bk-pg--a5 .bk-run, .bk-pg--a5 .bk-foot { left: 8.5mm; right: 8.5mm; }
.bk-pg--a5 .bk-run { top: 5.5mm; }
.bk-pg--a5 .bk-foot { bottom: 5mm; }

.bk-sheet { position: relative; width: 210mm; height: 297mm; overflow: hidden; background: #fff; }
.bk-sheet--land { display: flex; width: 297mm; height: 210mm; }

/* Module and sheet heading */
.bk-mod-head { display: flex; align-items: baseline; gap: 3mm; margin-bottom: 1mm; }
.bk-mod-num { font-size: 9pt; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; white-space: nowrap; }
.bk-mod-name { margin: 0; font-size: 14pt; line-height: 1.2; }
.ws-half .bk-mod-name, .bk-box.ws-half .bk-mod-name { font-size: 12pt; }

/* Cover */
.bk-cover { height: 100%; display: flex; flex-direction: column; justify-content: space-between; box-sizing: border-box; }
.bk-cover-top { min-height: 28mm; display: flex; flex-direction: column; gap: 3mm; }
.bk-logo { max-width: 60mm; max-height: 25mm; width: auto; height: auto; object-fit: contain; align-self: flex-start; }
.bk-school { font-size: 13pt; font-weight: 800; }
.bk-cover-mid { border-top: 1.2mm solid #1a1a2e; border-bottom: 1.2mm solid #1a1a2e; padding: 12mm 0; }
.bk-cover-tag { display: inline-block; border: .5mm solid #1a1a2e; padding: .8mm 3mm; font-size: 9pt; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 5mm; }
.bk-cover-title { font-size: 27pt; line-height: 1.12; margin: 0 0 4mm; font-weight: 800; }
.bk-cover-sub { font-size: 12pt; color: #374151; font-weight: 700; }
.bk-cover-part { margin-top: 3mm; font-size: 12pt; font-weight: 800; }
.bk-cover-fields { display: grid; gap: 7mm; padding-bottom: 6mm; font-size: 12pt; }
.bk-field { display: flex; align-items: baseline; gap: 3mm; font-weight: 800; }
.bk-field .bk-fill { flex: 1; min-width: 0; border-bottom: .4mm solid #1a1a2e; min-height: 1.5em; padding: 0 1mm; font-weight: 700; white-space: nowrap; overflow: hidden; }
.bk-field--short { max-width: 70%; }
.ws-half .bk-cover-title { font-size: 21pt; }
.ws-half .bk-cover-mid { padding: 9mm 0; }

/* Contents */
.bk-toc-title, .bk-key-title h2, .bk-divider h2, .bk-notes h2 { margin: 0 0 5mm; font-size: 17pt; font-weight: 800; }
.bk-toc-row { display: flex; align-items: baseline; gap: 2mm; padding: 1.1mm 0; font-size: 10pt; line-height: 1.3; }
.bk-toc-n { flex: none; width: 8mm; font-weight: 800; color: #6b7280; }
.bk-toc-name { min-width: 0; }
.bk-toc-dots { flex: 1; border-bottom: .3mm dotted #9ca3af; transform: translateY(-1mm); }
.bk-toc-pg { flex: none; font-weight: 800; min-width: 8mm; text-align: right; }
.bk-toc-row--sub { padding-left: 8mm; font-style: italic; }
.bk-toc-row--sub .bk-toc-n { width: 0; }

/* Dividers, notes, key */
.bk-divider { height: 100%; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 6mm; }
.bk-divider h2 { font-size: 30pt; margin: 0; }
.bk-divider p { margin: 0; font-size: 14pt; font-weight: 700; color: #374151; }
.bk-div-rule { border-top: 1.2mm solid #1a1a2e; }
.bk-notes { height: 100%; }
.bk-notes::after { content: ''; display: block; height: calc(100% - 14mm); background: repeating-linear-gradient(to bottom, transparent 0, transparent 7.4mm, #9ca3af 7.4mm, #9ca3af 7.8mm); }
.bk-key-head { display: flex; justify-content: space-between; gap: 6mm; margin: 5mm 0 2mm; padding-bottom: 1mm; border-bottom: .4mm solid #1a1a2e; font-weight: 800; font-size: 10.5pt; }
.bk-key-pg { color: #374151; white-space: nowrap; }

@media print {
    body.bk { background: #fff; }
    body.bk .no-print { display: none !important; }
    body.bk.bk-printing .bk-out { display: block; }
    .bk-sheet { break-after: page; page-break-after: always; break-inside: avoid; }
    .bk-sheet:last-child { break-after: auto; page-break-after: auto; }
    .bk-pg { -webkit-print-color-adjust: exact; print-color-adjust: exact; filter: grayscale(1); }
}
