/* ── The Journal, as a book (Oct 2026) ──
   Parchment shows through the pages (semi-transparent paper, never opaque). Your own words are
   set in blue-black ink; kept passages read like print, in brown, inside a quiet box.
   EB Garamond is self-hosted (SIL Open Font License, public/fonts/eb-garamond/OFL.txt). */

@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/eb-garamond/eb-garamond-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('../fonts/eb-garamond/eb-garamond-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/eb-garamond/eb-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/eb-garamond/eb-garamond-latin-600-normal.woff2') format('woff2'); }

.page-journal {
  --jb-book: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --jb-ink: #24324a;
  --jb-print: #4a3f30;
  --jb-brown: #3d3225;
  --jb-label: #8b7355;
  --jb-muted: #98a0ad;
  --jb-rule: rgba(160, 140, 110, 0.3);
  --jb-paper: rgba(255, 251, 242, 0.72);
  --jb-gold: #b8860b;
  --jb-scale: 1;
}
/* Reading settings ("Aa"). Size scales the reading text; Clean swaps the book face for the
   system sans. Applied as classes on <body> by journal-book.js and remembered per device. */
.jb-size-s { --jb-scale: 0.9; }
.jb-size-l { --jb-scale: 1.16; }
.jb-font-clean.page-journal { --jb-book: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
.jb-toolbar-right { display: flex; gap: 8px; align-items: center; }
.jb-type { position: relative; }
.jb-typebtn { font-family: 'EB Garamond', Georgia, serif; font-size: 19px; min-width: 44px; min-height: 42px; border-radius: 10px;
  border: 1px solid var(--jb-rule); background: transparent; color: var(--jb-brown); cursor: pointer; }
.jb-typebtn[aria-expanded="true"] { background: rgba(61, 50, 37, 0.08); }
.jb-typepanel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 12px; border: 1px solid var(--jb-rule); background: rgba(255, 250, 240, 0.97);
  box-shadow: 0 10px 28px rgba(90, 70, 40, 0.16); width: max-content; max-width: calc(100vw - 32px); }
