:root {
  --font-ui: "Calibri", "Carlito", "Segoe UI", sans-serif;

  --color-page-bg: #ffffff;
  --color-text-dark: #122033;
  --color-text-light: #FFFFFF;
  --color-text-light-muted: rgba(255, 255, 255, 0.78);
  --color-line: rgba(196, 206, 218, 0.85);
  --color-card-bg: rgba(255, 255, 255, 1.00);

  --shell-bg: rgba(55, 149, 135, 0.55);
  --shell-border: rgba(96, 96, 96, 0.18);
  --shell-shadow: none;
  --shell-blur: 18px;

  --surface-bg: rgba(10, 27, 48, 0.56);
  --surface-border: rgba(196, 206, 218, 0.85);
  --surface-shadow: none;
  --surface-blur: 20px;

  --radius-lg: 8px;
  --radius-md: 7px;
  --radius-sm: 5px;

  --page-width: 1280px;
  --page-height: 760px;
  --page-padding: 10px;
  --grid-gap: 10px;

  --header-height: 88px;
  --viewer-height: 1.18fr;
  --footer-height: 34px;
  --nav-width: 0.78fr;
  --reading-width: 1fr;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font-ui);
  overflow: hidden;
}

body {
  min-height: 100vh;
  color: var(--color-text-light);
  background: var(--color-page-bg);
  user-select: none;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.60), rgba(255, 255, 255, 0.43)),
    url("../images/background_custom.jpg") center center / cover no-repeat;
  background-attachment: fixed;
  z-index: -2;
}

.page-shell {
  width: min(calc(100vw - 24px), var(--page-width));
  height: calc(100vh - 24px);
  min-height: 0;
  margin: 12px auto;
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
  gap: var(--grid-gap);
  overflow: hidden;
}

.panel {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.site-header,
.site-footer,
.viewer-panel,
.navigation-panel {
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  color: var(--color-text-light);
  backdrop-filter: blur(var(--shell-blur));
  box-shadow: var(--shell-shadow);
}

.site-header::before,
.site-footer::before,
.viewer-panel::before,
.navigation-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  pointer-events: none;
  z-index: 0;
}

.navigation-panel {
  overflow: hidden;
}

.site-header > *,
.site-footer > *,
.viewer-panel > *,
.navigation-panel > * {
  position: relative;
  z-index: 1;
}

.site-header {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  padding: 18px 26px;
}

.site-kicker {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light-muted);
}

.site-header-copy h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.02;
}

.site-subtitle {
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--color-text-light);
}

.site-header-side {
  position: absolute;
  top: 18px;
  right: 26px;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.site-logo {
  display: block;
  width: auto;
  max-width: 170px;
  max-height: 56px;
  object-fit: contain;
}

.layout-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: var(--nav-width) var(--reading-width);
  grid-template-rows: minmax(0, 1.06fr) minmax(0, 1.12fr);
  gap: var(--grid-gap);
  overflow: hidden;
}

.viewer-panel {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.reading-panel {
  background: var(--color-card-bg);
  border: 1px solid rgba(10, 22, 32, 0.82);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  min-width: 0;
  min-height: 0;
}

.panel-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light-muted);
}

.panel-label-dark {
  color: rgba(18, 32, 51, 0.64);
}

.panel-body {
  height: 100%;
  padding: 54px 22px 22px;
  min-width: 0;
  min-height: 0;
}

