/* =========================================================================
   Apolynux Research & Engineering — Dark Technical Research Design System
   High-contrast obsidian surfaces, minimalist typography, animated data-flow
   diagrams, status badges, and clean publication-grade PDF print layout.
   ========================================================================= */

:root {
  --res-bg: #070b14;
  --res-bg-elev: #0d1424;
  --res-bg-card: #111a2e;
  --res-bg-code: #060911;
  --res-border: rgba(148, 163, 184, 0.16);
  --res-border-strong: rgba(148, 163, 184, 0.3);
  --res-text: #f1f5f9;
  --res-text-muted: #94a3b8;
  --res-text-soft: #cbd5e1;
  --res-accent: #d97757;
  --res-accent-glow: rgba(217, 119, 87, 0.22);
  --res-cyan: #38bdf8;
  --res-emerald: #34d399;
  --res-violet: #a78bfa;
  --res-amber: #fbbf24;
  --res-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Dedicated Research Pages Base */
body.research-page {
  background: var(--res-bg);
  color: var(--res-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.65;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

body.research-page *,
body.research-page *::before,
body.research-page *::after {
  box-sizing: border-box;
}

.res-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Research Top Navbar */
.res-navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(7, 11, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--res-border);
}

.res-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.res-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--res-text);
}

.res-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid rgba(217, 119, 87, 0.4);
}

.res-brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.res-brand-sub {
  font-family: var(--res-mono);
  font-size: 0.66rem;
  color: var(--res-accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.res-nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.res-nav-links a {
  color: var(--res-text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition: color 0.18s ease;
}

.res-nav-links a:hover,
.res-nav-links a.active {
  color: var(--res-text);
}

.res-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.res-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.res-btn-primary {
  background: linear-gradient(135deg, #d97757, #c25734);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(217, 119, 87, 0.28);
}

.res-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(217, 119, 87, 0.4);
}

.res-btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--res-text-soft);
  border-color: var(--res-border-strong);
}

.res-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border-color: rgba(217, 119, 87, 0.55);
}

/* Status Classification Badges (Strict 5-Tier Taxonomy) */
.res-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--res-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.res-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-research-concept {
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.34);
}
.status-research-concept .res-status-dot { background: #a78bfa; }

.status-architecture-design {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.34);
}
.status-architecture-design .res-status-dot { background: #38bdf8; }

.status-experimental-prototype {
  background: rgba(251, 191, 36, 0.13);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.35);
}
.status-experimental-prototype .res-status-dot { background: #fbbf24; }

.status-validated-implementation {
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.35);
}
.status-validated-implementation .res-status-dot { background: #34d399; }

.status-production-capability {
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.45);
}
.status-production-capability .res-status-dot { background: #10b981; }

/* Hero Section */
.res-hero {
  position: relative;
  padding: 72px 0 56px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(217, 119, 87, 0.13), transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 20%, rgba(56, 189, 248, 0.08), transparent 65%),
    var(--res-bg);
  border-bottom: 1px solid var(--res-border);
  overflow: hidden;
}

.res-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--res-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--res-accent);
  background: rgba(217, 119, 87, 0.1);
  border: 1px solid rgba(217, 119, 87, 0.3);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.res-hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.35rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #ffffff;
  margin: 0 0 18px;
  max-width: 920px;
}

.res-hero-lead {
  font-size: 1.08rem;
  color: var(--res-text-soft);
  max-width: 820px;
  line-height: 1.72;
  margin: 0 0 24px;
}

.res-proposition-box {
  background: linear-gradient(135deg, rgba(217, 119, 87, 0.1), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(217, 119, 87, 0.32);
  border-left: 4px solid var(--res-accent);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 920px;
  margin-bottom: 28px;
}

.res-proposition-label {
  font-family: var(--res-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--res-accent);
  margin-bottom: 6px;
}

.res-proposition-box p {
  margin: 0;
  color: #f8fafc;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.65;
}

.res-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-family: var(--res-mono);
  font-size: 0.76rem;
  color: var(--res-text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--res-border);
}

