/* ============================================================
   ADPT Research — book-grade reading typography
   The goal: the feel of a well-set PDF, in a browser.
   Serif stack: Charter (macOS/iOS ships it), Iowan Old Style,
   Georgia — all genuine book faces, no webfont download needed.
   ============================================================ */

:root {
  --serif: 'Charter', 'Iowan Old Style', 'Palatino', 'Georgia', 'Times New Roman', serif;
  --paper: rgba(12, 12, 20, 0.92);
}

/* ---------- Article shell ----------
   Wide frame (charts/tables get room to breathe), while running
   text stays at a book measure — see the width rules in the body. */
.article-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) 1.5rem 5rem;
}

.article {
  background: var(--paper);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: clamp(1.8rem, 6vw, 4.5rem);
  box-shadow: 0 34px 80px -24px rgba(0, 0, 0, 0.85);
}

/* ---------- Header ---------- */
.article-head { margin-bottom: 2.8rem; }
.article-head .kicker {
  font: 600 0.72rem var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--secondary);
}
.article-head h1 {
  font: 800 clamp(1.9rem, 5vw, 2.9rem)/1.15 var(--serif);
  letter-spacing: -0.01em;
  margin: 0.7rem 0 1rem;
  color: var(--text);
}
.article-head .standfirst {
  font: 400 1.15rem/1.6 var(--serif);
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 1.4rem;
}
.article-meta {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font: 500 0.8rem var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.05em;
  border-top: 1px solid var(--panel-edge);
  border-bottom: 1px solid var(--panel-edge);
  padding: 0.7rem 0;
}

/* ---------- Body copy: the whole point ---------- */
.article-body {
  font: 400 1.11rem/1.78 var(--serif);
  color: #d6d6e2;
  text-rendering: optimizeLegibility;
  font-variant-ligatures: common-ligatures;
  font-feature-settings: 'liga', 'kern';
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Running text keeps a book measure even in the wide frame… */
.article-body p,
.article-body ul,
.article-body ol,
.article-body h2,
.article-body h3,
.article-body blockquote {
  max-width: 76ch;
  margin-left: auto;
  margin-right: auto;
}

/* …while data blocks use the full width of the frame */
.article-body table,
.article-body figure,
.article-body pre,
.article-body img,
.article-body video {
  max-width: 100%;
}

.article-body p { margin-bottom: 1.35rem; }

/* Drop cap on the opening paragraph — the PDF signature move */
.article-body > p:first-of-type::first-letter {
  font-size: 3.6em;
  font-weight: 700;
  float: left;
  line-height: 0.82;
  padding: 0.08em 0.12em 0 0;
  color: var(--primary);
}

.article-body h2 {
  font: 700 1.55rem/1.3 var(--serif);
  color: var(--text);
  margin: 2.6rem auto 1rem;
}
.article-body h3 {
  font: 700 1.2rem/1.35 var(--serif);
  color: var(--text);
  margin: 2rem auto 0.8rem;
}

.article-body a { color: var(--primary); text-decoration-color: rgba(77,127,255,0.4); }
.article-body strong { color: var(--text); }
.article-body em { font-style: italic; }

.article-body ul, .article-body ol { margin: 0 auto 1.35rem; padding-left: 1.5rem; }
.article-body li { margin-bottom: 0.45rem; }

/* Pull quotes & block quotes */
.article-body blockquote {
  margin: 2rem auto;
  padding: 0.4rem 0 0.4rem 1.4rem;
  border-left: 3px solid var(--secondary);
  font-style: italic;
  font-size: 1.18rem;
  color: var(--text);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

/* Figures, images, charts */
.article-body figure { margin: 2.2rem 0; }
.article-body img, .article-body video {
  max-width: 100%;
  border-radius: 11px;
  border: 1px solid var(--panel-edge);
}
.article-body figcaption {
  font: 400 0.8rem var(--mono);
  color: var(--text-dim);
  margin-top: 0.6rem;
  letter-spacing: 0.03em;
}

/* Tables — Glassnode-style data blocks */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font: 400 0.92rem var(--font);
}
.article-body th {
  font: 600 0.72rem var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(130,140,190,0.25);
}
.article-body td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--panel-edge);
  color: #d6d6e2;
}

/* Code + data callouts */
.article-body code {
  font: 0.88em var(--mono);
  background: rgba(77,127,255,0.08);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}
.article-body pre {
  background: #07070f;
  border: 1px solid var(--panel-edge);
  border-radius: 11px;
  padding: 1.2rem;
  overflow-x: auto;
  margin: 2rem 0;
}
.article-body pre code { background: none; padding: 0; }

