/* ============================================
   Article — editorial long-read layout
   Layout: [ float-card + ECG ] | [ content ] | [ meta ]
   Index sits ABOVE the abstract, inside .article-main
   Floating card on the left mirrors the active section
   Decorative vertical accent rails on both flanks
   ============================================ */

.article-wrap {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 720px) minmax(200px, 230px);
  gap: clamp(40px, 5vw, 88px);
  align-items: start;
  max-width: 1380px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) clamp(20px, 4vw, 48px) 120px;
  color: var(--fg);
  font-family: var(--font-serif);
  position: relative;
}

.article-main {
  grid-column: 2;
  min-width: 0;
  position: relative;
}

/* Decorative vertical rails (subtle accent gradients) */
.article-main::before,
.article-main::after {
  content: '';
  position: absolute;
  top: 80px;
  bottom: 80px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(46,173,142,0.35) 12%,
    rgba(46,173,142,0.45) 50%,
    rgba(46,173,142,0.35) 88%,
    transparent 100%
  );
  pointer-events: none;
}
.article-main::before { left: clamp(-44px, -2.5vw, -28px); }
.article-main::after  { right: clamp(-44px, -2.5vw, -28px); }

.article-aside-left  { grid-column: 1; position: sticky; top: 96px; align-self: start; }
.article-aside-right { grid-column: 3; position: sticky; top: 96px; align-self: start; }

/* ============================================
   Aside left — sticky floating card + ECG
   ============================================ */

.float-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 12px;
  padding: 22px 22px 24px;
  box-shadow: 0 8px 28px -16px rgba(0,0,0,0.6);
  transition: transform .35s ease, opacity .35s ease;
}
.float-card-section {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.float-card-section::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(46,173,142,0.18);
}
.float-card-counter {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.16em;
  margin-bottom: 4px;
}
.float-card-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.3;
  color: var(--fg);
  letter-spacing: -0.012em;
}
.float-card-progress {
  margin-top: 18px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.float-card-progress::after {
  content: '';
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  transition: width .25s ease;
}

/* ECG decorative element under the floating card */
.ecg-wrap {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  position: relative;
}
.ecg-wrap::before {
  content: 'TRAZADO';
  position: absolute;
  top: -20px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--fg-dim);
}
.ecg-svg {
  width: 100%;
  max-width: 230px;
  height: 360px;
  display: block;
}
.ecg-svg .ecg-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(46,173,142,0.4));
  opacity: 0.9;
  animation: ecg-pulse 4.6s linear infinite;
}
.ecg-svg .ecg-dot {
  fill: var(--accent-hot);
  filter: drop-shadow(0 0 6px rgba(232,116,74,0.7));
}
@keyframes ecg-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ============================================
   Aside right — meta block
   ============================================ */

.article-meta-block { display: flex; flex-direction: column; gap: 22px; }
.meta-piece-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  display: block;
  margin-bottom: 4px;
}
.meta-piece-big {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 64px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--fg);
  margin-bottom: 8px;
}
.meta-row { border-top: 1px solid var(--line); padding-top: 14px; }
.meta-row-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.meta-row-value {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.35;
}
.meta-share-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  margin-top: 6px;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.meta-share-btn:hover { border-color: var(--accent); color: var(--accent-hot); }
.meta-share-btn[data-copied="1"] {
  border-color: var(--accent);
  color: var(--fg);
  background: rgba(46,173,142,0.1);
}

/* ============================================
   Header
   ============================================ */

.article-head {
  padding-bottom: clamp(28px, 4vw, 40px);
  margin-bottom: clamp(32px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
}
.article-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.article-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.article-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.028em;
  margin: 0 0 28px;
  color: var(--fg);
}
.article-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
}

/* ============================================
   Index (in-body), separators, disclaimer, abstract
   ============================================ */

.article-toc {
  margin: 0 0 clamp(28px, 4vw, 40px);
}
.article-toc-title {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}
.article-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}
.article-toc li { counter-increment: toc; }
.article-toc a {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fg);
  text-decoration: none;
  border-top: 1px solid var(--line);
  transition: color .15s ease, padding-left .15s ease;
}
.article-toc li:last-child a { border-bottom: 1px solid var(--line); }
.article-toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.08em;
}
.article-toc a::after {
  content: '→';
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--fg-dim);
  transition: color .15s ease, transform .15s ease;
}
.article-toc a:hover {
  color: var(--accent);
  padding-left: 6px;
}
.article-toc a:hover::after {
  color: var(--accent);
  transform: translateX(4px);
}
.article-toc a.is-abstract {
  color: var(--accent);
  font-weight: 600;
}

.rule {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: clamp(28px, 4vw, 36px) 0;
}

/* Disclaimer + Abstract --------------------------------- */

.disclaimer,
.abstract {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: start;
  padding: 4px 0;
}

.disclaimer-label,
.abstract-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding-top: 6px;
  white-space: nowrap;
}
.disclaimer-label { color: var(--accent); }
.abstract-label {
  color: var(--accent);
  font-weight: 700;
}
.disclaimer-text {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg-muted);
  font-style: italic;
  margin: 0;
}
.disclaimer-text em { font-style: italic; color: var(--fg); }
.abstract-text {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg);
  margin: 0;
}
.abstract-text em { font-style: italic; color: var(--accent); }
.abstract-text strong { font-weight: 600; color: var(--fg); }

