/* ============================================
   ArtNet Manager — User Manual
   Sidebar TOC + Content Layout
   ============================================ */

/* --- Manual Layout --- */
.manual-wrapper {
  display: flex;
  max-width: 1120px;
  margin: 0 auto;
  padding: 80px 1.5rem 4rem;
  gap: 3rem;
}

/* --- Sidebar TOC --- */
.manual-sidebar {
  position: sticky;
  top: 80px;
  width: 260px;
  flex-shrink: 0;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 1.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.manual-sidebar::-webkit-scrollbar { width: 4px; }
.manual-sidebar::-webkit-scrollbar-track { background: transparent; }
.manual-sidebar::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0 0.75rem;
}

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

.toc-list li { margin-bottom: 1px; }

.toc-list a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.toc-list a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.toc-list a.active {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
  border-left-color: var(--cyan);
}

.toc-list .toc-sub {
  padding-left: 1.25rem;
}

.toc-list .toc-sub a {
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  color: var(--text-dim);
}

.toc-list .toc-sub a:hover { color: var(--text-secondary); }
.toc-list .toc-sub a.active {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.04);
  border-left-color: var(--cyan);
}

.toc-divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0.75rem;
}

/* --- Main Content --- */
.manual-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 0;
}

/* --- Section Styling --- */
.manual-section {
  margin-bottom: 4rem;
  scroll-margin-top: 80px;
}

.manual-section:last-child { margin-bottom: 2rem; }

.manual-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.manual-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.manual-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.manual-section p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.manual-section ul,
.manual-section ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.manual-section li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 0.25rem;
}

.manual-section li strong {
  color: var(--text);
}

/* --- Hero Banner --- */
.manual-hero {
  padding: 8rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.manual-hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(34, 211, 238, 0.05) 0%, rgba(167, 139, 250, 0.02) 40%, transparent 70%);
  pointer-events: none;
}

.manual-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.manual-hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.manual-hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Tables --- */
.manual-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.manual-table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.manual-table tbody td {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  line-height: 1.6;
  vertical-align: top;
}

.manual-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.manual-table code,
.manual-table .mono {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

/* --- Inline Code --- */
.manual-section code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  padding: 0.125rem 0.4rem;
  border-radius: 4px;
}

/* --- Info / Tip / Warning Cards --- */
.info-card {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  margin-bottom: 1.5rem;
}

.info-card.tip {
  border-left: 3px solid var(--emerald);
}

.info-card.warning {
  border-left: 3px solid var(--amber);
}

.info-card.important {
  border-left: 3px solid var(--red);
}

.info-card p {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.info-card .info-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

.info-card.tip .info-label { color: var(--emerald); }
.info-card.warning .info-label { color: var(--amber); }
.info-card.important .info-label { color: var(--red); }

/* --- Feature/Protocol Badges --- */
.protocol-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
}

.protocol-badge.artnet {
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
}

.protocol-badge.sacn {
  background: rgba(167, 139, 250, 0.1);
  color: var(--violet);
}

/* --- Signal Flow Diagram (CSS-only) --- */
.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-family: var(--mono);
  font-size: 0.875rem;
}

.flow-box {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--card);
  text-align: center;
}

.flow-box.source { border-left: 3px solid var(--cyan); color: var(--cyan); }
.flow-box.universe { border-left: 3px solid var(--emerald); color: var(--emerald); }
.flow-box.dest { border-left: 3px solid var(--orange); color: var(--orange); }

.flow-arrow {
  color: var(--text-dim);
  font-size: 1.25rem;
}

/* --- Steps --- */
.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

.steps li {
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.125rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
}

/* --- Keyboard shortcuts --- */
kbd {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
  line-height: 1.4;
}

/* --- Mobile Toggle --- */
.toc-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 90;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border-light);
  color: var(--cyan);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
}

.toc-mobile-toggle:hover {
  border-color: var(--cyan);
  transform: scale(1.05);
}

/* --- Active nav link --- */
.nav-links a.active-page {
  color: var(--cyan) !important;
}

/* --- Back to top --- */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 140px;
  right: 24px;
  z-index: 90;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1rem;
}

.back-to-top.visible { display: flex; }
.back-to-top:hover { color: var(--text); border-color: var(--border-light); }

/* --- Responsive --- */
@media (max-width: 960px) {
  .manual-wrapper {
    flex-direction: column;
    padding-top: 64px;
  }

  .manual-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: none;
    background: rgba(6, 6, 10, 0.97);
    backdrop-filter: blur(16px);
    z-index: 50;
    padding: 1.5rem;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }

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

  .toc-mobile-toggle {
    display: flex;
  }

  .manual-content {
    padding-top: 0.5rem;
  }

  .back-to-top { bottom: 80px; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }

  .manual-hero {
    padding: 6rem 1rem 2rem;
  }

  .manual-hero h1 {
    font-size: 1.5rem;
  }

  .manual-section h2 {
    font-size: 1.375rem;
  }

  .manual-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .flow-diagram {
    flex-direction: column;
    gap: 0.75rem;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }
}

/* --- Screenshots --- */
.manual-screenshot {
  margin: 1.25rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.manual-screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

.manual-screenshot figcaption {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--border);
}