.res-meta-strip strong {
  color: var(--res-text-soft);
}

/* Section Headers */
.res-section {
  padding: 68px 0;
  border-bottom: 1px solid var(--res-border);
}

.res-section-alt {
  background: var(--res-bg-elev);
}

.res-section-head {
  margin-bottom: 36px;
  max-width: 840px;
}

.res-section-kicker {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--res-accent);
  margin-bottom: 8px;
  display: block;
}

.res-section-title {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 0 0 12px;
}

.res-section-desc {
  color: var(--res-text-muted);
  font-size: 0.98rem;
  margin: 0;
  line-height: 1.7;
}

/* Animated Unified Architecture Stack Diagram */
.res-arch-diagram {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(7, 11, 20, 0.96));
  border: 1px solid var(--res-border-strong);
  border-radius: 16px;
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
}

.res-arch-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 860px;
  margin: 0 auto;
}

.res-arch-layer {
  width: 100%;
  background: rgba(17, 26, 46, 0.95);
  border: 1px solid var(--res-border-strong);
  border-left: 3px solid var(--layer-accent, #d97757);
  border-radius: 10px;
  padding: 13px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.res-arch-layer:hover {
  transform: translateY(-1px);
  border-color: var(--layer-accent, #d97757);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.res-arch-layer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.res-arch-layer-name {
  font-family: var(--res-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.res-arch-tier-num {
  font-size: 0.68rem;
  color: var(--layer-accent, #d97757);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.res-arch-layer-role {
  font-size: 0.82rem;
  color: var(--res-text-muted);
}

.res-arch-subnodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.res-arch-subnode {
  font-family: var(--res-mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: center;
  color: #e2e8f0;
  background: rgba(7, 11, 20, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 6px;
  padding: 6px 10px;
}

.res-arch-connector {
  width: 2px;
  height: 22px;
  background: linear-gradient(180deg, rgba(217, 119, 87, 0.75), rgba(56, 189, 248, 0.6));
  position: relative;
}

.res-arch-connector::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: resFlowDrop 2.4s ease-in-out infinite;
}

@keyframes resFlowDrop {
  0% { top: 0; opacity: 0; }
  30% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 16px; opacity: 0; }
}

/* Status Legend Grid */
.res-status-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.res-status-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.res-status-card p {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--res-text-muted);
  line-height: 1.5;
}

/* Category Filter Tabs */
.res-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.res-filter-btn {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  color: var(--res-text-muted);
  font-family: var(--res-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.res-filter-btn:hover {
  border-color: var(--res-border-strong);
  color: #ffffff;
}

.res-filter-btn.active {
  background: rgba(217, 119, 87, 0.16);
  border-color: var(--res-accent);
  color: #ffffff;
}

/* White Paper Category Groups & Cards */
.res-cat-block {
  margin-bottom: 44px;
}

.res-cat-block:last-child {
  margin-bottom: 0;
}

.res-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--res-border);
}

.res-cat-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.18rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.res-cat-code {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--res-border-strong);
}

.res-cat-sub {
  font-size: 0.85rem;
  color: var(--res-text-muted);
}

.res-papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.res-paper-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.res-paper-card:hover {
  transform: translateY(-3px);
  border-color: rgba(217, 119, 87, 0.55);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.res-paper-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.res-wp-num {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--res-accent);
}

.res-paper-card h3 {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 8px;
  color: #ffffff;
}

.res-paper-card h3 a {
  color: inherit;
  text-decoration: none;
}

.res-paper-card h3 a:hover {
  color: var(--res-accent);
}

.res-paper-subtitle {
  font-size: 0.84rem;
  color: var(--res-text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

.res-paper-card-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--res-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
}

.res-paper-time {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  color: var(--res-text-muted);
}

.res-paper-link {
  color: var(--res-accent);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.res-paper-link:hover {
  text-decoration: underline;
}

/* 10 Architectural Principles */
.res-principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.res-principle-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 12px;
  padding: 16px;
}

.res-principle-num {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  color: var(--res-accent);
  font-weight: 800;
}

.res-principle-card h4 {
  font-size: 0.94rem;
  font-weight: 700;
  color: #ffffff;
  margin: 6px 0 6px;
}

.res-principle-card p {
  font-size: 0.81rem;
  color: var(--res-text-muted);
  margin: 0;
  line-height: 1.55;
}

/* 6-Phase Implementation Roadmap */
.res-roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.res-phase-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.res-phase-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.res-phase-badge {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--res-cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.res-phase-status {
  font-family: var(--res-mono);
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--res-text-soft);
}

.res-phase-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 10px;
}

.res-phase-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 0.83rem;
  color: var(--res-text-soft);
  line-height: 1.6;
}

.res-phase-deliverable {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--res-border-strong);
  font-size: 0.8rem;
  color: var(--res-emerald);
  font-weight: 600;
}

/* Technical Glossary */
.res-glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.res-glossary-item {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 10px;
  padding: 16px 18px;
  scroll-margin-top: 90px;
}

.res-glossary-item:target {
  border-color: var(--res-accent);
  box-shadow: 0 0 0 2px var(--res-accent-glow);
}

.res-glossary-term {
  font-family: var(--res-mono);
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 6px;
}

.res-glossary-def {
  font-size: 0.83rem;
  color: var(--res-text-muted);
  margin: 0;
  line-height: 1.58;
}

/* Integrity Notice */
.res-integrity-box {
  background: rgba(17, 26, 46, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  padding: 22px 26px;
}

.res-integrity-box h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #7dd3fc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.res-integrity-box p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--res-text-soft);
  line-height: 1.68;
}

/* =========================================================================
   Dedicated White Paper Detail Layout (/research/<slug>/)
   ========================================================================= */
.wp-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  padding: 34px 0 80px;
}

.wp-toc {
  position: sticky;
  top: 86px;
  background: var(--res-bg-elev);
  border: 1px solid var(--res-border);
  border-radius: 12px;
  padding: 18px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.wp-toc-title {
  font-family: var(--res-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--res-accent);
  margin: 0 0 12px;
}

.wp-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wp-toc a {
  display: block;
  font-size: 0.78rem;
  color: var(--res-text-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.wp-toc a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--res-accent);
}

.wp-article {
  min-width: 0;
}

.wp-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--res-mono);
  font-size: 0.75rem;
  color: var(--res-text-muted);
  margin-bottom: 18px;
}

