/* Commentaries: base, state, and responsive rules. */

.dyw-resizer {
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
}

.dyw-resizer:hover {
  background: var(--accent-border);
}

.dyw-resizer.disabled {
  cursor: default;
  background: transparent;
  pointer-events: none;
}

.dyw-leftpane {
  display: none;
  direction: rtl;
  flex-shrink: 0;
}

#dywRow.panel-open .dyw-leftpane {
  display: flex;
}

.dyw-columns {
  display: flex;
  flex-shrink: 0;
  overflow: hidden;
  min-height: 0px;
}

.dyw-col {
  flex: 1 1 0px;
  min-width: 0px;
  min-height: 0px;
  display: flex;
  flex-direction: column;
  gap: 0px;
  padding: 0px;
  box-sizing: border-box;
}

.dyw-slot-filled {
  flex: 1 1 auto;
  margin: 0px;
  display: flex;
  flex-direction: column;
  min-height: 0px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--surface);
}

.dyw-slot-hdr {
  justify-content: space-between;
  font-weight: bold;
  cursor: grab;
  border-bottom: 1px solid var(--panel-border);
}

.dyw-slot-hdr-remove {
  border: 0;
  background: none;
  color: inherit;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}

.dyw-slot-hdr-remove:hover {
  opacity: 1;
}

.dyw-slot-body {
  overflow: auto;
  flex: 1 1 0%;
  min-height: 0px;
}

.dyw-slot-hdr.drag-over {
  outline-offset: -2px;
}

.dyw-tools {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  min-height: 0px;
  transition: width 0.15s;
}

.dyw-tools-content {
  flex: 1 1 auto;
  min-width: 0px;
  display: flex;
  flex-direction: column;
  min-height: 0px;
}

.dyw-tools.collapsed {
  width: 24px;
}

.dyw-tools.collapsed .dyw-tools-content {
  display: none;
}

.dyw-toolsbody {
  flex: 1 1 0%;
  min-height: 0px;
  overflow: auto;
  padding: 15px 8px 8px;
  background: var(--panel-bg);
}

.dyw-comm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: bold;
  color: var(--accent-primary);
  border-radius: 6px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
}

.dyw-comm-name {
  flex: 1 1 0%;
  min-width: 0px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dyw-toggle-wrap {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.dyw-toggle-wrap input {
  display: none;
}

.dyw-toggle-slider {
  position: absolute;
  inset: 0px;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
  background: var(--line-subtle);
}

.dyw-toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  transition: transform 0.2s;
  background: var(--surface);
}

.dyw-toggle-wrap input:checked + .dyw-toggle-slider {
  background: var(--accent-primary);
}

.dyw-toggle-wrap input:checked + .dyw-toggle-slider::before {
  transform: translateX(18px);
}

#dywRow .dyw-leftpane {
  display: flex;
}

#dywRow .dyw-leftpane:not(:has(.dyw-col)) {
  display: none;
}

.dyw-slot-hdr {
  border-bottom-width: 1px;
  border-bottom-style: solid;
  color: var(--accent-primary);
  font-size: 16px;
}

.dyw-slot-body {
  font-size: 16px;
  line-height: 1.85;
  padding: 16px;
  color: var(--accent-dark);
}

.dyw-slot-hdr-remove {
  font-size: 22px;
}

.dyw-slot-filled {
  border-radius: 10px;
}

.dyw-resizer {
  position: relative;
  width: var(--reading-gap) !important;
  margin: 0px !important;
  background: transparent !important;
}

.dyw-resizer::after {
  content: "";
  position: absolute;
  top: 45%;
  left: 5px;
  height: 46px;
  width: 4px;
  border-radius: 4px;
  background: var(--accent-border);
}

.dyw-resizer:hover::after, .dyw-resizer:focus::after {
  background: var(--accent-primary);
}

.desk-dialog .dyw-tools-content {
  width: 100%;
  display: block !important;
}

.desk-dialog .dyw-toolsbody {
  max-height: 43vh;
  overflow: auto;
  padding: 0px;
}

.desk-dialog .dyw-comm-row {
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: 9px;
  min-height: 42px;
  margin: 6px 0px;
  padding: 6px 10px;
}

.desk-dialog .dyw-comm-name {
  font-size: 16px;
  max-width: none;
  white-space: normal;
}

.desk-dialog .dyw-toggle-wrap {
  width: 22px;
  height: 22px;
}

.desk-dialog .dyw-toggle-slider {
  display: none;
}

button:focus-visible, .dyw-resizer:focus-visible {
  outline: var(--focus-ring) solid 3px;
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  .dyw-col {
    flex: 1 1 0px;
    overflow: hidden;
  }
}

.desk-dropdown .dyw-comm-row {
  border: 0px;
  border-radius: 6px;
  background: transparent;
  margin: 0px;
  min-height: 30px;
  padding: 5px 8px;
}

.desk-dropdown .dyw-comm-row:hover {
  background: var(--surface-interactive);
}

.desk-dropdown .dyw-comm-name {
  font-size: 15px;
}

.desk-dropdown .dyw-toolsbody {
  max-height: 420px;
}

.dyw-slot-hdr {
  box-sizing: border-box;
  height: 66px;
  min-height: 66px;
  flex: 0 0 66px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 9px 9px 0px 0px;
  overflow: hidden;
  line-height: 22px;
}

.dyw-slot-hdr > span {
  flex: 1 1 auto;
  min-width: 0px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.dyw-slot-hdr-remove {
  flex: 0 0 26px;
  width: 26px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  align-self: center;
}

.dyw-slot-hdr.drag-over {
  outline: none;
}

.desk-dropdown .dyw-comm-row, .desk-dropdown .dyw-comm-name, .dyw-slot-hdr > span {
  color: var(--reading-ink);
}

.desk-dropdown #dywCommList .dyw-comm-row {
  padding-inline: 12px;
  gap: 12px;
}