.viewer-body {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 14px 18px 12px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

.viewer-head-copy {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.viewer-hint {
  margin: 0;
  color: var(--color-text-light-muted);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.viewer-head-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  min-height: 30px;
  flex: 0 0 auto;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  display: block;
}

.pdf-button {
  width: 36px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.pdf-button[data-action="zoom-reset"] {
  width: 42px;
}

.pdf-zoom-status {
  width: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  height: 30px;
  text-align: right;
  color: var(--color-text-light-muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.pdf-scroll-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 0;
  cursor: grab;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  user-select: none;
}

.pdf-scroll-shell.is-panning {
  cursor: grabbing;
}

.pdf-canvas-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
  min-height: 100%;
  min-width: 100%;
  padding: 0;
}

.pdf-page-shell {
  position: relative;
  width: fit-content;
  min-width: min-content;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.pdf-page-shell.is-fit {
  margin-left: auto;
  margin-right: auto;
}

.pdf-page-canvas {
  max-width: none;
  height: auto;
  display: block;
  background: #ffffff;
  box-shadow: none;
}

.pdf-hotspot-layer {
  position: absolute;
  inset: 0 auto auto 0;
  pointer-events: none;
}

.pdf-hotspot-link {
  position: absolute;
  pointer-events: auto;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  min-width: 18px;
  min-height: 18px;
}

.pdf-hotspot-link:hover,
.pdf-hotspot-link:focus-visible,
.pdf-hotspot-link.is-target {
  border-color: rgba(68, 114, 196, 0.55);
  background: rgba(68, 114, 196, 0.12);
  outline: none;
}

.navigation-panel .panel-body {
  display: block;
}

.navigation-body {
  height: 100%;
  padding: 10px;
  overflow: hidden;
}

.nav-sticky-head {
  margin: -10px -10px 0;
  padding: 10px 10px 8px;
  background: transparent;
  backdrop-filter: none;
}

.nav-search-shell {
  padding-bottom: 0;
}

.nav-search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-light);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-search-input::placeholder {
  color: rgba(255, 255, 255, 0.64);
}

.nav-tree-shell {
  width: 100%;
  height: calc(100% - 58px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.nav-tree {
  width: 100%;
  display: block;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-tree details,
.nav-tree ul,
.nav-tree li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-tree ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-tree ul ul {
  margin-left: 12px;
}

.nav-group.is-branch > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border-radius: 10px;
  padding: 0;
  list-style: none;
}

.nav-group.is-branch > summary::-webkit-details-marker {
  display: none;
}

.nav-group.is-branch > summary::marker {
  content: "";
}

.nav-group.is-branch > summary::before {
  content: "\25B8";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex: 0 0 16px;
  color: var(--color-text-light);
  opacity: 0.9;
}

.nav-group.is-branch[open] > summary::before {
  content: "\25BE";
}

.nav-group.is-hidden,
.nav-item.is-hidden,
.nav-tree li.is-hidden {
  display: none !important;
}

.nav-group.is-leaf > .nav-item::before {
  content: "";
  display: inline-block;
  width: 16px;
  flex: 0 0 16px;
  margin-right: 4px;
}

.nav-item {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text-light);
  text-decoration: none;
  text-align: left;
  font-size: 15px;
  line-height: 1.35;
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-item.level-1 {
  font-weight: 700;
}

.nav-item.level-2 {
  font-size: 14px;
}

.nav-item.level-3,
.nav-item.level-4,
.nav-item.level-5,
.nav-item.level-6 {
  font-size: 13px;
}

.nav-item:hover,
.nav-group.is-branch > summary:hover .nav-item {
  background: rgba(255, 255, 255, 0.10);
  text-decoration: none;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.16);
}

.nav-group.is-branch > summary.is-active .nav-item {
  background: rgba(255, 255, 255, 0.16);
}

.nav-item.is-match {
  background: rgba(255, 255, 255, 0.12);
  outline: 1px solid rgba(255, 255, 255, 0.14);
}

.reading-panel .panel-body {
  display: block;
  padding: 10px;
}

.reading-card {
  width: 100%;
  min-height: 100%;
  height: 100%;
  padding: 10px;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-dark);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  text-align: left;
  box-shadow: none;
  overflow: hidden;
}

.reading-content {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.reading-loading,
.reading-error {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.reading-content .doc-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.reading-content .doc-block {
  margin: 0 0 14px;
}

.reading-content .doc-heading {
  scroll-margin-top: 16px;
}

.reading-content h1,
.reading-content h2,
.reading-content h3,
.reading-content h4,
.reading-content h5,
.reading-content h6 {
  color: var(--color-text-dark);
  line-height: 1.2;
}

.reading-content h1 {
  margin-top: 8px;
  font-size: 29px;
}

.reading-content h2 {
  margin-top: 20px;
  font-size: 22px;
}

.reading-content h3 {
  margin-top: 18px;
  font-size: 18px;
}

.reading-content p,
.reading-content li,
.reading-content td,
.reading-content th {
  font-size: 15px;
  line-height: 1.55;
}

.reading-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 18px;
}

.reading-content td,
.reading-content th {
  padding: 10px 12px;
  border: 1px solid rgba(18, 32, 51, 0.12);
  vertical-align: top;
}

.reading-content tr:first-child td,
.reading-content tr:first-child th {
  font-weight: 700;
  background: rgba(18, 32, 51, 0.05);
}

.reading-content .is-target {
  background: rgba(68, 114, 196, 0.08);
  outline: 2px solid rgba(68, 114, 196, 0.18);
  border-radius: 8px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
}

.site-footer-left,
.site-footer-right,
.site-footer-right a {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--color-text-light-muted);
  text-decoration: none;
}

.site-footer-right a:hover,
.site-footer-right a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }

  .page-shell {
    width: min(calc(100vw - 20px), 960px);
    height: auto;
    min-height: calc(100vh - 20px);
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .site-header {
    grid-template-columns: 1fr;
  }

  .layout-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 380px) minmax(220px, auto) minmax(320px, auto);
    overflow: visible;
  }

  .viewer-panel,
  .navigation-panel,
  .reading-panel {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    margin: 8px auto;
    gap: 8px;
  }

  .site-header,
  .panel-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel-label {
    font-size: 12px;
  }

  .viewer-head {
    gap: 10px;
    padding: 12px 12px 10px 16px;
  }

  .viewer-head-copy {
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
  }

  .viewer-hint {
    font-size: 12px;
    white-space: normal;
  }

  .viewer-head-tools {
    gap: 6px;
  }

  .pdf-button {
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
  }

  .pdf-zoom-status {
    min-width: 44px;
    font-size: 12px;
  }

  .placeholder-copy h2,
  .reading-card h2 {
    font-size: 24px;
  }
}

