// BOLT HEADLINE COMPONENT

@import '@bolt/core-v3.x';
@import './tools.headlines';
@import './_headline.numbered'; // numbered bullet variation

/* ------------------------------------ *\
   Headlines
\* ------------------------------------ */

.c-bolt-headline,
.c-bolt-subheadline,
.c-bolt-eyebrow,
.c-bolt-text {
  @include bolt-headline;

  strong {
    font-weight: var(--bolt-type-font-weight-bold);
  }
}

.c-bolt-headline,
.c-bolt-subheadline,
.c-bolt-eyebrow {
  color: var(--m-bolt-headline);
}

.c-bolt-text {
  color: var(--m-bolt-text);
}

.c-bolt-headline {
  &:not(:last-child) {
    margin-bottom: var(--bolt-spacing-y-medium);
  }

  &:not([class*='c-bolt-headline--']) {
    font-family: var(--bolt-type-font-family-headline);
    font-size: var(--bolt-type-font-size-large);
    line-height: var(--bolt-type-line-height-large);
  }
}

// @TODO: grab the same shared values from the Blockquote component
.c-bolt-headline--quoted > .c-bolt-headline__text,
.c-bolt-subheadline--quoted > .c-bolt-subheadline__text {
  // workaround to display: flex breaking quote styles
  display: inline-block;

  &:first-child:before,
  &:last-child:after {
    font-family: 'Georgia', serif; // TODO: Replace with Noto Serif when it is added.
  }

  &:first-child:before {
    content: '\201C';
    position: absolute;
    transform: translate3d(-110%, 0, 0);
  }

  &:last-child:after {
    content: '\201D';
  }
}

.c-bolt-eyebrow {
  opacity: 0.8;
  margin-bottom: 0.1rem;
  font-family: var(--bolt-type-font-family-headline);
  font-size: var(--bolt-type-font-size-xsmall);
  line-height: var(--bolt-type-line-height-small);
  text-transform: uppercase;
  letter-spacing: var(--bolt-type-letter-spacing-wide);
}

.c-bolt-headline__line {
  flex: 1 0 1rem;
  align-self: center;
  opacity: 0.2;
  height: 1px;
  border-width: 0;
  border-style: none;
  background-color: inherit;

  &:first-child {
    margin: 0 var(--bolt-spacing-y-small) 0 0;
  }

  &:last-child {
    margin: 0 0 0 var(--bolt-spacing-x-small);
  }
}

.c-bolt-headline__text {
  display: inline-block;

  &-inner {
    display: inline-block;
    vertical-align: middle;
  }
}

// Subheadline styles.
.c-bolt-subheadline {
  margin-bottom: var(--bolt-spacing-y-medium);
  font-family: var(--bolt-type-font-family-headline);
  font-weight: var(--bolt-type-font-weight-regular);

  &:not([class*='c-bolt-subheadline--']) {
    font-size: var(--bolt-type-font-size-large);
  }
}

// Headline spacing with other elements.
.c-bolt-headline:not(.c-bolt-headline--xxxlarge) + .c-bolt-headline,
.c-bolt-headline:not(.c-bolt-headline--xxxlarge) + .c-bolt-subheadline,
.c-bolt-headline:not(.c-bolt-headline--xxxlarge) + .c-bolt-text,
.c-bolt-headline:not(.c-bolt-headline--xxxlarge) + bolt-inline-list,
.c-bolt-headline:not(.c-bolt-headline--xxxlarge) + p:not([class]) {
  margin-top: calc(var(--bolt-spacing-y-xsmall) - var(--bolt-spacing-y-medium));
}

.c-bolt-headline--xxxlarge + .c-bolt-headline,
.c-bolt-headline--xxxlarge + .c-bolt-subheadline,
.c-bolt-headline--xxxlarge + .c-bolt-text,
.c-bolt-headline--xxxlarge + bolt-inline-list,
.c-bolt-headline--xxxlarge + p:not([class]) {
  margin-top: calc(var(--bolt-spacing-y-small) - var(--bolt-spacing-y-medium));
}

.c-bolt-subheadline + .c-bolt-text,
.c-bolt-subheadline + p:not([class]) {
  margin-top: calc(var(--bolt-spacing-y-xsmall) - var(--bolt-spacing-y-medium));
}

.c-bolt-headline--xxxlarge,
.c-bolt-headline--xxlarge {
  letter-spacing: var(--bolt-type-letter-spacing-narrow);
}

/**
  * 1. Only include max-width rule on larger font sizes
  */
.c-bolt-text--xxxlarge,
.c-bolt-subheadline--xxxlarge,
.c-bolt-headline--xxxlarge {
  font-size: calc(var(--bolt-type-font-size-xxxlarge) * 1.06);
  line-height: var(--bolt-type-line-height-xxxlarge);
}

// [Mai] This needs to be deprecated.
.c-bolt-headline--xxxlarge-min {
  font-size: var(--bolt-type-font-size-xxxlarge);
  line-height: var(--bolt-type-line-height-xxxlarge);
}

.c-bolt-text--xxlarge,
.c-bolt-subheadline--xxlarge,
.c-bolt-headline--xxlarge {
  font-size: var(--bolt-type-font-size-xxlarge);
  line-height: var(--bolt-type-line-height-xxlarge);
}

.c-bolt-text--xlarge,
.c-bolt-subheadline--xlarge,
.c-bolt-headline--xlarge {
  font-size: var(--bolt-type-font-size-xlarge);
  line-height: var(--bolt-type-line-height-xlarge);
}

.c-bolt-text--large,
.c-bolt-subheadline--large,
.c-bolt-headline--large {
  font-size: var(--bolt-type-font-size-large);
  line-height: var(--bolt-type-line-height-large);
}

.c-bolt-text--medium,
.c-bolt-subheadline--medium,
.c-bolt-headline--medium {
  font-size: var(--bolt-type-font-size-medium);
  line-height: var(--bolt-type-line-height-medium);
}

.c-bolt-text--small,
.c-bolt-subheadline--small,
.c-bolt-headline--small {
  font-size: var(--bolt-type-font-size-small);
  line-height: var(--bolt-type-line-height-small);
}

.c-bolt-text--xsmall,
.c-bolt-subheadline--xsmall,
.c-bolt-headline--xsmall {
  font-size: var(--bolt-type-font-size-xsmall);
  line-height: var(--bolt-type-line-height-xsmall);
}

.c-bolt-text--xxsmall,
.c-bolt-subheadline--xxsmall,
.c-bolt-headline--xxsmall {
  font-size: var(--bolt-type-font-size-xxsmall);
  line-height: var(--bolt-type-line-height-xxsmall);
}

.c-bolt-headline--small {
  letter-spacing: var(--bolt-type-letter-spacing-wide);
}
