/* Running text with chapter navigation (templates/blocks/scrollspy_block.html,
   js/scrollspy.js) and intro_section (Impressum). Tokens: agrex.css. */

/* --- scrollspy_section -------------------------------------------------- */
.agx-spy__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.agx-spy__nav { display: none; }
.agx-spy__intro { margin-bottom: 8px; font-size: 17px; line-height: 1.55; color: var(--agx-text); }
.agx-spy__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 0;
  border-top: 1px solid var(--agx-line);
}
/* The last chapter can scroll up to the trigger line even when it is short. */
.agx-spy__section--last { padding-bottom: 40vh; }
.agx-spy__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}
.agx-spy__section .rich-text { font-size: 17px; line-height: 1.55; color: var(--agx-text); }

/* Mobile chapter bar (below 992px) */
.agx-spy__bar-wrap {
  position: sticky;
  top: var(--agx-nav-h, var(--header-height));
  z-index: 1019; /* above page content, below the header (1020) */
  margin-bottom: 8px;
}
.agx-spy__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--agx-line);
  background: var(--agx-white);
  font: inherit;
  font-size: 15px;
  color: var(--agx-ink);
  cursor: pointer;
}
.agx-spy__bar-label { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.agx-spy__chevron {
  flex: none;
  width: 12px;
  height: 12px;
  margin-left: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}
.agx-spy__bar.open .agx-spy__chevron { transform: rotate(180deg); }
.agx-spy__panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--agx-line);
  border-top: 0;
  background: var(--agx-white);
  box-shadow: var(--agx-shadow-pop);
}
.agx-spy__panel.open { display: block; }
.agx-spy__panel-link {
  display: block;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--agx-text);
  text-decoration: none;
}
.agx-spy__panel-link.active { background: var(--agx-surface); font-weight: 600; color: var(--agx-ink); }

@media (min-width: 992px) {
  .agx-spy__bar-wrap { display: none; }
  .agx-spy__grid { grid-template-columns: 300px minmax(0, 720px); gap: 72px; align-items: start; }
  .agx-spy__nav {
    position: sticky;
    top: var(--scroll-offset);
    display: flex;
    flex-direction: column;
  }
  .agx-spy__nav .agx-eyebrow { margin-bottom: 12px; }
  .agx-spy__link {
    padding: 7px 0 7px 12px;
    border-left: 2px solid var(--agx-line);
    font-size: 14px;
    line-height: 1.4;
    color: var(--agx-muted);
    text-decoration: none;
  }
  .agx-spy__link:hover { color: var(--agx-ink); }
  .agx-spy__link.active { border-left-color: var(--agx-teal); font-weight: 600; color: var(--agx-ink); }
}

/* --- intro_section (Impressum) ------------------------------------------- */
.agx-prose__col { max-width: 720px; }
.agx-prose__title { margin: 0 0 16px; font-size: 20px; font-weight: 600; line-height: 1.3; }
.agx-prose__text { font-size: 17px; line-height: 1.55; color: var(--agx-text); }
.agx-prose__text :is(h3, h4) {
  margin: 28px 0 8px;
  padding-top: 22px;
  border-top: 1px solid var(--agx-line);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--agx-ink);
}
.agx-prose__text > :is(h3, h4):first-child { margin-top: 0; }

/* --- Page title on pages without a hero (content/standard_page.html) ----- */
.agx-page-title { margin: 0 0 28px; }
/* The first section follows the title directly (28px from the title). */
.agx-page-head + .agx-section { padding-top: 0; }
