/* =========================================================
   RedemptionArc — Article content blocks (.ra-*)
   Rendered by includes/blocks.php, shared by article.php,
   admin/preview.php and the builder canvas.
   ========================================================= */

.ra-content {
  --ra-gap: 1.45rem;
  font-size: 1.05rem;
  line-height: 2.05;
}
.ra-content > * { margin-block: 0 var(--ra-gap); }
.ra-content > *:last-child { margin-bottom: 0; }

.ra-ico { width: 22px; height: 22px; flex-shrink: 0; }
.ra-ico-sm { width: 16px; height: 16px; flex-shrink: 0; }

/* Scroll reveal — the .reveal class is added by content.js only when
   IntersectionObserver is available, so no-JS visitors see everything. */
.ra-content .reveal {
  opacity: 0;
  transform: translateY(14px);
}
.ra-content .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------------------------------
   Headings + anchor links
   --------------------------------------------------------- */
.ra-content h2.ra-h,
.ra-content h3.ra-h,
.ra-content h4.ra-h {
  position: relative;
  scroll-margin-top: 90px;
  font-weight: 700;
  line-height: 1.65;
  margin-top: 2.6rem;
  margin-bottom: 0.9rem;
  color: var(--text-primary);
}
.ra-content h2.ra-h { font-size: 1.5rem; padding-right: 0.9rem; }
.ra-content h3.ra-h { font-size: 1.22rem; }
.ra-content h4.ra-h { font-size: 1.05rem; color: var(--text-secondary); }

/* Signal bar on h2 only — keeps the rhythm readable */
.ra-content h2.ra-h::before {
  content: '';
  position: absolute;
  right: 0; top: 0.35em; bottom: 0.35em;
  width: 3px; border-radius: 3px;
  background: var(--gradient-signal);
}
.ra-content h2.ra-al-center, .ra-content h2.ra-al-left { padding-right: 0; }
.ra-content h2.ra-al-center::before, .ra-content h2.ra-al-left::before { display: none; }

.ra-anchor {
  font-family: var(--font-mono);
  color: var(--accent-green);
  opacity: 0;
  margin-right: 0.4em;
  font-size: 0.8em;
  text-decoration: none !important;
  transition: opacity 0.15s;
}
.ra-h:hover .ra-anchor, .ra-anchor:focus-visible { opacity: 0.75; }

.ra-al-center { text-align: center; }
.ra-al-left   { text-align: left; direction: ltr; }
.ra-al-right  { text-align: right; }

/* ---------------------------------------------------------
   Paragraphs
   --------------------------------------------------------- */
.ra-content p.ra-p { color: var(--text-primary); margin-bottom: var(--ra-gap); }
.ra-content p.ra-lead {
  font-size: 1.16rem;
  line-height: 2;
  color: var(--text-secondary);
  border-right: 2px solid rgba(57, 255, 136, 0.35);
  padding-right: 1rem;
}
.ra-content a {
  color: var(--accent-green);
  text-decoration: none;
  border-bottom: 1px solid rgba(57, 255, 136, 0.35);
  transition: border-color 0.15s, color 0.15s;
}
.ra-content a:hover { border-bottom-color: var(--accent-green); }
.ra-content mark {
  background: rgba(45, 212, 255, 0.16);
  color: var(--accent-blue);
  padding: 0.05em 0.3em;
  border-radius: 4px;
}
.ra-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-line);
  border-radius: 5px;
  padding: 0.08em 0.4em;
  direction: ltr;
  display: inline-block;
}
.ra-content kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.45em;
  direction: ltr;
  display: inline-block;
}

/* ---------------------------------------------------------
   Lists
   --------------------------------------------------------- */
.ra-content ul.ra-list,
.ra-content ol.ra-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--ra-gap);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ra-content .ra-list li {
  position: relative;
  padding-right: 2rem;
  color: var(--text-primary);
}
.ra-content .ra-list li::before {
  position: absolute;
  right: 0;
  top: 0.05em;
  font-family: var(--font-mono);
  font-size: 0.95em;
  color: var(--accent-green);
}
.ra-list-check li::before { content: '✓'; }
.ra-list-arrow li::before { content: '‹'; font-size: 1.3em; line-height: 1.2; }
.ra-list-dot li::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gradient-signal);
  top: 0.75em;
}
.ra-list-num { counter-reset: ra-li; }
.ra-list-num li { counter-increment: ra-li; }
.ra-list-num li::before {
  content: counter(ra-li);
  font-size: 0.78em;
  font-weight: 700;
  width: 1.5em; height: 1.5em;
  border-radius: 50%;
  background: rgba(57, 255, 136, 0.12);
  display: flex; align-items: center; justify-content: center;
  top: 0.4em;
}

