/* Shared reading controls, after the existing Journal palette/integration layers. */
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-tree,
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-children { list-style:none; margin:0; padding:0; }
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-tree { gap:12px; }
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-children {
  gap:2px; margin:5px 0 0 11px; padding:0 0 0 10px; border-left:1px solid var(--line,#d4dddc);
}
html[data-variant="journal"] .toc[data-toc-enhanced] li { min-width:0; margin:0; padding:0; }
html[data-variant="journal"] .toc[data-toc-enhanced] li[data-level="2"] > .toc-link { font-weight:600; }
html[data-variant="journal"] .toc[data-toc-enhanced] li[data-level="3"] > .toc-link,
html[data-variant="journal"] .toc[data-toc-enhanced] li[data-level="4"] > .toc-link {
  grid-template-columns:32px minmax(0,1fr) 8px; gap:6px; min-height:42px; padding:7px 7px;
  font-weight:400; font-size:.8125rem; line-height:1.8; background:transparent;
}
html[data-variant="journal"] .toc[data-toc-enhanced] li[data-level="4"] > .toc-link { font-size:.75rem; color:var(--muted,#626d70); }
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-text { padding-left:0; font-size:inherit; overflow-wrap:anywhere; }
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-children .toc-number { width:auto; height:auto; font-size:.6875rem; color:var(--muted,#626d70); background:none; }
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-children .toc-chevron { font-size:1rem; }
html[data-variant="journal"] .toc[data-toc-enhanced] .toc-children a[aria-current] { color:var(--accent,#116d85); background:var(--journal-surface,#dcecf0); box-shadow:inset 2px 0 var(--accent,#116d85); }
html[data-variant="journal"] .toc[data-toc-enhanced] .is-current-branch > .toc-link > .toc-text { color:var(--accent,#116d85); }
html[data-variant="journal"] .mustache-content [data-mtcj-manual-toc][hidden] { display:none !important; }
html[data-variant="journal"] .mustache-content a[data-mtcj-zoom] { cursor:zoom-in; box-shadow:none; border:0; }
html[data-variant="journal"] .mustache-content a.mtcj-image-link { display:inline-block; max-width:100%; vertical-align:middle; }
html[data-variant="journal"] .mustache-content a.mtcj-image-link img { margin:0; }
html[data-variant="journal"] .mustache-content .wp-block-gallery a.mtcj-image-link { width:100%; height:100%; }
.mtcj-image-hint { display:block; margin:7px 0 0; color:#626d70; font:400 12px/1.7 var(--sans,sans-serif); text-align:center; }
html.mtcj-viewer-open { overflow:hidden !important; }
.mtcj-viewer {
  position:fixed; inset:0; width:calc(100vw - 32px); height:calc(100vh - 32px); height:calc(100dvh - 32px);
  max-width:1600px; max-height:none; margin:auto; padding:0; border:1px solid #465458; border-radius:6px;
  background:#162126; color:#fffef9; overflow:hidden; font-family:var(--sans,"Noto Sans JP",sans-serif); box-shadow:0 20px 70px #0005;
}
.mtcj-viewer[open] { display:flex; flex-direction:column; }
.mtcj-viewer::backdrop { background:rgb(9 17 21 / .88); }
.mtcj-viewer__bar { display:flex; flex:0 0 auto; align-items:center; flex-wrap:wrap; gap:8px; padding:12px 16px; border-bottom:1px solid #3b484e; }
.mtcj-viewer__label { margin-right:auto; font-size:13px; font-weight:500; letter-spacing:.06em; }
.mtcj-viewer button {
  appearance:none; display:inline-flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; margin:0;
  padding:0 12px; background:#293a42; border:1px solid #52616a; border-radius:3px; box-shadow:none; color:#fffef9; font:500 14px/1.2 var(--sans,sans-serif); cursor:pointer;
}
.mtcj-viewer button:hover { background:#3d525e; }
.mtcj-viewer button:disabled { opacity:.35; cursor:default; }
.mtcj-viewer :is(button,a):focus-visible { outline:2px solid #2cd4fc; outline-offset:3px; }
.mtcj-viewer__percent { min-width:48px; text-align:center; font-size:12px; font-variant-numeric:tabular-nums; }
.mtcj-viewer__stage { position:relative; flex:1 1 auto; min-height:0; overflow:hidden; touch-action:none; user-select:none; cursor:zoom-in; }
.mtcj-viewer__stage.is-zoomed { cursor:grab; }
.mtcj-viewer__stage.is-dragging { cursor:grabbing; }
.mtcj-viewer__stage img { position:absolute; left:50%; top:50%; max-width:none !important; max-height:none !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0; object-fit:contain; transform-origin:center; pointer-events:none; will-change:transform; }
.mtcj-viewer__status { position:absolute; inset:0; display:grid; place-items:center; padding:24px; text-align:center; font-size:14px; }
.mtcj-viewer [hidden] { display:none !important; }
.mtcj-viewer__footer { flex:0 0 auto; padding:12px 16px; border-top:1px solid #3b484e; }
.mtcj-viewer__caption { font-size:13px; line-height:1.7; margin:0 0 8px; max-height:4.8em; overflow-y:auto; color:#e3edf0; }
.mtcj-viewer__tools { display:flex; gap:8px; align-items:center; }
.mtcj-viewer__count { min-width:44px; text-align:center; font-size:12px; font-variant-numeric:tabular-nums; }
.mtcj-viewer__help { flex:1; margin:0; font-size:11px; line-height:1.7; color:#bacbd3; }
.mtcj-viewer__source { margin-left:auto; color:#d0ebf5; font-size:12px; white-space:nowrap; text-decoration:underline; }
@media (max-width:760px) {
  html[data-variant="journal"] .toc[data-toc-enhanced] .toc-children { margin-left:10px; padding-left:8px; }
  html[data-variant="journal"] .toc[data-toc-enhanced] li[data-level="3"] > .toc-link { min-height:44px; font-size:.875rem; }
  html[data-variant="journal"] .toc[data-toc-enhanced] li[data-level="4"] > .toc-link { min-height:44px; font-size:.8125rem; }
  .mtcj-viewer { width:calc(100vw - 12px); height:calc(100vh - 12px); height:calc(100dvh - 12px); }
  .mtcj-viewer__bar { padding:8px; gap:5px; }
  .mtcj-viewer__label { font-size:11px; letter-spacing:0; }
  .mtcj-viewer button { padding:0 9px; }
  .mtcj-viewer__footer { padding:9px; }
  .mtcj-viewer__tools { flex-wrap:wrap; }
  .mtcj-viewer__help { flex-basis:100%; order:1; }
}
@media (prefers-reduced-motion:reduce) { .mtcj-viewer * { scroll-behavior:auto !important; } }