.article-body hr {
  border: 0;
  text-align: center;
  margin: 2.6rem 0;
}
.article-body hr::after {
  content: '✦ ✦ ✦';
  color: var(--text-dim);
  letter-spacing: 1em;
  font-size: 0.8rem;
}

/* Footer of article */
.article-foot {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--panel-edge);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- Research hub (index) ---------- */
.research-grid { display: grid; gap: 1.2rem; max-width: 860px; margin: 0 auto; }
.research-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.8rem 2rem;
}
.research-card .rc-date {
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.research-card h3 {
  font: 700 1.45rem/1.25 var(--serif);
  margin: 0.5rem 0 0.6rem;
  color: var(--text);
}
.research-card:hover h3 { color: var(--primary); }
.research-card p {
  font: 400 1rem/1.6 var(--serif);
  color: var(--text-dim);
}
.research-card .rc-tags { margin-top: 0.9rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rc-tag {
  font: 600 0.66rem var(--mono);
  letter-spacing: 0.1em;
  color: var(--secondary);
  border: 1px solid rgba(255,154,60,0.3);
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
}

/* ============================================================
   RESEARCH — showcase enhancements (numbered sections, citations,
   typeset formula, responsive data tables, references, closing).
   Markup-driven; only appears where the classes are present.
   ============================================================ */

/* Numbered research sections (opt-in via .article-research) */
.article-research .article-body { counter-reset: sec; }
.article-research .article-body h2:not(.no-count) { counter-increment: sec; position: relative; }
.article-research .article-body h2:not(.no-count)::before {
  content: counter(sec, decimal-leading-zero);
  display: block;
  font: 600 0.72rem var(--mono);
  letter-spacing: 0.28em;
  color: var(--secondary);
  margin-bottom: 0.35rem;
}

/* Inline superscript citations */
.cite {
  font: 600 0.62em var(--mono);
  vertical-align: super;
  line-height: 0;
  color: var(--secondary);
  text-decoration: none;
  padding: 0 0.08em;
  white-space: nowrap;
}
.cite::before { content: '['; }
.cite::after  { content: ']'; }
.cite:hover { color: var(--primary); }

/* Definition / lead emphasis line */
.article-body .deflead { color: var(--text); }

/* Typeset formula card */
.formula {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  max-width: 66ch;
  margin: 2.2rem auto;
  padding: 1.6rem 1.4rem;
  background: rgba(77, 127, 255, 0.05);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
}
.formula .f-lhs { font: 700 1.5rem var(--serif); color: var(--primary); }
.formula .f-eq  { font: 400 1.5rem var(--serif); color: var(--text-dim); }
.formula .f-frac { display: inline-flex; flex-direction: column; text-align: center; font: 500 1.05rem var(--serif); color: var(--text); }
.formula .f-num { padding: 0 1rem 0.45rem; border-bottom: 1.5px solid var(--text-dim); }
.formula .f-den { padding: 0.45rem 1rem 0; }

/* Responsive wide data tables */
.table-wrap { max-width: 100%; overflow-x: auto; margin: 2rem 0; -webkit-overflow-scrolling: touch; }
.table-wrap table { margin: 0; min-width: 34rem; }
.table-wrap td:first-child, .table-wrap th:first-child { white-space: nowrap; }

/* References */
.references { margin-top: 3.2rem; padding-top: 1.6rem; border-top: 1px solid var(--panel-edge); }
.references h2 { font-size: 1.05rem !important; letter-spacing: 0.02em; margin: 0 0 1rem !important; }
.references h2::before { content: none !important; }
.references ol { max-width: none; margin: 0; padding-left: 1.8rem; font: 400 0.8rem/1.7 var(--mono); color: var(--text-dim); }
.references li { margin-bottom: 0.55rem; word-break: break-word; }
.references li b { color: var(--text); font-weight: 600; }
.references a { color: var(--text-dim); text-decoration-color: rgba(154,154,180,0.35); }
.references a:hover { color: var(--primary); }
.references li:target { color: var(--text); }
.references li:target b { color: var(--primary); }

/* Closing statement — the finale */
.article-close {
  max-width: 66ch;
  margin: 2.8rem auto 0;
  text-align: center;
  font: 700 clamp(1.15rem, 2.6vw, 1.5rem)/1.55 var(--serif);
}
.article-close span { display: block; }
.article-close .grad-line {
  background: linear-gradient(105deg, var(--vapor-yellow) 0%, var(--vapor-orange) 30%, var(--vapor-pink) 62%, var(--vapor-violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
