/* ef11 table of contents (Figma "Sidebar Blog Beitrag", 11/2026): a box in
   the area's box colour, 32px padding; the title Archivo ExtraBold 18/25,
   optionally a reading progress bar (2px, Rust on Beige 60) and the reading
   time 13/19; the chapters numbered, 14/22, 12px apart, the one in view bold. */
.ef-toc {
  display: grid;
  gap: 1rem;
  padding: 2rem;
  background-color: var(--color-base-200);
}

.ef-toc[hidden] {
  display: none;
}

.ef-toc__head {
  display: grid;
  gap: 0.25rem;
}

.ef-toc__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.5625rem;
  color: var(--color-heading);
}

.ef-toc__bar {
  height: 2px;
  margin-top: 0.25rem;
  /* Beige 60 track (Figma); on dark boxes a light share of the text colour. */
  background-color: #c9bfb2;
}

[data-theme="dark"] .ef-toc__bar,
[data-theme="brand"] .ef-toc__bar,
[data-theme="thunder"] .ef-toc__bar {
  background-color: color-mix(in oklab, var(--color-base-content) 30%, transparent);
}

.ef-toc__bar > span {
  display: block;
  width: 0;
  height: 100%;
  background-color: var(--color-rule);
}

.ef-toc__time {
  font-size: 0.8125rem;
  line-height: 1.1875rem;
  color: var(--color-base-content);
}

.ef-toc__list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ef-toc;
  font-size: 0.875rem;
  line-height: 1.375rem;
}

.ef-toc__list > li {
  counter-increment: ef-toc;
}

/* "01. Kapitel" (Figma): the number is part of the link. */
.ef-toc__list a::before {
  content: counter(ef-toc, decimal-leading-zero) ". ";
}

/* Link states: hover underlined in the heading colour; focus a light Rust
   pill with a Rust frame; the section in view (aria-current, toc.js) bold in
   Navy 80. The negative margin keeps the text in line with the title. */
.ef-toc__list a {
  /* Inline with cloned decoration: the hover line runs under every line of a
     long entry, not once under the whole box. */
  display: inline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  margin-inline: -0.5rem;
  padding: 0 0.5rem;
  color: var(--color-base-content);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}

.ef-toc__list a:hover {
  color: var(--color-heading);
  text-decoration-color: currentColor;
}

.ef-toc__list a:focus-visible {
  border-radius: 100px;
  outline: 1px solid var(--color-primary);
  outline-offset: 0;
  background-color: color-mix(in oklab, var(--color-primary) 15%, transparent);
  color: var(--color-heading);
  text-decoration-color: currentColor;
}

.ef-toc__list a[aria-current] {
  font-weight: 700;
  color: var(--color-ink, var(--color-heading));
}

/* With progress (articles): below lg a floating button and a bottom sheet
   in Beige 30 (Figma "Inhalt · Bottom Sheet"); from lg the dialog is the box
   in the sidebar and the button is gone (css/ef11.pcss .ef-fab). */
.ef-toc-fab[hidden] {
  display: none;
}

.ef-fab .ef-toc__bar {
  width: 9.625rem;
  margin: 0;
}

.ef-fab .ef-toc__time {
  color: #f8f3ed;
}

.ef-sheet--toc {
  background-color: var(--color-base-200);
}

.ef-sheet--toc .ef-toc {
  padding: 0;
  background: none;
}

.ef-sheet--toc .ef-sheet__close {
  position: absolute;
  top: 1.75rem;
  right: 1rem;
  margin: 0;
}

.ef-sheet--toc .ef-toc__list {
  gap: 0;
}

.ef-sheet--toc .ef-toc__list a {
  padding-block: 0.6875rem;
}

@media (min-width: 64rem) {
  .ef-sheet--toc {
    display: contents;
  }

  .ef-sheet--toc :is(.ef-sheet__grip, .ef-sheet__close) {
    display: none;
  }

  .ef-sheet--toc .ef-toc {
    padding: 2rem;
    background-color: var(--color-base-200);
  }

  .ef-sheet--toc .ef-toc__list {
    gap: 0.75rem;
  }

  .ef-sheet--toc .ef-toc__list a {
    padding-block: 0;
  }
}
