/* ==========================================================================
   CyclePack Whitepaper Stylesheet (whitepaper.css)
   Academic / High-Performance Systems Architecture Layout
   ========================================================================== */

/* Universal Link Reset in Whitepaper */
a {
  text-decoration: none;
}

/* Hero / Masthead */
.wp-hero-section {
  padding: 7.5rem 0 3rem;
  background: radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.08) 0%, rgba(10, 15, 27, 0) 70%), #090D16;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

.wp-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.wp-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.wp-breadcrumbs a:hover {
  color: var(--accent-cyan);
}

.wp-breadcrumbs .sep {
  opacity: 0.4;
}

.wp-breadcrumbs .current {
  color: var(--accent-cyan);
}

.wp-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.wp-meta-chip {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.wp-meta-chip.cyan {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.25);
  color: var(--accent-cyan);
}

.wp-meta-chip.emerald {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--accent-emerald);
}

.wp-meta-chip.violet {
  background: rgba(121, 40, 202, 0.08);
  border-color: rgba(121, 40, 202, 0.25);
  color: #C084FC;
}

.wp-main-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.85rem;
  color: #FFF;
}

.wp-main-subtitle {
  font-size: 1.15rem;
  color: #94A3B8;
  line-height: 1.5;
  max-width: 900px;
  margin-bottom: 1.75rem;
}

.wp-audience-box {
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-cyan);
  padding: 0.85rem 1.25rem;
  border-radius: 0 6px 6px 0;
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.wp-audience-box .audience-label {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.wp-audience-box .audience-text {
  color: #CBD5E1;
  line-height: 1.4;
}

/* Two-Column Layout */
.wp-layout-container {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 3.5rem;
  padding-top: 3.5rem;
  padding-bottom: 6rem;
  align-items: start;
  position: relative;
  z-index: 1;
}

/* Sidebar TOC */
.wp-sidebar {
  position: sticky;
  top: 6.5rem;
}

.wp-toc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.5rem;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-link {
  font-size: 0.85rem;
  color: #94A3B8;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  text-decoration: none !important;
  transition: all var(--transition-fast);
  line-height: 1.35;
  display: flex;
  gap: 0.45rem;
}

.toc-link:hover {
  text-decoration: none !important;
  color: #FFF;
  background: rgba(255, 255, 255, 0.04);
}

.toc-link .toc-num {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none !important;
}

.toc-link.active {
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  font-weight: 600;
  text-decoration: none !important;
}

.toc-link.active .toc-num {
  color: var(--accent-cyan);
}

.toc-cta-box {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.toc-cta-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFF;
  margin-bottom: 0.25rem;
}

.toc-cta-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

/* Content Body */
.wp-content-body {
  max-width: 860px;
}

.wp-section {
  padding-bottom: 4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4rem;
}

.wp-section-header {
  margin-bottom: 1.75rem;
}

.wp-section-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-block;
  margin-bottom: 0.35rem;
}

.wp-section h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFF;
  line-height: 1.2;
}

.wp-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #F1F5F9;
  margin: 1.75rem 0 0.85rem;
}

.wp-section h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 0.5rem;
}

.wp-section p {
  font-size: 0.95rem;
  color: #CBD5E1;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

/* Callouts */
.paper-callout {
  background: rgba(14, 22, 38, 0.8);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
}

.paper-callout.callout-important {
  border-left: 4px solid var(--accent-cyan);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.04) 0%, rgba(14, 22, 38, 0.9) 100%);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.85rem;
}

/* BLUF 4-Grid */
.bluf-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.bluf-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.4rem;
}

.bluf-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.bluf-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFF;
  margin-bottom: 0.4rem;
}

.bluf-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Paper List */
.paper-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1.5rem 0 2rem;
}

.paper-list-item {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #CBD5E1;
}

.paper-list-item .list-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* Mermaid Rendering Boxes & Interactive Zoom Controls */
.mermaid-box {
  background: #060A13;
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.25rem 1.5rem 1.5rem;
  margin: 2.25rem 0;
  position: relative;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6), 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease;
}

.mermaid-box:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

