/* Screen-only contract preview chrome (paginated A4). Not used by WeasyPrint. */

html,
body {
  margin: 0;
  padding: 0;
  background: #eef1f5;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.doc-preview {
  --doc-desk: #eef1f5;
  --doc-ink: #1a1f24;
  --doc-muted: #6b7680;
  --doc-accent: #055096;
  --doc-line: rgba(26, 31, 36, 0.12);
  /* Sticky TOC/pager bar clearance for in-page scroll targets */
  --doc-bar-offset: 3.5rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: var(--doc-desk);
  color: var(--doc-ink);
  font-family: "Wix Madefor Display", sans-serif;
  /* Keep legal clause counters continuous across paginated pages */
  counter-reset: sec;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.doc-preview[data-ready="0"] {
  opacity: 0;
}

.doc-preview[data-ready="1"] {
  opacity: 1;
}

.doc-preview:fullscreen,
.doc-preview:-webkit-full-screen {
  overflow: auto;
  background: var(--doc-desk);
}

.doc-preview *,
.doc-preview *::before,
.doc-preview *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.doc-preview__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(238, 241, 245, 0.94);
  border-bottom: 1px solid var(--doc-line);
  backdrop-filter: blur(10px);
}

.doc-preview__toc {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
}

.doc-preview__toc > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--doc-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--doc-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  user-select: none;
}

.doc-preview__toc > summary::-webkit-details-marker {
  display: none;
}

.doc-preview__toc > summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.5;
  margin-top: -0.12em;
}

.doc-preview__toc[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 0.12em;
}

.doc-preview__toc-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 6;
  width: min(26rem, calc(100vw - 24px));
  max-height: min(52vh, 24rem);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--doc-line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(26, 31, 36, 0.14);
}

.doc-preview__toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.doc-preview__toc-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--doc-ink) !important;
  text-decoration: none !important;
  font-size: 12.5px;
  line-height: 1.35;
}

.doc-preview__toc-list a:hover,
.doc-preview__toc-list a:focus-visible {
  background: #eef2f6;
  outline: none;
}

.doc-preview__toc-list a.is-active {
  background: rgba(5, 80, 150, 0.1);
  color: var(--doc-accent) !important;
  font-weight: 600;
}

.doc-preview__toc-list a.is-appendix {
  color: var(--doc-muted) !important;
}

.doc-preview__tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}

.doc-preview__pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--doc-line);
  border-radius: 10px;
  background: #ffffff;
}

.doc-preview__pager-btn,
.doc-preview__tool-btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--doc-ink);
  min-width: 2rem;
  height: 1.85rem;
  padding: 0 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.doc-preview__tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--doc-line);
  border-radius: 10px;
  background: #ffffff;
  padding: 0 8px;
}

.doc-preview__tool-btn svg {
  display: block;
  width: 14px;
  height: 14px;
}

.doc-preview__pager-btn:hover:not(:disabled),
.doc-preview__pager-btn:focus-visible:not(:disabled),
.doc-preview__tool-btn:hover,
.doc-preview__tool-btn:focus-visible {
  background: #eef2f6;
  outline: none;
}

.doc-preview__pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.doc-preview__pager-label {
  min-width: 3.75rem;
  padding: 0 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--doc-muted);
  font-variant-numeric: tabular-nums;
}

.doc-preview__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 18px 12px 32px;
}

.doc-page {
  position: relative;
  flex: 0 0 auto;
  background: #ffffff;
  color: var(--doc-ink);
  box-shadow:
    0 0 0 1px rgba(26, 31, 36, 0.07),
    0 12px 32px rgba(26, 31, 36, 0.12);
  overflow: hidden;
  transform-origin: top center;
  scroll-margin-top: var(--doc-bar-offset);
}

/* TOC targets: land below sticky bar, not under it */
.doc-page [id^="doc-sec"],
.doc-page [id^="doc-app"] {
  scroll-margin-top: var(--doc-bar-offset);
}

.doc-page--portrait {
  width: 210mm;
  min-width: 210mm;
  height: 297mm;
}

.doc-page--landscape {
  width: 297mm;
  min-width: 297mm;
  height: 210mm;
}

.doc-page__badge {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(238, 241, 245, 0.95);
  color: var(--doc-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.doc-page__content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.doc-page--portrait .doc-page__content {
  padding: 14mm 16mm 16mm;
}

.doc-page--landscape .doc-page__content {
  padding: 12mm 12mm 14mm;
}

/* Continuation of a clause whose nested list spilled to the next page */
.doc-page .doc-li-continue {
  counter-increment: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-page .doc-li-continue::before {
  content: none !important;
  display: none !important;
  width: 0 !important;
  margin: 0 !important;
}

.doc-preview__source {
  position: absolute;
  left: -10000px;
  top: 0;
  pointer-events: none;
}