/* ---------------------------------------------------------
   Images & galleries
   --------------------------------------------------------- */
.ra-figure { margin: 2rem 0; }
.ra-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-line);
  display: block;
}
.ra-figure.ra-rounded img { border-radius: 18px; }
.ra-figure figcaption {
  margin-top: 0.6rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.83rem;
  line-height: 1.9;
}
.ra-w-wide { width: min(100vw - 2.5rem, 940px); margin-inline: calc(50% - min(50vw - 1.25rem, 470px)); }
.ra-w-full { width: min(100vw - 2.5rem, 1200px); margin-inline: calc(50% - min(50vw - 1.25rem, 600px)); }
@media (max-width: 860px) {
  .ra-w-wide, .ra-w-full { width: 100%; margin-inline: 0; }
}

.ra-gallery { display: grid; gap: 0.7rem; margin: 2rem 0; }
.ra-gal-2 { grid-template-columns: repeat(2, 1fr); }
.ra-gal-3 { grid-template-columns: repeat(3, 1fr); }
.ra-gal-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .ra-gallery { grid-template-columns: repeat(2, 1fr); } }
.ra-gal-item {
  border: 1px solid var(--border-line) !important;
  border-radius: 9px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: block;
}
.ra-gal-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.ra-gal-item:hover img { transform: scale(1.06); }

/* ---------------------------------------------------------
   Code
   --------------------------------------------------------- */
