/**
 * Raw heading tags.  In other contexts they should carry component classes
 */

@use "../settings" as *;

h1:not([class]) {
  padding-bottom: space(1);
  margin-bottom: space(2);
  border-bottom: 1px solid $page-heading-border-color;
}

// Add a top margin to unstyled headings.  These won't play nicely and collapse at
// the top of columns, so we only add if not top of column.
// 1: Only child (eg excessive div wrappers) add spacing
// 2: Unless first child (ie top of column) add spacing
h2,
h3,
h4,
h5,
h6 {
  &:not([class]) {
    &:only-child,
    &:not(:first-child) {
      margin-top: .8em;
    }
  }
}

// Remove top spacing if immediately following a higher level heading.
h2:not([class]) + h3:not([class]),
h3:not([class]) + h4:not([class]),
h4:not([class]) + h5:not([class]),
h5:not([class]) + h6:not([class]) {
  margin-top: 0;
}

h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4,
h5,
.h5,
h6,
.h6 {
  --#{$prefix}link-font-weight: #{$headings-font-weight};
}
