/* SOJANG 2026-11-21 production visual hotfix.
   Keeps the author's physical manuscript dimensions intact: the prior Figma
   CSS forced 365px widths, ignoring editor.js' per-book 148mm page width,
   causing inconsistent wraps and clipping in the split-page editor. */
@media(min-width:701px){
 body.editor-mode .editor-paper,
 body.editor-mode .sojang-next-editor-paper{
   width:var(--sj-print-page-width,461.76px)!important;
   height:var(--sj-print-page-height,655.2px)!important;
   min-height:var(--sj-print-page-height,655.2px)!important;
   max-width:none!important;
   flex:0 0 auto!important;
   box-sizing:border-box!important;
 }
 body.editor-mode .editor-paper-shell{
   width:max-content!important;
   height:max-content!important;
   min-width:0!important;
   max-width:none!important;
   flex:0 0 auto!important;
   align-self:center!important;
   justify-content:center!important;
 }
 body.editor-mode .editor-canvas{
   display:flex!important;
   flex-direction:column!important;
   align-items:center!important;
   justify-content:flex-start!important;
   overflow-x:auto!important;
   overflow-y:auto!important;
   overscroll-behavior:contain;
   min-height:0!important;
   scroll-padding:16px;
 }
}
body.editor-mode .editor-canvas > .page-navigation{
 display:flex!important;
 align-items:center!important;
 justify-content:flex-end!important;
 gap:12px!important;
 position:relative!important;
 inset:auto!important;
 flex:0 0 auto!important;
 width:100%!important;
 min-height:58px!important;
 padding:8px 14px!important;
 margin:0!important;
 border:1px solid #ebdfe6!important;
 border-radius:9px!important;
 background:#fffefc!important;
 z-index:5!important;
}
body.editor-mode .editor-canvas > .page-navigation .page-count-label{
 flex:1;
 text-align:left;
 color:#625865;
 font:500 12px/1.5 "Noto Sans KR",sans-serif;
}
body.editor-mode .editor-canvas > .page-navigation button{
 flex:none!important;
 min-height:40px!important;
 border:1px solid #b49bad!important;
 border-radius:6px!important;
 padding:9px 12px!important;
 background:#fffefc!important;
 color:#784963!important;
}
body.editor-mode .editor-canvas > .editor-page-warning{
 flex:0 0 auto;
 max-width:100%;
 margin:0 8px 3px;
 text-align:left;
 color:#a33c53;
}
@media(max-width:700px){
 body.editor-mode .editor-canvas > .page-navigation{
   position:fixed!important;
   inset:auto 0 0!important;
   border-radius:0!important;
   z-index:95!important;
   display:grid!important;
   grid-template-columns:repeat(3,minmax(0,1fr))!important;
   gap:8px!important;
   padding:7px 12px!important;
 }
 body.editor-mode .editor-canvas > .page-navigation .page-count-label{
   grid-column:1/-1;
   text-align:center!important;
   font-size:11px!important;
 }
 body.editor-mode .editor-canvas > .page-navigation button{
   width:100%!important;
   min-width:0!important;
   font-size:11px!important;
   padding:7px 5px!important;
 }
 body.editor-mode .editor-paper-shell{zoom:1!important}
}
/* Restore Figma's complete 2×2 action grid on author-owned books.
   The like action is visibly present but disabled to avoid an owner-only
   write operation the existing server doesn't permit. */
.sj-detail-parity .sj-detail-actions-social #likeButton:disabled{
 display:inline-flex!important;
 opacity:.62!important;
 cursor:not-allowed!important;
 background:#fffefc!important;
 color:#625865!important;
}
/* Correct publication terminology in the metadata and give the author and
   reader the same stable visual action layout regardless of saved state. */
.sj-detail-parity .sj-detail-actions-social{
 display:grid!important;
 grid-template-columns:repeat(2,minmax(0,160px))!important;
 gap:12px!important;
}
.sj-detail-parity .sj-detail-actions-social>button{
 width:160px!important;
}
.sj-detail-parity .detail-content .sj-book-meta{
 margin-bottom:10px!important;
}
@media(max-width:600px){
 .sj-detail-parity .sj-detail-actions-social{
   width:100%!important;
   grid-template-columns:repeat(2,minmax(0,1fr))!important;
   gap:8px!important;
 }
 .sj-detail-parity .sj-detail-actions-social>button{
   width:100%!important;
   max-width:100%!important;
 }
}

/* The legacy .wrap rule capped /book at 1184px even for 1536px displays.
   Figma's R01 hero spans the viewport with a consistent 48px side gutter. */
@media(min-width:851px){
 .sj-detail-parity{
   width:calc(100% - 96px)!important;
   max-width:1440px!important;
 }
}
@media(min-width:601px) and (max-width:850px){
 .sj-detail-parity{
   width:calc(100% - 44px)!important;
   max-width:none!important;
 }
}
@media(max-width:600px){
 .sj-detail-parity{
   width:calc(100% - 32px)!important;
 }
}
/* Long synopses keep their underlying full text and expand on demand, rather
   than pushing all reading/action controls below the fold. */