.mermaid-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.mermaid-box .diagram-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.diagram-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.diagram-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.diagram-btn:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.4);
  color: var(--accent-cyan);
}

.diagram-btn.btn-fullscreen {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
}

.mermaid-viewport {
  width: 100%;
  min-height: 260px;
  max-height: 480px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-viewport:active {
  cursor: grabbing;
}

.mermaid-viewport svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block;
}

.diagram-hint {
  font-size: 0.72rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  margin-top: 0.65rem;
  text-align: right;
}

/* Lightbox Modal */
.diagram-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10000;
  display: none;
  flex-direction: column;
  padding: 1.5rem;
  box-sizing: border-box;
}

.diagram-lightbox-backdrop.active {
  display: flex;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.lightbox-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  background: #040812;
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.08);
}

.lightbox-body:active {
  cursor: grabbing;
}

.lightbox-body svg {
  width: 100% !important;
  height: 100% !important;
}

.lightbox-footer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Pillars Split */
.architecture-pillars-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

.arch-pillar-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.5rem;
}

.pillar-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.pillar-badge.rust {
  background: rgba(247, 76, 0, 0.12);
  color: var(--accent-rust);
  border: 1px solid rgba(247, 76, 0, 0.3);
}

.pillar-badge.lua {
  background: rgba(121, 40, 202, 0.12);
  color: #C084FC;
  border: 1px solid rgba(121, 40, 202, 0.3);
}

.paper-bullet-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.paper-bullet-list li {
  font-size: 0.875rem;
  color: #CBD5E1;
  line-height: 1.5;
  position: relative;
  padding-left: 1.2rem;
}

.paper-bullet-list li::before {
  content: "•";
  color: var(--accent-cyan);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Security Features 3-Grid */
.security-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 2rem 0;
}

.sec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.4rem;
}

.sec-card-icon {
  margin-bottom: 0.85rem;
}

.sec-card h4 {
  font-size: 0.925rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.35;
}

.sec-card p {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* Benchmark Table */
.wp-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  margin: 2rem 0;
  background: var(--bg-surface);
}

.wp-benchmark-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.wp-benchmark-table th {
  background: #090E1A;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-card);
}

.wp-benchmark-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #CBD5E1;
}

.wp-benchmark-table tr:last-child td {
  border-bottom: none;
}

.badge-gain {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ROI Pillars 4-Grid */
.roi-pillars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 2rem 0;
}

.roi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.4rem;
}

.roi-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.roi-icon {
  font-size: 1.2rem;
}

.roi-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: #FFF;
}

/* TCO Financial Table & Executive Summary Cards */
.tco-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}

.tco-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.4rem;
  text-align: center;
}

.tco-card-val {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.tco-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #FFF;
  margin-bottom: 0.25rem;
}

.tco-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tco-badge-positive {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
  .wp-layout-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .wp-sidebar {
    display: none;
  }
  .bluf-grid, .architecture-pillars-split, .roi-pillars-grid, .tco-summary-grid {
    grid-template-columns: 1fr;
  }
  .security-features-grid {
    grid-template-columns: 1fr;
  }
}

/* Narrow screens. Grid children may shrink below their content, long identifiers in code wrap
   instead of widening the page, and the navbar keeps the brand and the menu button. */
.wp-layout-container > * {
  min-width: 0;
}

.wp-content-body code {
  overflow-wrap: anywhere;
}

/* The navbar needs about 1130px for the brand, seven links and the request button; below that
   it collapses into the menu button, as style.css does below 768px. The "Back to Platform"
   button only fits on wide screens; the brand links to the same page. */
@media (max-width: 1440px) {
  .nav-actions .btn-secondary {
    display: none;
  }
}

@media (max-width: 1140px) {
  .nav-links,
  .nav-actions .btn-cyan-glow {
    display: none;
  }
  .mobile-menu-toggle {
    display: block;
  }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    background: rgba(9, 13, 22, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .wp-audience-box {
    flex-direction: column;
    gap: 0.35rem;
  }
  .paper-callout {
    padding: 1.25rem 1rem;
  }
  /* The table scrolls inside its wrapper instead of squeezing four columns into the screen. */
  .wp-benchmark-table {
    min-width: 680px;
  }
}
