/*-- scss:uses --*/

/*-- scss:defaults --*/

@import url(./fonts/source-sans-pro/source-sans-pro.css);

// fonts
$font-family-sans-serif: "Source Sans Pro", Helvetica, sans-serif !default;
$font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas,
  "Liberation Mono", "Courier New", monospace !default;
$presentation-font-size-root: 40px !default;
$presentation-font-smaller: 0.7 !default;
$presentation-line-height: 1.3 !default;

// Default variables which exist in bootstrap themes
// and are here to simplify the implementation of _brand.yml and
// user theming customization in general
$font-weight-base: 400 !default;
$code-font-size: 1em !default;
$font-family-monospace-block: $font-family-monospace !default;
$font-family-monospace-inline: $font-family-monospace !default;
$link-weight: $font-weight-base !default;
$link-color-bg: transparent !default;
$link-decoration: inherit !default;
$font-weight-monospace: $font-weight-base !default;
$font-weight-monospace-block: $font-weight-monospace !default;
$font-weight-monospace-inline: $font-weight-monospace !default;

// main colors
$body-bg: #fff !default;
$body-color: #222 !default;
$text-muted: lighten($body-color, 30%) !default;

// grey colors (like in bootstrap)
$gray-200: #e9ecef !default;
$gray-100: #f8f9fa !default;
$gray-900: #212529 !default;

// link colors
$primary: #2a76dd !default;
$link-color: $primary !default;
$link-color-hover: lighten($link-color, 10%) !default;

// selection colors
$selection-bg: lighten($link-color, 25%) !default;
$selection-color: $body-bg !default;

// border colors
$border-color: lighten($body-color, 30%) !default;
$border-width: 1px !default;
$border-radius: 4px !default;

// headings
$presentation-heading-font: $font-family-sans-serif !default;
$presentation-heading-color: $body-color !default;
$presentation-heading-line-height: 1.2 !default;
$presentation-heading-letter-spacing: normal !default;
$presentation-heading-text-transform: none !default;
$presentation-heading-text-shadow: none !default;
$presentation-h1-text-shadow: none !default;
$presentation-heading-font-weight: 600 !default;
$presentation-h1-font-size: 2.5em !default;
$presentation-h2-font-size: 1.6em !default;
$presentation-h3-font-size: 1.3em !default;
$presentation-h4-font-size: 1em !default;

// margins
$presentation-block-margin: 12px !default;

// text alignment
$presentation-slide-text-align: left !default;
$presentation-title-slide-text-align: center !default;
$reveal-slide-text-align: $presentation-slide-text-align !default;
$reveal-title-slide-text-align: $presentation-title-slide-text-align !default;

// Lists
$presentation-list-bullet-color: $body-color !default;

// code blocks
$code-block-bg: $body-bg !default;
$code-block-border-color: lighten($body-color, 60%) !default;
$code-block-font-size: $code-font-size * 0.55 !default;
$code-block-height: 500px !default;
$code-block-theme-dark-threshhold: 40% !default;
$code-block-line-height: $presentation-line-height !default;
$code-block-color: $body-color !default;

// inline code
$code-inline-font-size: $code-font-size * 0.875 !default;
$code-color: var(--quarto-hl-fu-color) !default;
$code-bg: transparent !default;

// tabset
$tabset-border-color: $code-block-border-color !default;

// table
$table-border-color: $code-block-border-color !default;

// input panel
$input-panel-border-color: $code-block-border-color !default;
$input-panel-border-width: $border-width !default;
$input-panel-border-radius: $border-radius !default;
$input-panel-bg: rgba(248, 249, 250, 1) !default;

// Callouts
$callout-border-width: 0.3rem !default;
$callout-border-scale: 0% !default;
$callout-icon-scale: 10% !default;
$callout-margin-top: 1rem !default;
$callout-margin-bottom: 1rem !default;
$callout-color-note: #0d6efd !default;
$callout-color-tip: #198754 !default;
$callout-color-important: #dc3545 !default;
$callout-color-caution: #fd7e14 !default;
$callout-color-warning: #ffc107 !default;