.dyw-slot-hdr {
  border-bottom-color: var(--accent-border);
  box-shadow: var(--panel-bg) 0px 1px 0px inset;
  background: var(--desk-gilded);
}

.dyw-slot-filled {
  border-color: var(--panel-border);
}

.dyw-slot-hdr.drag-over {
  box-shadow: var(--accent-primary) 0px 0px 0px 2px inset;
  background: var(--desk-gilded);
}

.desk-commentary-text[dir="ltr"], .desk-commentary-credit[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.desk-commentary-credit {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.page-container.full-mode.desk-scroll-full .dyw-slot-body {
  overflow: visible;
}

.page-container.full-mode.desk-scroll-viewport .dyw-slot-body, .page-container.full-mode.desk-scroll-viewport #deskTextView {
  overflow: auto;
}

.desk-resources-compact .desk-commentary-icon {
  font-family: "Times New Roman", serif;
  font-size: 27px;
  font-weight: 700;
  line-height: 24px;
  color: var(--accent-primary);
}

#deskTextContent, .dyw-slot-body {
  font-size: var(--reading-font-size);
}

.dyw-slot-body p, .dyw-slot-body div, .dyw-slot-body span, .dyw-slot-body font {
  font-size: inherit !important;
}

#dywResizer {
  touch-action: none;
  background: linear-gradient(to right,transparent 40%,var(--accent-border) 40%,var(--accent-border) 60%,transparent 60%);
}

.page-container.desk-commentaries-below #dywLeftPane {
  width: 100%;
  flex: 0 0 auto;
}

.page-container.desk-commentaries-below #dywResizer {
  display: none;
}

.page-container.desk-commentaries-below .dyw-col, .page-container.desk-commentaries-below .dyw-slot-filled {
  flex: 0 0 auto;
  overflow: visible;
}

.page-container.desk-commentaries-below .dyw-slot-body, .page-container.desk-commentaries-below #deskTextView {
  overflow: visible;
  flex: 0 0 auto;
}

.dyw-col.is-folded {
  flex: 0 0 var(--folded-width);
  width: var(--folded-width);
  padding: 0px;
}

.dyw-slot-body[hidden] {
  display: none !important;
}

.dyw-slot-hdr {
  gap: 4px;
}

.dyw-slot-title {
  flex: 1 1 0%;
  min-width: 0px;
}

.dyw-slot-fold, .dyw-slot-hdr-remove {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 9px;
  box-sizing: border-box;
  border: 0px;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-primary);
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dyw-slot-fold svg, .dyw-slot-hdr-remove svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
}

.dyw-slot-fold:hover, .dyw-slot-hdr-remove:hover {
  background: var(--accent-soft);
}

.dyw-slot-fold:focus-visible, .dyw-slot-hdr-remove:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: -3px;
}

.page-container:not(.desk-commentaries-below) .is-folded .dyw-slot-hdr {
  flex: 1 1 0%;
  flex-direction: column;
  justify-content: flex-start;
  padding: 6px 0px;
}

.page-container:not(.desk-commentaries-below) .is-folded .dyw-slot-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  flex: 0 1 auto;
  order: 3;
  margin-top: 8px;
}

.page-container:not(.desk-commentaries-below) .is-folded .dyw-slot-hdr-remove {
  order: 0;
}

.page-container:not(.desk-commentaries-below) .is-folded .dyw-slot-fold {
  order: 1;
}

.page-container.desk-commentaries-below .dyw-col.is-folded {
  width: 100%;
  flex: 0 0 auto;
}

#dywResizer::after {
  top: 0px;
  bottom: 0px;
  height: auto;
  width: 0px;
  left: calc(var(--reading-gap)/2);
  border-left: 1px dashed var(--accent-border);
  border-radius: 0px;
  background: none;
}

#dywResizer:hover::after, #dywResizer:focus-visible::after {
  border-color: var(--accent-primary);
  border-left-width: 2px;
  background: none;
}

#dywResizer.disabled {
  visibility: hidden;
  pointer-events: none;
}

.dyw-comm-name {
  cursor: pointer;
}

#dywRow .dyw-slot-filled, #dywRow #deskTextView {
  border-radius: var(--reading-radius);
}

#dywRow .dyw-slot-hdr {
  border-radius: calc(var(--reading-radius) - 1px) calc(var(--reading-radius) - 1px) 0 0;
}

#dywRow .is-folded .dyw-slot-hdr {
  border-radius: calc(var(--reading-radius) - 1px);
  border-bottom: 0px;
}

#deskCommentaryJump {
  position: fixed;
  z-index: var(--layer-toolbar);
  margin: 0px;
  direction: rtl;
  text-align: right;
}

#deskCommentaryJump button {
  box-shadow: 0 2px 8px var(--shadow-color);
}

#deskCommentaryJump[hidden] {
  display: none;
}

#deskCommentaryJump button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#deskCommentaryJump svg {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dyw-slot-hdr.desk-commentary-arrival {
  outline: 2px solid var(--focus-ring);
  outline-offset: -3px;
}

#dywColumns .dyw-slot-hdr {
  scroll-margin-top: 12px;
}

.desk-justify-text #deskTextContent, .desk-justify-text #deskTextContent p, .desk-justify-text #deskTextContent .desk-commentary-text, .desk-justify-text .dyw-slot-body, .desk-justify-text .dyw-slot-body p, .desk-justify-text .dyw-slot-body .desk-commentary-text {
  text-align: justify !important;
}

.desk-justify-text :is(#deskTextContent, .dyw-slot-body) :is(h2, h3, h4) {
  text-align: start;
}
