/* ---------------------------------------------------------------------- */
/* Tokens                                                                  */
/* ---------------------------------------------------------------------- */
:root {
  --navy: #201a3a;
  --navy-soft: #2b2350;
  --sidebar-width: 230px;
  --gradient: linear-gradient(90deg, #f5871f 0%, #e13a83 34%, #8b3fd1 66%, #2f5fd6 100%);
  --gray-50: #f7f7f9;
  --gray-100: #eceef2;
  --gray-300: #cfd2db;
  --gray-500: #7a7d8a;
  --gray-700: #4a4d59;
  --ink: #1b1830;
  --white: #ffffff;
  --radius: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--gray-50);
  font-family: var(--font-sans);
  color: var(--ink);
}

/* ---------------------------------------------------------------------- */
/* Layout shell                                                           */
/* ---------------------------------------------------------------------- */

.main {
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
}

.pdf-panel {
  flex: 1;
  min-height: 0;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(32, 26, 58, 0.06);
  overflow: hidden;
  position: relative;
}

.pdfViewerContainer {
  position: absolute;
  inset: 0;
  overflow: auto;
}

.pdf-error {
  padding: 40px;
  color: var(--gray-700);
  font-size: 15px;
}

/* ---------------------------------------------------------------------- */
/* Sidebar                                                                */
/* ---------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-header {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.wordmark {
  display: block;
  height: 20px;
  width: auto;
}

.published {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 16px;
  list-style: none;
  margin: 0;
}
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.nav-item {
  list-style: none;
}

.nav-row {
  display: flex;
  align-items: stretch;
}

.nav-link {
  display: block;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.4;
  padding: 9px 8px 9px 20px;
  position: relative;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.current {
  color: var(--white);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient);
}

.nav-toggle {
  flex-shrink: 0;
  width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  padding: 0 16px 0 0;
  transition: color 0.15s ease;
}

.nav-toggle:hover {
  color: var(--white);
}

.nav-toggle .chevron {
  transition: transform 0.2s ease;
}

.nav-item.open .nav-toggle .chevron {
  transform: rotate(90deg);
}

.nav-children {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.nav-subitem {
  list-style: none;
}

.nav-sublink {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 20px 7px 32px;
  position: relative;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-sublink:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.04);
}

.nav-sublink.current {
  color: var(--white);
  font-weight: 600;
}

.nav-sublink.current::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gradient);
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.download-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.download-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.download-icon {
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------- */
/* Context banner (lives inside the pdf.js scroll flow, above page 1)      */
/* ---------------------------------------------------------------------- */

.context-banner {
  padding: 10px 28px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-300);
}

.context-banner p {
  margin: 0;
  font-size: 12.5px;
  color: var(--gray-700);
  max-width: 720px;
}

/* ---------------------------------------------------------------------- */
/* Mobile nav toggle                                                       */
/* ---------------------------------------------------------------------- */

.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: var(--navy);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.mobile-nav-toggle .bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--white);
  border-radius: 1px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 30, 0.45);
  z-index: 19;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 60px 12px 12px;
  }
}