// alternate colors for when the background changes
$light-bg-text-color: #222 !default;
$dark-bg-text-color: #fff !default;
$light-bg-link-color: #2a76dd !default;
$dark-bg-link-color: #42affa !default;
$light-bg-code-color: #4758ab !default;
$dark-bg-code-color: #ffa07a !default;

// KBD variables
$kbd-padding-y: 0.4rem !default;
$kbd-padding-x: 0.4rem !default;
$kbd-font-size: $presentation-font-size-root !default;
$kbd-color: $body-color !default;
$kbd-bg: $gray-100 !default; // like in bootstrap style

// --- derive reveal versions of presentation variables for finer-grained override ---

$revealjs-font-size-root: $presentation-font-size-root !default;
$revealjs-h1-font-size: $presentation-h1-font-size !default;
$revealjs-h2-font-size: $presentation-h2-font-size !default;
$revealjs-h3-font-size: $presentation-h3-font-size !default;
$revealjs-h4-font-size: $presentation-h4-font-size !default;
$revealjs-heading-font: $presentation-heading-font !default;
$revealjs-heading-color: $presentation-heading-color !default;
$revealjs-heading-line-height: $presentation-heading-line-height !default;
$revealjs-heading-letter-spacing: $presentation-heading-letter-spacing !default;
$revealjs-heading-text-transform: $presentation-heading-text-transform !default;
$revealjs-heading-text-shadow: $presentation-heading-text-shadow !default;
$revealjs-h1-text-shadow: $presentation-h1-text-shadow !default;

$revealjs-heading-font-weight: $presentation-heading-font-weight !default;
$revealjs-block-margin: $presentation-block-margin !default;
$revealjs-line-height: $presentation-line-height !default;
$revealjs-list-bullet-color: $presentation-list-bullet-color !default;

$revealjs-code-inline-font-size: $code-inline-font-size !default;
$revealjs-code-block-font-size: $code-block-font-size !default;

// ---- map to reveal scss variables ---
// ---- This is based from the revealjs setting.scss
// -- START setting.scss --
// Background of the presentation
$backgroundColor: $body-bg !default;

// Primary/body text
$mainFont: $font-family-sans-serif !default;
$mainFontSize: $revealjs-font-size-root !default;
$mainColor: $body-color !default;

// Vertical spacing between blocks of text
$blockMargin: $revealjs-block-margin !default;

// Headings
$headingMargin: 0 0 $blockMargin 0 !default;
$headingFont: $revealjs-heading-font !default;
$headingColor: $revealjs-heading-color !default;
$headingLineHeight: $revealjs-heading-line-height !default;
$headingLetterSpacing: $revealjs-heading-letter-spacing !default;
$headingTextTransform: $revealjs-heading-text-transform !default;
$headingTextShadow: $revealjs-heading-text-shadow !default;
$heading1TextShadow: $revealjs-h1-text-shadow !default;
$headingFontWeight: $revealjs-heading-font-weight !default;

$heading1Size: $revealjs-h1-font-size !default;
$heading2Size: $revealjs-h2-font-size !default;
$heading3Size: $revealjs-h3-font-size !default;
$heading4Size: $revealjs-h4-font-size !default;

$codeFont: $font-family-monospace !default;

// Links and actions
$linkColor: $link-color !default;
$linkColorHover: $link-color-hover !default;

// Text selection
$selectionBackgroundColor: $selection-bg !default;
$selectionColor: $selection-color !default;

// Colors used for UI elements that are overlaid on top of
// the presentation
$overlayElementBgColor: 240, 240, 240 !default;
$overlayElementFgColor: 0, 0, 0 !default;

// -- END setting.scss --

/*-- scss:functions --*/

@function colorToRGB($color) {
  @return "rgb(" + red($color) + ", " + green($color) + ", " + blue($color) +
    ")";
}

@function tint-color($color, $weight) {
  @return mix(white, $color, $weight);
}

@function shade-color($color, $weight) {
  @return mix(black, $color, $weight);
}

@function shift-color($color, $weight) {
  @return if(
    $weight > 0,
    shade-color($color, $weight),
    tint-color($color, -$weight)
  );
}

/*-- scss:mixins --*/

