/* v1.9.3 — mobile portrait single-page mode.
   Live only: one vertical page, swipe/drag page-by-page, with scale transition.
   Desktop/editor book geometry remains untouched. */
@media (max-width: 760px){
  body.nc-mobile-portrait-page{
    overflow-x:hidden!important;
    min-height:100dvh!important;
  }
  body.nc-mobile-portrait-page .topbar{
    height:64px!important;
    padding:0 12px!important;
    position:sticky!important;
    top:0!important;
    z-index:90!important;
    backdrop-filter:blur(8px)!important;
  }
  body.nc-mobile-portrait-page .brand{gap:10px!important;min-width:0!important;}
  body.nc-mobile-portrait-page .logo{width:42px!important;height:42px!important;font-size:24px!important;flex:0 0 auto!important;}
  body.nc-mobile-portrait-page .brand h1{font-size:17px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
  body.nc-mobile-portrait-page .brand span,
  body.nc-mobile-portrait-page .nav button:not(#themeToggle),
  body.nc-mobile-portrait-page .nav a:not(.cta),
  body.nc-mobile-portrait-page .nav .cta{display:none!important;}
  body.nc-mobile-portrait-page .theme-toggle{padding:10px 16px!important;}

  body.nc-mobile-portrait-page .stage{
    min-height:calc(100dvh - 64px)!important;
    padding:14px 0 96px!important;
    overflow:hidden!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
  }
  body.nc-mobile-portrait-page .magazine-shell{
    width:100vw!important;
    max-width:none!important;
    margin:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    position:relative!important;
  }

  /* The mobile page is intentionally a portrait sheet, not a compressed spread. */
  body.nc-mobile-portrait-page .book-wrap{
    width:min(92vw, 470px)!important;
    height:min(calc(100dvh - 178px), 720px)!important;
    min-height:520px!important;
    max-height:760px!important;
    aspect-ratio:auto!important;
    perspective:1600px!important;
    transform-origin:center center!important;
    transition:transform .42s cubic-bezier(.22,.61,.36,1), opacity .32s ease!important;
    touch-action:pan-y!important;
  }
  body.nc-mobile-portrait-page .book{
    position:absolute!important;
    inset:0!important;
    transform:none!important;
    filter:drop-shadow(0 24px 26px rgba(0,0,0,.54))!important;
  }
  body.nc-mobile-portrait-page .book:before{
    inset:5% -8% -8%!important;
    opacity:.62!important;
  }

  body.nc-mobile-portrait-page .spread{
    position:absolute!important;
    inset:0!important;
    display:block!important;
    opacity:0!important;
    pointer-events:none!important;
    transition:opacity .18s ease!important;
  }
  body.nc-mobile-portrait-page .spread.is-active{
    opacity:1!important;
    pointer-events:auto!important;
  }
  body.nc-mobile-portrait-page .spread .page{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    display:none!important;
    border-radius:18px!important;
    padding:22px 20px 38px!important;
    overflow:hidden!important;
    box-shadow:inset 0 0 38px rgba(75,47,14,.18), 0 14px 30px rgba(0,0,0,.28)!important;
  }
  body.nc-mobile-portrait-page .spread.mobile-show-left .page.left,
  body.nc-mobile-portrait-page .spread.mobile-show-right .page.right{
    display:block!important;
  }
  body.nc-mobile-portrait-page .page.left,
  body.nc-mobile-portrait-page .page.right{border-radius:18px!important;}
  body.nc-mobile-portrait-page .page:before{inset:18px!important;}
  body.nc-mobile-portrait-page .spine{display:none!important;}

  body.nc-mobile-portrait-page .page-safe-area{
    height:100%!important;
    grid-template-rows:auto 1fr!important;
    gap:8px!important;
  }
  body.nc-mobile-portrait-page .page-head{min-height:72px!important;}
  body.nc-mobile-portrait-page .eyebrow{font-size:12px!important;letter-spacing:2px!important;}
  body.nc-mobile-portrait-page .page-title{
    font-size:clamp(30px, 10vw, 50px)!important;
    line-height:.88!important;
    max-width:100%!important;
  }
  body.nc-mobile-portrait-page .editorial-grid{
    height:100%!important;
    min-height:0!important;
    overflow:hidden!important;
  }

  /* Hide side stacks/tabs on very small screens only if they would make the page unreadable; otherwise keep a narrow paper edge. */
  body.nc-mobile-portrait-page .stack-left,
  body.nc-mobile-portrait-page .stack-right{
    width:18px!important;
    top:3.5%!important;
    bottom:3.5%!important;
    opacity:.48!important;
    z-index:-2!important;
  }
  body.nc-mobile-portrait-page .stack-left{left:-10px!important;}
  body.nc-mobile-portrait-page .stack-right{right:-10px!important;}
  body.nc-mobile-portrait-page .tabs{display:none!important;}

  body.nc-mobile-portrait-page .controls{
    height:88px!important;
    grid-template-columns:1fr 1.25fr 1fr!important;
    gap:8px!important;
    padding:12px!important;
    z-index:95!important;
  }
  body.nc-mobile-portrait-page .view-buttons{display:none!important;}
  body.nc-mobile-portrait-page .ctrl-btn{
    height:50px!important;
    padding:0 10px!important;
    font-size:13px!important;
    border-radius:12px!important;
  }
  body.nc-mobile-portrait-page .pager{font-size:13px!important;}
  body.nc-mobile-portrait-page .range{margin-top:8px!important;}
  body.nc-mobile-portrait-page .range i{width:20px!important;height:20px!important;}

  body.nc-mobile-portrait-page .nc-mobile-drag-hint{
    position:fixed!important;
    left:50%!important;
    bottom:91px!important;
    transform:translateX(-50%)!important;
    z-index:96!important;
    padding:8px 12px!important;
    border-radius:999px!important;
    background:rgba(10,7,4,.64)!important;
    color:#fff3c4!important;
    font-size:11px!important;
    font-weight:900!important;
    pointer-events:none!important;
    border:1px solid rgba(245,205,84,.26)!important;
    backdrop-filter:blur(8px)!important;
  }

  /* Drag feedback: the page scales and slides subtly, rather than flattening into a landscape card. */
  body.nc-mobile-portrait-page .book-wrap.nc-mobile-dragging{
    transition:none!important;
  }
  body.nc-mobile-portrait-page .book-wrap.nc-mobile-dragging[data-mobile-dir="next"] .spread.is-active .page{
    transform:translateX(calc(var(--mobile-drag-p,0) * -22px)) scale(calc(1 - var(--mobile-drag-p,0) * .035)) rotateY(calc(var(--mobile-drag-p,0) * -5deg))!important;
    transform-origin:right center!important;
  }
  body.nc-mobile-portrait-page .book-wrap.nc-mobile-dragging[data-mobile-dir="prev"] .spread.is-active .page{
    transform:translateX(calc(var(--mobile-drag-p,0) * 22px)) scale(calc(1 - var(--mobile-drag-p,0) * .035)) rotateY(calc(var(--mobile-drag-p,0) * 5deg))!important;
    transform-origin:left center!important;
  }
  body.nc-mobile-portrait-page .book-wrap.nc-mobile-turning-next{animation:ncMobileScaleNext .38s cubic-bezier(.22,.61,.36,1);}
  body.nc-mobile-portrait-page .book-wrap.nc-mobile-turning-prev{animation:ncMobileScalePrev .38s cubic-bezier(.22,.61,.36,1);}
  @keyframes ncMobileScaleNext{
    0%{transform:translateX(14px) scale(.965);opacity:.72;}
    60%{transform:translateX(-4px) scale(1.018);opacity:1;}
    100%{transform:translateX(0) scale(1);opacity:1;}
  }
  @keyframes ncMobileScalePrev{
    0%{transform:translateX(-14px) scale(.965);opacity:.72;}
    60%{transform:translateX(4px) scale(1.018);opacity:1;}
    100%{transform:translateX(0) scale(1);opacity:1;}
  }
}
