/* Printed selection frames and cut-paper marks replace the old blue left rules.
   Load after the component themes. Dataset directory and method catalogue cards
   have their own local treatment; chart marks and semantic quotations stay local. */

/* Floating reading directories: reserve the same border in every state. */
:is(body.studio-d.experience,body[data-portal-reader]) .ftoc:not(.dtoc) .ftoc-scroll :is(button,a,.ew-outline-item) {
  border:1px solid transparent!important;
  box-shadow:none!important;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ftoc:not(.dtoc) .ftoc-scroll :is([aria-current="true"],[aria-current="page"],[aria-current="location"],.is-selected,.cw-anchor-active,.cw-practice-active) {
  color:var(--ink)!important;
  border-color:var(--ink)!important;
  background:#f1f3d6!important;
  box-shadow:none!important;
  outline:1px dashed #22241f52;
  outline-offset:-4px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ftoc:not(.dtoc) .ftoc-trigger i {
  flex:none; width:8px; height:8px; margin-left:4px;
  border:1px solid var(--ink); border-radius:1px;
  background:var(--coral); opacity:1; transform:rotate(-13deg);
}
:is(body.studio-d.experience,body[data-portal-reader]) .ftoc:not(.dtoc) .ftoc-scroll .ew-outline-item.is-selected::before,
:is(body.studio-d.experience,body[data-portal-reader]) .ltoc .ltoc-paper::before {
  display:none;
}

/* Related method navigation shares the directory's printed frame. */
:is(body.studio-d.experience,body[data-portal-reader]) .mm-root.mm-explorer :is(.mm-question-nav button,.mm-local-toc-links button,.mm-method-entry) {
  border:1px solid transparent;
}
:is(body.studio-d.experience,body[data-portal-reader]) .mm-root.mm-explorer :is(.mm-question-nav button,.mm-local-toc-links button,.mm-method-entry):hover {
  color:var(--ink); background:var(--paper-deep); box-shadow:none;
}
:is(body.studio-d.experience,body[data-portal-reader]) .mm-root.mm-explorer :is(.mm-question-nav button[aria-current="true"],.mm-local-toc-links button[aria-current="true"],.mm-hub-method.is-selected,.mm-method-entry.active) {
  color:var(--ink); border-color:var(--ink)!important;
  background:#f1f3d6; box-shadow:none;
  outline:1px dashed #22241f52; outline-offset:-4px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .mm-root.mm-explorer .mm-hub-head h2 {
  border-left:0; padding-left:0;
}
:is(body.studio-d.experience,body[data-portal-reader]) .mm-root.mm-explorer .mm-hub-head h2::before {
  content:""; display:inline-block; width:9px; height:9px; margin:0 10px 2px 1px;
  border:1px solid var(--ink); border-radius:1px; background:var(--coral);
  transform:rotate(-12deg); vertical-align:middle;
}

/* Resource records: an entire frame and a small top-right cut corner. */
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-resource-open {
  border:1px solid transparent;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-resource-row.is-active>.dx-resource-open {
  border-color:var(--ink); background:#f1f3d6!important; box-shadow:none;
  outline:1px dashed #22241f52; outline-offset:-4px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-inline-detail {
  border:1px solid var(--line); border-top:0; border-radius:0 0 12px 12px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-inline-detail::before {
  content:""; position:absolute; right:0; top:0; width:18px; height:18px;
  background:var(--coral); clip-path:polygon(0 0,100% 0,100% 100%);
  pointer-events:none;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer :is(.dx-detail-column h4,.dx-subhead h4) {
  border:1px solid var(--line); border-radius:4px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer :is(.dx-detail-column h4,.dx-subhead h4)::after {
  content:""; display:inline-block; width:5px; height:5px; margin-left:7px;
  border:1px solid var(--ink); background:var(--coral); transform:rotate(-12deg);
  vertical-align:middle;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-cohort-context {
  position:relative; border:1px solid var(--line); border-radius:12px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-cohort-context::after {
  content:""; position:absolute; top:0; right:15px; width:23px; height:5px;
  border-inline:1px solid var(--ink); background:var(--coral);
  transform:skewX(-24deg); pointer-events:none;
}

/* Existing chapter rules become compact geometric registration marks. */
:is(body.studio-d.experience,body[data-portal-reader]) :is(.cr-content,.dw-article) h2::before {
  width:8px; height:8px; border:1px solid var(--ink); border-radius:1px;
  background:var(--coral); transform:rotate(-12deg);
}
:is(body.studio-d.experience,body[data-portal-reader]):not(.experience) h2:not(#TOC h2)::before {
  width:8px; height:8px; border:1px solid var(--ink); border-radius:1px;
  background:var(--coral); transform:rotate(-12deg);
}
:is(body.studio-d.experience,body[data-portal-reader]) .ps-studio .ps-chapter-nav>button[aria-selected="true"] {
  outline:1px dashed #22241f52; outline-offset:-4px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ew-workspace .ew-outline-item {
  border:1px solid transparent;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ew-workspace .ew-outline-item.is-selected {
  border:1px solid var(--ink); background:#f1f3d6;
  outline:1px dashed #22241f52; outline-offset:-4px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ew-workspace .ew-outline-item.is-selected::before {
  display:none;
}

/* Remaining boxed summaries use full paper edges, keeping source quotations intact. */
:is(body.studio-d.experience,body[data-portal-reader]) :is(.notice,.evidence-context,.stlab-explanation,.paper-question-line,.pb-summary) {
  border:1px solid var(--line); border-radius:8px;
  background:var(--paper); color:var(--type-ink);
}
:is(body.studio-d.experience,body[data-portal-reader]) :is(.lx-preview-finding,.xn-source-figure .iv-source-link,.evidence-claim-link) {
  border:1px solid var(--line); border-radius:8px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ps-studio :is(.ps-first-move>div,.ps-reading-note,.ps-first-trial) {
  border:1px solid var(--line); border-radius:8px;
}
:is(body.studio-d.experience,body[data-portal-reader]) .xn-launch::before {
  inset:0 0 auto auto; width:22px; height:22px;
  clip-path:polygon(0 0,100% 0,100% 100%); background:var(--coral);
}
:is(body.studio-d.experience,body[data-portal-reader]) .dw-reading-meta {
  border-left:0; padding-left:0;
}
:is(body.studio-d.experience,body[data-portal-reader]) :is(.cr-content,.dw-article) :is(figcaption,caption) {
  border-left:0; border-top:1px dashed var(--line);
}
:is(body.studio-d.experience,body[data-portal-reader]) .ew-figure-claims h3 {
  border-left:0; padding-left:0;
}
:is(body.studio-d.experience,body[data-portal-reader]) .ew-figure-claims h3::before {
  content:""; display:inline-block; width:6px; height:6px; margin:0 8px 1px 1px;
  border:1px solid var(--ink); background:var(--coral); transform:rotate(-12deg);
  vertical-align:middle;
}
:is(body.studio-d.experience,body[data-portal-reader]) .iv-dialog.iv-dialog .iv-caption,
:is(body.studio-d.experience,body[data-portal-reader]) #detail .drawer-publication {
  border-left:0; padding-left:0;
}
:is(body.studio-d.experience,body[data-portal-reader]):not(.experience) :is(figcaption,caption) {
  border-left:0; border-top:1px dashed var(--line);
}
:is(body.studio-d.experience,body[data-portal-reader]):not(.experience) .reader-bar::after {
  border-left:0; padding-left:0;
}
:is(body.studio-d.experience,body[data-portal-reader]).presentation .presentation-stage .ed-stage-methods {
  border:1px solid var(--line); border-radius:5px;
}
:is(body.studio-d.experience,body[data-portal-reader]) :is(.mm-panel-loading,.mm-panel-notice) {
  border:1px dashed var(--line); border-radius:7px;
}

/* Pattern frames yield to a distinct keyboard ring. */
:is(body.studio-d.experience,body[data-portal-reader]) .ftoc:not(.dtoc) .ftoc-scroll :is(button,a):focus-visible,
:is(body.studio-d.experience,body[data-portal-reader]) .mm-root.mm-explorer :is(.mm-question-nav button,.mm-local-toc-links button,.mm-hub-method,.mm-method-entry):focus-visible,
:is(body.studio-d.experience,body[data-portal-reader]) .dx-explorer .dx-resource-open:focus-visible,
:is(body.studio-d.experience,body[data-portal-reader]) .ps-studio .ps-chapter-nav>button:focus-visible,
:is(body.studio-d.experience,body[data-portal-reader]) .ew-workspace .ew-outline-item:focus-visible {
  outline:2px solid var(--electric)!important; outline-offset:2px;
}
@media(prefers-reduced-motion:reduce) {
  :is(body.studio-d.experience,body[data-portal-reader]) .ftoc:not(.dtoc) .ftoc-trigger i {
    transition:none;
  }
}
@media print {
  :is(body.studio-d.experience,body[data-portal-reader]):not(.experience) h2:not(#TOC h2)::before {
    display:none;
  }
}