.sj-detail-parity .detail-synopsis:not(.sj-synopsis-expanded){
 display:-webkit-box;
 -webkit-box-orient:vertical;
 -webkit-line-clamp:4;
 line-clamp:4;
 overflow:hidden;
 white-space:pre-line;
}
.sj-detail-parity .sj-synopsis-toggle{
 display:inline-flex;
 align-items:center;
 min-height:36px;
 padding:4px 0;
 margin:0 0 9px;
 background:transparent;
 border:0;
 color:#784963;
 text-decoration:underline;
 text-underline-offset:3px;
 font:500 12px/1.5 "Noto Sans KR",sans-serif;
 cursor:pointer;
}
body.editor-mode .editor-paper .paper-content,
body.editor-mode .sojang-next-editor-paper .paper-content{
 overflow:hidden!important;
 min-height:0!important;
 overflow-wrap:anywhere!important;
}
body.editor-mode .editor-canvas > .editor-page-warning:not([hidden]){
 display:flex!important;
 flex-direction:column;
 align-items:flex-start;
 gap:10px;
 width:100%;
 background:#fff3f1!important;
 border:1px solid #e1a2a5;
 padding:12px 14px;
 border-radius:8px;
}
body.editor-mode #repairPageOverflow{
 min-height:38px;
 font:600 12px/1.5 "Noto Sans KR",sans-serif;
 background:#fffefc;
 border:1px solid #a74258;
 border-radius:6px;
 color:#a74258;
 padding:8px 12px;
 cursor:pointer;
}

/* 2026-11-21: A saved manuscript still had its final text line visually
   crossing the page folio. The PDF's @page fix did not affect the editor:
   #pageEditor had an inline important overflow:hidden and no bottom safe area.
   Keep manuscript content scroll-accessible until its safe server split runs. */
body.editor-mode .editor-paper,
body.editor-mode .sojang-next-editor-paper{
 display:flex!important;
 flex-direction:column!important;
 overflow:hidden!important;
}
body.editor-mode .editor-paper .paper-kicker,
body.editor-mode .sojang-next-editor-paper .paper-kicker{
 flex:0 0 auto!important;
}
body.editor-mode .editor-paper .paper-content,
body.editor-mode .sojang-next-editor-paper .paper-content{
 flex:1 1 auto!important;
 min-height:0!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 overflow-wrap:anywhere!important;
 box-sizing:border-box!important;
 padding-bottom:var(--sj-editor-bottom-clearance,27px)!important;
 scrollbar-width:none!important;
}
body.editor-mode .editor-paper .paper-content::-webkit-scrollbar,
body.editor-mode .sojang-next-editor-paper .paper-content::-webkit-scrollbar{
 display:none;
}
body.editor-mode .editor-paper .paper-footer,
body.editor-mode .sojang-next-editor-paper .paper-footer{
 position:relative!important;
 z-index:3!important;
 flex:0 0 auto!important;
 margin-top:9px!important;
 padding-top:11px!important;
 min-height:24px!important;
 border-top:1px solid #e6d9e1!important;
 background:linear-gradient(90deg,#faf6f1 0%,#fffefc 9%,#fffefc 92%,#f8f1e9 100%)!important;
 color:#625865!important;
}
/* Keep the split action visible above the scrollable manuscript, not after
   the last page inside the editor canvas where it was initially unreachable. */
body.editor-mode .sj-editor-body > .editor-page-warning:not([hidden]){
 display:flex!important;
 flex-direction:row!important;
 justify-content:space-between!important;
 align-items:center!important;
 flex-wrap:wrap!important;
 gap:10px!important;
 flex:0 0 auto!important;
 width:100%!important;
 margin:0!important;
 padding:13px 16px!important;
 border:1px solid #dda4ad!important;
 border-radius:8px!important;
 background:#fff3f1!important;
 color:#893448!important;
 font:500 13px/1.65 "Noto Sans KR",sans-serif!important;
}
body.editor-mode .sj-editor-body > .editor-page-warning[hidden]{
 display:none!important;
}
body.editor-mode .sj-editor-body > .editor-page-warning #repairPageOverflow{
 display:inline-flex!important;
 justify-content:center!important;
 align-items:center!important;
 border:1px solid #a33c53!important;
 color:#a33c53!important;
 background:#fffefc!important;
 border-radius:7px!important;
 padding:9px 13px!important;
 min-height:40px!important;
 cursor:pointer;
 font:600 12px/1.5 "Noto Sans KR",sans-serif!important;
}
@media(max-width:700px){
 body.editor-mode .sj-editor-body > .editor-page-warning:not([hidden]){
   padding:9px 10px!important;
   font-size:11px!important;
 }
 body.editor-mode .sj-editor-body > .editor-page-warning #repairPageOverflow{
   min-height:36px!important;
   font-size:11px!important;
 }
}