@mixin shift_to_dark($property, $colorDark, $colorLight) {
  @if (
    quarto-color.blackness($backgroundColor) > $code-block-theme-dark-threshhold
  ) {
    #{$property}: $colorDark;
  } @else {
    #{$property}: $colorLight;
  }
}

// Make the font size smaller by a factor of $times
// Useful for font-size defined in px inside smaller font size controled by em
// as they would not be impacted by the smaller font size
@mixin make-smaller-font-size($element, $times: 1) {
  font-size: calc(
    #{$element} * #{quarto-math.pow($presentation-font-smaller, $times)}
  );
}

// Undo the smaller font size
// Useful for font-size in em already that should not be impacted by smaller font size controled by em
@mixin undo-smaller-font-size($element) {
  font-size: calc(#{$element} / #{$presentation-font-smaller});
}

// -- START setting.scss --

// Generates the presentation background, can be overridden
// to return a background image or gradient
@mixin bodyBackground() {
  background: $backgroundColor;
}

// -- END setting.scss --

/*-- scss:rules --*/

.reveal.center .slide aside,
.reveal.center .slide div.aside {
  position: initial;
}

section.has-light-background {
  &,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: $light-bg-text-color;
  }
  a,
  a:hover {
    color: $light-bg-link-color;
  }
  code {
    color: $light-bg-code-color;
  }
}

section.has-dark-background {
  &,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: $dark-bg-text-color;
  }
  a,
  a:hover {
    color: $dark-bg-link-color;
  }
  code {
    color: $dark-bg-code-color;
  }
}

#title-slide,
/* for when hash-type: number as identifier removed*/
div.reveal div.slides section.quarto-title-block {
  text-align: $presentation-title-slide-text-align;
  .subtitle {
    margin-bottom: 2.5rem;
  }
}

.reveal .slides {
  text-align: $reveal-slide-text-align;
}

.reveal .title-slide h1 {
  font-size: $revealjs-h2-font-size;
}

.reveal[data-navigation-mode="linear"] .title-slide h1 {
  font-size: $revealjs-h1-font-size;
}

.reveal div.sourceCode {
  border: $border-width solid $code-block-border-color;
  border-radius: $border-radius;
}

.reveal pre {
  width: 100%;
  box-shadow: none;
  background-color: $code-block-bg;
  border: none;
  margin: 0;
  font-size: $revealjs-code-block-font-size;
  line-height: $code-block-line-height;
  font-family: $font-family-monospace-block;

  code {
    background-color: $body-bg; // Insure we color output and code cell differently
    font-size: inherit;
    color: $code-block-color;
    font-family: inherit;
  }

  &.sourceCode code {
    color: $code-block-color;
    font-size: inherit;
    background-color: inherit;
    white-space: pre;
    font-family: inherit;
    padding: 6px 9px;
    max-height: $code-block-height;
  }
}

// Inside code-file-name div, we want to use the same background color as decorated codeblock header
// https://github.com/quarto-dev/quarto-cli/issues/9560
.reveal .code-with-filename .code-with-filename-file pre {
  background-color: unset;
}

.reveal code {
  color: $code-color;
  font-size: $revealjs-code-inline-font-size;
  background-color: $code-bg;
  white-space: pre-wrap;
  font-family: $font-family-monospace-inline;
}

.reveal .column-output-location {
  display: flex;
  align-items: stretch;
}

.reveal .column-output-location .column:first-of-type div.sourceCode {
  height: 100%;
  background-color: $code-block-bg;
}

.reveal blockquote {
  display: block;
  position: relative;
  color: $border-color;
  width: unset;
  margin: var(--r-block-margin) auto;
  padding: 0.625rem 1.75rem;
  border-left: 0.25rem solid $text-muted;
  font-style: normal;
  background: none;
  box-shadow: none;
}
.reveal blockquote p:first-child,
.reveal blockquote p:last-child {
  display: block;
}

.reveal .slide aside,
.reveal .slide div.aside {
  position: absolute;
  bottom: 20px;
  font-size: #{$presentation-font-smaller}em;
  color: $text-muted;
}