.reading-panel {
  border: 1px solid rgba(196, 206, 218, 0.85);
  border-radius: 8px;
  backdrop-filter: blur(20px);
  box-shadow: none;
}
.reading-card {
  border-radius: 0px;
}
.site-header,
.site-footer,
.viewer-panel,
.navigation-panel {
  border-radius: 8px;
  backdrop-filter: blur(18px);
  box-shadow: none;
}
.nav-item,
.nav-group.is-branch > summary,
.pdf-button,
.nav-search-input {
  border-radius: 10px;
}
.pdf-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(8, 25, 46, 0.28);
  color: #FFFFFF;
}
.pdf-button:hover,
.pdf-button:focus-visible {
  background: rgba(122, 207, 160, 0.20);
  box-shadow: inset 0 0 0 1px rgba(77, 151, 179, 0.65);
}
.nav-search-input {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(8, 25, 46, 0.28);
  color: #FFFFFF;
}
.nav-search-input::placeholder {
  color: rgba(255, 255, 255, 0.64);
}
.nav-item:hover,
.nav-group.is-branch > summary:hover .nav-item {
  background: rgba(122, 207, 160, 0.18);
}
.nav-item.is-active,
.nav-group.is-branch > summary.is-active .nav-item {
  background: rgba(122, 207, 160, 0.24);
  box-shadow: inset 0 0 0 1px rgba(77, 151, 179, 0.60);
}
.nav-item.is-match {
  background: rgba(122, 207, 160, 0.14);
  outline: 1px solid rgba(77, 151, 179, 0.35);
}
.is-disabled,
[disabled],
.pdf-button[disabled] {
  opacity: 1.00;
}

:root {
  --interaction-highlight: #7acfa0;
  --interaction-accent: #4d97b3;
}

.site-nav a:hover,
.legend a:hover,
.site-footer a:hover,
.toolbar-button:hover {
  filter: brightness(1.12);
  background: color-mix(in srgb, var(--interaction-highlight) 12%, transparent);
}

.site-nav a.is-active,
.site-nav a[aria-current='page'] {
  background: color-mix(in srgb, var(--interaction-highlight) 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--interaction-accent) 65%, transparent);
}

.is-disabled,
[disabled],
.toolbar-button[aria-disabled='true'] {
  opacity: 0.45;
  filter: grayscale(0.35);
}
