/* ==================================================
   Codexal — Research Paper article styling
   Used by the Global Neural Grid whitepaper pages (EN + AR).
   Keeps the site theme (header/footer) but renders the
   article body as an academic "paper sheet".
   Works in both LTR and RTL (uses logical properties).
================================================== */

.paper-page {
  background:
    radial-gradient(900px 460px at 12% -8%, color-mix(in oklab, var(--blue) 7%, transparent), transparent 70%),
    radial-gradient(820px 420px at 92% 4%, color-mix(in oklab, var(--green) 6%, transparent), transparent 72%),
    #eef2f7;
  padding: 28px 16px 64px;
}

.paper-shell {
  max-width: 900px;
  margin: 0 auto;
}

.paper-breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 4px 16px;
}
.paper-breadcrumb a { color: var(--link); text-decoration: none; }
.paper-breadcrumb a:hover { text-decoration: underline; }
.paper-breadcrumb span { margin: 0 6px; opacity: .7; }

/* The paper sheet */
.paper {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 24px 60px -28px rgba(2, 8, 23, .35);
  padding: clamp(26px, 5vw, 70px);
  color: #1f2937;
  font-family: Georgia, "Times New Roman", "Noto Naskh Arabic", "Amiri", serif;
  line-height: 1.75;
  counter-reset: figure;
}

