/* ── pdf-outline panel ────────────────────────────────────────────────────── */

/* position: absolute intentional — single-context component always inside reader-pdf-pane */
.pdf-outline {
  position: absolute;
  top: 53px;
  left: 0;
  bottom: 0;
  width: 224px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-soft);
  box-shadow: var(--shadow-2);
  z-index: 10;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--dur-slow) var(--ease-out);
  overflow: hidden;
}

.pdf-outline.-open {
  transform: translateX(0);
}

/* ── drag handle (hidden on desktop, shown on mobile bottom sheet) ────────── */

.pdf-outline > .-drag-handle {
  display: none;
  justify-content: center;
  padding: 10px 0 4px;
  flex-shrink: 0;
}

.pdf-outline > .-drag-handle > .-pill {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--slate-200);
}

/* ── header ──────────────────────────────────────────────────────────────── */

.pdf-outline > .-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 10px 16px 4px;
}

.pdf-outline > .-header > .-label {
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.pdf-outline > .-header > .-close {
  display: none;
}

.pdf-outline > .-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-200) transparent;
}

.pdf-outline > .-nav::-webkit-scrollbar {
  width: 4px;
}

.pdf-outline > .-nav::-webkit-scrollbar-track {
  background: transparent;
}

.pdf-outline > .-nav::-webkit-scrollbar-thumb {
  background: var(--slate-200);
  border-radius: var(--radius-pill);
}

.pdf-outline > .-nav::-webkit-scrollbar-thumb:hover {
  background: var(--slate-300);
}

/* ── outline list & items ─────────────────────────────────────────────────── */

/* .-list appears at any depth inside .-nav (recursive); .-item is always direct child of .-list */
.pdf-outline .-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pdf-outline .-list > .-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 14px 4px 16px;
  transition: background var(--dur-fast) var(--ease-out);
}

.pdf-outline .-list > .-item[data-page] { cursor: pointer; }

.pdf-outline .-list > .-item[data-page]:hover { background: var(--slate-50); }

/* depth indentation */
.pdf-outline .-list > .-item.-depth-0 { padding-left: 16px; }
.pdf-outline .-list > .-item.-depth-1 { padding-left: 26px; }
.pdf-outline .-list > .-item.-depth-2 { padding-left: 38px; }
.pdf-outline .-list > .-item.-depth-3 { padding-left: 50px; }

/* title */
.pdf-outline .-list > .-item > .-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
  line-height: var(--lh-snug);
}

.pdf-outline .-list > .-item.-depth-0 > .-title {
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
}

.pdf-outline .-list > .-item.-depth-1 > .-title {
  font-size: var(--fs-13);
  font-weight: var(--fw-regular);
  color: var(--fg-2);
}

.pdf-outline .-list > .-item.-depth-2 > .-title,
.pdf-outline .-list > .-item.-depth-3 > .-title {
  font-size: var(--fs-12);
  font-weight: var(--fw-regular);
  color: var(--fg-3);
}

.pdf-outline .-list > .-item.-bold > .-title {
  font-weight: var(--fw-semibold);
}

/* page number */
.pdf-outline .-list > .-item > .-page {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--fg-3);
  flex-shrink: 0;
  min-width: 20px;
  text-align: right;
}

/* active item */
.pdf-outline .-list > .-item.-active > .-title {
  color: var(--slate-500);
}

.pdf-outline .-list > .-item.-active > .-title::before {
  content: "· ";
}

.pdf-outline .-list > .-item.-active > .-page {
  color: var(--slate-500);
}

/* ── Mobile: bottom sheet variant ────────────────────────────────────────── */

@media (max-width: 767px) {
  .pdf-outline {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    border-right: none;
    border-top: 1px solid var(--border-soft);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 40px -4px rgba(10, 15, 18, 0.18);
    transform: translateY(105%);
  }

  .pdf-outline.-open {
    transform: translateY(0);
  }

  .pdf-outline > .-drag-handle {
    display: flex;
  }

  .pdf-outline > .-header {
    padding: 4px 20px 14px;
    border-bottom: 1px solid var(--border-soft);
  }

  .pdf-outline > .-header > .-label {
    font-size: var(--fs-18);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    letter-spacing: 0;
    text-transform: none;
  }

  .pdf-outline > .-header > .-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--fg-3);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out);
  }

  .pdf-outline > .-header > .-close:hover {
    background: var(--slate-50);
    color: var(--fg-2);
  }

  .pdf-outline > .-nav {
    padding-bottom: 32px;
  }
}
