/* ============================================================
   ARTICLE.CSS — Yieldora
   ============================================================ */

/* ── GLOBAL OVERFLOW FIX ──
   NOTE: overflow-x on html OR body breaks position:sticky on descendants.
   We use a wrapper approach instead — the .article-page itself is
   constrained and all grid children have min-width:0, so no overflow
   can occur without needing overflow on html/body.
   The PHP file's inline <style> handles the belt-and-suspenders for
   pre-CSS-load flash; we remove it from here to protect sticky.
*/

/* ── 1. PAGE SHELL ── */
.article-page {
  width: 100%;
  max-width: 1100px; /* matches .container — belt-and-suspenders if container ever removed */
  margin: 0 auto;
  padding: 36px 0 80px; /* left/right = 0: .container already gives 20px each side */
  box-sizing: border-box;
}

/* Desktop: two columns
   CRITICAL: align-items:start makes sidebar height = its own content,
   NOT stretched to match the main column. This is required for
   position:sticky to work — sticky needs the parent to be taller
   than the sticky element so there's room to scroll within it.
*/
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  align-items: start;
}

/* ── 2. READING PROGRESS ── */
.reading-progress {
  position: fixed; top: 0; left: 0;
  width: 0%; height: 3px;
  background: linear-gradient(90deg, #9200C5, #40E0D0);
  z-index: 9999;
  transition: width .1s linear;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

/* ── 3. BREADCRUMB ── */
.article-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: #888; margin-bottom: 22px;
  flex-wrap: wrap; width: 100%;
}
.article-breadcrumb a { color: #888; text-decoration: none; }
.article-breadcrumb a:hover { color: #9200C5; }
.article-breadcrumb .sep { color: #ccc; font-size: 11px; }
.article-breadcrumb .current { color: #444; font-weight: 500; }

/* ── 4. HEADER ── */
.article-header { margin-bottom: 28px; }

.article-category-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  background: rgba(146,0,197,.08);
  border: 1px solid rgba(146,0,197,.2);
  border-radius: 20px;
  font-size: 11px; font-weight: 700; color: #9200C5;
  text-transform: uppercase; letter-spacing: .7px;
  margin-bottom: 14px;
}

.article-title {
  font-size: 34px; font-weight: 800; color: #111;
  line-height: 1.2; margin: 0 0 14px;
  letter-spacing: -.4px; word-wrap: break-word;
}

.article-subtitle {
  font-size: 16px; color: #555; line-height: 1.65; margin: 0 0 20px;
}

.article-meta {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}
.article-meta-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: #777; font-weight: 500;
}
.article-meta-item svg { width: 14px; height: 14px; flex-shrink: 0; stroke: #9200C5; }

/* ── 5. FEATURED IMAGE ── */
.article-featured-image {
  width: 100%; border-radius: 14px; overflow: hidden;
  margin-bottom: 32px; box-shadow: 0 6px 24px rgba(0,0,0,.1);
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #f8f0ff, #e8f8f6);
}
.article-featured-image img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* ── 6. BODY ── */
.article-body {
  font-size: 16px; line-height: 1.85; color: #333;
  min-width: 0; word-wrap: break-word; overflow-wrap: break-word;
}

.article-body h2 {
  font-size: 24px; font-weight: 700;
  margin: 44px 0 14px;
  background: linear-gradient(135deg, #9200C5, #A020D0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; scroll-margin-top: 90px;
}

.article-body h3 {
  font-size: 19px; font-weight: 700; color: #1a1a1a;
  margin: 28px 0 10px; scroll-margin-top: 90px;
}

.article-body p   { margin: 0 0 18px; color: #444; }
.article-body ul,
.article-body ol  { margin: 0 0 18px 22px; }
.article-body li  { margin-bottom: 8px; color: #444; line-height: 1.7; }
.article-body strong { color: #1a1a1a; font-weight: 700; }

/* Inline links only */
.article-body p a, .article-body li a {
  color: #9200C5; text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(146,0,197,.3);
}
.article-body p a:hover, .article-body li a:hover {
  text-decoration-color: #9200C5;
}

/* ── 7. CALLOUT ── */
.article-callout {
  background: linear-gradient(135deg, rgba(146,0,197,.05), rgba(64,224,208,.06));
  border-left: 4px solid #9200C5;
  border-radius: 0 12px 12px 0;
  padding: 16px 20px; margin: 24px 0;
}
.article-callout.info { border-left-color: #40E0D0; background: rgba(64,224,208,.07); }
.article-callout.tip  { border-left-color: #f59e0b; background: rgba(245,158,11,.06); }
.article-callout p { margin: 0; font-size: 14.5px; color: #444; line-height: 1.7; }
.article-callout strong { color: #9200C5; }

/* ── 8. EXAMPLE BOX ── */
.example-box {
  background: #fff; border: 2px solid #E8E4EC;
  border-radius: 14px; padding: 24px; margin: 28px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.example-box-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: #9200C5;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid #f0e8f8;
}
.example-box-title svg { width: 16px; height: 16px; flex-shrink: 0; stroke: #9200C5; }

.example-inputs  { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.example-results { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }

.example-input-row {
  background: #faf8fc; border: 1.5px solid #E8E4EC;
  border-radius: 10px; padding: 12px; text-align: center;
}
.example-input-label {
  font-size: 10px; font-weight: 600; color: #888;
  text-transform: uppercase; letter-spacing: .4px;
  display: block; margin-bottom: 4px;
}
.example-input-value { font-size: 17px; font-weight: 800; color: #9200C5; display: block; }

.example-result-card {
  background: linear-gradient(135deg, rgba(146,0,197,.06), rgba(64,224,208,.06));
  border: 1.5px solid rgba(146,0,197,.15); border-radius: 10px; padding: 12px; text-align: center;
}
.example-result-card.highlight {
  background: linear-gradient(135deg, #9200C5, #A020D0); border-color: transparent;
}
.example-result-card.highlight .example-result-label,
.example-result-card.highlight .example-result-value { color: #fff; }
.example-result-label { font-size: 10px; font-weight: 600; color: #777; text-transform: uppercase; display: block; margin-bottom: 4px; }
.example-result-value { font-size: 17px; font-weight: 800; color: #1a1a1a; display: block; }

.example-cta { text-align: center; padding-top: 8px; }

/* Buttons — tag+class beats .article-body p a */
a.example-cta-btn,
a.example-cta-btn:link,
a.example-cta-btn:visited {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 26px;
  background: linear-gradient(135deg, #9200C5, #A020D0);
  color: #fff !important; text-decoration: none !important;
  font-weight: 700; font-size: 14px; border-radius: 10px;
  box-shadow: 0 4px 14px rgba(146,0,197,.28);
  transition: all .3s ease;
}
a.example-cta-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(146,0,197,.38); }
a.example-cta-btn svg { width: 15px; height: 15px; flex-shrink: 0; stroke: #fff; }

/* ── 9. TABLE ── */
.article-table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 24px 0; border-radius: 12px;
  border: 1px solid #E8E4EC; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.article-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 320px; }
.article-table thead tr { background: linear-gradient(135deg, #9200C5, #A020D0); }
.article-table thead th {
  padding: 11px 14px; text-align: left; font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: #fff; white-space: nowrap;
}
.article-table tbody tr { border-bottom: 1px solid #f0edf4; }
.article-table tbody tr:last-child { border-bottom: none; }
.article-table tbody tr:hover { background: rgba(146,0,197,.03); }
.article-table tbody td { padding: 10px 14px; color: #444; }
.article-table tbody td strong { color: #9200C5; }

/* ── 10. CTA BANNER ── */
.article-cta-banner {
  background: linear-gradient(135deg, #9200C5, #A020D0);
  border-radius: 14px; padding: 28px 24px; text-align: center;
  margin: 36px 0; box-shadow: 0 8px 28px rgba(146,0,197,.22);
  overflow: hidden;
}
.article-cta-banner h3 { font-size: 20px; font-weight: 800; color: #fff; margin: 0 0 8px; }
.article-cta-banner p  { font-size: 14px; color: rgba(255,255,255,.88); margin: 0 0 18px; }

a.cta-btn, a.cta-btn:link, a.cta-btn:visited {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 26px; background: #fff;
  color: #9200C5 !important; text-decoration: none !important;
  font-weight: 700; font-size: 14px; border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.14); transition: all .3s ease;
}
a.cta-btn:hover { transform: translateY(-2px); background: #f5f0ff; }

/* ── 11. FAQ ── */
.article-faq { margin-top: 44px; padding-top: 36px; border-top: 2px solid #f0f0f0; }
.article-faq-title {
  font-size: 26px; font-weight: 800; margin: 0 0 20px;
  background: linear-gradient(135deg, #9200C5, #A020D0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.article-faq .faq-item { max-width: 680px; }

/* ── 12. SIDEBAR ──
   STICKY RULES:
   1. position: sticky; top: [header height + gap]
   2. NO overflow-y or max-height on this element (breaks sticky in all browsers)
   3. Parent (.article-layout) must have align-items: start
   4. No ancestor can have overflow: hidden or overflow: clip on the scroll axis
   5. The sidebar sticks within .article-layout's grid area (main column height)
*/
.article-sidebar {
  position: sticky;
  top: 80px;           /* header is ~60px; 80px gives breathing room */
  align-self: start;   /* belt-and-suspenders: ensures grid doesn't stretch it */
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  /* NO max-height, NO overflow-y — these kill sticky */
}

.sidebar-toc {
  background: #fff; border: 1.5px solid #E8E4EC;
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.sidebar-toc-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: #888; margin: 0 0 12px;
}
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.toc-list li a {
  display: block; font-size: 12px; color: #555; text-decoration: none;
  padding: 5px 9px; border-radius: 6px; border-left: 2px solid transparent;
  transition: all .2s; line-height: 1.4;
}
.toc-list li a:hover  { color: #9200C5; background: rgba(146,0,197,.05); border-left-color: #9200C5; }
.toc-list li a.active { color: #9200C5; background: rgba(146,0,197,.08); border-left-color: #9200C5; font-weight: 600; }

.sidebar-calc-cta {
  background: linear-gradient(135deg, #9200C5, #A020D0);
  border-radius: 14px; padding: 20px; text-align: center;
  box-shadow: 0 6px 24px rgba(146,0,197,.2);
}
.sidebar-calc-cta h4 { font-size: 14px; font-weight: 700; color: #fff; margin: 0 0 6px; }
.sidebar-calc-cta p  { font-size: 12px; color: rgba(255,255,255,.85); margin: 0 0 12px; line-height: 1.5; }

a.sidebar-calc-btn, a.sidebar-calc-btn:link, a.sidebar-calc-btn:visited {
  display: block; padding: 9px 14px; background: #fff;
  color: #9200C5 !important; text-decoration: none !important;
  font-weight: 700; font-size: 13px; border-radius: 8px; transition: all .25s;
}
a.sidebar-calc-btn:hover { transform: translateY(-2px); background: #f5f0ff; }

.sidebar-related {
  background: #fff; border: 1.5px solid #E8E4EC;
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.sidebar-related-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: #888; margin: 0 0 10px;
}
.sidebar-related-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.sidebar-related-list li a {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #444; text-decoration: none;
  padding: 6px 8px; border-radius: 7px; transition: all .2s; font-weight: 500;
}
.sidebar-related-list li a:hover { background: rgba(64,224,208,.08); color: #9200C5; }
.sidebar-related-list li a svg { width: 12px; height: 12px; flex-shrink: 0; stroke: #9200C5; }

/* ── 13. AUTHOR BOX ── */
.article-footer-box {
  background: linear-gradient(135deg, rgba(146,0,197,.04), rgba(64,224,208,.04));
  border: 1.5px solid #E8E4EC; border-radius: 14px;
  padding: 20px 22px; margin-top: 40px;
  display: flex; align-items: flex-start; gap: 14px;
}
.article-author-avatar {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #9200C5, #40E0D0);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 700;
}
.article-author-info h4 { font-size: 14px; font-weight: 700; color: #1a1a1a; margin: 0 0 4px; }
.article-author-info p  { font-size: 13px; color: #666; margin: 0; line-height: 1.5; }

/* ─────────────────────────────────────────────────────────
   14. RELATED CALCULATORS — fixed 2 rows × 3 columns grid
   Exact clone of homepage LIC calc-cards visual style
───────────────────────────────────────────────────────── */
.article-related-calcs {
  margin-top: 52px; padding-top: 40px; border-top: 2px solid #f0f0f0;
}
.article-related-calcs .rc-header {
  text-align: center; margin-bottom: 28px;
}
.article-related-calcs .rc-title {
  font-size: 26px; font-weight: 800; margin: 0 0 6px;
  background: linear-gradient(135deg, #9200C5, #A020D0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.article-related-calcs .rc-desc { font-size: 14px; color: #666; margin: 0; }

/* 2 rows × 3 columns = 6 cards, always */
.rc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 18px;
}

/* Card — pixel-perfect match to homepage calc-card */
.rc-grid a.rc-card {
  background: #fff;
  border: 2px solid #E8E4EC;
  border-radius: 12px;
  padding: 24px 16px;
  text-decoration: none !important;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  aspect-ratio: 1;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.rc-grid a.rc-card:hover {
  transform: translateY(-8px);
  border-color: #40E0D0;
  box-shadow: 0 12px 32px rgba(64,224,208,.22);
  background: linear-gradient(to bottom, #fff, rgba(64,224,208,.02));
  text-decoration: none !important;
}

/* Icon */
.rc-grid .rc-icon {
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  color: #9200C5; background: none; flex-shrink: 0;
  transition: all .3s ease;
}
.rc-grid .rc-icon svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 2px 4px rgba(146,0,197,.1));
  transition: transform .25s ease;
}
.rc-grid a.rc-card:hover .rc-icon { color: #40E0D0; transform: scale(1.15); }
.rc-grid a.rc-card:hover .rc-icon svg { filter: drop-shadow(0 4px 8px rgba(64,224,208,.3)); }

/* Text */
.rc-grid .rc-text { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.rc-grid .rc-text h3 {
  font-size: 14px; font-weight: 600; margin: 0; color: #1a1a1a; line-height: 1.3;
  transition: color .2s;
}
.rc-grid a.rc-card:hover .rc-text h3 { color: #9200C5; }
.rc-grid .rc-text p { font-size: 12px; color: #666; margin: 0; line-height: 1.4; }

/* ─────────────────────────────────────────────────────────
   15. RESPONSIVE
   KEY: use display:block (not grid) on mobile to prevent
   the 280px sidebar from ever causing horizontal overflow
───────────────────────────────────────────────────────── */

/* Tablet / small desktop ≤ 900px */
@media (max-width: 900px) {
  /* Switch to block — sidebar cannot overflow in block flow */
  .article-layout {
    display: block;
  }
  .article-sidebar {
    position: static;   /* override sticky */
    align-self: auto;   /* override align-self:start */
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 14px;
    margin-top: 36px;
    width: 100%;
  }
  .sidebar-toc { display: none; }
}

/* Mobile ≤ 640px */
@media (max-width: 640px) {
  .article-page     { padding: 16px 16px 60px; }
  .article-title    { font-size: 22px; }
  .article-subtitle { font-size: 15px; }
  .article-body h2  { font-size: 19px; margin: 32px 0 12px; }
  .article-body h3  { font-size: 16px; }
  .article-meta-item { font-size: 11px; }

  .example-box { padding: 16px 14px; }
  .example-inputs  { grid-template-columns: 1fr; gap: 8px; }
  .example-results { grid-template-columns: 1fr; gap: 8px; }

  a.example-cta-btn { width: 100%; justify-content: center; }
  a.cta-btn         { width: 100%; justify-content: center; }

  .article-cta-banner    { padding: 20px 16px; }
  .article-cta-banner h3 { font-size: 17px; }
  .article-footer-box    { flex-direction: column; gap: 12px; padding: 16px; }
  .article-sidebar       { grid-template-columns: 1fr; }

  .article-faq .faq-item { max-width: 100%; }
  .article-faq-title     { font-size: 20px; }

  /* Related calcs: 3×2 on mobile (smaller) */
  .article-related-calcs .rc-title { font-size: 20px; }
  .rc-grid {
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
  }
  .rc-grid a.rc-card { padding: 14px 8px; gap: 8px; }
  .rc-grid .rc-icon  { width: 32px; height: 32px; }
  .rc-grid .rc-text h3 { font-size: 11px; }
  .rc-grid .rc-text p  { display: none; }
}

/* Very small phones ≤ 380px */
@media (max-width: 380px) {
  .article-title { font-size: 20px; }
  /* 2×3 on tiny screens */
  .rc-grid {
    grid-template-columns: repeat(2,1fr);
    gap: 8px;
  }
  .rc-grid a.rc-card { aspect-ratio: auto; min-height: 90px; }
}