.reveal .slide sup {
  font-size: #{$presentation-font-smaller}em;
}

.reveal .slide.scrollable aside,
.reveal .slide.scrollable div.aside {
  position: relative;
  margin-top: 1em;
}

.reveal .slide aside .aside-footnotes {
  margin-bottom: 0;
}

.reveal .slide aside .aside-footnotes li:first-of-type {
  margin-top: 0;
}

$panel-sidebar-width: 270px;
$panel-sidebar-padding: 0.5em;

.reveal .layout-sidebar {
  display: flex;
  width: 100%;
  margin-top: 0.8em;
}

.reveal .layout-sidebar .panel-sidebar {
  width: $panel-sidebar-width;
}

.reveal .layout-sidebar-left .panel-sidebar {
  margin-right: calc(#{$panel-sidebar-padding} * 2);
}

.reveal .layout-sidebar-right .panel-sidebar {
  margin-left: calc(#{$panel-sidebar-padding} * 2);
}

.reveal .layout-sidebar .panel-fill,
.reveal .layout-sidebar .panel-center,
.reveal .layout-sidebar .panel-tabset {
  flex: 1;
}

.reveal .panel-input,
.reveal .panel-sidebar {
  font-size: 0.5em;
  padding: $panel-sidebar-padding;
  border-style: solid;
  border-color: $input-panel-border-color;
  border-width: $input-panel-border-width;
  border-radius: $input-panel-border-radius;
  background-color: $input-panel-bg;
}

.reveal .panel-sidebar :first-child,
.reveal .panel-fill :first-child {
  margin-top: 0;
}

.reveal .panel-sidebar :last-child,
.reveal .panel-fill :last-child {
  margin-bottom: 0;
}

.panel-input > div,
.panel-input > div > div {
  vertical-align: middle;
  padding-right: 1em;
}

.reveal p,
.reveal .slides section,
.reveal .slides section > section {
  line-height: $revealjs-line-height;
}

// Smaller font size logic
.reveal {
  // When smaller is set globally
  &.smaller {
    .slides {
      // We make the all slide font-size smaller by a factor of $presentation-font-smaller
      section {
        font-size: #{$presentation-font-smaller}em;

        // avoid applying twice the reduction when using nested section
        section {
          font-size: inherit;
        }
      }

      // But we don't want headers to change size and they are in em
      h1 {
        @include undo-smaller-font-size($revealjs-h1-font-size);
      }
      h2 {
        @include undo-smaller-font-size($revealjs-h2-font-size);
      }
      h3 {
        @include undo-smaller-font-size($revealjs-h3-font-size);
      }
    }
  }

  .slides section {
    // when  smaller is set on slide
    &.smaller {
      font-size: #{$presentation-font-smaller}em;

      // But we don't want headers to change size and they are in em
      h1 {
        @include undo-smaller-font-size($revealjs-h1-font-size);
      }
      h2 {
        @include undo-smaller-font-size($revealjs-h2-font-size);
      }
      h3 {
        @include undo-smaller-font-size($revealjs-h3-font-size);
      }
    }

    // On callout we want to make the font-size smaller too
    div.callout {
      font-size: #{$presentation-font-smaller}em;

      // But we don't want headers to change size and they are in em
      h1 {
        @include undo-smaller-font-size($revealjs-h1-font-size);
      }
      h2 {
        @include undo-smaller-font-size($revealjs-h2-font-size);
      }
      h3 {
        @include undo-smaller-font-size($revealjs-h3-font-size);
      }
    }
  }
}

.reveal .columns > .column > :not(ul, ol) {
  margin-left: 0.25rem;
  margin-right: 0.25rem;
}

.reveal .columns > .column:first-child > :not(ul, ol) {
  margin-right: 0.5rem;
  margin-left: 0;
}
.reveal .columns > .column:last-child > :not(ul, ol) {
  margin-right: 0;
  margin-left: 0.5rem;
}

.reveal .slide-number {
  color: $linkColorHover;
  background-color: $body-bg;
}

.reveal .footer {
  color: $text-muted;

  a {
    color: $linkColor;
  }

  &.has-dark-background {
    color: quarto-color.scale($dark-bg-text-color, $whiteness: 30%);

    a {
      color: quarto-color.scale($dark-bg-link-color, $whiteness: 30%);
    }
  }

  &.has-light-background {
    color: quarto-color.scale($light-bg-text-color, $whiteness: 30%);

    a {
      color: quarto-color.scale($light-bg-link-color, $whiteness: 30%);
    }
  }
}

.reveal .slide-number {
  color: $text-muted;

  &.has-dark-background {
    color: quarto-color.scale($dark-bg-text-color, $whiteness: 30%);
  }

  &.has-light-background {
    color: quarto-color.scale($light-bg-text-color, $whiteness: 30%);
  }
}

// handle caption for figures
.reveal .slide {
  figure > figcaption,
  img.stretch + p.caption,
  img.r-stretch + p.caption {
    font-size: #{$presentation-font-smaller}em;
  }
}

@media screen and (min-width: 500px) {
  $arrow-spacing: 0.2em;
  $control-arrow-spacing: 1.4em;

  .reveal .controls[data-controls-layout="edges"] .navigate-left {
    left: $arrow-spacing;
  }

  .reveal .controls[data-controls-layout="edges"] .navigate-right {
    right: $arrow-spacing;
  }

  .reveal .controls[data-controls-layout="edges"] .navigate-up {
    top: $arrow-spacing * 2;
  }

  .reveal .controls[data-controls-layout="edges"] .navigate-down {
    bottom: $arrow-spacing - $control-arrow-spacing + 3.5em;
  }
}

.tippy-box[data-theme~="light-border"] {
  background-color: $backgroundColor;
  color: $mainColor;
  border-radius: $border-radius;
  border: solid $border-width $border-color;
  font-size: 0.6em;
}

.tippy-box[data-theme~="light-border"] .tippy-arrow {
  color: $border-color;
}

.tippy-box[data-placement^="bottom"] > .tippy-content {
  padding: 7px 10px;
  z-index: 1;
}

.reveal .panel-tabset [role="tab"] {
  padding: 0.25em 0.7em;
}

.reveal .slide-menu-button .fa-bars::before {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#{colorToRGB($linkColor)}" class="bi bi-list" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/></svg>');
}

.reveal .slide-chalkboard-buttons .fa-easel2::before {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#{colorToRGB($linkColor)}" class="bi bi-easel2" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 0a.5.5 0 0 1 .447.276L8.81 1h4.69A1.5 1.5 0 0 1 15 2.5V11h.5a.5.5 0 0 1 0 1h-2.86l.845 3.379a.5.5 0 0 1-.97.242L12.11 14H3.89l-.405 1.621a.5.5 0 0 1-.97-.242L3.36 12H.5a.5.5 0 0 1 0-1H1V2.5A1.5 1.5 0 0 1 2.5 1h4.691l.362-.724A.5.5 0 0 1 8 0ZM2 11h12V2.5a.5.5 0 0 0-.5-.5h-11a.5.5 0 0 0-.5.5V11Zm9.61 1H4.39l-.25 1h7.72l-.25-1Z"/></svg>');
}

.reveal .slide-chalkboard-buttons .fa-brush::before {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#{colorToRGB($linkColor)}" class="bi bi-brush" viewBox="0 0 16 16"><path d="M15.825.12a.5.5 0 0 1 .132.584c-1.53 3.43-4.743 8.17-7.095 10.64a6.067 6.067 0 0 1-2.373 1.534c-.018.227-.06.538-.16.868-.201.659-.667 1.479-1.708 1.74a8.118 8.118 0 0 1-3.078.132 3.659 3.659 0 0 1-.562-.135 1.382 1.382 0 0 1-.466-.247.714.714 0 0 1-.204-.288.622.622 0 0 1 .004-.443c.095-.245.316-.38.461-.452.394-.197.625-.453.867-.826.095-.144.184-.297.287-.472l.117-.198c.151-.255.326-.54.546-.848.528-.739 1.201-.925 1.746-.896.126.007.243.025.348.048.062-.172.142-.38.238-.608.261-.619.658-1.419 1.187-2.069 2.176-2.67 6.18-6.206 9.117-8.104a.5.5 0 0 1 .596.04zM4.705 11.912a1.23 1.23 0 0 0-.419-.1c-.246-.013-.573.05-.879.479-.197.275-.355.532-.5.777l-.105.177c-.106.181-.213.362-.32.528a3.39 3.39 0 0 1-.76.861c.69.112 1.736.111 2.657-.12.559-.139.843-.569.993-1.06a3.122 3.122 0 0 0 .126-.75l-.793-.792zm1.44.026c.12-.04.277-.1.458-.183a5.068 5.068 0 0 0 1.535-1.1c1.9-1.996 4.412-5.57 6.052-8.631-2.59 1.927-5.566 4.66-7.302 6.792-.442.543-.795 1.243-1.042 1.826-.121.288-.214.54-.275.72v.001l.575.575zm-4.973 3.04.007-.005a.031.031 0 0 1-.007.004zm3.582-3.043.002.001h-.002z"/></svg>');
}

// This is a sentinel value that renderers can use to determine
// whether the theme is dark or light
@if (
  quarto-color.blackness($backgroundColor) > $code-block-theme-dark-threshhold
) {
  /*! dark */
} @else {
  /*! light */
}

/* override theme.scss style for the default styles
 
  Note the need for both the case sensitive flag and the
  case-oblivious selectors. This is a workaround for what's
  apparently a Chrome and Safari bug:

  https://github.com/quarto-dev/quarto-cli/issues/1902#issuecomment-1219783059
 */

.reveal ol[type="a"] {
  list-style-type: lower-alpha;
}

.reveal ol[type="a" s] {
  list-style-type: lower-alpha;
}

.reveal ol[type="A" s] {
  list-style-type: upper-alpha;
}

.reveal ol[type="i"] {
  list-style-type: lower-roman;
}

.reveal ol[type="i" s] {
  list-style-type: lower-roman;
}

.reveal ol[type="I" s] {
  list-style-type: upper-roman;
}

.reveal ol[type="1"] {
  list-style-type: decimal;
}

// https://github.com/quarto-dev/quarto-cli/issues/2834
// temporary workaround while we come up with a pure CSS solution

.reveal ul.task-list {
  list-style: none;
}
.reveal ul.task-list li input[type="checkbox"] {
  width: 2em;
  height: 2em;
  margin: 0 1em 0.5em -1.6em;
  vertical-align: middle;
}

// https://github.com/quarto-dev/quarto-cli/issues/3380

div.cell-output-display div.pagedtable-wrapper table.table {
  font-size: 0.6em;
}

.reveal .code-annotation-container-hidden {
  display: none;
}

.reveal code.sourceCode button.code-annotation-anchor,
.reveal code.sourceCode .code-annotation-anchor {
  font-family: $font-family-monospace;
  color: var(--quarto-hl-co-color);
  border: solid var(--quarto-hl-co-color) 1px;
  border-radius: 50%;
  font-size: 0.7em;
  line-height: 1.2em;
  margin-top: 2px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
}

.reveal code.sourceCode button.code-annotation-anchor {
  cursor: pointer;
}

.reveal code.sourceCode a.code-annotation-anchor {
  text-align: center;
  vertical-align: middle;
  text-decoration: none;
  cursor: default;
  height: 1.2em;
  width: 1.2em;
}

.reveal code.sourceCode.fragment a.code-annotation-anchor {
  left: auto;
}

.reveal #code-annotation-line-highlight-gutter {
  width: 100%;
  border-top: solid var(--quarto-hl-co-color) 1px;
  border-bottom: solid var(--quarto-hl-co-color) 1px;
  z-index: 2;
}

.reveal #code-annotation-line-highlight {
  margin-left: -8em;
  width: calc(100% + 4em);
  border-top: solid var(--quarto-hl-co-color) 1px;
  border-bottom: solid var(--quarto-hl-co-color) 1px;
  z-index: 2;
  margin-bottom: -2px;
}

