/*
 * Copyright IBM Corp. 2022, 2025
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

@use '@carbon/react/scss/breakpoint' as breakpoint;
@use '@carbon/styles/scss/themes' as *;
@use '@carbon/styles/scss/theme' as *;
@use '@carbon/styles/scss/colors' as *;
@use '@carbon/react/scss/spacing' as spacing;
@use '@carbon/react/scss/type' as type;

@use '../utils' as *;
@use './autolink-header/autolink-header';

/*  Spacing */
.#{with-prefix('h1-container')} + *,
.#{with-prefix('h2-container')} + *,
.#{with-prefix('h3-container')} + *,
.#{with-prefix('paragraph-container')} + * {
  margin-block-start: spacing.$spacing-06;
}

.#{with-prefix('h4-container')} + *,
.#{with-prefix('h4-container')} + div {
  margin-block-start: 0;
}

.#{with-prefix('h1-container')} {
  margin-block-start: spacing.$spacing-12;
}

.#{with-prefix('h2-container')},
.#{with-prefix('paragraph-container')} + .#{with-prefix('h2-container')} {
  margin-block-start: spacing.$spacing-09;

  @include breakpoint.breakpoint(md) {
    margin-block-start: spacing.$spacing-11;
  }
}

.#{with-prefix('h3-container')},
.#{with-prefix('paragraph-container')} + .#{with-prefix('h3-container')} {
  margin-block-start: spacing.$spacing-10;
}

.#{with-prefix('h4-container')},
.#{with-prefix('paragraph-container')} + .#{with-prefix('h4-container')} {
  margin-block-start: spacing.$spacing-07;
}

.#{with-prefix('h5-container')},
.#{with-prefix('h6-container')} {
  margin-block-start: 0;
}

.#{with-prefix('paragraph-container')} {
  margin-block-start: spacing.$spacing-06;
}

/* Spacing List */
.#{with-prefix('list-container')} {
  margin-block-start: spacing.$spacing-06;
}

.#{with-prefix('list')} .#{with-prefix('list')} {
  margin-block-start: 0;
}

.#{with-prefix('ul')} {
  /* override carbon remove hanging bullet */
  /* stylelint-disable-next-line declaration-no-important */
  margin-inline-start: spacing.$spacing-05 !important;
}

.#{with-prefix('ol')} {
  /*  override carbon remove hanging bullet */
  /* stylelint-disable-next-line declaration-no-important */
  margin-inline-start: spacing.$spacing-06 !important;
}

/* Headings */
.#{with-prefix('h1')} {
  @include type.type-style('fluid-heading-05', true);
}

.#{with-prefix('h2')} {
  @include type.type-style('fluid-heading-04', true);
}

.#{with-prefix('h3')} {
  @include type.type-style('fluid-heading-03', true);
}

.#{with-prefix('h4')} {
  @include type.type-style('heading-02');
}

.#{with-prefix('h5')},
.#{with-prefix('h6')} {
  @include type.type-style('heading-01');
}

/* Paragraph */
.#{with-prefix('paragraph')} {
  @include type.type-style('body-long-02');
}

.#{with-prefix('paragraph--large')} {
  @include type.type-style('fluid-heading-03', true);
}

/*  Blockquote */
.#{with-prefix('blockquote')} {
  margin: spacing.$spacing-08 0;
  margin-inline-start: spacing.$spacing-05;
  padding-inline-start: 1ch;

  @include breakpoint.breakpoint('md') {
    margin-inline-start: spacing.$spacing-08;
  }
}

.#{with-prefix('blockquote')} .#{with-prefix('paragraph')} {
  @include type.type-style('fluid-heading-03', true);

  font-style: italic;
}

.#{with-prefix('blockquote')} cite {
  @include type.type-style('body-long-01');

  display: block;
  font-style: italic;
  margin-block-start: spacing.$spacing-02;
  padding-inline-start: spacing.$spacing-07;
  text-indent: 0;
}