/* ===== Title block ===== */
.paper-head { text-align: center; border-bottom: 2px solid #0f3d5c; padding-bottom: 26px; margin-bottom: 30px; }
.paper-eyebrow {
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  letter-spacing: .14em; font-size: 11.5px; font-weight: 700;
  color: #1d6fa5; margin: 0 0 18px; text-transform: uppercase;
}
.paper-title {
  font-size: clamp(1.55rem, 4.2vw, 2.3rem);
  line-height: 1.22; color: #0f172a; margin: 0 0 14px; font-weight: 700;
}
.paper-subtitle {
  font-style: italic; color: #475569;
  font-size: clamp(1rem, 2.4vw, 1.18rem); margin: 0 auto 22px; max-width: 56ch;
}
.paper-authors { font-weight: 700; color: #0f172a; margin: 0 0 4px; font-size: 1.1rem; }
.paper-affil { color: #475569; margin: 0 0 6px; font-size: .98rem; }
.paper-meta {
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  color: #64748b; font-size: .86rem; margin: 0;
}
.paper-meta a { color: var(--link); text-decoration: none; }

/* ===== Action buttons ===== */
.paper-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px;
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
}
.paper-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: .92rem;
  text-decoration: none; border: 1px solid transparent; transition: transform .15s ease, box-shadow .15s ease;
}
.paper-btn svg { flex: 0 0 auto; }
.paper-btn.primary { background: #1d6fa5; color: #fff; box-shadow: 0 8px 18px -8px rgba(29, 111, 165, .8); }
.paper-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -8px rgba(29, 111, 165, .9); }
.paper-btn.ghost { background: #fff; color: #1d6fa5; border-color: #cbd5e1; }
.paper-btn.ghost:hover { border-color: #1d6fa5; background: #f8fafc; }

/* ===== Hero figure ===== */
.paper-hero-figure { margin: 26px 0 8px; }
.paper-hero-figure img {
  width: 100%; height: auto; display: block;
  border-radius: 14px; border: 1px solid #e2e8f0;
}

/* ===== Abstract ===== */
.paper-abstract {
  background: #f8fafc; border: 1px solid #e2e8f0; border-inline-start: 4px solid #1d6fa5;
  border-radius: 12px; padding: 22px 26px; margin: 30px 0;
}
.paper-abstract h2 {
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  font-size: .82rem; letter-spacing: .16em; text-transform: uppercase;
  color: #1d6fa5; margin: 0 0 10px;
}
.paper-abstract p { margin: 0 0 12px; font-size: 1.02rem; text-align: justify; }
.paper-keywords { font-size: .95rem !important; color: #334155; margin: 8px 0 0 !important; }

/* ===== Body ===== */
.paper-body { font-size: 1.06rem; }
.paper-body section { margin-top: 8px; }
.paper-body h2 {
  font-size: clamp(1.25rem, 3vw, 1.55rem); color: #0f172a;
  margin: 38px 0 14px; padding-bottom: 8px; border-bottom: 1px solid #e2e8f0; font-weight: 700;
}
.paper-body h3 { font-size: 1.18rem; color: #1d3a52; margin: 26px 0 8px; font-weight: 700; }
.paper-body p { margin: 0 0 16px; text-align: justify; color: #283549; }
.paper-list { margin: 0 0 18px; padding-inline-start: 22px; }
.paper-list li { margin-bottom: 10px; color: #283549; }
.m { font-family: "Cambria Math", Georgia, serif; white-space: nowrap; }

/* Equation block */
.paper-eq {
  position: relative;
  font-family: "Cambria Math", Georgia, serif; font-size: 1.12rem;
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px;
  padding: 16px 44px; margin: 6px 0 18px; text-align: center; color: #0f172a; overflow-x: auto;
}
.paper-eq .eqn {
  position: absolute; inset-inline-end: 16px; top: 50%; transform: translateY(-50%);
  font-family: Inter, "Readex Pro", system-ui, sans-serif; font-size: .9rem; color: #64748b;
}

/* ===== Figures ===== */
.paper-figure {
  margin: 24px 0; padding: 18px; background: #fcfdff;
  border: 1px solid #e2e8f0; border-radius: 14px; text-align: center;
}
.paper-figure svg { width: 100%; height: auto; max-width: 720px; }
.paper-figure figcaption {
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  font-size: .86rem; color: #475569; margin-top: 12px; line-height: 1.6; text-align: start;
}
.paper-figure .fg-t { font: 700 13px Inter, system-ui, sans-serif; fill: #0f172a; }
.paper-figure .fg-s { font: 400 11.5px Inter, system-ui, sans-serif; fill: #475569; }
.paper-figure .fg-step { font: 700 12px Inter, system-ui, sans-serif; fill: #0f172a; }

/* ===== Table ===== */
.paper-table-wrap { overflow-x: auto; margin: 8px 0 18px; }
.paper-table { width: 100%; border-collapse: collapse; font-size: .96rem; }
.paper-table caption {
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  caption-side: bottom; text-align: start; font-size: .85rem; color: #475569; padding-top: 10px;
}
.paper-table thead th {
  background: #0f3d5c; color: #fff; text-align: start; padding: 11px 14px; font-weight: 600;
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
}
.paper-table tbody td { padding: 10px 14px; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.paper-table tbody tr:nth-child(even) { background: #f8fafc; }
.paper-table td:last-child { white-space: nowrap; color: #1d6fa5; font-weight: 600; }

/* ===== Scope box ===== */
.paper-scope {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 16px 20px; margin: 14px 0 8px; font-size: .98rem; color: #713f12;
}

/* ===== PDF embed ===== */
.paper-pdf { margin-top: 34px; }
.paper-pdf-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 20px; margin-bottom: 16px;
}
.paper-pdf-meta { display: flex; align-items: center; gap: 14px; font-family: Inter, "Readex Pro", system-ui, sans-serif; }
.paper-pdf-meta strong { display: block; color: #0f172a; }
.paper-pdf-meta span { display: block; font-size: .82rem; color: #64748b; }
.paper-pdf-frame { width: 100%; height: 720px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f1f5f9; }
.paper-pdf-frame iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; }
.paper-pdf-fallback { padding: 24px; text-align: center; color: #475569; }

/* ===== References ===== */
.paper-refs {
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  font-size: .92rem; color: #334155; padding-inline-start: 26px; line-height: 1.7;
}
.paper-refs li { margin-bottom: 9px; }

/* ===== Footer + CTA ===== */
.paper-foot {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid #e2e8f0;
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
  font-size: .82rem; color: #94a3b8; text-align: center;
}
.paper-cta {
  margin-top: 28px; text-align: center; background: linear-gradient(135deg, #0f3d5c, #1d6fa5);
  color: #fff; border-radius: 16px; padding: 32px 24px;
  font-family: Inter, "Readex Pro", system-ui, sans-serif;
}
.paper-cta h3 { margin: 0 0 8px; font-size: 1.4rem; }
.paper-cta p { margin: 0 auto 18px; max-width: 52ch; color: #dbeafe; }
.paper-cta .paper-btn.primary { background: #fff; color: #0f3d5c; }
.paper-cta .paper-btn.ghost { color: #fff; border-color: rgba(255,255,255,.6); background: transparent; }
.paper-cta .paper-btn.ghost:hover { background: rgba(255,255,255,.12); }

/* ===== RTL niceties ===== */
[dir="rtl"] .paper-subtitle,
[dir="rtl"] .paper-abstract p,
[dir="rtl"] .paper-body p { text-align: right; }
[dir="rtl"] .paper { font-family: "Readex Pro", "Noto Naskh Arabic", "Amiri", Georgia, serif; }
[dir="rtl"] .paper-eq, [dir="rtl"] .m { direction: ltr; unicode-bidi: embed; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .paper { padding: 22px; }
  .paper-pdf-frame { height: 520px; }
  .paper-abstract p, .paper-body p { text-align: start; }
}
