/* ==========================================================================
   Blok „Tekst ze spisem treści” (.tocdoc): 5/7 – przyklejony spis treści po lewej (numery
   w kropkach na nitce: przeczytane i bieżący punkt zapalone na pomarańczowo, jak wątek
   formularza), tekst po prawej z typografią .prose. Na telefonie spis to zwijany, przyklejony
   pasek z bieżącym punktem i paskiem postępu.
   ========================================================================== */

.tocdoc { --p: 0; padding: clamp(2.5rem, 5vw, 4rem) 0 var(--section-y); }
.tocdoc__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2rem clamp(2rem, 6vw, 6rem); align-items: start; }

/* ---- spis treści ---- */
.tocdoc__aside { position: sticky; top: calc(var(--nav-h) + 2.5rem); max-height: calc(100vh - var(--nav-h) - 4rem); overflow: auto; overscroll-behavior: contain; padding: .25rem; margin: -.25rem; }
.tocdoc__box { margin: 0; }
.tocdoc__sum { display: flex; align-items: center; gap: .75rem; list-style: none; cursor: default; pointer-events: none; }
.tocdoc__sum::-webkit-details-marker { display: none; }
.tocdoc__label {
  font-family: var(--font-ui); font-weight: 500; font-size: .75rem; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.tocdoc__cur, .tocdoc__chev, .tocdoc__bar { display: none; }
.tocdoc__nav { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line-strong); }
.tocdoc__empty { margin: 0; color: var(--muted); font-size: .9375rem; }

.tocdoc__list { position: relative; list-style: none; margin: 0; padding: 0; }
.tocdoc__list::before { content: ""; position: absolute; left: 11px; top: .95rem; bottom: .95rem; width: 2px; border-radius: 1px; background: var(--orange-100); }
.tocdoc__fill { position: absolute; left: 10.75px; top: .95rem; width: 2.5px; height: 0; border-radius: 2px; background: var(--orange); transition: height .35s var(--ease); }
.tocdoc__list a {
  position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: start; gap: .8rem;
  padding: .45rem 0; color: var(--muted); text-decoration: none; font-size: .9375rem; line-height: 1.4;
  transition: color .2s;
}
.tocdoc__n {
  position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; margin-top: -.05rem;
  background: #fff; box-shadow: inset 0 0 0 1.5px var(--line-strong);
  font-family: var(--font-ui); font-weight: 500; font-size: .75rem; color: var(--muted-2); font-variant-numeric: tabular-nums;
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease), color .3s;
}
.tocdoc__t { padding-top: .1rem; }
.tocdoc__list a:hover { color: var(--navy-900); }
.tocdoc__list a:hover .tocdoc__n { box-shadow: inset 0 0 0 1.5px var(--navy); color: var(--navy-900); }
.tocdoc__list a:focus-visible { outline: 2px solid var(--navy-900); outline-offset: 2px; border-radius: 6px; }
.tocdoc__list .is-done .tocdoc__n { background: var(--orange-100); box-shadow: none; color: var(--navy-900); }
.tocdoc__list .is-current a { color: var(--navy-900); font-weight: 600; }
.tocdoc__list .is-current .tocdoc__n { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-50); color: var(--navy-900); }

/* ---- tekst ---- */
.tocdoc__body.prose { max-width: 68ch; padding-block: 0; margin: 0; }
.tocdoc__body > :first-child { margin-top: 0; }
.tocdoc__lead {
  margin: 0 0 2rem !important; padding-bottom: 1.75rem; border-bottom: 1px solid var(--line-strong);
  font-size: clamp(1.1875rem, 1rem + .6vw, 1.4375rem) !important; font-weight: 500; line-height: 1.45 !important; letter-spacing: -.01em; color: var(--navy-900) !important; max-width: 48ch;
}
.tocdoc__body h2 { scroll-margin-top: calc(var(--nav-h) + 2.5rem); }
.tocdoc__body h2:first-of-type { margin-top: 0; }
.tocdoc__body strong { color: var(--navy-900); font-weight: 600; }
.tocdoc__date { margin-top: 2.5rem !important; padding-top: 1.25rem; border-top: 1px solid var(--line); font-family: var(--font-ui); font-size: .875rem !important; color: var(--muted) !important; }
.tocdoc__todo {
  padding: .05em .3em; border-radius: 4px; background: var(--orange-50); box-shadow: inset 0 0 0 1px var(--orange-100);
  font-family: var(--font-ui); font-size: .875em; color: var(--navy-900); -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.tocdoc__draft {
  margin: 0 0 2rem !important; padding: 1rem 1.2rem; border-radius: 12px; background: var(--orange-50); box-shadow: inset 0 0 0 1.5px var(--orange-100);
  font-size: .9375rem; line-height: 1.55; color: var(--navy-900);
}

.site-main > .tocdoc:last-child { padding-bottom: calc(var(--section-y) + 44px); }

@media (max-width: 900px) {
  .tocdoc__grid { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .tocdoc__body.prose { max-width: none; }
  /* spis jako przyklejony, zwijany pasek */
  .tocdoc__aside {
    z-index: 5; top: calc(var(--nav-h) + 1.25rem); max-height: none; overflow: visible; margin: 0; padding: 0;
    border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line), var(--shadow-float);
  }
  .tocdoc__sum { pointer-events: auto; cursor: pointer; padding: .8rem 1rem; min-height: 52px; }
  .tocdoc__sum:focus-visible { outline: 2px solid var(--navy-900); outline-offset: 2px; border-radius: 16px; }
  .tocdoc__label { flex: none; }
  .tocdoc__cur { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; font-weight: 500; color: var(--navy-900); }
  .tocdoc__chev { display: grid; place-items: center; flex: none; width: 30px; height: 30px; margin-left: auto; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--navy); transition: transform .3s var(--ease); }
  .tocdoc__chev .icon { width: .95rem; height: .95rem; }
  .tocdoc__box[open] .tocdoc__chev { transform: rotate(180deg); }
  .tocdoc__nav { margin: 0; padding: .4rem 1rem 1rem; border-top: 1px solid var(--line); max-height: min(60vh, 28rem); overflow: auto; overscroll-behavior: contain; }
  .tocdoc__bar { display: block; position: absolute; left: 1rem; right: 1rem; bottom: 0; height: 2px; border-radius: 1px; background: var(--orange-100); overflow: hidden; }
  .tocdoc__bar span { display: block; height: 100%; background: var(--orange); transform: scaleX(var(--p)); transform-origin: left; }
}

@media (prefers-reduced-motion: reduce) {
  .tocdoc__fill, .tocdoc__n, .tocdoc__chev { transition: none; }
}
