/* Research hub & article pages (loaded with /index.css) */

.page-shell {
  padding-top: 6.5rem;
  padding-bottom: 4rem;
  min-height: 100vh;
}

.research-hero {
  max-width: 42rem;
  margin: 0 auto 3rem;
  text-align: center;
}

.research-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--accent-blue) 10%, var(--accent-orange) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.research-lead {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.article-list {
  max-width: 40rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.article-list-item {
  display: block;
  padding: 1.35rem 1.5rem;
  background: #fff;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.article-list-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.article-list-item time {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.article-list-item h2 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.article-list-item p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Article prose */
.article-prose {
  max-width: 42rem;
  margin: 0 auto;
}

.article-prose header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.article-prose .article-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.article-prose h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.article-prose .article-deck {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.article-disclaimer {
  background-color: #fef2f2;
  border-left: 4px solid #ef4444;
  color: #991b1b;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.article-disclaimer strong {
  color: #7f1d1d;
  font-weight: 600;
}

.article-prose h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.75rem;
}

.article-prose h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

.article-prose blockquote {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  border-left: 4px solid var(--accent-blue);
  background: rgba(36, 83, 184, 0.04);
  border-radius: 0 10px 10px 0;
}

.article-prose blockquote p {
  margin: 0;
}

.article-takeaways {
  background: rgba(36, 83, 184, 0.03);
  border: 1px solid rgba(36, 83, 184, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.article-takeaways h3 {
  margin-top: 0 !important;
  color: var(--accent-blue);
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.article-takeaways ul {
  margin-bottom: 0 !important;
}

.article-takeaways li {
  margin-bottom: 0.75rem;
}

.article-takeaways li:last-child {
  margin-bottom: 0;
}

.article-prose pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-x: auto;
}

.article-prose pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.article-prose p {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.article-prose ul,
.article-prose ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
  color: var(--text-primary);
}

.article-prose li {
  margin-bottom: 0.4rem;
}

.article-prose .table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}

.article-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 0;
  min-width: 600px;
}

.article-prose th,
.article-prose td {
  border: 1px solid var(--glass-border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.article-prose th {
  background: rgba(36, 83, 184, 0.06);
  font-weight: 600;
}

.article-prose tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.02);
}

.article-prose a:not(.btn) {
  color: var(--accent-blue);
  font-weight: 500;
}

.article-back {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
}

.article-prose figure.article-figure {
  margin: 1.75rem 0;
  padding: 0;
}

.article-prose .article-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70vh, 920px);
  object-fit: contain;
  object-position: top center;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: #fff;
}

.article-prose .article-figure figcaption {
  margin-top: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.article-prose .article-figure-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: #fff;
}

.article-prose .article-figure-scroll img {
  border: none;
  border-radius: 0;
  max-height: none;
  min-width: 720px;
}

/* Mermaid (client-rendered diagrams) */
.article-prose .article-mermaid {
  margin: 1.75rem 0;
}

.article-prose .article-mermaid-inner {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem 1.25rem 1.35rem;
  border-radius: 16px;
  border: 1px solid rgba(36, 83, 184, 0.12);
  background:
    radial-gradient(ellipse 85% 55% at 50% 0%, rgba(219, 234, 254, 0.55) 0%, transparent 62%),
    linear-gradient(180deg, #fafcff 0%, #ffffff 45%, #f8fafc 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px -16px rgba(36, 83, 184, 0.12);
  min-height: 120px;
  /* HTML labels live in SVG foreignObject — without this, dark-mode UA styles paint a huge dark slab behind the diagram */
  color-scheme: only light;
}

.article-prose .article-mermaid-inner .mermaid {
  display: flex;
  justify-content: center;
  color-scheme: only light;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.article-prose .article-mermaid-inner .mermaid svg {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  background-color: #ffffff !important;
  color-scheme: only light;
}

/* foreignObject subtrees must stay light or borders read as “black frame” */
.article-prose .article-mermaid-inner .mermaid svg foreignObject {
  color-scheme: only light;
}

.article-prose .article-mermaid-inner .mermaid svg foreignObject > div,
.article-prose .article-mermaid-inner .mermaid svg foreignObject span {
  background: transparent !important;
  color: #0f172a !important;
}

/* Mermaid sometimes emits a labeled background rect */
.article-prose .article-mermaid-inner .mermaid svg .background {
  fill: #ffffff !important;
}

/* Increase Mermaid sequence diagram box title text size */
.article-prose .article-mermaid-inner .mermaid svg text.labelText,
.article-prose .article-mermaid-inner .mermaid svg text.boxText,
.article-prose .article-mermaid-inner .mermaid svg g.box text {
  font-size: 14px !important;
  font-weight: 600 !important;
}

/* Mermaid Zoom Modal */
.mermaid-zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  overflow: auto;
  padding: 3rem;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mermaid-zoom-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mermaid-zoom-overlay .mermaid-cloned {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  margin: auto;
  transition: transform 0.3s ease;
  transform: scale(0.95);
  min-width: min-content;
}

.mermaid-zoom-overlay.active .mermaid-cloned {
  transform: scale(1);
}

.mermaid-zoom-overlay .mermaid-cloned svg {
  display: block;
  width: 100% !important;
  height: auto !important;
  min-width: 1600px;
}

.article-mermaid-inner {
  cursor: zoom-in;
  position: relative;
}

.article-mermaid-inner::after {
  content: "🔍 Click to enlarge";
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-blue);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.article-mermaid-inner:hover::after {
  opacity: 1;
  transform: translateY(0);
}