.ra-code {
  background: var(--code-bg);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  overflow: hidden;
  margin: 1.8rem 0;
}
.ra-code-head {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border-line);
}
.ra-code-dots { display: inline-flex; gap: 5px; }
.ra-code-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-line); display: block; }
.ra-code-dots i:first-child { background: #ff5c6a; }
.ra-code-dots i:nth-child(2) { background: #ffb84d; }
.ra-code-dots i:nth-child(3) { background: #39ff88; }
.ra-code-name {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  direction: ltr;
  flex: 1;
  text-align: left;
}
.ra-copy {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--border-line);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-fa);
  font-size: 0.75rem;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ra-copy:hover { color: var(--accent-green); border-color: rgba(57, 255, 136, 0.5); }
.ra-copy.is-done { color: var(--accent-green); border-color: var(--accent-green); }
.ra-pre {
  margin: 0;
  padding: 1.05rem 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.85;
  color: var(--code-text);
  tab-size: 2;
}
.ra-pre code { background: none; border: none; padding: 0; font-size: inherit; display: block; }
.ra-pre::-webkit-scrollbar { height: 8px; }
.ra-pre::-webkit-scrollbar-thumb { background: var(--border-line); border-radius: 8px; }

/* ---------------------------------------------------------
   Quote
   --------------------------------------------------------- */
.ra-quote {
  position: relative;
  margin: 2rem 0;
  padding: 1.5rem 3.4rem 1.5rem 1.5rem;
  background: linear-gradient(120deg, rgba(45, 212, 255, 0.05), rgba(57, 255, 136, 0.03));
  border: 1px solid var(--border-line);
  border-right: 3px solid var(--accent-blue);
  border-radius: 12px;
}
.ra-q-mark {
  position: absolute; top: 1.2rem; right: 1.15rem;
  width: 26px; height: 26px;
  color: var(--accent-blue);
  opacity: 0.45;
}
.ra-quote blockquote {
  margin: 0;
  font-size: 1.1rem;
  line-height: 2;
  color: var(--text-primary);
}
.ra-quote figcaption { margin-top: 0.9rem; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.ra-q-author { font-weight: 600; font-size: 0.92rem; color: var(--accent-blue); }
.ra-q-role { font-size: 0.8rem; color: var(--text-muted); }

/* ---------------------------------------------------------
   Callouts
   --------------------------------------------------------- */
.ra-callout {
  --c: var(--accent-blue);
  --c-soft: rgba(45, 212, 255, 0.09);
  display: flex; gap: 0.9rem;
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--border-line);
  border-right: 3px solid var(--c);
  border-radius: 12px;
  background: var(--c-soft);
  margin: 1.7rem 0;
}
.ra-callout-info    { --c: #2dd4ff; --c-soft: rgba(45,212,255,0.08); }
.ra-callout-tip     { --c: #a78bfa; --c-soft: rgba(167,139,250,0.09); }
.ra-callout-success { --c: #39ff88; --c-soft: rgba(57,255,136,0.07); }
.ra-callout-warn    { --c: #ffb84d; --c-soft: rgba(255,184,77,0.08); }
.ra-callout-danger  { --c: #ff5c6a; --c-soft: rgba(255,92,106,0.08); }

.ra-callout-ico { color: var(--c); display: flex; padding-top: 0.2rem; }
.ra-callout-body { flex: 1; min-width: 0; }
.ra-callout-title { display: block; font-weight: 700; font-size: 0.95rem; color: var(--c); margin-bottom: 0.25rem; }
.ra-callout-text { color: var(--text-secondary); font-size: 0.96rem; line-height: 1.95; }
.ra-callout-text p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------
   CVE card
   --------------------------------------------------------- */
.ra-cve {
  --c: var(--accent-warn);
  display: block;
  border: 1px solid var(--border-line);
  border-radius: 14px;
  background: var(--bg-panel);
  overflow: hidden;
  margin: 1.9rem 0;
  position: relative;
}
.ra-cve::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--c);
}
.ra-sev-critical { --c: #ff5c6a; }
.ra-sev-high     { --c: #ff8a3d; }
.ra-sev-medium   { --c: #ffb84d; }
.ra-sev-low      { --c: #2dd4ff; }

.ra-cve-head {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--border-line);
}
.ra-cve-ico { width: 22px; height: 22px; color: var(--c); flex-shrink: 0; }
.ra-cve-id {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.98rem;
  color: var(--text-primary) !important; border-bottom: 1px dashed var(--border-line) !important;
}
.ra-cve-id:hover { color: var(--c) !important; }
.ra-cve-sev {
  font-size: 0.75rem; font-weight: 700; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  border-radius: 20px; padding: 0.12rem 0.7rem;
}
.ra-cve-score {
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted);
  margin-inline-start: auto;
}
.ra-cve-row {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.7rem 1.15rem; font-size: 0.86rem;
  border-bottom: 1px solid var(--border-line);
}
.ra-cve-row span { color: var(--text-muted); }
.ra-cve-row b { color: var(--text-primary); font-weight: 500; }
.ra-cve-text { padding: 0.9rem 1.15rem; color: var(--text-secondary); font-size: 0.95rem; }
.ra-cve-text p:last-child { margin-bottom: 0; }

/* Fallback where color-mix() is unsupported */
@supports not (color: color-mix(in srgb, red 10%, blue)) {
  .ra-cve-sev { background: rgba(255, 255, 255, 0.07); border-color: var(--border-line); }
}

/* ---------------------------------------------------------
   Steps
   --------------------------------------------------------- */
.ra-steps {
  list-style: none; padding: 0; margin: 1.9rem 0;
  display: flex; flex-direction: column; gap: 1.1rem;
  position: relative;
}
.ra-step { display: flex; gap: 0.95rem; align-items: flex-start; position: relative; }
.ra-step::before {
  content: ''; position: absolute;
  right: 17px; top: 38px; bottom: -1.1rem;
  width: 1px; background: var(--border-line);
}
.ra-step:last-child::before { display: none; }
.ra-step-n {
  width: 35px; height: 35px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-panel-alt);
  border: 1px solid rgba(57, 255, 136, 0.35);
  color: var(--accent-green);
  font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.ra-step-b { flex: 1; min-width: 0; padding-top: 0.15rem; }
.ra-step-t { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 0.3rem; }
.ra-step-x { color: var(--text-secondary); font-size: 0.96rem; }
.ra-step-x p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------
   Table
   --------------------------------------------------------- */
.ra-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-line);
  border-radius: 12px;
  margin: 1.9rem 0;
}
.ra-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 480px; }
.ra-table th {
  background: var(--bg-panel-alt);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-line);
  white-space: nowrap;
}
.ra-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-line);
  color: var(--text-primary);
}
.ra-table tbody tr:last-child td { border-bottom: none; }
.ra-table tbody tr { transition: background 0.15s; }
.ra-table tbody tr:hover { background: rgba(45, 212, 255, 0.04); }

/* ---------------------------------------------------------
   Button block
   --------------------------------------------------------- */
.ra-btn-wrap { margin: 1.8rem 0; display: flex; }
.ra-btn-wrap.ra-al-center { justify-content: center; }
.ra-btn-wrap.ra-al-left   { justify-content: flex-start; }
.ra-btn-wrap.ra-al-right  { justify-content: flex-end; }
.ra-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.6rem;
  border-radius: 9px;
  font-weight: 700; font-size: 0.95rem;
  border: 1px solid transparent !important;
  transition: transform 0.15s, box-shadow 0.2s;
}
.ra-btn-primary { background: var(--gradient-signal); color: #00130a !important; }
.ra-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(57, 255, 136, 0.28); }
.ra-btn-outline { border-color: var(--border-line) !important; color: var(--text-primary) !important; }
.ra-btn-outline:hover { border-color: var(--accent-green) !important; color: var(--accent-green) !important; }

