/* Side rails for both posts: a sticky left rail (back link, "In this article" contents with a reading progress bar)
   and a sticky right rail (share icons and a small promo card). Shown at 1200 px and wider; below that the contents
   become a small "In this article" dropdown and the share row stays inline. Post 2 restyles them dark (night.css). */
.rails { display: block; }
.rail { display: none; }
.toc-m { max-width: 680px; margin: 28px auto 0; padding: 0 16px; }
.toc-m summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; font: 600 .85rem/1.3 var(--font); letter-spacing: .04em; cursor: pointer; list-style: none; }
.toc-m summary::-webkit-details-marker { display: none; }
.toc-m summary:hover, .toc-m summary:focus-visible { box-shadow: var(--act-glow); outline: none; }
.toc-m[open] summary .licon { transform: rotate(180deg); }
.toc-m ol { margin: 8px 0 0; padding: 12px 16px 12px 34px; border-radius: 14px; background: var(--bg-2); font-size: .92rem; }
.toc-m li { margin: 6px 0; }
.toc-m a { text-decoration: none; }
[data-article] h2[id] { scroll-margin-top: 90px; }

@media (min-width: 1200px) {
  .toc-m { display: none; }
  .rails { display: grid; grid-template-columns: 210px minmax(0, 1fr) 240px; gap: 40px; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
  .rails__main { min-width: 0; }
  .rail { display: block; position: relative; }
  .rail__in { position: sticky; top: 92px; padding-top: 72px; }
  .rail--l .rail__in { padding-left: 16px; }
  .rail__bar { position: absolute; left: 0; top: 72px; bottom: 0; width: 2px; border-radius: 1px; background: var(--line); overflow: hidden; }
  .rail__bar i { display: block; width: 100%; height: calc(var(--read, 0) * 100%); background: var(--accent); transition: height .15s linear; }
  .rail__back { display: inline-block; margin: 0 0 22px; font-size: .85rem; color: var(--muted); text-decoration: none; }
  .rail__back:hover, .rail__back:focus-visible { color: var(--accent); }
  .toc__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
  .toc__title { margin: 0; font: 600 .74rem/1.3 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .act--xs { width: 26px; height: 26px; }
  .act--xs .licon { width: 14px; height: 14px; transition: transform .25s; }
  .toc.is-closed .act--xs .licon { transform: rotate(-90deg); }
  .toc.is-closed .toc__list { display: none; }
  .toc__list { margin: 0; padding: 0; list-style: none; font-size: .86rem; line-height: 1.4; }
  .toc__list li { margin: 0; }
  .toc__list a { display: block; padding: 7px 0 7px 12px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; transition: color .2s, border-color .2s; }
  .toc__list a:hover, .toc__list a:focus-visible { color: var(--fg); outline: none; }
  .toc__list a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
  .rail__share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 22px; }
  .rail__label { font: 600 .8rem/1 var(--font); color: var(--muted); }
  .rail__share .share { gap: 6px; }
  .promo { padding: 22px 20px; border-radius: 22px; background: linear-gradient(165deg, #6B5BFF, #4231D6 60%, #2B2190); color: #FFFFFF; box-shadow: 0 30px 60px -40px rgba(66, 49, 214, .8); }
  .promo__k { margin: 0 0 10px; font: 600 .7rem/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: #D9D2FF; }
  .promo__h { margin: 0 0 16px; font: 650 1.3rem/1.15 var(--font); letter-spacing: -.02em; }
  .promo__chat { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .12); }
  .promo__b { margin: 0; max-width: 90%; padding: 7px 10px; border-radius: 12px 12px 12px 4px; background: #FFFFFF; color: #15141F; font-size: .78rem; line-height: 1.35; }
  .promo__b--me { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: #CDEFDD; }
  .promo__p { margin: 0 0 14px; font-size: .84rem; line-height: 1.5; color: #E7E3FF; }
  .promo__link { font: 600 .85rem/1 var(--font); color: #FFFFFF; text-underline-offset: 3px; }
  .promo__link:hover, .promo__link:focus-visible { text-shadow: 0 0 12px rgba(255, 255, 255, .7); outline: none; }
  /* rails sit next to the main column, so the wide blocks inside it fill the column */
  .rails__main .s-scrolly, .rails__main .s-vs, .rails__main .n-tl, .rails__main .n-qa, .rails__main .n-flow { max-width: none; padding-inline: 0; }
  .rails__main .s-scrolly { gap: 40px; }
  .rails__main .s-col, .rails__main .n-col { padding-inline: 0; }
}

/* post 2: the rails go dark */
.p-night .toc-m summary { border-color: var(--edge); color: var(--text); }
.p-night .toc-m ol { background: var(--panel); color: var(--text-2); }
.p-night .rail__bar { background: var(--edge); }
.p-night .rail__bar i { background: linear-gradient(var(--neon), var(--neon-g)); }
.p-night .toc__title, .p-night .rail__back, .p-night .rail__label, .p-night .toc__list a { color: var(--dim); }
.p-night .toc__list a:hover { color: var(--text); }
.p-night .toc__list a.is-active { color: var(--neon); border-left-color: var(--neon); }
.p-night .promo { background: linear-gradient(165deg, #2A2370, #171447 55%, #0E1036); border: 1px solid rgba(164, 149, 255, .35); box-shadow: 0 0 40px rgba(124, 107, 255, .25); }
.p-night .promo__b { background: #1F6E51; color: #FFFFFF; }
.p-night .promo__b--me { background: #3A3A80; }
@media (prefers-reduced-motion: reduce) { .rail__bar i, .act--xs .licon { transition: none; } }
