/* RPA · Guide contents list. A numbered in-page index. Sticks beside the chapters on wide
   screens; a fold-away compact list on small ones (native <details>, no JS).
   Shared atoms (.rpa-eyebrow, .rpa-plate) are styled in the theme. */

.rpa-guide-toc {
  --_rule: var(--rpa-c-rule, var(--rpa-rule));
  --_rule-strong: var(--rpa-c-rule-strong, var(--rpa-rule-strong));
  --_muted: var(--rpa-c-muted, var(--rpa-slate));
  --_text: var(--rpa-c-text, var(--rpa-ink));
  --_link: var(--rpa-c-link, var(--rpa-indigo));
}

.rpa-guide-toc__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding-block-end: 0.9rem;
  border-block-end: 1px solid var(--_rule-strong);
  list-style: none;
  cursor: pointer;
}
.rpa-guide-toc__title::-webkit-details-marker { display: none; }
.rpa-guide-toc__title::after {
  content: "–";
  font-family: var(--rpa-mono);
  color: var(--_muted);
}
.rpa-guide-toc__fold:not([open]) > .rpa-guide-toc__title::after { content: "+"; }

.rpa-guide-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rpa-guide-toc__item { margin: 0; border-block-end: 1px solid var(--_rule); }

.rpa-guide-toc .rpa-guide-toc__link {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  align-items: baseline;
  padding-block: 0.7rem;
  min-height: 44px;
  color: var(--_text);
  font-size: calc(var(--rpa-step-0) * 0.92);
  line-height: 1.35;
  text-decoration: none;
}
/* A contents list is recognisably a list of links; the label still carries an underline on
   hover/focus, and the number is set in the link colour so it never reads as plain text. */
.rpa-guide-toc .rpa-guide-toc__num { color: var(--_link); font-size: var(--rpa-step--1); }
.rpa-guide-toc__label {
  text-decoration: underline;
  text-decoration-color: var(--_rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color var(--rpa-dur-1) var(--rpa-ease), color var(--rpa-dur-1) var(--rpa-ease);
}
.rpa-guide-toc__link:hover .rpa-guide-toc__label,
.rpa-guide-toc__link:focus-visible .rpa-guide-toc__label {
  color: var(--_link);
  text-decoration-color: currentColor;
  text-decoration-thickness: 1.5px;
}

.rpa-guide-toc__note {
  margin: 1.5rem 0 0;
  color: var(--_muted);
  font-size: var(--rpa-step--1);
  line-height: 1.55;
  max-width: 34ch;
}

/* Wide screens: the list sticks under the header while the chapters scroll past. The summary
   stops behaving like a switch — the list is always open there. */
@media (min-width: 1025px) {
  .elementor-widget-rpa-guide-toc {
    position: sticky;
    top: calc(var(--rpa-header-h) + 2rem);
    align-self: flex-start;
  }
  .admin-bar .elementor-widget-rpa-guide-toc { top: calc(var(--rpa-header-h) + 2rem + var(--wp-admin--admin-bar--height, 0px)); }
  .rpa-guide-toc { max-height: calc(100vh - var(--rpa-header-h) - 4rem); overflow-y: auto; scrollbar-width: thin; }
  .rpa-guide-toc__title { pointer-events: none; cursor: default; }
  .rpa-guide-toc__title::after { content: none; }
  .rpa-guide-toc .rpa-guide-toc__link { padding-block: 0.55rem; min-height: 0; }
}

/* Small screens: two tidy columns when there is room. */
@media (min-width: 600px) and (max-width: 1024px) {
  .rpa-guide-toc__list { columns: 2; column-gap: var(--rpa-gap); }
  .rpa-guide-toc__item { break-inside: avoid; }
}

@media print {
  .elementor-widget-rpa-guide-toc { position: static; }
}
