////
///Placeholder for Copyright ///
////

// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------

// Scoped in typesetted content to match specificity of regular content
.md-typeset {

  // Headerlink
  .headerlink {
    display: inline-block;
    margin-left: px2rem(10px);
    color: var(--md-default-fg-color--lighter);
    opacity: 0;
    transition:
      color      250ms,
      opacity    125ms;

    // [print]: Hide headerlinks
    @media print {
      display: none;
    }

    // Adjust for right-to-left languages
    [dir="rtl"] & {
      margin-right: px2rem(10px);
      margin-left: initial;
    }
  }

  // Show headerlinks on parent hover
  :hover  > .headerlink,
  :target > .headerlink,
  .headerlink:focus {
    opacity: 1;
    transition:
      color      250ms,
      opacity    125ms;
  }

  // Adjust color on parent target or focus/hover
  :target > .headerlink,
  .headerlink:focus,
  .headerlink:hover {
    color: var(--md-accent-fg-color);
  }

  // Adjust scroll offset for all elements with `id` attributes - general scroll
  // margin offset for anything that can be targeted. Browser support is pretty
  // decent by now, but Edge <79 and Safari (iOS and macOS) still don't support
  // it properly, so we settle with a cross-browser anchor correction solution.
  :target {
    scroll-margin-top: px2rem(48px + 24px);
  }

  // Adjust scroll offset for headlines of level 1-3
  h1:target,
  h2:target,
  h3:target {
    scroll-margin-top: initial;

    // Anchor correction hack
    &::before {
      display: block;
      margin-top: -1 * px2rem(48px + 24px - 4px);
      padding-top: px2rem(48px + 24px - 4px);
      content: "";
    }
  }

  // Adjust scroll offset for headlines of level 4
  h4:target {
    scroll-margin-top: initial;

    // Anchor correction hack
    &::before {
      display: block;
      margin-top: -1 * px2rem(48px + 24px - 3px);
      padding-top: px2rem(48px + 24px - 3px);
      content: "";
    }
  }

  // Adjust scroll offset for headlines of level 5-6
  h5:target,
  h6:target {
    scroll-margin-top: initial;

    // Anchor correction hack
    &::before {
      display: block;
      margin-top: -1 * px2rem(48px + 24px);
      padding-top: px2rem(48px + 24px);
      content: "";
    }
  }
}
