/* ============================================
   Blog enhancements: readability upgrades for every article + config-driven animated / interactive
   components. Loaded together with blog-tools.css (shares the .bt card frame).
   Everything here is progressive enhancement and degrades to plain, readable text.
   ============================================ */

/* ---------- reading progress ---------- */
.bx-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 1200; pointer-events: none; background: transparent; }
.bx-progress i { display: block; height: 100%; transform-origin: left center; transform: scaleX(0); background: linear-gradient(90deg, var(--accent-dark), var(--accent) 60%, #ff5a66); box-shadow: 0 0 12px rgba(203,31,44,0.7); }

/* ---------- scroll reveal (only ever applied when JS + IntersectionObserver are available) ---------- */
.bx-rv { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.bx-rv.bx-in { opacity: 1; transform: none; }

/* ---------- headings, emphasis, tables ---------- */
.bx-article h2 { position: relative; padding-left: 18px; scroll-margin-top: 90px; }
.bx-article h2::before { content: ""; position: absolute; left: 0; top: 0.16em; bottom: 0.16em; width: 5px; border-radius: 4px; background: linear-gradient(180deg, var(--accent), var(--accent-dark)); box-shadow: 0 0 14px rgba(203,31,44,0.45); }
.bx-article h2.bx-tldr-head { padding-left: 0; }
.bx-article h2.bx-tldr-head::before { display: none; }
.bx-article strong { color: #fff; background: linear-gradient(transparent 62%, rgba(203,31,44,0.38) 62%); padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.bx-article .pull-quote strong, .bx-article .bt strong, .bx-article .bx strong, .bx-article .guide-cta-section strong { background: none; padding: 0; }
mark.bx-num { background: rgba(203,31,44,0.16); color: #fff; font-weight: 700; padding: 1px 6px; border-radius: 6px; border-bottom: 2px solid var(--accent); white-space: nowrap; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.bx-article a:not(.btn) { text-decoration-color: rgba(203,31,44,0.6); text-underline-offset: 3px; }
.bx-table { overflow-x: auto; margin: 28px 0; border-radius: 14px; border: 1px solid var(--glass-border); background: #121212; -webkit-overflow-scrolling: touch; }
.bx-table table { width: 100%; min-width: 520px; border-collapse: collapse; margin: 0; font-size: 0.92rem; }
.bx-table th { background: linear-gradient(180deg, rgba(203,31,44,0.35), rgba(203,31,44,0.18)); color: #fff; text-align: left; padding: 13px 16px; font-family: var(--font-head); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
.bx-table td { padding: 13px 16px; border-top: 1px solid rgba(255,255,255,0.08); color: #dcdcdc; vertical-align: top; }
.bx-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
.bx-table tbody tr { transition: background .2s; }
.bx-table tbody tr:hover td { background: rgba(203,31,44,0.1); }
.bx-article .pull-quote { border-left: 5px solid var(--accent); background: radial-gradient(80% 140% at 0% 0%, rgba(203,31,44,0.18), transparent 70%), #141414; border-radius: 0 16px 16px 0; padding: 22px 26px; font-size: 1.12rem; line-height: 1.55; color: #fff; }

/* ---------- jump nav ---------- */
.bx-jump { margin: 30px 0; border-radius: 16px; border: 1px solid var(--glass-border); background: #131313; overflow: hidden; }
.bx-jump summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; }
.bx-jump summary::-webkit-details-marker { display: none; }
.bx-jump summary b { font-family: var(--font-head); color: #fff; font-size: 1rem; }
.bx-jump summary b::before { content: ""; display: inline-block; width: 22px; height: 3px; background: var(--accent); border-radius: 3px; margin-right: 10px; vertical-align: middle; box-shadow: 0 6px 0 var(--accent), 0 -6px 0 var(--accent); }
.bx-jump summary span { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.bx-jump summary::after { content: "+"; flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; }
.bx-jump[open] summary::after { content: "–"; }
.bx-jump-list { list-style: none; margin: 0; padding: 4px 20px 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 22px; counter-reset: bj; }
.bx-jump-list li { counter-increment: bj; }
.bx-jump-list a { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 10px; color: #dcdcdc; text-decoration: none !important; font-size: 0.88rem; line-height: 1.4; transition: background .2s, color .2s, transform .2s; }
.bx-jump-list a::before { content: counter(bj, decimal-leading-zero); font-family: var(--font-head); font-weight: 800; color: var(--accent-text, #ff3b47); font-size: 0.78rem; flex: none; }
.bx-jump-list a:hover { background: rgba(203,31,44,0.14); color: #fff; transform: translateX(3px); }

/* ---------- TL;DR key takeaways card ---------- */
.bx-tldr { list-style: none; counter-reset: tl; margin: 18px 0 32px; padding: 22px 22px 8px; border-radius: 20px; border: 1px solid rgba(203,31,44,0.45); background: radial-gradient(70% 90% at 100% 0%, rgba(203,31,44,0.22), transparent 65%), #151515; box-shadow: 0 30px 60px -38px rgba(0,0,0,0.9); }
.bx-tldr li { display: block !important; counter-increment: tl; position: relative; padding: 0 0 16px 50px !important; margin: 0 !important; color: #ececec; line-height: 1.6; }
.bx-tldr li::before { content: counter(tl) !important; position: absolute !important; left: 0 !important; top: 0 !important; width: 34px !important; height: 34px !important; border-radius: 50% !important; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-dark)) !important; color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 0.9rem; box-shadow: 0 0 0 5px rgba(203,31,44,0.18); }
.bx-tldr li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: linear-gradient(var(--accent), transparent); opacity: 0.5; }
.bx-tldr.bx-rv li { opacity: 0; transform: translateX(-14px); transition: opacity .55s var(--ease-out) var(--d, 0ms), transform .55s var(--ease-out) var(--d, 0ms); }
.bx-tldr.bx-rv.bx-in li { opacity: 1; transform: none; }

/* ---------- component frame extras ---------- */
.bx .bx-body { display: block; }
.bx-pop { animation: bxPop .5s var(--ease-out); }
@keyframes bxPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.bx .btn.bx-cta { margin-top: 14px; }
.bx-gauge { display: block; height: 10px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; margin-bottom: 8px; }
.bx-gauge i { display: block; height: 100%; width: var(--w, 0%); border-radius: 999px; background: linear-gradient(90deg, #6a6a6a, var(--accent) 70%, #ff5a66); animation: bxGrow 1s var(--ease-out); }
@keyframes bxGrow { from { width: 0; } }
.bx-score { display: block; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.bx .bt-progress i { display: block; height: 100%; width: var(--w, 0%); background: var(--accent); transition: width .4s var(--ease-out); }

/* ---------- animated stats ---------- */
.bx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.bx-stat { position: relative; padding: 20px 18px 18px; border-radius: 16px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.04); overflow: hidden; opacity: .35; transform: translateY(14px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out), border-color .3s, background .3s; }
.bx-stat.on { opacity: 1; transform: none; }
.bx-stat:hover { border-color: rgba(203,31,44,0.6); background: rgba(203,31,44,0.09); transform: translateY(-3px); }
.bx-stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(203,31,44,0.28), transparent 70%); }
.bx-stat-n { display: block; font-family: var(--font-head); font-weight: 800; font-size: clamp(1.9rem, 4.6vw, 2.5rem); line-height: 1.05; color: #fff; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bx-stat-bar { display: block; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.1); margin: 12px 0 10px; overflow: hidden; }
.bx-stat-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width 1.3s var(--ease-out) .2s; }
.bx-stat.on .bx-stat-bar i { width: var(--w, 0%); }
.bx-stat-l { display: block; font-size: 0.88rem; line-height: 1.4; color: #e4e4e4; margin-top: 8px; font-weight: 600; }
.bx-stat-bar + .bx-stat-l { margin-top: 0; }
.bx-stat small { display: block; margin-top: 6px; font-size: 0.72rem; color: var(--muted); line-height: 1.4; }

/* ---------- flip cards ---------- */
.bx-flips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.bx-flip { font: inherit; text-align: left; cursor: pointer; padding: 0; border: 0; background: none; color: inherit; perspective: 1000px; -webkit-tap-highlight-color: transparent; }
.bx-flip-in { display: grid; transform-style: preserve-3d; transition: transform .65s var(--ease-out); }
.bx-flip[aria-pressed="true"] .bx-flip-in { transform: rotateY(180deg); }
.bx-face { grid-area: 1 / 1; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: flex; flex-direction: column; gap: 10px; padding: 20px 18px; border-radius: 16px; border: 1px solid var(--glass-border); min-height: 168px; }
.bx-face em { font-style: normal; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; align-self: flex-start; padding: 4px 10px; border-radius: 999px; }
.bx-face b { font-family: var(--font-head); font-weight: 600; font-size: 1rem; line-height: 1.45; color: #fff; }
.bx-face small { margin-top: auto; font-size: 0.72rem; color: var(--muted); }
.bx-front { background: linear-gradient(160deg, #1d1d1d, #141414); }
.bx-front em { color: #ffb3b9; background: rgba(203,31,44,0.22); border: 1px solid rgba(203,31,44,0.5); }
.bx-front:hover, .bx-flip:focus-visible .bx-front { border-color: rgba(203,31,44,0.6); }
.bx-back { transform: rotateY(180deg); background: linear-gradient(160deg, rgba(203,31,44,0.3), #1a1a1a 75%); border-color: rgba(203,31,44,0.6); }
.bx-back em { color: #fff; background: var(--accent); }
.bx-back b { font-weight: 500; font-size: 0.94rem; color: #f0f0f0; }
.bx-flip:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 16px; }

/* ---------- animated timeline ---------- */
.bx-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.bx-tl-item { position: relative; padding: 0 0 18px 58px; }
.bx-tl-item:last-child { padding-bottom: 0; }
.bx-tl-item::before { content: ""; position: absolute; left: 20px; top: 42px; bottom: -2px; width: 3px; border-radius: 3px; background: rgba(255,255,255,0.1); }
.bx-tl-item::after { content: ""; position: absolute; left: 20px; top: 42px; bottom: -2px; width: 3px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-dark)); transform: scaleY(0); transform-origin: top; transition: transform .8s var(--ease-out) var(--d, 0ms); }
.bx-tl-item.on::after { transform: scaleY(1); }
.bx-tl-item:last-child::before, .bx-tl-item:last-child::after { display: none; }
.bx-tl-node { position: absolute; left: 0; top: 0; width: 43px; height: 43px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; color: #fff; background: #222; border: 2px solid #555; transition: background .5s, border-color .5s, box-shadow .5s, transform .5s var(--ease-out); transition-delay: var(--d, 0ms); transform: scale(.85); }
.bx-tl-item.on .bx-tl-node { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); border-color: var(--accent); box-shadow: 0 0 0 6px rgba(203,31,44,0.2); transform: scale(1); }
.bx-tl-card { border-radius: 14px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.04); transition: border-color .25s, background .25s; }
.bx-tl-item.open .bx-tl-card { border-color: rgba(203,31,44,0.5); background: rgba(203,31,44,0.08); }
.bx-tl-head { width: 100%; font: inherit; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: none; border: 0; color: #fff; border-radius: 14px; min-height: 43px; }
.bx-tl-head em { font-style: normal; flex: none; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #ffb3b9; background: rgba(203,31,44,0.22); border: 1px solid rgba(203,31,44,0.45); padding: 3px 9px; border-radius: 999px; }
.bx-tl-head b { font-family: var(--font-head); font-weight: 600; font-size: 0.98rem; line-height: 1.35; flex: 1; }
.bx-tl-chev { flex: none; width: 10px; height: 10px; border-right: 2px solid #bbb; border-bottom: 2px solid #bbb; transform: rotate(45deg); transition: transform .3s var(--ease-out); margin-right: 4px; }
.bx-tl-item.open .bx-tl-chev { transform: rotate(-135deg); margin-top: 5px; }
.bx-tl-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease-out); }
.bx-tl-body > p { overflow: hidden; margin: 0; padding: 0 16px; font-size: 0.93rem; line-height: 1.7; color: #d4d4d4; }
.bx-tl-item.open .bx-tl-body { grid-template-rows: 1fr; }
.bx-tl-item.open .bx-tl-body > p { padding: 0 16px 16px; }
.bx-tl-head:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- compare ---------- */
.bx-cmp { padding: 20px; border-radius: 16px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.04); }
.bx-swap { animation: bxPop .4s var(--ease-out); }
.bx-cmp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.bx-cmp-head b { font-family: var(--font-head); font-size: 1.2rem; color: #fff; }
.bx-cmp-head em { font-style: normal; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #ffb3b9; background: rgba(203,31,44,0.22); border: 1px solid rgba(203,31,44,0.45); padding: 4px 10px; border-radius: 999px; }
.bx-cmp-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bx-pros, .bx-cons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.bx-pros li, .bx-cons li { position: relative; padding: 0 0 0 28px; font-size: 0.9rem; line-height: 1.5; color: #dcdcdc; }
.bx-pros li::before, .bx-cons li::before { position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; color: #fff; }
.bx-pros li::before { content: "✓"; background: #1f8f55; }
.bx-cons li::before { content: "✕"; background: var(--accent); }
.bx-best { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: rgba(203,31,44,0.12); border: 1px solid rgba(203,31,44,0.4); font-size: 0.9rem; color: #f0f0f0; line-height: 1.55; }
.bx-best b { color: #fff; }

/* ---------- calculator ---------- */
.bx-outs { display: grid; gap: 14px; margin-top: 4px; }
.bx-o { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; }
.bx-o-l { font-size: 0.86rem; color: #dcdcdc; }
.bx-o-v { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; color: #fff; text-align: right; }
.bx-o .bt-track { grid-column: 1 / -1; }
.bx-o.big { padding: 16px 18px; border-radius: 14px; background: rgba(203,31,44,0.12); border: 1px solid rgba(203,31,44,0.45); }
.bx-o.big .bx-o-v { font-size: 1.8rem; }
.bx-msg { margin-top: 16px; font-size: 0.92rem; line-height: 1.6; color: #f0f0f0; }
.bx-msg:empty { display: none; }

/* ---------- bars ---------- */
.bx-bars .bt-fill { width: var(--w, 0%); transition: width 1s var(--ease-out); }

/* ---------- funnel ---------- */
.bx-funnel { display: grid; gap: 8px; margin-top: 8px; }
.bx-fn-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 64px; gap: 12px; align-items: center; font-size: 0.82rem; color: #d6d6d6; }
.bx-fn-l { line-height: 1.3; }
.bx-fn-t { display: block; height: 26px; border-radius: 8px; background: rgba(255,255,255,0.06); overflow: hidden; }
.bx-fn-t i { display: block; height: 100%; width: var(--w, 100%); border-radius: 8px; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width .55s var(--ease-out); }
.bx-fn-row:last-child .bx-fn-t i { background: linear-gradient(90deg, #1f8f55, #35c37b); }
.bx-fn-row b { text-align: right; font-family: var(--font-head); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .bx-jump-list { grid-template-columns: minmax(0, 1fr); }
  .bx-jump summary span { display: none; }
  .bx-cmp-cols { grid-template-columns: minmax(0, 1fr); }
  .bx-tl-item { padding-left: 50px; }
  .bx-tl-node { width: 37px; height: 37px; font-size: 0.85rem; }
  .bx-tl-item::before, .bx-tl-item::after { left: 17px; top: 38px; }
  .bx-tl-head { flex-wrap: wrap; gap: 6px 10px; }
  .bx-fn-row { grid-template-columns: 84px minmax(0, 1fr) 52px; gap: 8px; font-size: 0.74rem; }
  .bx-article h2 { padding-left: 14px; }
  .bx-tldr { padding: 18px 16px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .bx-rv, .bx-tldr.bx-rv li, .bx-stat, .bx-tl-node, .bx-flip-in { transition: none !important; transform: none !important; opacity: 1 !important; }
  .bx-flip-in { transition: none !important; }
  .bx-flip[aria-pressed="false"] .bx-back, .bx-flip[aria-pressed="true"] .bx-front { visibility: hidden; }
  .bx-flip[aria-pressed="true"] .bx-back { transform: none; }
  .bx-flip[aria-pressed="true"] .bx-flip-in { transform: none !important; }
  .bx-tl-item::after { transform: scaleY(1); transition: none; }
  .bx-stat-bar i, .bx-gauge i, .bx-fn-t i { transition: none; animation: none; }
  .bx-pop, .bx-swap { animation: none; }
}
@media print {
  .bx-progress, .bx-jump { display: none; }
  .bx-rv { opacity: 1 !important; transform: none !important; }
}
