:root {
  --viewer-accent: #8b4d32;
  --viewer-text: #393733;
  --viewer-surface: #fff;
  --viewer-footer: #292622;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  overscroll-behavior: none;
  background: var(--viewer-footer);
  color: var(--viewer-text);
  font-family: var(--font-main, Arial, Helvetica, sans-serif);
}

.document-viewer-page .site-header,
.document-viewer-page .site-navigation {
  flex: 0 0 auto;
}

.document-viewer__bar {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--viewer-accent);
  background: var(--viewer-footer);
  color: #f7f5ef;
  font-size: 15px;
}

.document-viewer__heading {
  display: grid;
  min-width: 0;
  max-width: min(78%, 980px);
  gap: 2px;
}

.document-viewer__bar h1 {
  margin: 0;
  color: inherit !important;
  font-family: var(--font-main, Arial, Helvetica, sans-serif) !important;
  font-size: inherit;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.document-viewer__heading p {
  margin: 0;
  color: rgba(247, 245, 239, 0.76);
  font-size: 0.82em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.document-viewer__bar > span {
  flex: 0 0 auto;
  color: rgba(247, 245, 239, 0.78);
  font-size: 0.9em;
  text-align: right;
}

.document-viewer__main {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  background: #eae7de;
}

.document-viewer__main iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--viewer-surface);
}

.document-viewer__return {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: var(--viewer-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  opacity: 0.88;
}

.document-viewer__return:is(:hover, :focus-visible) {
  background: var(--viewer-footer);
  opacity: 1;
  outline: 2px solid var(--viewer-accent);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .document-viewer__bar {
    min-height: 52px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .document-viewer__heading {
    max-width: 78%;
  }

  .document-viewer__heading p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .document-viewer__bar > span {
    font-size: 11px;
    line-height: 1.2;
  }

  .document-viewer__return {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    min-height: 38px;
    max-width: calc(100% - 16px);
    padding: 8px 12px;
    font-size: 13px;
  }
}