.wp-breadcrumbs a {
  color: var(--res-text-soft);
  text-decoration: none;
}

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

.wp-cover {
  background: linear-gradient(160deg, rgba(17, 26, 46, 0.96), rgba(7, 11, 20, 0.98));
  border: 1px solid var(--res-border-strong);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
}

.wp-cover-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.wp-cover h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.18;
  color: #ffffff;
  margin: 0 0 12px;
}

.wp-cover-sub {
  font-size: 1.04rem;
  color: var(--res-text-soft);
  margin: 0 0 22px;
  line-height: 1.6;
}

.wp-cover-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--res-border);
}

.wp-section {
  margin-bottom: 34px;
  scroll-margin-top: 90px;
}

.wp-section h2 {
  font-size: 1.32rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--res-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.wp-sec-num {
  font-family: var(--res-mono);
  font-size: 0.78rem;
  color: var(--res-accent);
  background: rgba(217, 119, 87, 0.12);
  padding: 2px 8px;
  border-radius: 5px;
}

.wp-section p {
  color: var(--res-text-soft);
  font-size: 0.96rem;
  line-height: 1.76;
  margin: 0 0 12px;
}

.wp-list {
  margin: 0;
  padding-left: 20px;
  color: var(--res-text-soft);
  font-size: 0.94rem;
  line-height: 1.7;
}

.wp-list li {
  margin-bottom: 8px;
}

.wp-components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.wp-component-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 10px;
  padding: 16px;
}

.wp-component-card h3 {
  font-size: 0.94rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 6px;
}

.wp-component-card p {
  font-size: 0.84rem;
  color: var(--res-text-muted);
  margin: 0;
  line-height: 1.58;
}