/* ---------------------------------------------------------
   Video
   --------------------------------------------------------- */
.ra-video { margin: 2rem 0; }
.ra-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-line);
  background: var(--code-bg-deep);
}
.ra-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ra-video figcaption { margin-top: 0.6rem; text-align: center; color: var(--text-muted); font-size: 0.83rem; }

/* ---------------------------------------------------------
   Table of contents
   --------------------------------------------------------- */
.ra-toc {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin: 1.9rem 0;
}
.ra-toc-head {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 0.95rem;
  color: var(--accent-green);
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 0.7rem;
}
.ra-toc-list { list-style: none; margin: 0; padding: 0; counter-reset: ra-toc; }
.ra-toc-list li { margin: 0.15rem 0; }
.ra-toc-list a {
  display: block;
  padding: 0.28rem 0;
  color: var(--text-secondary) !important;
  border: none !important;
  font-size: 0.92rem;
  transition: color 0.15s, padding 0.15s;
}
.ra-toc-list a:hover { color: var(--accent-green) !important; padding-right: 0.35rem; }
.ra-toc-list a.is-active { color: var(--accent-green) !important; font-weight: 600; }
.ra-toc-l3 { padding-right: 1.1rem; }
.ra-toc-l4 { padding-right: 2.2rem; font-size: 0.9em; }

/* Auto contents list: a <details>, so a phone shows one tappable line while a
   desktop shows the whole list (content.js opens it on wide screens). */
.ra-toc-auto { padding-block: 0.9rem; margin-top: 0; }
.ra-toc-auto > summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.ra-toc-auto > summary::-webkit-details-marker { display: none; }
.ra-toc-auto[open] > summary {
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 0.7rem;
}
.ra-toc-caret {
  margin-inline-start: auto;
  width: 8px; height: 8px;
  border-inline-start: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
.ra-toc-auto[open] .ra-toc-caret { transform: rotate(135deg); }

/* The navbar is sticky, so a heading jumped to would otherwise sit underneath
   it. Handled in CSS rather than JS so plain #anchor links behave too. */
.ra-content h2[id], .ra-content h3[id], .ra-content h4[id] { scroll-margin-top: 84px; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------------------------------------------------------
   Divider / spacer / embed
   --------------------------------------------------------- */
.ra-hr { border: none; margin: 2.4rem 0; }
.ra-hr-line { height: 1px; background: var(--border-line); }
.ra-hr-glow {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(57, 255, 136, 0.55), transparent);
}
.ra-hr-dots {
  height: 6px;
  background-image: radial-gradient(circle, var(--text-muted) 1.5px, transparent 1.6px);
  background-size: 14px 6px;
  background-repeat: repeat-x;
  background-position: center;
  opacity: 0.7;
}
.ra-spacer-sm { height: 1rem; }
.ra-spacer-md { height: 2.2rem; }
.ra-spacer-lg { height: 4rem; }
.ra-embed { margin: 1.9rem 0; }
.ra-embed iframe { max-width: 100%; border-radius: 12px; border: 1px solid var(--border-line); }

/* ---------------------------------------------------------
   Reading progress bar (added by content.js)
   --------------------------------------------------------- */
.ra-progress {
  position: fixed; top: 0; right: 0; left: 0;
  height: 3px; z-index: 200;
  background: transparent;
  pointer-events: none;
}
.ra-progress span {
  display: block; height: 100%; width: 0;
  background: var(--gradient-signal);
  box-shadow: 0 0 12px rgba(57, 255, 136, 0.5);
  transform-origin: right center;
}

/* Copy-confirmation toast */
.ra-toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--bg-panel); border: 1px solid rgba(57, 255, 136, 0.4);
  color: var(--accent-green);
  border-radius: 10px; padding: 0.55rem 1.1rem; font-size: 0.85rem;
  z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.ra-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------
   Reduced motion — kill every movement, keep every state
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ra-content .reveal { opacity: 1; transform: none; }
  .ra-gal-item:hover img,
  .ra-btn:hover { transform: none; }
}