.reveal code.sourceCode .code-annotation-anchor.code-annotation-active {
  background-color: var(--quarto-hl-normal-color, #aaaaaa);
  border: solid var(--quarto-hl-normal-color, #aaaaaa) 1px;
  color: rgb(red($code-block-bg), green($code-block-bg), blue($code-block-bg));
  font-weight: bolder;
}

.reveal pre.code-annotation-code {
  padding-top: 0;
  padding-bottom: 0;
  code {
    z-index: 3;
    padding-left: 0px;
  }
}

.reveal dl.code-annotation-container-grid {
  margin-left: 0.1em;
  dt {
    margin-top: 0.65rem;
    font-family: $font-family-monospace;
    border: solid $body-color 1px;
    border-radius: 50%;
    height: 1.3em;
    width: 1.3em;
    line-height: 1.3em;
    font-size: 0.5em;
    text-align: center;
    vertical-align: middle;

    text-decoration: none;
  }

  dd {
    margin-left: 0.25em;
  }
}

/*

  https://github.com/quarto-dev/quarto-cli/issues/4283

  The trick itself is from here:

  https://stackoverflow.com/questions/8720931/can-css-detect-the-number-of-children-an-element-has

*/

.reveal .scrollable ol li:first-child:nth-last-child(n + 10),
.reveal .scrollable ol li:first-child:nth-last-child(n + 10) ~ li {
  margin-left: 1em;
}

/* kbd rules */

kbd {
  font-family: $font-family-monospace;
  font-size: $kbd-font-size;
  color: $kbd-color;
  @include shift_to_dark(
    "background-color",
    shift-color($kbd-bg, 70%),
    $kbd-bg
  );
  border: 1px solid;
  border-color: $code-block-border-color;
  border-radius: 5px;
  padding: $kbd-padding-y $kbd-padding-x;
}

:root {
  --r-inline-code-font: #{$font-family-monospace-inline};
  --r-block-code-font: #{$font-family-monospace-block};
  --r-inline-code-font-size: #{$revealjs-code-inline-font-size};
  --r-block-code-font-size: #{$revealjs-code-block-font-size};
}

// _brand.yml rules

.reveal a {
  font-weight: $link-weight;
  background-color: $link-color-bg;
  text-decoration: $link-decoration;
}

/* Callout styles */

.reveal div.callout {
  margin-top: $callout-margin-top;
  margin-bottom: $callout-margin-bottom;
  border-radius: $border-radius;
  overflow-wrap: break-word;

  // Rules for both styles
  &.callout-style-simple,
  &.callout-style-default {
    border-left: $callout-border-width solid #acacac;
    border-right: solid 1px $table-border-color;
    border-top: solid 1px $table-border-color;
    border-bottom: solid 1px $table-border-color;

    div {
      &.callout-body,
      &.callout-title {
        // Font size is inherited from the parent div.callout
        // which is scaled down like .smaller
        font-size: inherit;
        border-bottom: none;
        font-weight: 600;
      }

      &.callout-title {
        display: flex;
        align-items: center;

        p {
          margin-top: 0.5em;
          margin-bottom: 0.5em;
          color: var(--r-main-color);
        }
      }
    }

    .callout-icon::before {
      height: 1.25em;
      width: 1.25em;
      background-size: 1.25em 1.25em;
    }

    &.callout-titled {
      .callout-body {
        > .callout-content {
          > :last-child {
            margin-bottom: var(--r-block-margin);
          }
          > :last-child:not(div.sourceCode) {
            padding-bottom: 0.5rem;
            margin-bottom: 0;
          }
        }
      }
      .callout-icon::before {
        margin-top: 0.25em;
        padding-right: 0.25em;
      }
    }

    &.no-icon::before {
      display: none !important;
    }
  }

  // Apply only to simple callout style which could have
  // - a title or not
  // - an icon or not
  &.callout-style-simple {
    padding: 0em 0.5em;
    display: flex;

    &.callout-titled {
      .callout-body {
        margin-top: 0.2em;
      }
      &:not(.no-icon) {
        .callout-content {
          padding-left: 1.6em;
        }
      }
      .callout-content {
        p {
          margin-top: 0;
        }
      }
    }

    &:not(.callout-titled) {
      .callout-body {
        display: flex;
      }
      .callout-icon::before {
        margin-top: var(--r-block-margin);
        padding-right: 0.5em;
      }
      .callout-body {
        > .callout-content {
          // Margin needs to be added when last child is div.sourceCode
          // Other code cell border is mixed with callout border
          > div.sourceCode:last-child {
            margin-bottom: 1rem;
          }
          > :first-child {
            margin-top: var(--r-block-margin);
          }
        }
      }
    }

    .callout-icon::before {
      display: inline-block;
      content: "";
      background-repeat: no-repeat;
    }

    div {
      &.callout-title {
        opacity: 75%;
      }
      &.callout-body {
        font-weight: 400;
      }
    }
  }

  // Apply only to default callout style which could have
  // - a title (can't have no title)
  // - an icon or not
  &.callout-style-default {
    &.callout-titled {
      .callout-content {
        p {
          margin-top: 0.7em;
        }
      }
    }

    .callout-icon::before {
      display: inline-block;
      content: "";
      background-repeat: no-repeat;
    }

    div {
      &.callout-body {
        font-weight: 400;
      }
      &.callout-title {
        opacity: 85%;
        padding-left: 0.5em;
        padding-right: 0.5em;
      }
      &.callout-content {
        padding-left: 0.5em;
        padding-right: 0.5em;
      }
    }
  }

  // FIXME: There is no body-container in revealjs so remove but before find what it was suppose to do
  .callout-body-container {
    flex-grow: 1;
  }
}

/* Callout Types */

// Generate per callout type css to customize their appearance
// Define the callouts for which we should define styles
$callouts: (
  // NOTE
  "note":
    (
      "color": $callout-color-note,
      "icon":
        '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/></svg>',
    ),
  // TIP
  "tip":
    (
      "color": $callout-color-tip,
      "icon":
        '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightbulb" viewBox="0 0 16 16"><path d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a1.964 1.964 0 0 0-.453-.618A5.984 5.984 0 0 1 2 6zm6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1z"/></svg>',
    ),
  // WARNING
  "warning":
    (
      "color": $callout-color-warning,
      "icon":
        '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle" viewBox="0 0 16 16"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></svg>',
    ),
  // CAUTION
  "caution":
    (
      "color": $callout-color-caution,
      "icon":
        '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cone-striped" viewBox="0 0 16 16"><path d="M9.97 4.88l.953 3.811C10.158 8.878 9.14 9 8 9c-1.14 0-2.159-.122-2.923-.309L6.03 4.88C6.635 4.957 7.3 5 8 5s1.365-.043 1.97-.12zm-.245-.978L8.97.88C8.718-.13 7.282-.13 7.03.88L6.274 3.9C6.8 3.965 7.382 4 8 4c.618 0 1.2-.036 1.725-.098zm4.396 8.613a.5.5 0 0 1 .037.96l-6 2a.5.5 0 0 1-.316 0l-6-2a.5.5 0 0 1 .037-.96l2.391-.598.565-2.257c.862.212 1.964.339 3.165.339s2.303-.127 3.165-.339l.565 2.257 2.391.598z"/></svg>',
    ),
  // IMPORTANT
  "important":
    (
      "color": $callout-color-important,
      "icon":
        '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></svg>',
    )
);

@each $name, $info in $callouts {
  $shifted-color: #{shift-color(
      quarto-map.get($info, "color"),
      $callout-icon-scale
    )};
  $shifted-color-svg: str-replace($shifted-color, "#", "%23");

  .reveal div.callout {
    &.callout-#{$name} {
      border-left-color: shift-color(
        quarto-map.get($info, "color"),
        $callout-border-scale
      );
      &.callout-style-default {
        .callout-title {
          @include shift_to_dark(
            "background-color",
            shift-color(quarto-map.get($info, "color"), 70%),
            shift-color(quarto-map.get($info, "color"), -90%)
          );
        }
      }
      .callout-icon::before {
        background-image: #{"url('data:image/svg+xml," +
          str-replace(
            quarto-map.get($info, "icon"),
            'fill="currentColor"',
            'style="fill: #{$shifted-color-svg}"'
          ) +
          "');"};
      }
    }
  }
}