.jb-typepanel[hidden] { display: none; }
@media (max-width: 640px) { .jb-typepanel { left: 0; right: auto; } }
.jb-typepanel .jb-seg { align-self: flex-start; }
.jb-face-book { font-family: 'EB Garamond', Georgia, serif !important; font-size: 15px !important; }
.jb-chip-suggest { border-style: dashed; border-color: rgba(184, 134, 11, 0.5); color: #6b4f0a; }
.jb-chip-suggest small { color: #a8987c; }

/* Toolbar under the page header */
.jb-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 18px; }
.jb-seg { display: inline-flex; border: 1px solid var(--jb-rule); border-radius: 999px; overflow: hidden; align-self: center; }
.jb-seg button { font: inherit; font-size: 13.5px; min-height: 38px; padding: 0 16px; border: 0; background: transparent; color: rgba(61, 50, 37, 0.72); cursor: pointer; }
.jb-seg button[aria-pressed="true"] { background: rgba(61, 50, 37, 0.1); color: var(--jb-brown); font-weight: 600; }
.jb-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px;
  font: inherit; font-size: 14.5px; font-weight: 600; color: #fff; text-decoration: none; cursor: pointer;
  background: linear-gradient(135deg, #b8860b 0%, #8b6914 100%);
}
.jb-btn:disabled { opacity: 0.55; cursor: default; }
.jb-btn[hidden] { display: none; }
.jb-mini { font: inherit; font-size: 13px; color: var(--jb-label); background: none; border: 0; padding: 6px 4px; cursor: pointer; text-decoration: none; }
.jb-mini:hover { color: #6b5a3e; text-decoration: underline; }
.jb-danger { color: #a0522d; }
.jb-link { font-size: 13.5px; color: var(--jb-label); }
.jb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.jb-loading { text-align: center; padding: 60px 0; color: var(--jb-label); font-family: var(--jb-book); font-size: 19px; font-style: italic; }
.jb-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: rgba(61, 50, 37, 0.92); color: #fff8ec; font-size: 14px; max-width: calc(100% - 32px); }
.jb-toast[hidden] { display: none; }

/* The book */
.jb-spread {
  display: grid; grid-template-columns: 1fr; border: 1px solid var(--jb-rule); border-radius: 6px 14px 14px 6px;
  box-shadow: 0 18px 40px rgba(90, 70, 40, 0.14), 0 2px 6px rgba(90, 70, 40, 0.07);
}
.jb-single { max-width: 720px; margin: 0 auto; border-radius: 8px; }
.jb-page {
  position: relative; background: var(--jb-paper); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 34px 26px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; color: var(--jb-brown);
}
.jb-page + .jb-page { border-top: 1px solid var(--jb-rule); }
.jb-blank { min-height: 200px; }
@media (min-width: 900px) {
  .jb-spread:not(.jb-single) { grid-template-columns: 1fr 1fr; }
  .jb-spread:not(.jb-single) .jb-page { padding: 48px 52px 30px; min-height: clamp(440px, calc(100vh - 170px), 720px); }
  .jb-spread:not(.jb-single) .jb-page + .jb-page { border-top: 0; }
  .jb-page-left { box-shadow: inset -18px 0 24px -18px rgba(90, 70, 40, 0.25); }
  .jb-page-right { box-shadow: inset 18px 0 24px -18px rgba(90, 70, 40, 0.22); }
  .jb-single .jb-page { padding: 44px 56px 30px; }
}
.jb-folio { margin-top: auto; padding-top: 12px; text-align: center; font-family: var(--jb-book); font-size: 15px; color: var(--jb-muted); }
.jb-kicker { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--jb-label); font-weight: 600; }
.jb-h2 { margin: 0; font-family: var(--jb-book); font-weight: 500; font-size: 32px; text-align: center; color: var(--jb-brown); }
.jb-h3 { margin: 18px 0 4px; font-family: var(--jb-book); font-weight: 500; font-size: 22px; color: var(--jb-brown); }
.jb-note { margin: 0; font-size: 14px; line-height: 1.55; color: #6f6455; }

/* Title page */
.jb-titlepage { align-items: center; text-align: center; }
.jb-booktitle { margin: 18px 0 0; font-family: var(--jb-book); font-weight: 500; font-size: clamp(38px, 6vw, 52px); line-height: 1.05; color: var(--jb-brown); text-wrap: balance; }
.jb-begun { font-family: var(--jb-book); font-style: italic; font-size: 19px; color: #6b5a3e; }
.jb-fleuron { display: flex; align-items: center; gap: 10px; width: 120px; }
.jb-fleuron span { flex: 1; height: 1px; background: rgba(184, 134, 11, 0.5); }
.jb-fleuron i { width: 6px; height: 6px; border-radius: 50%; background: rgba(184, 134, 11, 0.7); }
.jb-stats { margin: 0; font-family: var(--jb-book); font-size: 18px; line-height: 1.55; color: #5b4d3a; max-width: 32ch; }
.jb-continue {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 20px; border: 1px solid var(--jb-rule); border-radius: 10px;
  text-decoration: none; color: var(--jb-brown); transition: all 0.25s ease;
}
.jb-continue:hover { background: rgba(255, 250, 240, 0.6); transform: translateY(-1px); }
.jb-continue span { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--jb-label); }
.jb-continue b { font-weight: 500; font-size: 15px; }
.jb-today { margin-top: auto; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 20px; border-top: 1px solid rgba(160, 140, 110, 0.2); }
.jb-today-prompt { margin: 0; font-family: var(--jb-book); font-style: italic; font-size: 19px; line-height: 1.45; color: var(--jb-brown); }
.jb-today-src { font-size: 12.5px; color: var(--jb-label); }
.jb-today-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.jb-btn.jb-btn-ghost { background: transparent; color: var(--jb-brown); border: 1px solid rgba(139, 105, 20, 0.55); box-shadow: none; }
.jb-btn.jb-btn-ghost:hover { background: rgba(184, 134, 11, 0.08); }
.jb-seg.jb-write-mode { align-self: flex-start; }

/* Contents */
.jb-toc-group { display: flex; flex-direction: column; gap: 4px; }
.jb-toc-head { display: flex; justify-content: space-between; align-items: baseline; }
.jb-toc-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.jb-toc-line > .jb-toc-row { flex: 1 1 240px; }
.jb-toc-row { display: flex; align-items: baseline; gap: 8px; min-height: 34px; text-decoration: none; color: var(--jb-brown); font-family: var(--jb-book); font-size: 20px; }
.jb-toc-row:hover .jb-toc-label { text-decoration: underline; text-decoration-color: rgba(139, 115, 85, 0.5); }
.jb-toc-count { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 12px; color: var(--jb-muted); }
.jb-toc-dots { flex: 1; min-width: 20px; border-bottom: 1.5px dotted rgba(139, 115, 85, 0.45); transform: translateY(-5px); }
.jb-toc-page { font-variant-numeric: tabular-nums; color: #6b5a3e; }
.jb-theme-edit { display: inline-flex; gap: 4px; }

/* Reading */
.jb-readbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.jb-where { font-size: 13.5px; color: rgba(61, 50, 37, 0.72); }
.jb-runhead { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: #a8987c; padding-right: 36px; }
.jb-date { margin: 6px 0 0; font-family: var(--jb-book); font-weight: 500; font-size: 30px; color: var(--jb-brown); }
.jb-meta { font-size: 13px; color: var(--jb-label); }
.jb-meta a { color: inherit; }
.jb-prompt { margin: 0; font-family: var(--jb-book); font-style: italic; font-size: calc(18px * var(--jb-scale)); line-height: 1.5; color: #6b5a3e; padding-left: 14px; border-left: 2px solid rgba(184, 134, 11, 0.35); }
.jb-quote { margin: 0; font-family: var(--jb-book); font-style: italic; font-size: calc(18px * var(--jb-scale)); line-height: 1.5; color: var(--jb-print); }
.jb-ink { font-family: var(--jb-book); font-size: calc(20px * var(--jb-scale)); line-height: 1.62; color: var(--jb-ink); max-width: 36em; overflow-wrap: anywhere; }
.jb-ink p { margin: 0 0 12px; }
.jb-ink p:last-child { margin-bottom: 0; }
.jb-label { font-size: 12px; color: var(--jb-label); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.jb-asked { display: flex; flex-direction: column; }
.jb-passage { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border-radius: 10px; border: 1px solid rgba(160, 140, 110, 0.25); background: rgba(255, 250, 240, 0.45); }
.jb-passage-head { display: flex; align-items: center; gap: 12px; }
.jb-passage-who { display: flex; flex-direction: column; }
.jb-passage-who b { font-family: var(--jb-book); font-weight: 500; font-size: 19px; font-variant: small-caps; letter-spacing: 0.5px; color: var(--jb-brown); }
.jb-passage-who span { font-size: 12px; color: var(--jb-label); }
.jb-mono { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; border: 2px solid #f0e6d0; background: #f7f4ef; }
.jb-passage-label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--jb-label); }
.jb-passage-text { font-family: var(--jb-book); font-size: calc(18px * var(--jb-scale)); line-height: 1.6; color: var(--jb-print); overflow-wrap: anywhere; }
.jb-passage-text p { margin: 0 0 10px; }
.jb-passage-text p:last-child { margin-bottom: 0; }
.jb-keythought { margin: 4px 0 0; font-family: var(--jb-book); font-style: italic; font-size: calc(21px * var(--jb-scale)); line-height: 1.45; color: var(--jb-brown); }
.jb-margin { display: flex; flex-direction: column; padding-left: 12px; border-left: 2px solid rgba(36, 50, 74, 0.18); }
.jb-margin .jb-ink { font-size: calc(19px * var(--jb-scale)); }
.jb-margin-editor { display: flex; flex-direction: column; gap: 10px; }
.jb-margin-add { align-self: flex-start; }
.jb-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.jb-actions-main { margin-top: 6px; }

/* Bookmark ribbon */
.jb-ribbon { position: absolute; top: -2px; right: 22px; width: 30px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: start center; }
.jb-ribbon svg { width: 20px; height: 28px; fill: transparent; stroke: rgba(139, 115, 85, 0.55); stroke-width: 1.5; transition: all 0.2s ease; }
.jb-ribbon:hover svg { stroke: var(--jb-gold); }
.jb-ribbon.jb-on svg { fill: var(--jb-gold); stroke: var(--jb-gold); fill-opacity: 0.85; }

/* Chips and pickers */
.jb-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.jb-chip {
  display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12.5px; min-height: 32px; padding: 0 11px; border-radius: 999px;
  border: 1px solid rgba(160, 140, 110, 0.38); background: transparent; color: #5e5040; cursor: pointer;
}
.jb-chip small { color: var(--jb-muted); font-size: 11px; }
.jb-chip button { border: 0; background: none; padding: 0 0 0 2px; font-size: 15px; line-height: 1; color: var(--jb-muted); cursor: pointer; min-width: 20px; min-height: 24px; }
.jb-chip button:hover { color: #a0522d; }
.jb-chip-add { border-style: dashed; color: var(--jb-label); }
.jb-chip-mood { font-style: italic; }
.jb-chip.jb-on { border-color: var(--jb-gold); background: rgba(184, 134, 11, 0.14); color: #6b4f0a; font-weight: 600; }
.jb-picker { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px; border-radius: 10px; background: rgba(255, 250, 240, 0.6); border: 1px solid rgba(160, 140, 110, 0.22); }
.jb-picker-input { font: inherit; font-size: 13px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(200, 190, 170, 0.6); background: rgba(255, 250, 240, 0.7); color: var(--jb-brown); min-width: 0; width: 190px; }
.jb-picker-input:focus { outline: none; border-color: #667eea; }

/* Writing */
.jb-lined {
  width: 100%; box-sizing: border-box; min-height: 260px; resize: vertical; border: 0; border-radius: 0; padding: 4px 2px;
  font-family: var(--jb-book); font-size: calc(20px * var(--jb-scale)); line-height: calc(32px * var(--jb-scale)); color: var(--jb-ink);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(32px * var(--jb-scale) - 1px), rgba(139, 115, 85, 0.22) calc(32px * var(--jb-scale) - 1px), rgba(139, 115, 85, 0.22) calc(32px * var(--jb-scale)));
}
.jb-margin-editor .jb-lined { min-height: 128px; }
.jb-asked .jb-lined { min-height: 110px; }
.jb-lined:focus { outline: 2px solid rgba(102, 126, 234, 0.35); outline-offset: 4px; }
.jb-fset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.jb-fset legend { padding: 0; margin-bottom: 8px; }

/* Turning pages */
.jb-turn { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.jb-turnbtn { font: inherit; font-size: 14px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid rgba(160, 140, 110, 0.32); background: transparent; color: #6b5a3e; cursor: pointer; }
.jb-turnbtn:disabled { opacity: 0.4; cursor: default; }
.jb-progress { flex: 1; max-width: 420px; height: 4px; border-radius: 4px; background: rgba(160, 140, 110, 0.2); overflow: hidden; }
.jb-progress i { display: block; height: 100%; background: rgba(184, 134, 11, 0.6); }

/* Find and list */
.jb-findwrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.jb-filters {
  flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 18px; padding: 20px; box-sizing: border-box;
  border-radius: 14px; border: 1px solid rgba(160, 140, 110, 0.28); background: rgba(255, 250, 240, 0.5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.jb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jb-field input, .jb-field select, .jb-results-tools select {
  font: inherit; font-size: 14.5px; min-height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(200, 190, 170, 0.6);
  background: rgba(255, 250, 240, 0.7); color: var(--jb-brown); min-width: 0; box-sizing: border-box;
}
.jb-field input:focus, .jb-field select:focus { outline: none; border-color: #667eea; }
.jb-twocol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.jb-results { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.jb-results-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.jb-results-bar p { margin: 0; font-size: 15px; color: #5e5040; }
.jb-results-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jb-result {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 16px 18px; border-radius: 14px; text-decoration: none; color: var(--jb-brown);
  border: 1px solid rgba(160, 140, 110, 0.2); background: transparent; transition: all 0.25s ease;
}
.jb-result:hover { background: rgba(255, 250, 240, 0.45); border-color: rgba(160, 140, 110, 0.35); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(120, 100, 70, 0.08); }
.jb-result-num { font-family: var(--jb-book); font-size: 26px; color: #b8a27e; text-align: right; font-variant-numeric: tabular-nums; }
.jb-result-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jb-result-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--jb-label); }
.jb-result-meta b { font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: rgba(160, 140, 110, 0.12); font-weight: 700; }
.jb-result-text { font-family: var(--jb-book); font-size: calc(18px * var(--jb-scale)); line-height: 1.5; overflow-wrap: anywhere; }
.jb-kind-writing .jb-result-text { color: var(--jb-ink); }
.jb-kind-kept .jb-result-text { color: var(--jb-print); }

/* Index of thinkers */
.jb-index-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid rgba(160, 140, 110, 0.12); font-family: var(--jb-book); font-size: 19px; }
.jb-index-name { flex: 0 0 auto; color: var(--jb-brown); }
.jb-index-pages { flex: 1; text-align: right; font-variant-numeric: tabular-nums; color: #6b5a3e; overflow-wrap: anywhere; }
.jb-index-pages a { color: inherit; }

@media (max-width: 640px) {
  .jb-ink { font-size: calc(19px * var(--jb-scale)); }
  .jb-date { font-size: 27px; }
  .jb-filters { max-width: none; }
  .jb-turnbtn { padding: 0 12px; }
}
