/*-- scss:defaults --*/

// import font
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap");

// import shared colors
@import "_posit-colors";

/*-- scss:variables --*/
$primary: $posit-blue;

/* ======== General Styles ======== */

// Feature preview heading colors
$preview-header: #ee6331; /* posit orange, contrast: 8.45 */
$preview-header-border: darken($preview-header, 5%);

// Typography
$font-family-sans-serif: "Open Sans", "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans",
  "Liberation Sans", Arial, sans-serif, system-ui;
$font-family-monospace: "Source Code Pro", monospace;
$font-family-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
$font-size-base: 1rem;
$line-height-base: 1.7;

// Headings
$headings-font-weight: 400 !default;

// Font and body color
$body-color: $posit-dark-gray-2;

// Navbar customization
$navbar-bg: #ffffff;
$navbar-fg: $posit-light-gray-3;
$navbar-hl: $primary;
$navbar-brand: $posit-dark-gray-2;
$navbar-brand-hl: $navbar-brand;
$navbar-brand-font-size: 1rem !default;

// Callouts
$callout-color-note: $posit-blue;
$callout-color-warning: $posit-orange;
$callout-color-important: $posit-burgundy;

// Tables
$table-hover-bg: $posit-light-blue-2 !default;
$table-striped-bg: $posit-light-blue-1 !default;

/* Navbar */
.navbar {
  border-bottom: 1px solid $posit-light-blue-1;
}

/* Style for the version included in the website title */
.navbar-title small {
  font-size: 14px;
  display: block;
}

/* Adds separation between nav bar links and site title */
.navbar-collapse {
  margin-left: 2ch;
}

/* Adds weight to selected active item in the navbar */
.navbar-nav .nav-link.active,
.navbar-nav .nav-link.show {
  font-weight: 600;
}

/* Sidebar */
.sidebar-navigation a {
  // font-weight: 500;
}

#quarto-sidebar strong {
  font-weight: 600;
  text-transform: uppercase;
}

div.sidebar-item-container .active,
div.sidebar-item-container .show > .nav-link,
div.sidebar-item-container .sidebar-link > code {
  background-color: #f4f4f7;
  border-radius: 5px;
  margin-bottom: 2px;
  margin-left: -5px;
  padding: 6px;
}

div.sidebar-item-container .active,
div.sidebar-item-container .show > .nav-link,
div.sidebar-item-container .sidebar-link > code {
  font-weight: 600;
  font-size: 1rem;
}

.sidebar-navigation li a {
  text-decoration: none;
  font-size: 1rem;
}

/* Mini TOC */
.sidebar nav[role="doc-toc"] > ul li a {
  font-size: 1rem;
}

.sidebar nav[role="doc-toc"] ul > li > a.active,
.sidebar nav[role="doc-toc"] ul > li > ul > li > a.active {
  font-weight: 700;
  border-left: 2px solid #447099 !important;
}

/* Footer */
#footer-right-posit-logo {
}

.nav-footer-left .footer-items,
.nav-item {
  padding-right: 11px;
}

.posit-footer-logo {
  margin-right: -10px;
  // margin-right: 5px; #Positron uses this to align the logo with the text
}

/* Tabs and Pills */
.nav-tabs .nav-link {
  text-transform: none !important;
  font-family: $font-family-sans-serif;
  color: $navbar-fg;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: $primary !important;
  font-weight: 700 !important;
}

.nav-tabs .nav-link:hover,
.nav-link:focus {
  color: $posit-blue !important;
}

.nav-pills {
  border: none !important;
}

.nav-pills,
.panel-underline {
  > .nav {
    display: flex;
    border: none !important;
    flex-direction: row;
    justify-content: center;

    .nav-link {
      cursor: pointer;
    }
  }
}

.nav-pills > .nav .nav-link {
  border: none !important;
}

.nav-pills,
.panel-underline {
  .tab-content {
    padding-left: 0;
    padding-right: 0;
    border: none;
  }
}

.nav-pills .nav-link.active,
.nav-pills .nav-item.show .nav-link {
  color: #ffffff !important;
  text-decoration: none !important;
}

.nav-pills .nav-link:hover,
.nav-link:focus {
  isolation: isolate;
  color: $posit-blue !important;
  border: none !important;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: #ffffff !important;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: $headings-font-weight !important;
}

/* Body */
body {
  letter-spacing: -0.2px;
  -webkit-font-smoothing: antialiased;
}

/* Code */
div.sourceCode {
  background-color: lighten($posit-light-gray-3, 55%) !important;
}

.code-with-filename .code-with-filename-file {
  padding: 0.25rem;
  border: none !important;
  box-shadow: 0px 0px 2px rgba(5, 10, 15, 0.14), 0px 2px 4px rgba(29, 31, 33, 0.16);
}

div.sourceCode,
pre.console {
  border: none !important;
  box-shadow: 0px 0px 2px rgba(5, 10, 15, 0.14), 0px 2px 4px rgba(29, 31, 33, 0.16);
  margin-top: 2rem;
  margin-bottom: 2.5rem;
  padding: 0.25rem;
}

p code.sourceCode,
li code.sourceCode,
td code.sourceCode {
  background-color: lighten($posit-light-gray-3, 55%) !important;
}

/* Footnotes */
a.footnote-back {
  font-weight: 900;
  font-size: 1.1rem;
}

/* Feature Preview Header */
.preview-header > h1:after,
.preview-header > h2:after,
.preview-header > h3:after,
.preview-header > h4:after,
header h1 .preview-header {
  content: "Preview feature";
  margin-left: 1em;
  position: relative;
  border-radius: 50rem !important;
  top: -0.5em;
}

.preview-header > h1:after,
.preview-header > h2:after,
.preview-header > h3:after,
.preview-header > h4:after,
header h1 .preview-header,
div span.preview-feature {
  color: $preview-header;
  border: 1px solid $preview-header-border;
  font-weight: 500;
  font-size: 9pt !important;
  padding: 0rem 0.4rem;
}

div span.preview-feature {
  margin-left: 1em;
  text-transform: uppercase;
}

/* Callout Steps */
ol.groovyAlpha {
  list-style: none;
  counter-reset: list-counter;
}

ol.groovyAlpha li {
  counter-increment: list-counter;
}

ol.groovyAlpha li > p:before {
  content: counter(list-counter, lower-alpha);
  width: 20px;
  height: 20px;
  text-align: center;
  margin-right: 10px;
  color: #fff;
  background-color: #fc403b;
  display: inline-block;
  border-radius: 10px;
  font-size: 14px;
  line-height: 16px;
  vertical-align: middle;
}

/* Keyboard Shortcuts */
kbd {
  padding: 0.2rem 0.4rem;
}

/* Version Toast */
#version-toast {
  background-color: $posit-white;
  color: $body-color;

  .toast-header {
    background-color: $primary;
    color: #ffffff;
  }

  .btn-close {
    filter: invert(1);
  }
}

/* Mermaid Diagrams */
[id^="mermaid-"] {
  .cluster rect {
    fill: none !important;
    font-size: $font-size-base;
  }

  foreignObject {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: $font-size-base;

    &:has(.edgeLabel) {
      background-color: transparent;

      .edgeLabel,
      .labelBkg {
        background-color: transparent !important;
        font-size: $font-size-base;
      }

      p {
        margin-inline: auto !important;
        max-width: max-content;
        border-radius: 8px;
        padding: 0 0.75rem;
        color: $posit-dark-blue-2;
        font-size: $font-size-base;
      }
    }
  }
}
