/* Shared book layout (staff admin + public members handbook) */
.handbook-shell {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 8.5rem);
}

.handbook-toc-panel {
  background: linear-gradient(180deg, #102a3a 0%, #071923 100%);
  color: #eef4f7;
  border-radius: 12px;
  padding: 1rem 0.85rem;
  box-shadow: inset 0 0 0 1px rgba(244, 182, 63, 0.18);
  overflow: auto;
  max-height: calc(100vh - 8.5rem);
}

.handbook-toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--amber);
}

.handbook-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.handbook-toc-chapter {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 182, 63, 0.85);
}

.handbook-toc-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #dce8ee;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.handbook-toc-link:hover,
.handbook-toc-link.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.handbook-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - 8.5rem);
}

.handbook-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.handbook-jump-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.handbook-jump {
  min-width: 16rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.handbook-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.handbook-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(7, 25, 35, 0.25);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

.handbook-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.handbook-spread {
  display: grid;
  grid-template-columns: 1fr 10px 1fr;
  gap: 0;
  width: min(100%, 980px);
  min-height: 520px;
  filter: drop-shadow(0 18px 28px rgba(7, 25, 35, 0.22));
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.handbook-spread.is-turning {
  transform: rotateY(-4deg) translateX(-4px);
  opacity: 0.92;
}

.handbook-spread.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.handbook-spread.is-single .handbook-spine,
.handbook-spread.is-single #handbook-page-right {
  display: none;
}

.handbook-spine {
  background: linear-gradient(90deg, #5a3d22 0%, #2f1d10 45%, #120a05 50%, #2f1d10 55%, #5a3d22 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
}

.handbook-page {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.05)),
    linear-gradient(180deg, #faf6eb 0%, #f3ead6 100%);
  border: 1px solid #d8ccb0;
  border-radius: 4px 10px 10px 4px;
  padding: 1.35rem 1.5rem 1rem;
  color: #2b2418;
  font-family: Georgia, "Times New Roman", serif;
  overflow: auto;
  position: relative;
}

.handbook-page-left.is-clickable {
  cursor: w-resize;
}

.handbook-page-right.is-clickable {
  cursor: e-resize;
}

#handbook-page-right {
  border-radius: 10px 4px 4px 10px;
}

.handbook-page[data-kind="cover"] {
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 28%, rgba(244, 182, 63, 0.16), transparent 52%),
    linear-gradient(180deg, #102a3a 0%, #071923 100%);
  color: #f7f2e8;
  border-color: rgba(244, 182, 63, 0.35);
}

.handbook-page[data-kind="cover"] .handbook-page-head {
  display: none;
}

.handbook-cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.handbook-cover-mark {
  width: min(220px, 58%);
  height: auto;
  aspect-ratio: 1;
  margin: 0 0 1.15rem;
  border-radius: 50%;
  border: 2px solid rgba(244, 182, 63, 0.55);
  background: #071923;
  object-fit: cover;
}

.handbook-cover-inner h1 {
  margin: 0.5rem 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: var(--amber);
}

.handbook-cover-kicker,
.handbook-cover-sub,
.handbook-cover-note {
  margin: 0.35rem 0;
}

.handbook-cover-kicker {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  opacity: 0.85;
}

.handbook-cover-note {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  opacity: 0.75;
}

.handbook-page-head {
  border-bottom: 1px solid rgba(43, 36, 24, 0.12);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.handbook-page-chapter {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6548;
}

.handbook-page-title {
  margin: 0.25rem 0 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.handbook-page-body {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.55;
}

.handbook-page-body h2,
.handbook-page-body h3 {
  margin: 1rem 0 0.5rem;
  line-height: 1.25;
}

.handbook-page-body p {
  margin: 0.55rem 0;
}

.handbook-page-body ul,
.handbook-page-body ol {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.handbook-page-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.86rem;
}

.handbook-page-body th,
.handbook-page-body td {
  border: 1px solid rgba(43, 36, 24, 0.18);
  padding: 0.35rem 0.45rem;
  vertical-align: top;
}

.handbook-page-body th {
  background: rgba(11, 58, 82, 0.08);
}

.handbook-page-body code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: rgba(11, 58, 82, 0.08);
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
}

.handbook-page-body a {
  color: var(--teal);
}

.handbook-draft {
  color: #c62828;
  font-weight: 600;
}

.handbook-page-body .handbook-draft code {
  color: #c62828;
  background: rgba(198, 40, 40, 0.08);
}

.handbook-page-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #7a6548;
}

.handbook-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 0.85rem;
}

.handbook-page-label {
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}

.handbook-hint {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 979px) {
  .handbook-shell {
    grid-template-columns: 1fr;
  }

  .handbook-toc-panel {
    max-height: 220px;
  }
}

@media (max-width: 720px) {
  .handbook-footer {
    grid-template-columns: 1fr 1fr;
  }

  .handbook-page-label {
    grid-column: 1 / -1;
  }

  .handbook-nav {
    width: 100%;
  }

  .handbook-page {
    padding: 1rem;
    min-height: 420px;
  }
}
