@use "sass:color";
@use "../../../scss/functions/to-rgb" as *;
@use "../../../scss/mixins/breakpoints" as *;
@use "../../../scss/vendor/rfs" as *;
@use "../../../scss/variables" as *;

//
// CoreUI docs content theming
//

.docs-intro {
  > h2 {
    --cui-heading-color: var(--cui-emphasis-color);
  }
}

.docs-content {
  > h2,
  > h3,
  > h4 {
    --cui-heading-color: var(--cui-emphasis-color);
  }

  // Offset content from fixed navbar when jumping to headings
  > h2:not(:first-child) {
    margin-top: 3rem;
  }

  > h3 {
    margin-top: 2rem;
  }

  > ul li,
  > ol li {
    margin-bottom: .25rem;

    // stylelint-disable selector-max-type, selector-max-compound-selectors
    > p ~ ul {
      margin-top: -.5rem;
      margin-bottom: 1rem;
    }
    // stylelint-enable selector-max-type, selector-max-compound-selectors
  }

  // Override Bootstrap defaults
  > .table,
  > .table-responsive .table {
    --cui-table-border-color: var(--cui-border-color);

    max-width: 100%;
    margin-bottom: 1.5rem;
    @include font-size(.875rem);

    @include media-breakpoint-down(lg) {
      &.table-bordered {
        border: 0;
      }
    }

    thead {
      border-bottom: 2px solid currentcolor;
    }

    tbody:not(:first-child) {
      border-top: 2px solid currentcolor;
    }

    th,
    td {
      &:first-child {
        padding-left: 0;
      }

      &:not(:last-child) {
        padding-right: 1.5rem;
      }
    }

    th {
      color: var(--cui-emphasis-color);
    }

    strong {
      color: var(--cui-emphasis-color);
    }

    // Prevent breaking of code
    th,
    td:first-child > code { // stylelint-disable-line selector-max-compound-selectors
      white-space: nowrap;
    }
  }
}

.table-options {
  td:nth-child(2) {
    min-width: 160px;
  }
}

.table-options td:last-child,
.table-utilities td:last-child {
  min-width: 280px;
}

.table-swatches {
  th {
    color: var(--cui-emphasis-color);
  }

  td code {
    white-space: nowrap;
  }
}

.docs-title {
  --cui-heading-color: var(--cui-emphasis-color);
  @include font-size(3rem);
}

.docs-lead {
  font-weight: 300;
  @include font-size(1.5rem);
}

.bi {
  width: 1em;
  height: 1em;
  vertical-align: -.125em;
  fill: currentcolor;
}

.border-lg-start {
  @include media-breakpoint-up(lg) {
    border-left: var(--cui-border-width) solid var(--cui-border-color);
  }
}

// stylelint-disable selector-no-qualifying-type
.docs-summary-link {
  color: var(--cui-link-color);

  &:hover,
  details[open] > & {
    color: var(--cui-link-hover-color);
  }
}
// stylelint-enable selector-no-qualifying-type

// scss-docs-start custom-color-mode
[data-coreui-theme="blue"] {
  --cui-body-color: var(--cui-white);
  --cui-body-color-rgb: #{to-rgb($white)};
  --cui-body-bg: var(--cui-blue);
  --cui-body-bg-rgb: #{to-rgb($blue)};
  --cui-tertiary-bg: #{$blue-600};

  .dropdown-menu {
    --cui-dropdown-bg: #{color.mix($blue-500, $blue-600)};
    --cui-dropdown-link-active-bg: #{$blue-700};
  }

  .btn-secondary {
    --cui-btn-bg: #{color.mix($gray-600, $blue-400, 50%)};
    --cui-btn-border-color: #{rgba($white, .25)};
    --cui-btn-hover-bg: #{color.scale(color.mix($gray-600, $blue-400, 50%), $lightness: -8%)}; // stylelint-disable-line scss/at-function-named-arguments
    --cui-btn-hover-border-color: #{rgba($white, .25)};
    --cui-btn-active-bg: #{color.scale(color.mix($gray-600, $blue-400, 50%), $lightness: -16%)}; // stylelint-disable-line scss/at-function-named-arguments
    --cui-btn-active-border-color: #{rgba($white, .5)};
    --cui-btn-focus-border-color: #{rgba($white, .5)};
    --cui-btn-focus-box-shadow: 0 0 0 .25rem rgba(255, 255, 255, .2);
  }
}
// scss-docs-end custom-color-mode
