/*
 * 只保留 PDF.js 文字层所需的样式，从 pdf_viewer.css 原样摘出（PDF.js 5.6.205，Apache-2.0）。
 *
 * 为什么不直接引 pdf_viewer.css：那是整个 PDF.js 官方阅读器界面的样式表，
 * 里面有 .sidebar / .toolbar / .page / .dialog 等通用类名，会和本应用同名的界面元素冲突
 * （曾导致侧栏被它的 max-width 压窄）。我们只用 PDF.js 的渲染能力，界面完全自己写，
 * 所以这里只留 .textLayer 相关规则。
 *
 * 升级 PDF.js 时：从新版 pdf_viewer.css 里重新摘 .textLayer 段落覆盖本文件。
 */
.textLayer{
  --csstools-color-scheme--light:initial;
  color-scheme:only light;

  position:absolute;
  text-align:initial;
  inset:0;
  overflow:clip;
  opacity:1;
  line-height:1;
  -webkit-text-size-adjust:none;
     -moz-text-size-adjust:none;
          text-size-adjust:none;
  forced-color-adjust:none;
  transform-origin:0 0;
  caret-color:CanvasText;
  z-index:0;
}

.textLayer.highlighting{
    touch-action:none;
  }

.textLayer :is(span,br){
    color:transparent;
    position:absolute;
    white-space:pre;
    cursor:text;
    transform-origin:0% 0%;
  }

.textLayer{
  --min-font-size:1;
  --text-scale-factor:calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv:calc(1 / var(--min-font-size));
}

.textLayer  > :not(.markedContent),.textLayer .markedContent span:not(.markedContent){
    z-index:1;

    --font-height:0;
    font-size:calc(var(--text-scale-factor) * var(--font-height));

    --scale-x:1;
    --rotate:0deg;
    transform:rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
  }

.textLayer .markedContent{
    display:contents;
  }

.textLayer span[role="img"]{
    -webkit-user-select:none;
       -moz-user-select:none;
            user-select:none;
    cursor:default;
  }

.textLayer .highlight{
    --highlight-bg-color:rgb(180 0 170 / 0.25);
    --highlight-selected-bg-color:rgb(0 100 0 / 0.25);
    --highlight-backdrop-filter:none;
    --highlight-selected-backdrop-filter:none;
  }

@media screen and (forced-colors: active){

.textLayer .highlight{
      --highlight-bg-color:transparent;
      --highlight-selected-bg-color:transparent;
      --highlight-backdrop-filter:var(--hcm-highlight-filter);
      --highlight-selected-backdrop-filter:var(
        --hcm-highlight-selected-filter
      );
  }
    }

.textLayer .highlight{

    margin:-1px;
    padding:1px;
    background-color:var(--highlight-bg-color);
    -webkit-backdrop-filter:var(--highlight-backdrop-filter);
            backdrop-filter:var(--highlight-backdrop-filter);
    border-radius:4px;
  }

.appended:is(.textLayer .highlight){
      position:initial;
    }

.begin:is(.textLayer .highlight){
      border-radius:4px 0 0 4px;
    }

.end:is(.textLayer .highlight){
      border-radius:0 4px 4px 0;
    }

.middle:is(.textLayer .highlight){
      border-radius:0;
    }

.selected:is(.textLayer .highlight){
      background-color:var(--highlight-selected-bg-color);
      -webkit-backdrop-filter:var(--highlight-selected-backdrop-filter);
              backdrop-filter:var(--highlight-selected-backdrop-filter);
      scroll-margin-top:50px;
    }

.textLayer ::-moz-selection{
    background:rgba(0 0 255 / 0.25);
    background:color-mix(in srgb, AccentColor, transparent 75%);
  }

.textLayer ::selection{
    background:rgba(0 0 255 / 0.25);
    background:color-mix(in srgb, AccentColor, transparent 75%);
  }

.textLayer br::-moz-selection{
    background:transparent;
  }

.textLayer br::selection{
    background:transparent;
  }

.textLayer .endOfContent{
    display:block;
    position:absolute;
    inset:100% 0 0;
    z-index:0;
    cursor:default;
    -webkit-user-select:none;
       -moz-user-select:none;
            user-select:none;
  }

.textLayer.selecting .endOfContent{
    top:0;
  }