/* Code Window */
.wp-code-window {
  background: var(--res-bg-code);
  border: 1px solid var(--res-border-strong);
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
}

.wp-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--res-border);
  font-family: var(--res-mono);
  font-size: 0.74rem;
  color: var(--res-text-muted);
}

.wp-code-copy {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--res-border-strong);
  color: var(--res-text-soft);
  font-family: var(--res-mono);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.wp-code-copy:hover {
  border-color: var(--res-accent);
  color: #ffffff;
}

.wp-code-window pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--res-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  color: #e2e8f0;
}

/* Tables */
.wp-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--res-border);
  border-radius: 10px;
}

.wp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.wp-table caption {
  text-align: left;
  padding: 10px 14px;
  font-family: var(--res-mono);
  font-size: 0.74rem;
  color: var(--res-accent);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--res-border);
}

.wp-table th {
  text-align: left;
  padding: 11px 14px;
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-weight: 700;
  border-bottom: 1px solid var(--res-border-strong);
}

.wp-table td {
  padding: 10px 14px;
  color: var(--res-text-soft);
  border-bottom: 1px solid var(--res-border);
}

/* Diagram Box inside Paper */
.wp-diagram-card {
  background: linear-gradient(180deg, rgba(13, 20, 36, 0.95), rgba(6, 9, 17, 0.98));
  border: 1px solid var(--res-border-strong);
  border-radius: 14px;
  padding: 22px;
  margin: 18px 0;
}

