/* Infinite Investor v1.9.9: article reading (links and table of contents).
   Loaded after ii-reru-content.css so these rules win. */

/* Links inside article text use Infinite Red. Classed links (buttons, cards,
   bookmark cards, calculators) keep their own styling. */
html .fd-prose a:not([class]),
html .fd-prose p a, html .fd-prose li a, html .fd-prose td a, html .fd-prose blockquote a {
  color: #BC2025;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(188, 32, 37, .35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s, color .15s;
}
html .fd-prose a:not([class]):hover,
html .fd-prose p a:hover, html .fd-prose li a:hover, html .fd-prose td a:hover, html .fd-prose blockquote a:hover {
  color: #BC2025;
  text-decoration-color: #BC2025;
}
html .fd-prose a:not([class]):focus-visible { outline: 2px solid #BC2025; outline-offset: 2px; border-radius: 2px; }

/* Headings land below the sticky header when a contents link is clicked */
html .fd-prose h2, html .fd-prose h3 { scroll-margin-top: 104px; }

/* Table of contents (adapted from the Reru theme): a tick rail on the right edge.
   Desktop (1100px and up): hover or click opens the list of sections.
   Smaller screens: a floating button opens the list as a bottom sheet. */
.ii-toc { position: fixed; right: 16px; z-index: 40; top: 50%; transform: translateY(-50%); }
.ii-toc[hidden] { display: none; }
.ii-toc__trigger { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding: 8px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.ii-toc__trigger:focus-visible { outline: 2px solid #BC2025; outline-offset: 2px; }
.ii-toc__tick { display: block; height: 2px; width: 16px; border-radius: 999px; background: color-mix(in srgb, var(--fd-ink, #000) 28%, transparent); pointer-events: none; transition: width .18s ease, background-color .18s ease; }
.ii-toc__tick.is-sub { width: 10px; }
.ii-toc__tick.is-active { width: 20px; background: #BC2025; }
.ii-toc__tick.is-sub.is-active { width: 14px; }
.ii-toc__panel { position: absolute; right: 100%; top: 50%; margin-right: 4px; width: 264px; transform: translateY(-50%); padding: 6px; border: 1px solid var(--fd-border, #E0E0E0); border-radius: 16px; background: var(--fd-surface, #fff); box-shadow: 0 18px 40px -18px rgba(0,0,0,.28); transform-origin: center right; transition: opacity .16s ease, transform .16s ease; }
.ii-toc__panel[hidden] { display: none; }
.ii-toc__title { margin: 0; padding: 8px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--fd-ink-3, #777); line-height: 1; }
.ii-toc__list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }
.ii-toc__link { display: flex; align-items: center; padding: 8px 14px; border-radius: 12px; font-family: var(--fd-font-sans, inherit); font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--fd-ink-3, #666); text-decoration: none; transition: background-color .15s, color .15s; }
.ii-toc__link.is-sub { padding-left: 28px; }
.ii-toc__link:hover { background: var(--fd-surface-2, #f5f5f5); color: var(--fd-ink, #000); }
.ii-toc__link[aria-current="true"] { color: #BC2025; font-weight: 700; }
.ii-toc__sheet { width: 100%; max-width: 100%; margin: auto 0 0; padding: 0; border: 0; border-radius: 24px 24px 0 0; background: var(--fd-bg, #fff); color: var(--fd-ink, #000); }
.ii-toc__sheet::backdrop { background: rgba(0,0,0,.4); }
.ii-toc__sheet-inner { padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); }
.ii-toc__handle { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 999px; background: color-mix(in srgb, var(--fd-ink, #000) 15%, transparent); }
.ii-toc__sheet-head { display: flex; align-items: center; justify-content: space-between; }
.ii-toc__sheet-head h2 { margin: 0; padding-left: 4px; font-size: 16px; font-weight: 700; color: var(--fd-ink, #000); }
.ii-toc__close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: var(--fd-surface-2, #f2f2f2); color: var(--fd-ink, #000); cursor: pointer; }
.ii-toc__sheet .ii-toc__list { margin-top: 12px; max-height: 60dvh; }
.ii-toc__sheet .ii-toc__link { font-size: 15px; padding: 11px 14px; }
@media (max-width: 1099px) {
  /* sits above the floating Share button */
  .ii-toc { top: auto; transform: none; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .ii-toc__trigger { padding: 14px 12px; border: 1px solid var(--fd-border, #E0E0E0); background: color-mix(in srgb, var(--fd-bg, #fff) 85%, transparent); box-shadow: 0 10px 28px -12px rgba(0,0,0,.3); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
@media (prefers-reduced-motion: reduce) { .ii-toc__tick, .ii-toc__panel { transition: none; } }