@media (max-width: 640px) {
  .disclaimer, .abstract { grid-template-columns: 1fr; gap: 10px; }
}

/* ============================================
   Body
   ============================================ */

.article-body {
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.75;
  color: var(--fg);
}
.article-body p { margin: 0 0 24px; color: var(--fg); }
.article-body h2 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.15;
  margin: clamp(48px, 6vw, 72px) 0 22px;
  color: var(--fg);
  letter-spacing: -0.018em;
  scroll-margin-top: 96px;
}
.article-body h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(19px, 2.2vw, 22px);
  margin: 44px 0 14px;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.article-body blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 24px;
  margin: 36px 0;
  font-style: italic;
  color: var(--fg);
  opacity: 0.92;
  font-size: clamp(19px, 2vw, 22px);
  line-height: 1.5;
}
.article-body em { font-style: italic; }
.article-body strong { font-weight: 700; color: var(--fg); }
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s ease;
}
.article-body a:hover { color: var(--accent-hot); }
.article-body sup a {
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 3px;
  color: var(--accent);
  font-weight: 600;
  border-radius: 2px;
}
.article-body sup a:hover { background: var(--accent); color: #051018; }
.article-body ul, .article-body ol { margin: 0 0 24px 22px; color: var(--fg); }
.article-body li { margin-bottom: 10px; }

/* ============================================
   Special blocks
   ============================================ */

.pre-public-note,
.indication-list {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  color: var(--fg);
  padding: 24px 28px;
  margin: clamp(36px, 5vw, 56px) 0;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
}
.pre-public-note strong,
.indication-list h4 {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  display: block;
  margin: 0 0 12px;
}
.indication-list ul { margin: 0; padding-left: 22px; color: var(--fg); }
.indication-list li { margin-bottom: 10px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: clamp(36px, 5vw, 52px) 0;
  font-family: var(--font-sans);
}
.stat-card {
  background: var(--bg-card);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.stat-card-num {
  font-size: clamp(32px, 4vw, 40px);
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
  letter-spacing: -0.025em;
}
.stat-card-label {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 10px;
  line-height: 1.4;
}

/* ============================================
   Charts (inline SVG)
   ============================================ */

.chart {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(20px, 3vw, 32px);
  margin: clamp(36px, 5vw, 56px) 0;
  font-family: var(--font-sans);
}
.chart-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
  display: block;
}
.chart-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 17px;
  color: var(--fg);
  margin: 0 0 24px;
  line-height: 1.35;
}
.chart-caption {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 16px;
  line-height: 1.5;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-svg .bar-bg { fill: rgba(255,255,255,0.04); }
.chart-svg .bar { fill: var(--accent); opacity: 0.85; transition: opacity .2s ease; }
.chart-svg .bar:hover { opacity: 1; }
.chart-svg .bar-hot { fill: var(--accent-hot); opacity: 1; }
.chart-svg .bar-muted { fill: var(--fg-dim); opacity: 0.5; }
.chart-svg .ref-line { stroke: var(--accent-hot); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-svg .label-y { font-family: 'JetBrains Mono', monospace; font-size: 11px; fill: var(--fg-muted); letter-spacing: 0.02em; }
.chart-svg .label-x { font-family: 'JetBrains Mono', monospace; font-size: 10px; fill: var(--fg-dim); letter-spacing: 0.05em; }
.chart-svg .value { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; fill: var(--fg); }
.chart-svg .value-accent { fill: var(--accent); }
.chart-svg .value-hot { fill: var(--accent-hot); }
.chart-svg .dot { fill: var(--accent); }
.chart-svg .dot-hot { fill: var(--accent-hot); }
.chart-svg .connector { stroke: var(--line-strong); stroke-width: 1; }

.chart-split {
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}
@media (max-width: 540px) { .chart-split { grid-template-columns: 1fr; } }
.chart-donut-num {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}
.chart-donut-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend span::before { content: ''; width: 12px; height: 12px; border-radius: 2px; background: var(--accent); }
.chart-legend span.legend-hot::before { background: var(--accent-hot); }
.chart-legend span.legend-muted::before { background: var(--fg-dim); opacity: 0.5; }

/* ============================================
   References + back
   ============================================ */

.references {
  margin-top: clamp(72px, 8vw, 96px);
  padding-top: 40px;
  border-top: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
}
.references h2 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 28px;
  color: var(--accent);
}
.references ol { padding-left: 28px; margin: 0; }
.references li { margin-bottom: 16px; color: var(--fg-muted); }
.references li em { font-style: italic; color: var(--fg); }
.references li a {
  color: var(--accent);
  word-break: break-word;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.references li a:hover { color: var(--accent-hot); }

.article-back {
  display: inline-block;
  margin-top: clamp(48px, 6vw, 72px);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
  transition: color .15s ease;
}
.article-back:hover { color: var(--accent-hot); }

/* ============================================
   Responsive collapse
   ============================================ */

@media (max-width: 1100px) {
  .article-wrap {
    grid-template-columns: 1fr;
    max-width: 760px;
    gap: 32px;
  }
  .article-main { grid-column: 1; }
  .article-main::before, .article-main::after { display: none; }
  .article-aside-left,
  .article-aside-right {
    position: static;
    grid-column: 1;
  }
  .article-aside-left { display: none; }
  .article-aside-right {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
  }
  .meta-piece-big { font-size: 48px; }
}