.wp-diagram-title {
  font-family: var(--res-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--res-cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.wp-diagram-cap {
  font-size: 0.82rem;
  color: var(--res-text-muted);
  margin: 0 0 18px;
}

.wp-diagram-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.wp-diagram-tier {
  width: 100%;
  background: rgba(17, 26, 46, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 12px 16px;
}

.wp-diagram-tier-label {
  font-family: var(--res-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--res-accent);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.wp-diagram-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.wp-diagram-node {
  font-family: var(--res-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: #f8fafc;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 6px;
  padding: 7px 10px;
  text-align: center;
}

/* Glossary Chips & Cross Navigation */
.wp-glossary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.wp-glossary-chip {
  font-family: var(--res-mono);
  font-size: 0.74rem;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 5px 11px;
  border-radius: 999px;
  text-decoration: none;
}

.wp-glossary-chip:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
}

.wp-prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 34px 0 28px;
}

.wp-nav-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 12px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--res-text);
  transition: border-color 0.2s ease;
}

.wp-nav-card:hover {
  border-color: var(--res-accent);
}

.wp-nav-dir {
  font-family: var(--res-mono);
  font-size: 0.7rem;
  color: var(--res-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 4px;
}

.wp-nav-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.res-footer {
  background: #050811;
  border-top: 1px solid var(--res-border);
  padding: 40px 0;
  color: var(--res-text-muted);
  font-size: 0.84rem;
}

/* =========================================================================
   Embedded Research & Engineering Area inside landing.html
   ========================================================================= */
.landing-research-section {
  background:
    radial-gradient(ellipse 75% 45% at 50% 0%, rgba(217, 119, 87, 0.14), transparent 68%),
    radial-gradient(ellipse 50% 35% at 90% 25%, rgba(56, 189, 248, 0.09), transparent 65%),
    #070b14;
  color: #f1f5f9;
  padding: 90px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  position: relative;
}

.landing-research-section .res-section-title,
.landing-research-section h2,
.landing-research-section h3,
.landing-research-section h4 {
  color: #ffffff;
}

/* AIFL Flagship Spotlight Showcase */
.aifl-spotlight-box {
  background: linear-gradient(160deg, rgba(17, 26, 46, 0.96), rgba(7, 11, 20, 0.98));
  border: 1px solid rgba(217, 119, 87, 0.38);
  border-radius: 18px;
  padding: 32px;
  margin-bottom: 48px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.aifl-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  width: 100%;
}

.aifl-bucket-node {
  background: rgba(7, 11, 20, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-top: 2px solid var(--res-cyan);
  border-radius: 9px;
  padding: 10px 12px;
  text-align: left;
}

.aifl-bucket-node strong {
  display: block;
  font-family: var(--res-mono);
  font-size: 0.74rem;
  color: #7dd3fc;
  margin-bottom: 4px;
}

.aifl-bucket-node span {
  display: block;
  font-size: 0.73rem;
  color: #94a3b8;
  line-height: 1.4;
}

.aifl-pipeline-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 18px 0 6px;
}

.aifl-stage-pill {
  font-family: var(--res-mono);
  font-size: 0.69rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(217, 119, 87, 0.12);
  border: 1px solid rgba(217, 119, 87, 0.32);
  color: #fed7aa;
}

.aifl-stage-arrow {
  color: #64748b;
  font-size: 0.75rem;
}

.aifl-split-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 22px;
  margin-top: 24px;
}

.aifl-info-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aifl-mini-card {
  background: rgba(11, 17, 32, 0.9);
  border: 1px solid var(--res-border);
  border-radius: 11px;
  padding: 15px 17px;
}

.aifl-mini-card h4 {
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.aifl-mini-card p,
.aifl-mini-card li {
  font-size: 0.81rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.res-lowres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.res-lowres-card {
  background: var(--res-bg-card);
  border: 1px solid var(--res-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.res-lowres-card h4 {
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  margin: 8px 0 8px;
}

.res-lowres-card p {
  font-size: 0.83rem;
  color: #94a3b8;
  line-height: 1.6;
  margin: 0 0 14px;
}

/* Publication-Grade Architectural SVG Figures */
.res-diagram-figure {
  margin: 18px 0 22px;
  background: #060a13;
  border: 1px solid var(--res-border-strong);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36);
}

.res-diagram-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.res-diagram-figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 6px 2px;
  font-size: 0.78rem;
  color: var(--res-text-muted);
}

.res-diagram-figcaption strong {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  color: var(--res-cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.res-diagram-open {
  font-family: var(--res-mono);
  font-size: 0.72rem;
  color: var(--res-accent);
  text-decoration: none;
  font-weight: 700;
}

.res-diagram-open:hover {
  text-decoration: underline;
}

.res-card-thumb-wrap {
  display: block;
  margin: 0 0 14px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #060a13;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.res-card-thumb-wrap:hover {
  border-color: rgba(217, 119, 87, 0.6);
}

.res-card-thumb {
  display: block;
  width: 100%;
  height: 154px;
  object-fit: cover;
  object-position: top center;
}

.res-architecture-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  margin-bottom: 42px;
}

@media (max-width: 640px) {
  .res-architecture-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .aifl-split-grid {
    grid-template-columns: 1fr;
  }
  .aifl-spotlight-box {
    padding: 22px 16px;
  }
}

/* Responsive */
@media (max-width: 960px) {
  .wp-layout {
    grid-template-columns: 1fr;
  }
  .wp-toc {
    position: static;
    max-height: none;
  }
  .res-nav-links {
    display: none;
  }
}

@media (max-width: 640px) {
  .wp-prev-next {
    grid-template-columns: 1fr;
  }
  .wp-cover {
    padding: 22px 18px;
  }
  .res-hero {
    padding: 48px 0 40px;
  }
}

/* Publication-Grade PDF Print Stylesheet */
@media print {
  body.research-page {
    background: #ffffff !important;
    color: #0f172a !important;
  }
  .res-navbar,
  .wp-toc,
  .wp-cover-actions,
  .wp-code-copy,
  .wp-prev-next,
  .res-footer,
  .no-print {
    display: none !important;
  }
  .wp-layout {
    display: block !important;
    padding: 0 !important;
  }
  .wp-cover,
  .wp-component-card,
  .wp-diagram-card,
  .wp-code-window,
  .res-integrity-box,
  .res-arch-diagram {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .wp-cover h1,
  .wp-section h2,
  .wp-component-card h3,
  .wp-table th {
    color: #0f172a !important;
  }
  .wp-section p,
  .wp-list,
  .wp-table td,
  .wp-code-window pre,
  .wp-diagram-node {
    color: #1e293b !important;
    background: #f8fafc !important;
  }
}
