.index-section {
  --offset: 10px;
  --gutter: 40px;
  --column-breakpoint: 15em;
  padding: var(--offset);
  line-height: 1.25;
  will-change: transform, opacity;
  animation: showIndexSection 0.4s forwards;
}

.index-section:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--column-breakpoint)), 1fr));
  column-gap: var(--offset);
  align-items: start;
}

@keyframes showIndexSection {
  from {
    opacity: 0;
    transform: translateY(-1.25em);
  }
}

.index-section__item {
  scroll-margin-block: calc(var(--header-height) * 1px + 1rem);
  position: relative;
  padding-bottom: var(--gutter);
  display: flow-root;
  page-break-inside: avoid;
  break-inside: avoid;
}

@media (width >= 1024px) {
  .index-section__item {
    scroll-margin-block: calc(var(--header-height) * 1px + 2rem);
  }
}

.index-section__item::before {
  content: "";
  opacity: 0;
  position: absolute;
  z-index: -1;
  inset: calc(-1 * var(--offset) / 2);
  bottom: calc(var(--gutter) - var(--offset) / 2);
  background-color: var(--accent-color);
}

.index-section__item:target::before {
  animation-name: targetArticlesGroup;
  animation-iteration-count: 3;
  animation-fill-mode: both;
  animation-duration: 1s;
}

@keyframes targetArticlesGroup {
  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: calc(var(--is-light-theme-on) * 0.2 + var(--is-dark-theme-on) * 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .index-section__item:target::before {
    animation-iteration-count: 1;
    animation-duration: 4s;
  }
}

@media (width >= 768px) {
  .index-section {
    --offset: 20px;
    --gutter: 22px;
  }
}

@media (width >= 1024px) {
  .index-section {
    --gutter: 60px;
  }
}

@media (width >= 1680px) {
  .index-section {
    --gutter: 70px;
  }
}
